[Webkit-unassigned] [Bug 57770] Factoring the creation of 'FunctionOnly' callbacks in JavaScriptCore

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Apr 5 18:10:25 PDT 2011


https://bugs.webkit.org/show_bug.cgi?id=57770





--- Comment #15 from Darin Adler <darin at apple.com>  2011-04-05 18:10:24 PST ---
(From update of attachment 88272)
View in context: https://bugs.webkit.org/attachment.cgi?id=88272&action=review

Generally seems OK. A little awkward the way this handles undefined and null, but fine.

> Source/WebCore/bindings/js/CallbackFunction.h:30
> +#include <wtf/Forward.h>

What is wtf/Forward.h needed for? I don’t see anything here that would benefit from including that.

> Source/WebCore/bindings/js/CallbackFunction.h:35
> +    CallbackAllowFunction = 0,

Should probably be named CallbackAllowFunctionOnly. It’s misleading to have it be named AllowFunction when a function will be allowed even if you don’t pass this value!

> Source/WebCore/bindings/js/CallbackFunction.h:57
> +    if (value.isUndefined() && (acceptedValues & CallbackAllowUndefined))
> +        return 0;
> +
> +    if (value.isNull() && (acceptedValues & CallbackAllowNull))
> +        return 0;
> +
> +    // FIXME: disallows callable objects created via JSC API. It's not clear what exactly the specification intends to allow.
> +    // https://bugs.webkit.org/show_bug.cgi?id=40012
> +    if (!value.inherits(&JSC::JSFunction::s_info)) {
> +        setDOMException(exec, TYPE_MISMATCH_ERR);
> +        return 0;
> +    }

There’s no real reason this has to be in the header. If this logic was in a non-template function called by the template function we could make this header include fewer header files.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list