[Webkit-unassigned] [Bug 112506] [JSC] Implement EnforceRange IDL attribute for integer conversions

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Mar 19 17:22:37 PDT 2013


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


Kentaro Hara <haraken at chromium.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #193841|review?                     |review+
               Flag|                            |




--- Comment #21 from Kentaro Hara <haraken at chromium.org>  2013-03-19 17:25:02 PST ---
(From update of attachment 193841)
View in context: https://bugs.webkit.org/attachment.cgi?id=193841&action=review

> Source/WebCore/bindings/js/JSDOMBinding.cpp:268
> +static double enforceRange(ExecState* exec, double x, double minimum, double maximum)

This helper method looks great; it is easy to understand that the implementation is conformed to the spec. I'd be happy if you could clean up V8Binding.cpp similarly in a follow-up patch:)

> Source/WebCore/bindings/js/JSDOMBinding.h:278
> +    inline int32_t toInt32(JSC::ExecState* exec, JSC::JSValue value, IntegerConversionConfiguration configuration)
> +    {
> +        if (configuration == EnforceRange)
> +            return toInt32EnforceRange(exec, value);
> +        return value.toInt32(exec);
> +    }
> +
> +    inline uint32_t toUInt32(JSC::ExecState* exec, JSC::JSValue value, IntegerConversionConfiguration configuration)
> +    {
> +        if (configuration == EnforceRange)
> +            return toUInt32EnforceRange(exec, value);
> +        return value.toUInt32(exec);
> +    }
> +
> +    int64_t toInt64(JSC::ExecState*, JSC::JSValue, IntegerConversionConfiguration);
> +    uint64_t toUInt64(JSC::ExecState*, JSC::JSValue, IntegerConversionConfiguration);

In a follow-up patch, let's make IntegerConversionConfiguration an optional parameter and set NormalConversion by default (in both CodeGeneratorJS.pm and CodeGeneratorV8.pm). Then you don't need to care about the parameter in caller sites in common cases.

-- 
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