[JSC] Implement EnforceRange IDL attribute for integer conversions
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 Mar 2013 02:42:02 +0000 (02:42 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 Mar 2013 02:42:02 +0000 (02:42 +0000)
https://bugs.webkit.org/show_bug.cgi?id=112506

Patch by Michael Pruett <michael@68k.org> on 2013-03-20
Reviewed by Kentaro Hara.

.:

* Source/autotools/symbols.filter:

Source/WebCore:

Implement the EnforceRange attribute for JSC bindings.

The EnforceRange attribute requires a type error to be thrown when
converting an ECMAScript number which is beyond the representable
range of the IDL integer type.

Tests: fast/js/webidl-type-mapping.html
       storage/indexeddb/cursor-advance-workers.html
       storage/indexeddb/cursor-advance.html
       storage/indexeddb/intversion-bad-parameters.html

* WebCore.exp.in:
* bindings/js/JSDOMBinding.cpp:
(WebCore):
(WebCore::enforceRange):
(WebCore::toInt32EnforceRange):
(WebCore::toUInt32EnforceRange):
(WebCore::toInt64):
(WebCore::toUInt64):
* bindings/js/JSDOMBinding.h:
(WebCore::toInt32):
(WebCore):
(WebCore::toUInt32):
* bindings/scripts/CodeGeneratorJS.pm:
(JSValueToNative):
* bindings/scripts/test/JS/JSTestEventTarget.cpp:
(WebCore::jsTestEventTargetPrototypeFunctionItem):
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::setJSTestObjShortAttr):
(WebCore::setJSTestObjUnsignedShortAttr):
(WebCore::setJSTestObjLongAttr):
(WebCore::setJSTestObjLongLongAttr):
(WebCore::setJSTestObjUnsignedLongLongAttr):
(WebCore::setJSTestObjReflectedIntegralAttr):
(WebCore::setJSTestObjReflectedUnsignedIntegralAttr):
(WebCore::setJSTestObjReflectedCustomIntegralAttr):
(WebCore::setJSTestObjAttrWithGetterException):
(WebCore::setJSTestObjAttrWithSetterException):
(WebCore::setJSTestObjWithScriptStateAttribute):
(WebCore::setJSTestObjConditionalAttr1):
(WebCore::setJSTestObjConditionalAttr2):
(WebCore::setJSTestObjConditionalAttr3):
(WebCore::setJSTestObjStrawberry):
(WebCore::setJSTestObjId):
(WebCore::setJSTestObjNullableLongSettableAttribute):
(WebCore::setJSTestObjNullableStringValue):
(WebCore::jsTestObjPrototypeFunctionVoidMethodWithArgs):
(WebCore::jsTestObjPrototypeFunctionLongMethodWithArgs):
(WebCore::jsTestObjPrototypeFunctionObjMethodWithArgs):
(WebCore::jsTestObjPrototypeFunctionMethodReturningSequence):
(WebCore::jsTestObjPrototypeFunctionMethodWithOptionalArg):
(WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg):
(WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs):
(WebCore::jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod2):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod4):
(WebCore::jsTestObjConstructorFunctionClassMethodWithOptional):
(WebCore::jsTestObjConstructorFunctionOverloadedMethod11):
(WebCore::jsTestObjPrototypeFunctionStrictFunction):
* bindings/scripts/test/JS/JSTestTypedefs.cpp:
(WebCore::setJSTestTypedefsUnsignedLongLongAttr):
(WebCore::setJSTestTypedefsAttrWithGetterException):
(WebCore::setJSTestTypedefsAttrWithSetterException):

Source/WebKit/win:

* WebKit.vcproj/WebKitExports.def.in:

LayoutTests:

* fast/js/webidl-type-mapping-expected.txt:
* platform/chromium/fast/js/webidl-type-mapping-expected.txt: Removed.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@146430 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 files changed:
ChangeLog
LayoutTests/ChangeLog
LayoutTests/fast/js/webidl-type-mapping-expected.txt
LayoutTests/platform/chromium/fast/js/webidl-type-mapping-expected.txt [deleted file]
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/bindings/js/JSDOMBinding.cpp
Source/WebCore/bindings/js/JSDOMBinding.h
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp
Source/WebKit/win/ChangeLog
Source/WebKit/win/WebKit.vcproj/WebKitExports.def.in
Source/autotools/symbols.filter

index 8981758..0810e51 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2013-03-20  Michael Pruett  <michael@68k.org>
+
+        [JSC] Implement EnforceRange IDL attribute for integer conversions
+        https://bugs.webkit.org/show_bug.cgi?id=112506
+
+        Reviewed by Kentaro Hara.
+
+        * Source/autotools/symbols.filter:
+
 2013-03-20  Zan Dobersek  <zdobersek@igalia.com>
 
         [GTK] Build ANGLE sources into a separate library from libWebCore.la
index 82cb5ab..f354407 100644 (file)
@@ -1,3 +1,13 @@
+2013-03-20  Michael Pruett  <michael@68k.org>
+
+        [JSC] Implement EnforceRange IDL attribute for integer conversions
+        https://bugs.webkit.org/show_bug.cgi?id=112506
+
+        Reviewed by Kentaro Hara.
+
+        * fast/js/webidl-type-mapping-expected.txt:
+        * platform/chromium/fast/js/webidl-type-mapping-expected.txt: Removed.
+
 2013-03-20  Ryosuke Niwa  <rniwa@webkit.org>
 
                Add flaky test expectations to compositing/geometry/limit-layer-bounds-fixed.html
index 686063d..aec0ac1 100644 (file)
@@ -109,25 +109,25 @@ converter.testEnforceRangeLong = -0x8001
 PASS converter.testEnforceRangeLong is -0x8001
 converter.testEnforceRangeLong = 0x7FFFFFFF
 PASS converter.testEnforceRangeLong is 0x7FFFFFFF
-FAIL converter.testEnforceRangeLong = 0x80000000 should throw an exception. Was 2147483648.
-FAIL converter.testEnforceRangeLong = 0xFFFFFFFF should throw an exception. Was 4294967295.
+PASS converter.testEnforceRangeLong = 0x80000000 threw exception TypeError: Type error.
+PASS converter.testEnforceRangeLong = 0xFFFFFFFF threw exception TypeError: Type error.
 converter.testEnforceRangeLong = -0x80000000
 PASS converter.testEnforceRangeLong is -0x80000000
-FAIL converter.testEnforceRangeLong = -0x80000001 should throw an exception. Was -2147483649.
-FAIL converter.testEnforceRangeLong = 0xDCBA9876543210 should throw an exception. Was 62129658859368980.
-FAIL converter.testEnforceRangeLong = Number.MAX_VALUE should throw an exception. Was 1.7976931348623157e+308.
+PASS converter.testEnforceRangeLong = -0x80000001 threw exception TypeError: Type error.
+PASS converter.testEnforceRangeLong = 0xDCBA9876543210 threw exception TypeError: Type error.
+PASS converter.testEnforceRangeLong = Number.MAX_VALUE threw exception TypeError: Type error.
 converter.testEnforceRangeLong = Number.MIN_VALUE
 PASS converter.testEnforceRangeLong is 0
-FAIL converter.testEnforceRangeLong = -Number.MAX_VALUE should throw an exception. Was -1.7976931348623157e+308.
+PASS converter.testEnforceRangeLong = -Number.MAX_VALUE threw exception TypeError: Type error.
 converter.testEnforceRangeLong = -Number.MIN_VALUE
 PASS converter.testEnforceRangeLong is 0
 converter.testEnforceRangeLong = 1.99
 PASS converter.testEnforceRangeLong is 1
 converter.testEnforceRangeLong = -1.99
 PASS converter.testEnforceRangeLong is -1
-FAIL converter.testEnforceRangeLong = Infinity should throw an exception. Was Infinity.
-FAIL converter.testEnforceRangeLong = -Infinity should throw an exception. Was -Infinity.
-FAIL converter.testEnforceRangeLong = NaN should throw an exception. Was NaN.
+PASS converter.testEnforceRangeLong = Infinity threw exception TypeError: Type error.
+PASS converter.testEnforceRangeLong = -Infinity threw exception TypeError: Type error.
+PASS converter.testEnforceRangeLong = NaN threw exception TypeError: Type error.
 converter.testEnforceRangeLong = false
 PASS converter.testEnforceRangeLong is 0
 converter.testEnforceRangeLong = true
@@ -136,10 +136,10 @@ converter.testEnforceRangeLong = ''
 PASS converter.testEnforceRangeLong is 0
 converter.testEnforceRangeLong = '1'
 PASS converter.testEnforceRangeLong is 1
-FAIL converter.testEnforceRangeLong = 'abc' should throw an exception. Was abc.
+PASS converter.testEnforceRangeLong = 'abc' threw exception TypeError: Type error.
 converter.testEnforceRangeLong = null
 PASS converter.testEnforceRangeLong is 0
-FAIL converter.testEnforceRangeLong = undefined should throw an exception. Was undefined.
+PASS converter.testEnforceRangeLong = undefined threw exception TypeError: Type error.
 PASS converter.testEnforceRangeLong = {valueOf:function(){throw new Error('custom');}} threw exception Error: custom.
 
 PASS 'testUnsignedLong' in converter is true
@@ -220,7 +220,7 @@ PASS 'testEnforceRangeUnsignedLong' in converter is true
 PASS typeof converter.testEnforceRangeUnsignedLong === 'number' is true
 converter.testEnforceRangeUnsignedLong = 0
 PASS converter.testEnforceRangeUnsignedLong is 0
-FAIL converter.testEnforceRangeUnsignedLong = -1 should throw an exception. Was -1.
+PASS converter.testEnforceRangeUnsignedLong = -1 threw exception TypeError: Type error.
 converter.testEnforceRangeUnsignedLong = 1
 PASS converter.testEnforceRangeUnsignedLong is 1
 converter.testEnforceRangeUnsignedLong = 0x7F
@@ -229,37 +229,37 @@ converter.testEnforceRangeUnsignedLong = 0x80
 PASS converter.testEnforceRangeUnsignedLong is 0x80
 converter.testEnforceRangeUnsignedLong = 0xFF
 PASS converter.testEnforceRangeUnsignedLong is 0xFF
-FAIL converter.testEnforceRangeUnsignedLong = -0x80 should throw an exception. Was -128.
-FAIL converter.testEnforceRangeUnsignedLong = -0x81 should throw an exception. Was -129.
+PASS converter.testEnforceRangeUnsignedLong = -0x80 threw exception TypeError: Type error.
+PASS converter.testEnforceRangeUnsignedLong = -0x81 threw exception TypeError: Type error.
 converter.testEnforceRangeUnsignedLong = 0x7FFF
 PASS converter.testEnforceRangeUnsignedLong is 0x7FFF
 converter.testEnforceRangeUnsignedLong = 0x8000
 PASS converter.testEnforceRangeUnsignedLong is 0x8000
 converter.testEnforceRangeUnsignedLong = 0xFFFF
 PASS converter.testEnforceRangeUnsignedLong is 0xFFFF
-FAIL converter.testEnforceRangeUnsignedLong = -0x8000 should throw an exception. Was -32768.
-FAIL converter.testEnforceRangeUnsignedLong = -0x8001 should throw an exception. Was -32769.
+PASS converter.testEnforceRangeUnsignedLong = -0x8000 threw exception TypeError: Type error.
+PASS converter.testEnforceRangeUnsignedLong = -0x8001 threw exception TypeError: Type error.
 converter.testEnforceRangeUnsignedLong = 0x7FFFFFFF
 PASS converter.testEnforceRangeUnsignedLong is 0x7FFFFFFF
 converter.testEnforceRangeUnsignedLong = 0x80000000
 PASS converter.testEnforceRangeUnsignedLong is 0x80000000
 converter.testEnforceRangeUnsignedLong = 0xFFFFFFFF
 PASS converter.testEnforceRangeUnsignedLong is 0xFFFFFFFF
-FAIL converter.testEnforceRangeUnsignedLong = -0x80000000 should throw an exception. Was -2147483648.
-FAIL converter.testEnforceRangeUnsignedLong = -0x80000001 should throw an exception. Was -2147483649.
-FAIL converter.testEnforceRangeUnsignedLong = 0xDCBA9876543210 should throw an exception. Was 62129658859368980.
-FAIL converter.testEnforceRangeUnsignedLong = Number.MAX_VALUE should throw an exception. Was 1.7976931348623157e+308.
+PASS converter.testEnforceRangeUnsignedLong = -0x80000000 threw exception TypeError: Type error.
+PASS converter.testEnforceRangeUnsignedLong = -0x80000001 threw exception TypeError: Type error.
+PASS converter.testEnforceRangeUnsignedLong = 0xDCBA9876543210 threw exception TypeError: Type error.
+PASS converter.testEnforceRangeUnsignedLong = Number.MAX_VALUE threw exception TypeError: Type error.
 converter.testEnforceRangeUnsignedLong = Number.MIN_VALUE
 PASS converter.testEnforceRangeUnsignedLong is 0
-FAIL converter.testEnforceRangeUnsignedLong = -Number.MAX_VALUE should throw an exception. Was -1.7976931348623157e+308.
+PASS converter.testEnforceRangeUnsignedLong = -Number.MAX_VALUE threw exception TypeError: Type error.
 converter.testEnforceRangeUnsignedLong = -Number.MIN_VALUE
 PASS converter.testEnforceRangeUnsignedLong is 0
 converter.testEnforceRangeUnsignedLong = 1.99
 PASS converter.testEnforceRangeUnsignedLong is 1
-FAIL converter.testEnforceRangeUnsignedLong = -1.99 should throw an exception. Was -1.99.
-FAIL converter.testEnforceRangeUnsignedLong = Infinity should throw an exception. Was Infinity.
-FAIL converter.testEnforceRangeUnsignedLong = -Infinity should throw an exception. Was -Infinity.
-FAIL converter.testEnforceRangeUnsignedLong = NaN should throw an exception. Was NaN.
+PASS converter.testEnforceRangeUnsignedLong = -1.99 threw exception TypeError: Type error.
+PASS converter.testEnforceRangeUnsignedLong = Infinity threw exception TypeError: Type error.
+PASS converter.testEnforceRangeUnsignedLong = -Infinity threw exception TypeError: Type error.
+PASS converter.testEnforceRangeUnsignedLong = NaN threw exception TypeError: Type error.
 converter.testEnforceRangeUnsignedLong = false
 PASS converter.testEnforceRangeUnsignedLong is 0
 converter.testEnforceRangeUnsignedLong = true
@@ -268,10 +268,10 @@ converter.testEnforceRangeUnsignedLong = ''
 PASS converter.testEnforceRangeUnsignedLong is 0
 converter.testEnforceRangeUnsignedLong = '1'
 PASS converter.testEnforceRangeUnsignedLong is 1
-FAIL converter.testEnforceRangeUnsignedLong = 'abc' should throw an exception. Was abc.
+PASS converter.testEnforceRangeUnsignedLong = 'abc' threw exception TypeError: Type error.
 converter.testEnforceRangeUnsignedLong = null
 PASS converter.testEnforceRangeUnsignedLong is 0
-FAIL converter.testEnforceRangeUnsignedLong = undefined should throw an exception. Was undefined.
+PASS converter.testEnforceRangeUnsignedLong = undefined threw exception TypeError: Type error.
 PASS converter.testEnforceRangeUnsignedLong = {valueOf:function(){throw new Error('custom');}} threw exception Error: custom.
 
 PASS 'testLongLong' in converter is true
@@ -319,17 +319,17 @@ PASS converter.testLongLong is 0
 converter.testLongLong = -Number.MIN_VALUE
 PASS converter.testLongLong is 0
 converter.testLongLong = Number.MAX_VALUE
-FAIL converter.testLongLong should be 0. Was -9223372036854776000.
+PASS converter.testLongLong is 0
 converter.testLongLong = -Number.MAX_VALUE
-FAIL converter.testLongLong should be 0. Was -9223372036854776000.
+PASS converter.testLongLong is 0
 converter.testLongLong = 1.99
 PASS converter.testLongLong is 1
 converter.testLongLong = -1.99
 PASS converter.testLongLong is -1
 converter.testLongLong = Infinity
-FAIL converter.testLongLong should be 0. Was -9223372036854776000.
+PASS converter.testLongLong is 0
 converter.testLongLong = -Infinity
-FAIL converter.testLongLong should be 0. Was -9223372036854776000.
+PASS converter.testLongLong is 0
 converter.testLongLong = NaN
 PASS converter.testLongLong is 0
 converter.testLongLong = false
@@ -386,20 +386,20 @@ converter.testEnforceRangeLongLong = -0x80000000
 PASS converter.testEnforceRangeLongLong is -0x80000000
 converter.testEnforceRangeLongLong = -0x80000001
 PASS converter.testEnforceRangeLongLong is -0x80000001
-FAIL converter.testEnforceRangeLongLong = 0xDCBA9876543210 should throw an exception. Was 62129658859368980.
+PASS converter.testEnforceRangeLongLong = 0xDCBA9876543210 threw exception TypeError: Type error.
 converter.testEnforceRangeLongLong = Number.MIN_VALUE
 PASS converter.testEnforceRangeLongLong is 0
 converter.testEnforceRangeLongLong = -Number.MIN_VALUE
 PASS converter.testEnforceRangeLongLong is 0
-FAIL converter.testEnforceRangeLongLong = Number.MAX_VALUE should throw an exception. Was 1.7976931348623157e+308.
-FAIL converter.testEnforceRangeLongLong = -Number.MAX_VALUE should throw an exception. Was -1.7976931348623157e+308.
+PASS converter.testEnforceRangeLongLong = Number.MAX_VALUE threw exception TypeError: Type error.
+PASS converter.testEnforceRangeLongLong = -Number.MAX_VALUE threw exception TypeError: Type error.
 converter.testEnforceRangeLongLong = 1.99
 PASS converter.testEnforceRangeLongLong is 1
 converter.testEnforceRangeLongLong = -1.99
 PASS converter.testEnforceRangeLongLong is -1
-FAIL converter.testEnforceRangeLongLong = Infinity should throw an exception. Was Infinity.
-FAIL converter.testEnforceRangeLongLong = -Infinity should throw an exception. Was -Infinity.
-FAIL converter.testEnforceRangeLongLong = NaN should throw an exception. Was NaN.
+PASS converter.testEnforceRangeLongLong = Infinity threw exception TypeError: Type error.
+PASS converter.testEnforceRangeLongLong = -Infinity threw exception TypeError: Type error.
+PASS converter.testEnforceRangeLongLong = NaN threw exception TypeError: Type error.
 converter.testEnforceRangeLongLong = false
 PASS converter.testEnforceRangeLongLong is 0
 converter.testEnforceRangeLongLong = true
@@ -408,10 +408,10 @@ converter.testEnforceRangeLongLong = ''
 PASS converter.testEnforceRangeLongLong is 0
 converter.testEnforceRangeLongLong = '1'
 PASS converter.testEnforceRangeLongLong is 1
-FAIL converter.testEnforceRangeLongLong = 'abc' should throw an exception. Was abc.
+PASS converter.testEnforceRangeLongLong = 'abc' threw exception TypeError: Type error.
 converter.testEnforceRangeLongLong = null
 PASS converter.testEnforceRangeLongLong is 0
-FAIL converter.testEnforceRangeLongLong = undefined should throw an exception. Was undefined.
+PASS converter.testEnforceRangeLongLong = undefined threw exception TypeError: Type error.
 PASS converter.testEnforceRangeLongLong = {valueOf:function(){throw new Error('custom');}} threw exception Error: custom.
 
 PASS 'testUnsignedLongLong' in converter is true
@@ -461,7 +461,7 @@ PASS converter.testUnsignedLongLong is 0
 converter.testUnsignedLongLong = Number.MAX_VALUE
 PASS converter.testUnsignedLongLong is 0
 converter.testUnsignedLongLong = -Number.MAX_VALUE
-FAIL converter.testUnsignedLongLong should be 0. Was 9223372036854776000.
+PASS converter.testUnsignedLongLong is 0
 converter.testUnsignedLongLong = 1.99
 PASS converter.testUnsignedLongLong is 1
 converter.testUnsignedLongLong = -1.99
@@ -469,7 +469,7 @@ PASS converter.testUnsignedLongLong is 0xFFFFFFFFFFFFFFFF
 converter.testUnsignedLongLong = Infinity
 PASS converter.testUnsignedLongLong is 0
 converter.testUnsignedLongLong = -Infinity
-FAIL converter.testUnsignedLongLong should be 0. Was 9223372036854776000.
+PASS converter.testUnsignedLongLong is 0
 converter.testUnsignedLongLong = NaN
 PASS converter.testUnsignedLongLong is 0
 converter.testUnsignedLongLong = false
@@ -492,7 +492,7 @@ PASS 'testEnforceRangeUnsignedLongLong' in converter is true
 PASS typeof converter.testEnforceRangeUnsignedLongLong === 'number' is true
 converter.testEnforceRangeUnsignedLongLong = 0
 PASS converter.testEnforceRangeUnsignedLongLong is 0
-FAIL converter.testEnforceRangeUnsignedLongLong = -1 should throw an exception. Was -1.
+PASS converter.testEnforceRangeUnsignedLongLong = -1 threw exception TypeError: Type error.
 converter.testEnforceRangeUnsignedLongLong = 1
 PASS converter.testEnforceRangeUnsignedLongLong is 1
 converter.testEnforceRangeUnsignedLongLong = 0x7F
@@ -501,37 +501,37 @@ converter.testEnforceRangeUnsignedLongLong = 0x80
 PASS converter.testEnforceRangeUnsignedLongLong is 0x80
 converter.testEnforceRangeUnsignedLongLong = 0xFF
 PASS converter.testEnforceRangeUnsignedLongLong is 0xFF
-FAIL converter.testEnforceRangeUnsignedLongLong = -0x80 should throw an exception. Was -128.
-FAIL converter.testEnforceRangeUnsignedLongLong = -0x81 should throw an exception. Was -129.
+PASS converter.testEnforceRangeUnsignedLongLong = -0x80 threw exception TypeError: Type error.
+PASS converter.testEnforceRangeUnsignedLongLong = -0x81 threw exception TypeError: Type error.
 converter.testEnforceRangeUnsignedLongLong = 0x7FFF
 PASS converter.testEnforceRangeUnsignedLongLong is 0x7FFF
 converter.testEnforceRangeUnsignedLongLong = 0x8000
 PASS converter.testEnforceRangeUnsignedLongLong is 0x8000
 converter.testEnforceRangeUnsignedLongLong = 0xFFFF
 PASS converter.testEnforceRangeUnsignedLongLong is 0xFFFF
-FAIL converter.testEnforceRangeUnsignedLongLong = -0x8000 should throw an exception. Was -32768.
-FAIL converter.testEnforceRangeUnsignedLongLong = -0x8001 should throw an exception. Was -32769.
+PASS converter.testEnforceRangeUnsignedLongLong = -0x8000 threw exception TypeError: Type error.
+PASS converter.testEnforceRangeUnsignedLongLong = -0x8001 threw exception TypeError: Type error.
 converter.testEnforceRangeUnsignedLongLong = 0x7FFFFFFF
 PASS converter.testEnforceRangeUnsignedLongLong is 0x7FFFFFFF
 converter.testEnforceRangeUnsignedLongLong = 0x80000000
 PASS converter.testEnforceRangeUnsignedLongLong is 0x80000000
 converter.testEnforceRangeUnsignedLongLong = 0xFFFFFFFF
 PASS converter.testEnforceRangeUnsignedLongLong is 0xFFFFFFFF
-FAIL converter.testEnforceRangeUnsignedLongLong = -0x80000000 should throw an exception. Was -2147483648.
-FAIL converter.testEnforceRangeUnsignedLongLong = -0x80000001 should throw an exception. Was -2147483649.
-FAIL converter.testEnforceRangeUnsignedLongLong = 0xDCBA9876543210 should throw an exception. Was 62129658859368980.
+PASS converter.testEnforceRangeUnsignedLongLong = -0x80000000 threw exception TypeError: Type error.
+PASS converter.testEnforceRangeUnsignedLongLong = -0x80000001 threw exception TypeError: Type error.
+PASS converter.testEnforceRangeUnsignedLongLong = 0xDCBA9876543210 threw exception TypeError: Type error.
 converter.testEnforceRangeUnsignedLongLong = Number.MIN_VALUE
 PASS converter.testEnforceRangeUnsignedLongLong is 0
 converter.testEnforceRangeUnsignedLongLong = -Number.MIN_VALUE
 PASS converter.testEnforceRangeUnsignedLongLong is 0
-FAIL converter.testEnforceRangeUnsignedLongLong = Number.MAX_VALUE should throw an exception. Was 1.7976931348623157e+308.
-FAIL converter.testEnforceRangeUnsignedLongLong = -Number.MAX_VALUE should throw an exception. Was -1.7976931348623157e+308.
+PASS converter.testEnforceRangeUnsignedLongLong = Number.MAX_VALUE threw exception TypeError: Type error.
+PASS converter.testEnforceRangeUnsignedLongLong = -Number.MAX_VALUE threw exception TypeError: Type error.
 converter.testEnforceRangeUnsignedLongLong = 1.99
 PASS converter.testEnforceRangeUnsignedLongLong is 1
-FAIL converter.testEnforceRangeUnsignedLongLong = -1.99 should throw an exception. Was -1.99.
-FAIL converter.testEnforceRangeUnsignedLongLong = Infinity should throw an exception. Was Infinity.
-FAIL converter.testEnforceRangeUnsignedLongLong = -Infinity should throw an exception. Was -Infinity.
-FAIL converter.testEnforceRangeUnsignedLongLong = NaN should throw an exception. Was NaN.
+PASS converter.testEnforceRangeUnsignedLongLong = -1.99 threw exception TypeError: Type error.
+PASS converter.testEnforceRangeUnsignedLongLong = Infinity threw exception TypeError: Type error.
+PASS converter.testEnforceRangeUnsignedLongLong = -Infinity threw exception TypeError: Type error.
+PASS converter.testEnforceRangeUnsignedLongLong = NaN threw exception TypeError: Type error.
 converter.testEnforceRangeUnsignedLongLong = false
 PASS converter.testEnforceRangeUnsignedLongLong is 0
 converter.testEnforceRangeUnsignedLongLong = true
@@ -540,10 +540,10 @@ converter.testEnforceRangeUnsignedLongLong = ''
 PASS converter.testEnforceRangeUnsignedLongLong is 0
 converter.testEnforceRangeUnsignedLongLong = '1'
 PASS converter.testEnforceRangeUnsignedLongLong is 1
-FAIL converter.testEnforceRangeUnsignedLongLong = 'abc' should throw an exception. Was abc.
+PASS converter.testEnforceRangeUnsignedLongLong = 'abc' threw exception TypeError: Type error.
 converter.testEnforceRangeUnsignedLongLong = null
 PASS converter.testEnforceRangeUnsignedLongLong is 0
-FAIL converter.testEnforceRangeUnsignedLongLong = undefined should throw an exception. Was undefined.
+PASS converter.testEnforceRangeUnsignedLongLong = undefined threw exception TypeError: Type error.
 PASS converter.testEnforceRangeUnsignedLongLong = {valueOf:function(){throw new Error('custom');}} threw exception Error: custom.
 
 PASS successfullyParsed is true
diff --git a/LayoutTests/platform/chromium/fast/js/webidl-type-mapping-expected.txt b/LayoutTests/platform/chromium/fast/js/webidl-type-mapping-expected.txt
deleted file mode 100644 (file)
index aec0ac1..0000000
+++ /dev/null
@@ -1,552 +0,0 @@
-Exercise WebIDL type conversions.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-converter = window.internals.typeConversions()
-
-PASS 'testLong' in converter is true
-PASS typeof converter.testLong === 'number' is true
-converter.testLong = 0
-PASS converter.testLong is 0
-converter.testLong = -1
-PASS converter.testLong is -1
-converter.testLong = 1
-PASS converter.testLong is 1
-converter.testLong = 0x7F
-PASS converter.testLong is 0x7F
-converter.testLong = 0x80
-PASS converter.testLong is 0x80
-converter.testLong = 0xFF
-PASS converter.testLong is 0xFF
-converter.testLong = -0x80
-PASS converter.testLong is -0x80
-converter.testLong = -0x81
-PASS converter.testLong is -0x81
-converter.testLong = 0x7FFF
-PASS converter.testLong is 0x7FFF
-converter.testLong = 0x8000
-PASS converter.testLong is 0x8000
-converter.testLong = 0xFFFF
-PASS converter.testLong is 0xFFFF
-converter.testLong = -0x8000
-PASS converter.testLong is -0x8000
-converter.testLong = -0x8001
-PASS converter.testLong is -0x8001
-converter.testLong = 0x7FFFFFFF
-PASS converter.testLong is 0x7FFFFFFF
-converter.testLong = 0x80000000
-PASS converter.testLong is -0x80000000
-converter.testLong = 0xFFFFFFFF
-PASS converter.testLong is -1
-converter.testLong = -0x80000000
-PASS converter.testLong is -0x80000000
-converter.testLong = -0x80000001
-PASS converter.testLong is 0x7FFFFFFF
-converter.testLong = 0xDCBA9876543210
-PASS converter.testLong is 0x76543210
-converter.testLong = Number.MAX_VALUE
-PASS converter.testLong is 0
-converter.testLong = Number.MIN_VALUE
-PASS converter.testLong is 0
-converter.testLong = -Number.MAX_VALUE
-PASS converter.testLong is 0
-converter.testLong = -Number.MIN_VALUE
-PASS converter.testLong is 0
-converter.testLong = 1.99
-PASS converter.testLong is 1
-converter.testLong = -1.99
-PASS converter.testLong is -1
-converter.testLong = Infinity
-PASS converter.testLong is 0
-converter.testLong = -Infinity
-PASS converter.testLong is 0
-converter.testLong = NaN
-PASS converter.testLong is 0
-converter.testLong = false
-PASS converter.testLong is 0
-converter.testLong = true
-PASS converter.testLong is 1
-converter.testLong = ''
-PASS converter.testLong is 0
-converter.testLong = '1'
-PASS converter.testLong is 1
-converter.testLong = 'abc'
-PASS converter.testLong is 0
-converter.testLong = null
-PASS converter.testLong is 0
-converter.testLong = undefined
-PASS converter.testLong is 0
-PASS converter.testLong = {valueOf:function(){throw new Error('custom');}} threw exception Error: custom.
-
-PASS 'testEnforceRangeLong' in converter is true
-PASS typeof converter.testEnforceRangeLong === 'number' is true
-converter.testEnforceRangeLong = 0
-PASS converter.testEnforceRangeLong is 0
-converter.testEnforceRangeLong = -1
-PASS converter.testEnforceRangeLong is -1
-converter.testEnforceRangeLong = 1
-PASS converter.testEnforceRangeLong is 1
-converter.testEnforceRangeLong = 0x7F
-PASS converter.testEnforceRangeLong is 0x7F
-converter.testEnforceRangeLong = 0x80
-PASS converter.testEnforceRangeLong is 0x80
-converter.testEnforceRangeLong = 0xFF
-PASS converter.testEnforceRangeLong is 0xFF
-converter.testEnforceRangeLong = -0x80
-PASS converter.testEnforceRangeLong is -0x80
-converter.testEnforceRangeLong = -0x81
-PASS converter.testEnforceRangeLong is -0x81
-converter.testEnforceRangeLong = 0x7FFF
-PASS converter.testEnforceRangeLong is 0x7FFF
-converter.testEnforceRangeLong = 0x8000
-PASS converter.testEnforceRangeLong is 0x8000
-converter.testEnforceRangeLong = 0xFFFF
-PASS converter.testEnforceRangeLong is 0xFFFF
-converter.testEnforceRangeLong = -0x8000
-PASS converter.testEnforceRangeLong is -0x8000
-converter.testEnforceRangeLong = -0x8001
-PASS converter.testEnforceRangeLong is -0x8001
-converter.testEnforceRangeLong = 0x7FFFFFFF
-PASS converter.testEnforceRangeLong is 0x7FFFFFFF
-PASS converter.testEnforceRangeLong = 0x80000000 threw exception TypeError: Type error.
-PASS converter.testEnforceRangeLong = 0xFFFFFFFF threw exception TypeError: Type error.
-converter.testEnforceRangeLong = -0x80000000
-PASS converter.testEnforceRangeLong is -0x80000000
-PASS converter.testEnforceRangeLong = -0x80000001 threw exception TypeError: Type error.
-PASS converter.testEnforceRangeLong = 0xDCBA9876543210 threw exception TypeError: Type error.
-PASS converter.testEnforceRangeLong = Number.MAX_VALUE threw exception TypeError: Type error.
-converter.testEnforceRangeLong = Number.MIN_VALUE
-PASS converter.testEnforceRangeLong is 0
-PASS converter.testEnforceRangeLong = -Number.MAX_VALUE threw exception TypeError: Type error.
-converter.testEnforceRangeLong = -Number.MIN_VALUE
-PASS converter.testEnforceRangeLong is 0
-converter.testEnforceRangeLong = 1.99
-PASS converter.testEnforceRangeLong is 1
-converter.testEnforceRangeLong = -1.99
-PASS converter.testEnforceRangeLong is -1
-PASS converter.testEnforceRangeLong = Infinity threw exception TypeError: Type error.
-PASS converter.testEnforceRangeLong = -Infinity threw exception TypeError: Type error.
-PASS converter.testEnforceRangeLong = NaN threw exception TypeError: Type error.
-converter.testEnforceRangeLong = false
-PASS converter.testEnforceRangeLong is 0
-converter.testEnforceRangeLong = true
-PASS converter.testEnforceRangeLong is 1
-converter.testEnforceRangeLong = ''
-PASS converter.testEnforceRangeLong is 0
-converter.testEnforceRangeLong = '1'
-PASS converter.testEnforceRangeLong is 1
-PASS converter.testEnforceRangeLong = 'abc' threw exception TypeError: Type error.
-converter.testEnforceRangeLong = null
-PASS converter.testEnforceRangeLong is 0
-PASS converter.testEnforceRangeLong = undefined threw exception TypeError: Type error.
-PASS converter.testEnforceRangeLong = {valueOf:function(){throw new Error('custom');}} threw exception Error: custom.
-
-PASS 'testUnsignedLong' in converter is true
-PASS typeof converter.testUnsignedLong === 'number' is true
-converter.testUnsignedLong = 0
-PASS converter.testUnsignedLong is 0
-converter.testUnsignedLong = -1
-PASS converter.testUnsignedLong is 0xFFFFFFFF
-converter.testUnsignedLong = 1
-PASS converter.testUnsignedLong is 1
-converter.testUnsignedLong = 0x7F
-PASS converter.testUnsignedLong is 0x7F
-converter.testUnsignedLong = 0x80
-PASS converter.testUnsignedLong is 0x80
-converter.testUnsignedLong = 0xFF
-PASS converter.testUnsignedLong is 0xFF
-converter.testUnsignedLong = -0x80
-PASS converter.testUnsignedLong is 0xFFFFFF80
-converter.testUnsignedLong = -0x81
-PASS converter.testUnsignedLong is 0xFFFFFF7F
-converter.testUnsignedLong = 0x7FFF
-PASS converter.testUnsignedLong is 0x7FFF
-converter.testUnsignedLong = 0x8000
-PASS converter.testUnsignedLong is 0x8000
-converter.testUnsignedLong = 0xFFFF
-PASS converter.testUnsignedLong is 0xFFFF
-converter.testUnsignedLong = -0x8000
-PASS converter.testUnsignedLong is 0xFFFF8000
-converter.testUnsignedLong = -0x8001
-PASS converter.testUnsignedLong is 0xFFFF7FFF
-converter.testUnsignedLong = 0x7FFFFFFF
-PASS converter.testUnsignedLong is 0x7FFFFFFF
-converter.testUnsignedLong = 0x80000000
-PASS converter.testUnsignedLong is 0x80000000
-converter.testUnsignedLong = 0xFFFFFFFF
-PASS converter.testUnsignedLong is 0xFFFFFFFF
-converter.testUnsignedLong = -0x80000000
-PASS converter.testUnsignedLong is 0x80000000
-converter.testUnsignedLong = -0x80000001
-PASS converter.testUnsignedLong is 0x7FFFFFFF
-converter.testUnsignedLong = 0xDCBA9876543210
-PASS converter.testUnsignedLong is 0x76543210
-converter.testUnsignedLong = Number.MAX_VALUE
-PASS converter.testUnsignedLong is 0
-converter.testUnsignedLong = Number.MIN_VALUE
-PASS converter.testUnsignedLong is 0
-converter.testUnsignedLong = -Number.MAX_VALUE
-PASS converter.testUnsignedLong is 0
-converter.testUnsignedLong = -Number.MIN_VALUE
-PASS converter.testUnsignedLong is 0
-converter.testUnsignedLong = 1.99
-PASS converter.testUnsignedLong is 1
-converter.testUnsignedLong = -1.99
-PASS converter.testUnsignedLong is 0xFFFFFFFF
-converter.testUnsignedLong = Infinity
-PASS converter.testUnsignedLong is 0
-converter.testUnsignedLong = -Infinity
-PASS converter.testUnsignedLong is 0
-converter.testUnsignedLong = NaN
-PASS converter.testUnsignedLong is 0
-converter.testUnsignedLong = false
-PASS converter.testUnsignedLong is 0
-converter.testUnsignedLong = true
-PASS converter.testUnsignedLong is 1
-converter.testUnsignedLong = ''
-PASS converter.testUnsignedLong is 0
-converter.testUnsignedLong = '1'
-PASS converter.testUnsignedLong is 1
-converter.testUnsignedLong = 'abc'
-PASS converter.testUnsignedLong is 0
-converter.testUnsignedLong = null
-PASS converter.testUnsignedLong is 0
-converter.testUnsignedLong = undefined
-PASS converter.testUnsignedLong is 0
-PASS converter.testUnsignedLong = {valueOf:function(){throw new Error('custom');}} threw exception Error: custom.
-
-PASS 'testEnforceRangeUnsignedLong' in converter is true
-PASS typeof converter.testEnforceRangeUnsignedLong === 'number' is true
-converter.testEnforceRangeUnsignedLong = 0
-PASS converter.testEnforceRangeUnsignedLong is 0
-PASS converter.testEnforceRangeUnsignedLong = -1 threw exception TypeError: Type error.
-converter.testEnforceRangeUnsignedLong = 1
-PASS converter.testEnforceRangeUnsignedLong is 1
-converter.testEnforceRangeUnsignedLong = 0x7F
-PASS converter.testEnforceRangeUnsignedLong is 0x7F
-converter.testEnforceRangeUnsignedLong = 0x80
-PASS converter.testEnforceRangeUnsignedLong is 0x80
-converter.testEnforceRangeUnsignedLong = 0xFF
-PASS converter.testEnforceRangeUnsignedLong is 0xFF
-PASS converter.testEnforceRangeUnsignedLong = -0x80 threw exception TypeError: Type error.
-PASS converter.testEnforceRangeUnsignedLong = -0x81 threw exception TypeError: Type error.
-converter.testEnforceRangeUnsignedLong = 0x7FFF
-PASS converter.testEnforceRangeUnsignedLong is 0x7FFF
-converter.testEnforceRangeUnsignedLong = 0x8000
-PASS converter.testEnforceRangeUnsignedLong is 0x8000
-converter.testEnforceRangeUnsignedLong = 0xFFFF
-PASS converter.testEnforceRangeUnsignedLong is 0xFFFF
-PASS converter.testEnforceRangeUnsignedLong = -0x8000 threw exception TypeError: Type error.
-PASS converter.testEnforceRangeUnsignedLong = -0x8001 threw exception TypeError: Type error.
-converter.testEnforceRangeUnsignedLong = 0x7FFFFFFF
-PASS converter.testEnforceRangeUnsignedLong is 0x7FFFFFFF
-converter.testEnforceRangeUnsignedLong = 0x80000000
-PASS converter.testEnforceRangeUnsignedLong is 0x80000000
-converter.testEnforceRangeUnsignedLong = 0xFFFFFFFF
-PASS converter.testEnforceRangeUnsignedLong is 0xFFFFFFFF
-PASS converter.testEnforceRangeUnsignedLong = -0x80000000 threw exception TypeError: Type error.
-PASS converter.testEnforceRangeUnsignedLong = -0x80000001 threw exception TypeError: Type error.
-PASS converter.testEnforceRangeUnsignedLong = 0xDCBA9876543210 threw exception TypeError: Type error.
-PASS converter.testEnforceRangeUnsignedLong = Number.MAX_VALUE threw exception TypeError: Type error.
-converter.testEnforceRangeUnsignedLong = Number.MIN_VALUE
-PASS converter.testEnforceRangeUnsignedLong is 0
-PASS converter.testEnforceRangeUnsignedLong = -Number.MAX_VALUE threw exception TypeError: Type error.
-converter.testEnforceRangeUnsignedLong = -Number.MIN_VALUE
-PASS converter.testEnforceRangeUnsignedLong is 0
-converter.testEnforceRangeUnsignedLong = 1.99
-PASS converter.testEnforceRangeUnsignedLong is 1
-PASS converter.testEnforceRangeUnsignedLong = -1.99 threw exception TypeError: Type error.
-PASS converter.testEnforceRangeUnsignedLong = Infinity threw exception TypeError: Type error.
-PASS converter.testEnforceRangeUnsignedLong = -Infinity threw exception TypeError: Type error.
-PASS converter.testEnforceRangeUnsignedLong = NaN threw exception TypeError: Type error.
-converter.testEnforceRangeUnsignedLong = false
-PASS converter.testEnforceRangeUnsignedLong is 0
-converter.testEnforceRangeUnsignedLong = true
-PASS converter.testEnforceRangeUnsignedLong is 1
-converter.testEnforceRangeUnsignedLong = ''
-PASS converter.testEnforceRangeUnsignedLong is 0
-converter.testEnforceRangeUnsignedLong = '1'
-PASS converter.testEnforceRangeUnsignedLong is 1
-PASS converter.testEnforceRangeUnsignedLong = 'abc' threw exception TypeError: Type error.
-converter.testEnforceRangeUnsignedLong = null
-PASS converter.testEnforceRangeUnsignedLong is 0
-PASS converter.testEnforceRangeUnsignedLong = undefined threw exception TypeError: Type error.
-PASS converter.testEnforceRangeUnsignedLong = {valueOf:function(){throw new Error('custom');}} threw exception Error: custom.
-
-PASS 'testLongLong' in converter is true
-PASS typeof converter.testLongLong === 'number' is true
-converter.testLongLong = 0
-PASS converter.testLongLong is 0
-converter.testLongLong = -1
-PASS converter.testLongLong is -1
-converter.testLongLong = 1
-PASS converter.testLongLong is 1
-converter.testLongLong = 0x7F
-PASS converter.testLongLong is 0x7F
-converter.testLongLong = 0x80
-PASS converter.testLongLong is 0x80
-converter.testLongLong = 0xFF
-PASS converter.testLongLong is 0xFF
-converter.testLongLong = -0x80
-PASS converter.testLongLong is -0x80
-converter.testLongLong = -0x81
-PASS converter.testLongLong is -0x81
-converter.testLongLong = 0x7FFF
-PASS converter.testLongLong is 0x7FFF
-converter.testLongLong = 0x8000
-PASS converter.testLongLong is 0x8000
-converter.testLongLong = 0xFFFF
-PASS converter.testLongLong is 0xFFFF
-converter.testLongLong = -0x8000
-PASS converter.testLongLong is -0x8000
-converter.testLongLong = -0x8001
-PASS converter.testLongLong is -0x8001
-converter.testLongLong = 0x7FFFFFFF
-PASS converter.testLongLong is 0x7FFFFFFF
-converter.testLongLong = 0x80000000
-PASS converter.testLongLong is 0x80000000
-converter.testLongLong = 0xFFFFFFFF
-PASS converter.testLongLong is 0xFFFFFFFF
-converter.testLongLong = -0x80000000
-PASS converter.testLongLong is -0x80000000
-converter.testLongLong = -0x80000001
-PASS converter.testLongLong is -0x80000001
-converter.testLongLong = 0xDCBA9876543210
-PASS converter.testLongLong is 0xDCBA9876543210
-converter.testLongLong = Number.MIN_VALUE
-PASS converter.testLongLong is 0
-converter.testLongLong = -Number.MIN_VALUE
-PASS converter.testLongLong is 0
-converter.testLongLong = Number.MAX_VALUE
-PASS converter.testLongLong is 0
-converter.testLongLong = -Number.MAX_VALUE
-PASS converter.testLongLong is 0
-converter.testLongLong = 1.99
-PASS converter.testLongLong is 1
-converter.testLongLong = -1.99
-PASS converter.testLongLong is -1
-converter.testLongLong = Infinity
-PASS converter.testLongLong is 0
-converter.testLongLong = -Infinity
-PASS converter.testLongLong is 0
-converter.testLongLong = NaN
-PASS converter.testLongLong is 0
-converter.testLongLong = false
-PASS converter.testLongLong is 0
-converter.testLongLong = true
-PASS converter.testLongLong is 1
-converter.testLongLong = ''
-PASS converter.testLongLong is 0
-converter.testLongLong = '1'
-PASS converter.testLongLong is 1
-converter.testLongLong = 'abc'
-PASS converter.testLongLong is 0
-converter.testLongLong = null
-PASS converter.testLongLong is 0
-converter.testLongLong = undefined
-PASS converter.testLongLong is 0
-PASS converter.testLongLong = {valueOf:function(){throw new Error('custom');}} threw exception Error: custom.
-
-PASS 'testEnforceRangeLongLong' in converter is true
-PASS typeof converter.testEnforceRangeLongLong === 'number' is true
-converter.testEnforceRangeLongLong = 0
-PASS converter.testEnforceRangeLongLong is 0
-converter.testEnforceRangeLongLong = -1
-PASS converter.testEnforceRangeLongLong is -1
-converter.testEnforceRangeLongLong = 1
-PASS converter.testEnforceRangeLongLong is 1
-converter.testEnforceRangeLongLong = 0x7F
-PASS converter.testEnforceRangeLongLong is 0x7F
-converter.testEnforceRangeLongLong = 0x80
-PASS converter.testEnforceRangeLongLong is 0x80
-converter.testEnforceRangeLongLong = 0xFF
-PASS converter.testEnforceRangeLongLong is 0xFF
-converter.testEnforceRangeLongLong = -0x80
-PASS converter.testEnforceRangeLongLong is -0x80
-converter.testEnforceRangeLongLong = -0x81
-PASS converter.testEnforceRangeLongLong is -0x81
-converter.testEnforceRangeLongLong = 0x7FFF
-PASS converter.testEnforceRangeLongLong is 0x7FFF
-converter.testEnforceRangeLongLong = 0x8000
-PASS converter.testEnforceRangeLongLong is 0x8000
-converter.testEnforceRangeLongLong = 0xFFFF
-PASS converter.testEnforceRangeLongLong is 0xFFFF
-converter.testEnforceRangeLongLong = -0x8000
-PASS converter.testEnforceRangeLongLong is -0x8000
-converter.testEnforceRangeLongLong = -0x8001
-PASS converter.testEnforceRangeLongLong is -0x8001
-converter.testEnforceRangeLongLong = 0x7FFFFFFF
-PASS converter.testEnforceRangeLongLong is 0x7FFFFFFF
-converter.testEnforceRangeLongLong = 0x80000000
-PASS converter.testEnforceRangeLongLong is 0x80000000
-converter.testEnforceRangeLongLong = 0xFFFFFFFF
-PASS converter.testEnforceRangeLongLong is 0xFFFFFFFF
-converter.testEnforceRangeLongLong = -0x80000000
-PASS converter.testEnforceRangeLongLong is -0x80000000
-converter.testEnforceRangeLongLong = -0x80000001
-PASS converter.testEnforceRangeLongLong is -0x80000001
-PASS converter.testEnforceRangeLongLong = 0xDCBA9876543210 threw exception TypeError: Type error.
-converter.testEnforceRangeLongLong = Number.MIN_VALUE
-PASS converter.testEnforceRangeLongLong is 0
-converter.testEnforceRangeLongLong = -Number.MIN_VALUE
-PASS converter.testEnforceRangeLongLong is 0
-PASS converter.testEnforceRangeLongLong = Number.MAX_VALUE threw exception TypeError: Type error.
-PASS converter.testEnforceRangeLongLong = -Number.MAX_VALUE threw exception TypeError: Type error.
-converter.testEnforceRangeLongLong = 1.99
-PASS converter.testEnforceRangeLongLong is 1
-converter.testEnforceRangeLongLong = -1.99
-PASS converter.testEnforceRangeLongLong is -1
-PASS converter.testEnforceRangeLongLong = Infinity threw exception TypeError: Type error.
-PASS converter.testEnforceRangeLongLong = -Infinity threw exception TypeError: Type error.
-PASS converter.testEnforceRangeLongLong = NaN threw exception TypeError: Type error.
-converter.testEnforceRangeLongLong = false
-PASS converter.testEnforceRangeLongLong is 0
-converter.testEnforceRangeLongLong = true
-PASS converter.testEnforceRangeLongLong is 1
-converter.testEnforceRangeLongLong = ''
-PASS converter.testEnforceRangeLongLong is 0
-converter.testEnforceRangeLongLong = '1'
-PASS converter.testEnforceRangeLongLong is 1
-PASS converter.testEnforceRangeLongLong = 'abc' threw exception TypeError: Type error.
-converter.testEnforceRangeLongLong = null
-PASS converter.testEnforceRangeLongLong is 0
-PASS converter.testEnforceRangeLongLong = undefined threw exception TypeError: Type error.
-PASS converter.testEnforceRangeLongLong = {valueOf:function(){throw new Error('custom');}} threw exception Error: custom.
-
-PASS 'testUnsignedLongLong' in converter is true
-PASS typeof converter.testUnsignedLongLong === 'number' is true
-converter.testUnsignedLongLong = 0
-PASS converter.testUnsignedLongLong is 0
-converter.testUnsignedLongLong = -1
-PASS converter.testUnsignedLongLong is 0xFFFFFFFFFFFFFFFF
-converter.testUnsignedLongLong = 1
-PASS converter.testUnsignedLongLong is 1
-converter.testUnsignedLongLong = 0x7F
-PASS converter.testUnsignedLongLong is 0x7F
-converter.testUnsignedLongLong = 0x80
-PASS converter.testUnsignedLongLong is 0x80
-converter.testUnsignedLongLong = 0xFF
-PASS converter.testUnsignedLongLong is 0xFF
-converter.testUnsignedLongLong = -0x80
-PASS converter.testUnsignedLongLong is 0xFFFFFFFFFFFFFF80
-converter.testUnsignedLongLong = -0x81
-PASS converter.testUnsignedLongLong is 0xFFFFFFFFFFFFFF7F
-converter.testUnsignedLongLong = 0x7FFF
-PASS converter.testUnsignedLongLong is 0x7FFF
-converter.testUnsignedLongLong = 0x8000
-PASS converter.testUnsignedLongLong is 0x8000
-converter.testUnsignedLongLong = 0xFFFF
-PASS converter.testUnsignedLongLong is 0xFFFF
-converter.testUnsignedLongLong = -0x8000
-PASS converter.testUnsignedLongLong is 0xFFFFFFFFFFFF8000
-converter.testUnsignedLongLong = -0x8001
-PASS converter.testUnsignedLongLong is 0xFFFFFFFFFFFF7FFF
-converter.testUnsignedLongLong = 0x7FFFFFFF
-PASS converter.testUnsignedLongLong is 0x7FFFFFFF
-converter.testUnsignedLongLong = 0x80000000
-PASS converter.testUnsignedLongLong is 0x80000000
-converter.testUnsignedLongLong = 0xFFFFFFFF
-PASS converter.testUnsignedLongLong is 0xFFFFFFFF
-converter.testUnsignedLongLong = -0x80000000
-PASS converter.testUnsignedLongLong is 0xFFFFFFFF80000000
-converter.testUnsignedLongLong = -0x80000001
-PASS converter.testUnsignedLongLong is 0xFFFFFFFF7FFFFFFF
-converter.testUnsignedLongLong = 0xDCBA9876543210
-PASS converter.testUnsignedLongLong is 0xDCBA9876543210
-converter.testUnsignedLongLong = Number.MIN_VALUE
-PASS converter.testUnsignedLongLong is 0
-converter.testUnsignedLongLong = -Number.MIN_VALUE
-PASS converter.testUnsignedLongLong is 0
-converter.testUnsignedLongLong = Number.MAX_VALUE
-PASS converter.testUnsignedLongLong is 0
-converter.testUnsignedLongLong = -Number.MAX_VALUE
-PASS converter.testUnsignedLongLong is 0
-converter.testUnsignedLongLong = 1.99
-PASS converter.testUnsignedLongLong is 1
-converter.testUnsignedLongLong = -1.99
-PASS converter.testUnsignedLongLong is 0xFFFFFFFFFFFFFFFF
-converter.testUnsignedLongLong = Infinity
-PASS converter.testUnsignedLongLong is 0
-converter.testUnsignedLongLong = -Infinity
-PASS converter.testUnsignedLongLong is 0
-converter.testUnsignedLongLong = NaN
-PASS converter.testUnsignedLongLong is 0
-converter.testUnsignedLongLong = false
-PASS converter.testUnsignedLongLong is 0
-converter.testUnsignedLongLong = true
-PASS converter.testUnsignedLongLong is 1
-converter.testUnsignedLongLong = ''
-PASS converter.testUnsignedLongLong is 0
-converter.testUnsignedLongLong = '1'
-PASS converter.testUnsignedLongLong is 1
-converter.testUnsignedLongLong = 'abc'
-PASS converter.testUnsignedLongLong is 0
-converter.testUnsignedLongLong = null
-PASS converter.testUnsignedLongLong is 0
-converter.testUnsignedLongLong = undefined
-PASS converter.testUnsignedLongLong is 0
-PASS converter.testUnsignedLongLong = {valueOf:function(){throw new Error('custom');}} threw exception Error: custom.
-
-PASS 'testEnforceRangeUnsignedLongLong' in converter is true
-PASS typeof converter.testEnforceRangeUnsignedLongLong === 'number' is true
-converter.testEnforceRangeUnsignedLongLong = 0
-PASS converter.testEnforceRangeUnsignedLongLong is 0
-PASS converter.testEnforceRangeUnsignedLongLong = -1 threw exception TypeError: Type error.
-converter.testEnforceRangeUnsignedLongLong = 1
-PASS converter.testEnforceRangeUnsignedLongLong is 1
-converter.testEnforceRangeUnsignedLongLong = 0x7F
-PASS converter.testEnforceRangeUnsignedLongLong is 0x7F
-converter.testEnforceRangeUnsignedLongLong = 0x80
-PASS converter.testEnforceRangeUnsignedLongLong is 0x80
-converter.testEnforceRangeUnsignedLongLong = 0xFF
-PASS converter.testEnforceRangeUnsignedLongLong is 0xFF
-PASS converter.testEnforceRangeUnsignedLongLong = -0x80 threw exception TypeError: Type error.
-PASS converter.testEnforceRangeUnsignedLongLong = -0x81 threw exception TypeError: Type error.
-converter.testEnforceRangeUnsignedLongLong = 0x7FFF
-PASS converter.testEnforceRangeUnsignedLongLong is 0x7FFF
-converter.testEnforceRangeUnsignedLongLong = 0x8000
-PASS converter.testEnforceRangeUnsignedLongLong is 0x8000
-converter.testEnforceRangeUnsignedLongLong = 0xFFFF
-PASS converter.testEnforceRangeUnsignedLongLong is 0xFFFF
-PASS converter.testEnforceRangeUnsignedLongLong = -0x8000 threw exception TypeError: Type error.
-PASS converter.testEnforceRangeUnsignedLongLong = -0x8001 threw exception TypeError: Type error.
-converter.testEnforceRangeUnsignedLongLong = 0x7FFFFFFF
-PASS converter.testEnforceRangeUnsignedLongLong is 0x7FFFFFFF
-converter.testEnforceRangeUnsignedLongLong = 0x80000000
-PASS converter.testEnforceRangeUnsignedLongLong is 0x80000000
-converter.testEnforceRangeUnsignedLongLong = 0xFFFFFFFF
-PASS converter.testEnforceRangeUnsignedLongLong is 0xFFFFFFFF
-PASS converter.testEnforceRangeUnsignedLongLong = -0x80000000 threw exception TypeError: Type error.
-PASS converter.testEnforceRangeUnsignedLongLong = -0x80000001 threw exception TypeError: Type error.
-PASS converter.testEnforceRangeUnsignedLongLong = 0xDCBA9876543210 threw exception TypeError: Type error.
-converter.testEnforceRangeUnsignedLongLong = Number.MIN_VALUE
-PASS converter.testEnforceRangeUnsignedLongLong is 0
-converter.testEnforceRangeUnsignedLongLong = -Number.MIN_VALUE
-PASS converter.testEnforceRangeUnsignedLongLong is 0
-PASS converter.testEnforceRangeUnsignedLongLong = Number.MAX_VALUE threw exception TypeError: Type error.
-PASS converter.testEnforceRangeUnsignedLongLong = -Number.MAX_VALUE threw exception TypeError: Type error.
-converter.testEnforceRangeUnsignedLongLong = 1.99
-PASS converter.testEnforceRangeUnsignedLongLong is 1
-PASS converter.testEnforceRangeUnsignedLongLong = -1.99 threw exception TypeError: Type error.
-PASS converter.testEnforceRangeUnsignedLongLong = Infinity threw exception TypeError: Type error.
-PASS converter.testEnforceRangeUnsignedLongLong = -Infinity threw exception TypeError: Type error.
-PASS converter.testEnforceRangeUnsignedLongLong = NaN threw exception TypeError: Type error.
-converter.testEnforceRangeUnsignedLongLong = false
-PASS converter.testEnforceRangeUnsignedLongLong is 0
-converter.testEnforceRangeUnsignedLongLong = true
-PASS converter.testEnforceRangeUnsignedLongLong is 1
-converter.testEnforceRangeUnsignedLongLong = ''
-PASS converter.testEnforceRangeUnsignedLongLong is 0
-converter.testEnforceRangeUnsignedLongLong = '1'
-PASS converter.testEnforceRangeUnsignedLongLong is 1
-PASS converter.testEnforceRangeUnsignedLongLong = 'abc' threw exception TypeError: Type error.
-converter.testEnforceRangeUnsignedLongLong = null
-PASS converter.testEnforceRangeUnsignedLongLong is 0
-PASS converter.testEnforceRangeUnsignedLongLong = undefined threw exception TypeError: Type error.
-PASS converter.testEnforceRangeUnsignedLongLong = {valueOf:function(){throw new Error('custom');}} threw exception Error: custom.
-
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
index 8874233..982e4b4 100644 (file)
@@ -1,3 +1,74 @@
+2013-03-20  Michael Pruett  <michael@68k.org>
+
+        [JSC] Implement EnforceRange IDL attribute for integer conversions
+        https://bugs.webkit.org/show_bug.cgi?id=112506
+
+        Reviewed by Kentaro Hara.
+
+        Implement the EnforceRange attribute for JSC bindings.
+
+        The EnforceRange attribute requires a type error to be thrown when
+        converting an ECMAScript number which is beyond the representable
+        range of the IDL integer type.
+
+        Tests: fast/js/webidl-type-mapping.html
+               storage/indexeddb/cursor-advance-workers.html
+               storage/indexeddb/cursor-advance.html
+               storage/indexeddb/intversion-bad-parameters.html
+
+        * WebCore.exp.in:
+        * bindings/js/JSDOMBinding.cpp:
+        (WebCore):
+        (WebCore::enforceRange):
+        (WebCore::toInt32EnforceRange):
+        (WebCore::toUInt32EnforceRange):
+        (WebCore::toInt64):
+        (WebCore::toUInt64):
+        * bindings/js/JSDOMBinding.h:
+        (WebCore::toInt32):
+        (WebCore):
+        (WebCore::toUInt32):
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (JSValueToNative):
+        * bindings/scripts/test/JS/JSTestEventTarget.cpp:
+        (WebCore::jsTestEventTargetPrototypeFunctionItem):
+        * bindings/scripts/test/JS/JSTestObj.cpp:
+        (WebCore::setJSTestObjShortAttr):
+        (WebCore::setJSTestObjUnsignedShortAttr):
+        (WebCore::setJSTestObjLongAttr):
+        (WebCore::setJSTestObjLongLongAttr):
+        (WebCore::setJSTestObjUnsignedLongLongAttr):
+        (WebCore::setJSTestObjReflectedIntegralAttr):
+        (WebCore::setJSTestObjReflectedUnsignedIntegralAttr):
+        (WebCore::setJSTestObjReflectedCustomIntegralAttr):
+        (WebCore::setJSTestObjAttrWithGetterException):
+        (WebCore::setJSTestObjAttrWithSetterException):
+        (WebCore::setJSTestObjWithScriptStateAttribute):
+        (WebCore::setJSTestObjConditionalAttr1):
+        (WebCore::setJSTestObjConditionalAttr2):
+        (WebCore::setJSTestObjConditionalAttr3):
+        (WebCore::setJSTestObjStrawberry):
+        (WebCore::setJSTestObjId):
+        (WebCore::setJSTestObjNullableLongSettableAttribute):
+        (WebCore::setJSTestObjNullableStringValue):
+        (WebCore::jsTestObjPrototypeFunctionVoidMethodWithArgs):
+        (WebCore::jsTestObjPrototypeFunctionLongMethodWithArgs):
+        (WebCore::jsTestObjPrototypeFunctionObjMethodWithArgs):
+        (WebCore::jsTestObjPrototypeFunctionMethodReturningSequence):
+        (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalArg):
+        (WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg):
+        (WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs):
+        (WebCore::jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg):
+        (WebCore::jsTestObjPrototypeFunctionOverloadedMethod2):
+        (WebCore::jsTestObjPrototypeFunctionOverloadedMethod4):
+        (WebCore::jsTestObjConstructorFunctionClassMethodWithOptional):
+        (WebCore::jsTestObjConstructorFunctionOverloadedMethod11):
+        (WebCore::jsTestObjPrototypeFunctionStrictFunction):
+        * bindings/scripts/test/JS/JSTestTypedefs.cpp:
+        (WebCore::setJSTestTypedefsUnsignedLongLongAttr):
+        (WebCore::setJSTestTypedefsAttrWithGetterException):
+        (WebCore::setJSTestTypedefsAttrWithSetterException):
+
 2013-03-20  Hayato Ito  <hayato@chromium.org>
 
         Gesture events should include AllowShadowContent in hit testing
index 5303a1a..6ff9892 100644 (file)
@@ -614,6 +614,7 @@ __ZN7WebCore19TextResourceDecoder5flushEv
 __ZN7WebCore19TextResourceDecoder6decodeEPKcm
 __ZN7WebCore19TextResourceDecoderC1ERKN3WTF6StringERKNS_12TextEncodingEb
 __ZN7WebCore19TextResourceDecoderD1Ev
+__ZN7WebCore19toInt32EnforceRangeEPN3JSC9ExecStateENS0_7JSValueE
 __ZN7WebCore20CachedResourceLoader31garbageCollectDocumentResourcesEv
 __ZN7WebCore20DictationAlternativeC1Ejjy
 __ZN7WebCore20DictationAlternativeC1Ev
@@ -637,6 +638,7 @@ __ZN7WebCore20UserGestureIndicatorD1Ev
 __ZN7WebCore20makeRGBA32FromFloatsEffff
 __ZN7WebCore20protocolIsJavaScriptERKN3WTF6StringE
 __ZN7WebCore20SpaceSplitStringDataD1Ev
+__ZN7WebCore20toUInt32EnforceRangeEPN3JSC9ExecStateENS0_7JSValueE
 __ZN7WebCore21BackForwardController11itemAtIndexEi
 __ZN7WebCore21MemoryPressureHandler7installEv
 __ZN7WebCore21NetworkStorageSession28createPrivateBrowsingSessionERKN3WTF6StringE
@@ -968,6 +970,7 @@ __ZN7WebCore7cookiesEPKNS_8DocumentERKNS_4KURLE
 __ZN7WebCore7jsArrayEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEN3WTF10PassRefPtrINS_13DOMStringListEEE
 __ZN7WebCore7makeRGBEiii
 __ZN7WebCore7replaceERN3WTF6StringERKNS_17RegularExpressionERKS1_
+__ZN7WebCore7toInt64EPN3JSC9ExecStateENS0_7JSValueENS_30IntegerConversionConfigurationE
 __ZN7WebCore7toRangeEN3JSC7JSValueE
 __ZN7WebCore8CSSValue7destroyEv
 __ZN7WebCore8Document11createRangeEv
@@ -1045,6 +1048,7 @@ __ZN7WebCore8blankURLEv
 __ZN7WebCore8makeRGBAEiiii
 __ZN7WebCore8openFileERKN3WTF6StringENS_12FileOpenModeE
 __ZN7WebCore8toStringERKN3WTF6VectorINS_11ProxyServerELm0EEE
+__ZN7WebCore8toUInt64EPN3JSC9ExecStateENS0_7JSValueENS_30IntegerConversionConfigurationE
 __ZN7WebCore9DOMWindow30dispatchAllPendingUnloadEventsEv
 __ZN7WebCore9DOMWindow36dispatchAllPendingBeforeUnloadEventsEv
 __ZN7WebCore9FloatRectC1ERK6CGRect
index 81f19a7..b9c0789 100644 (file)
@@ -2,6 +2,7 @@
  *  Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
  *  Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
  *  Copyright (C) 2007 Samuel Weinig <sam@webkit.org>
+ *  Copyright (C) 2013 Michael Pruett <michael@68k.org>
  *
  *  This library is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU Lesser General Public
@@ -259,4 +260,85 @@ Structure* cacheDOMStructure(JSDOMGlobalObject* globalObject, Structure* structu
     return structures.set(classInfo, WriteBarrier<Structure>(globalObject->globalData(), globalObject, structure)).iterator->value.get();
 }
 
+static const int32_t kMaxInt32 = 0x7fffffff;
+static const int32_t kMinInt32 = -kMaxInt32 - 1;
+static const uint32_t kMaxUInt32 = 0xffffffffU;
+static const int64_t kJSMaxInteger = 0x20000000000000LL - 1; // 2^53 - 1, largest integer exactly representable in ECMAScript.
+
+static double enforceRange(ExecState* exec, double x, double minimum, double maximum)
+{
+    if (std::isnan(x) || std::isinf(x)) {
+        throwTypeError(exec);
+        return 0;
+    }
+    x = trunc(x);
+    if (x < minimum || x > maximum) {
+        throwTypeError(exec);
+        return 0;
+    }
+    return x;
+}
+
+// http://www.w3.org/TR/WebIDL/#es-long
+int32_t toInt32EnforceRange(ExecState* exec, JSValue value)
+{
+    if (value.isInt32())
+        return value.toInt32(exec);
+
+    double x = value.toNumber(exec);
+    if (exec->hadException())
+        return 0;
+    return enforceRange(exec, x, kMinInt32, kMaxInt32);
+}
+
+// http://www.w3.org/TR/WebIDL/#es-unsigned-long
+uint32_t toUInt32EnforceRange(ExecState* exec, JSValue value)
+{
+    if (value.isUInt32())
+        return value.toUInt32(exec);
+
+    double x = value.toNumber(exec);
+    if (exec->hadException())
+        return 0;
+    return enforceRange(exec, x, 0, kMaxUInt32);
+}
+
+// http://www.w3.org/TR/WebIDL/#es-long-long
+int64_t toInt64(ExecState* exec, JSValue value, IntegerConversionConfiguration configuration)
+{
+    if (value.isInt32())
+        return value.toInt32(exec);
+
+    double x = value.toNumber(exec);
+    if (exec->hadException())
+        return 0;
+
+    if (configuration == EnforceRange)
+        return enforceRange(exec, x, -kJSMaxInteger, kJSMaxInteger);
+
+    // Map NaNs and +/-Infinity to 0; convert finite values modulo 2^64.
+    unsigned long long n;
+    doubleToInteger(x, n);
+    return n;
+}
+
+// http://www.w3.org/TR/WebIDL/#es-unsigned-long-long
+uint64_t toUInt64(ExecState* exec, JSValue value, IntegerConversionConfiguration configuration)
+{
+    if (value.isUInt32())
+        return value.toUInt32(exec);
+
+    double x = value.toNumber(exec);
+    if (exec->hadException())
+        return 0;
+
+    if (configuration == EnforceRange)
+        return enforceRange(exec, x, 0, kJSMaxInteger);
+
+    // Map NaNs and +/-Infinity to 0; convert finite values modulo 2^64.
+    unsigned long long n;
+    doubleToInteger(x, n);
+    return n;
+}
+
 } // namespace WebCore
index bb0d89c..395fccf 100644 (file)
@@ -4,6 +4,7 @@
  *  Copyright (C) 2007 Samuel Weinig <sam@webkit.org>
  *  Copyright (C) 2009 Google, Inc. All rights reserved.
  *  Copyright (C) 2012 Ericsson AB. All rights reserved.
+ *  Copyright (C) 2013 Michael Pruett <michael@68k.org>
  *
  *  This library is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU Lesser General Public
@@ -244,6 +245,38 @@ class DOMStringList;
         return JSC::toInt32(number);
     }
 
+    enum IntegerConversionConfiguration {
+        NormalConversion,
+        EnforceRange,
+        // FIXME: Implement Clamp
+    };
+
+    int32_t toInt32EnforceRange(JSC::ExecState*, JSC::JSValue);
+    uint32_t toUInt32EnforceRange(JSC::ExecState*, JSC::JSValue);
+
+    /*
+        Convert a value to an integer as per <http://www.w3.org/TR/WebIDL/>.
+        The conversion fails if the value cannot be converted to a number or,
+        if EnforceRange is specified, the value is outside the range of the
+        destination integer type.
+    */
+    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);
+
     // Returns a Date instance for the specified value, or null if the value is NaN or infinity.
     JSC::JSValue jsDateOrNull(JSC::ExecState*, double);
     // NaN if the value can't be converted to a date.
index 8062ebf..cd1d700 100644 (file)
@@ -3206,10 +3206,12 @@ sub JSValueToNative
     return "$value.toBoolean(exec)" if $type eq "boolean";
     return "$value.toNumber(exec)" if $type eq "double";
     return "$value.toFloat(exec)" if $type eq "float";
-    # FIXME: Add [EnforceRange] support
-    return "$value.toInt32(exec)" if $type eq "long" or $type eq "short";
-    return "$value.toUInt32(exec)" if $type eq "unsigned long" or $type eq "unsigned short";
-    return "static_cast<$type>($value.toInteger(exec))" if $type eq "long long" or $type eq "unsigned long long";
+
+    my $intConversion = $signature->extendedAttributes->{"EnforceRange"} ? "EnforceRange" : "NormalConversion";
+    return "toInt32(exec, $value, $intConversion)" if $type eq "long" or $type eq "short";
+    return "toUInt32(exec, $value, $intConversion)" if $type eq "unsigned long" or $type eq "unsigned short";
+    return "toInt64(exec, $value, $intConversion)" if $type eq "long long";
+    return "toUInt64(exec, $value, $intConversion)" if $type eq "unsigned long long";
 
     return "valueToDate(exec, $value)" if $type eq "Date";
     return "static_cast<Range::CompareHow>($value.toInt32(exec))" if $type eq "CompareHow";
index 8d064ea..0f297e7 100644 (file)
@@ -234,7 +234,7 @@ EncodedJSValue JSC_HOST_CALL jsTestEventTargetPrototypeFunctionItem(ExecState* e
     TestEventTarget* impl = static_cast<TestEventTarget*>(castedThis->impl());
     if (exec->argumentCount() < 1)
         return throwVMError(exec, createNotEnoughArgumentsError(exec));
-    int index(exec->argument(0).toUInt32(exec));
+    int index(toUInt32(exec, exec->argument(0), NormalConversion));
     if (index < 0) {
         setDOMException(exec, INDEX_SIZE_ERR);
         return JSValue::encode(jsUndefined());
index f0a7bd7..a03397e 100644 (file)
@@ -1099,7 +1099,7 @@ void setJSTestObjShortAttr(ExecState* exec, JSObject* thisObject, JSValue value)
     UNUSED_PARAM(exec);
     JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
     TestObj* impl = static_cast<TestObj*>(castedThis->impl());
-    impl->setShortAttr(value.toInt32(exec));
+    impl->setShortAttr(toInt32(exec, value, NormalConversion));
 }
 
 
@@ -1108,7 +1108,7 @@ void setJSTestObjUnsignedShortAttr(ExecState* exec, JSObject* thisObject, JSValu
     UNUSED_PARAM(exec);
     JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
     TestObj* impl = static_cast<TestObj*>(castedThis->impl());
-    impl->setUnsignedShortAttr(value.toUInt32(exec));
+    impl->setUnsignedShortAttr(toUInt32(exec, value, NormalConversion));
 }
 
 
@@ -1117,7 +1117,7 @@ void setJSTestObjLongAttr(ExecState* exec, JSObject* thisObject, JSValue value)
     UNUSED_PARAM(exec);
     JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
     TestObj* impl = static_cast<TestObj*>(castedThis->impl());
-    impl->setLongAttr(value.toInt32(exec));
+    impl->setLongAttr(toInt32(exec, value, NormalConversion));
 }
 
 
@@ -1126,7 +1126,7 @@ void setJSTestObjLongLongAttr(ExecState* exec, JSObject* thisObject, JSValue val
     UNUSED_PARAM(exec);
     JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
     TestObj* impl = static_cast<TestObj*>(castedThis->impl());
-    impl->setLongLongAttr(static_cast<long long>(value.toInteger(exec)));
+    impl->setLongLongAttr(toInt64(exec, value, NormalConversion));
 }
 
 
@@ -1135,7 +1135,7 @@ void setJSTestObjUnsignedLongLongAttr(ExecState* exec, JSObject* thisObject, JSV
     UNUSED_PARAM(exec);
     JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
     TestObj* impl = static_cast<TestObj*>(castedThis->impl());
-    impl->setUnsignedLongLongAttr(static_cast<unsigned long long>(value.toInteger(exec)));
+    impl->setUnsignedLongLongAttr(toUInt64(exec, value, NormalConversion));
 }
 
 
@@ -1189,7 +1189,7 @@ void setJSTestObjReflectedIntegralAttr(ExecState* exec, JSObject* thisObject, JS
     UNUSED_PARAM(exec);
     JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
     TestObj* impl = static_cast<TestObj*>(castedThis->impl());
-    impl->setIntegralAttribute(WebCore::HTMLNames::reflectedintegralattrAttr, value.toInt32(exec));
+    impl->setIntegralAttribute(WebCore::HTMLNames::reflectedintegralattrAttr, toInt32(exec, value, NormalConversion));
 }
 
 
@@ -1198,7 +1198,7 @@ void setJSTestObjReflectedUnsignedIntegralAttr(ExecState* exec, JSObject* thisOb
     UNUSED_PARAM(exec);
     JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
     TestObj* impl = static_cast<TestObj*>(castedThis->impl());
-    impl->setUnsignedIntegralAttribute(WebCore::HTMLNames::reflectedunsignedintegralattrAttr, value.toUInt32(exec));
+    impl->setUnsignedIntegralAttribute(WebCore::HTMLNames::reflectedunsignedintegralattrAttr, toUInt32(exec, value, NormalConversion));
 }
 
 
@@ -1234,7 +1234,7 @@ void setJSTestObjReflectedCustomIntegralAttr(ExecState* exec, JSObject* thisObje
     UNUSED_PARAM(exec);
     JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
     TestObj* impl = static_cast<TestObj*>(castedThis->impl());
-    impl->setIntegralAttribute(WebCore::HTMLNames::customContentIntegralAttrAttr, value.toInt32(exec));
+    impl->setIntegralAttribute(WebCore::HTMLNames::customContentIntegralAttrAttr, toInt32(exec, value, NormalConversion));
 }
 
 
@@ -1270,7 +1270,7 @@ void setJSTestObjAttrWithGetterException(ExecState* exec, JSObject* thisObject,
     UNUSED_PARAM(exec);
     JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
     TestObj* impl = static_cast<TestObj*>(castedThis->impl());
-    impl->setAttrWithGetterException(value.toInt32(exec));
+    impl->setAttrWithGetterException(toInt32(exec, value, NormalConversion));
 }
 
 
@@ -1280,7 +1280,7 @@ void setJSTestObjAttrWithSetterException(ExecState* exec, JSObject* thisObject,
     JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
     TestObj* impl = static_cast<TestObj*>(castedThis->impl());
     ExceptionCode ec = 0;
-    impl->setAttrWithSetterException(value.toInt32(exec), ec);
+    impl->setAttrWithSetterException(toInt32(exec, value, NormalConversion), ec);
     setDOMException(exec, ec);
 }
 
@@ -1317,7 +1317,7 @@ void setJSTestObjWithScriptStateAttribute(ExecState* exec, JSObject* thisObject,
     UNUSED_PARAM(exec);
     JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
     TestObj* impl = static_cast<TestObj*>(castedThis->impl());
-    impl->setWithScriptStateAttribute(exec, value.toInt32(exec));
+    impl->setWithScriptStateAttribute(exec, toInt32(exec, value, NormalConversion));
 }
 
 
@@ -1405,7 +1405,7 @@ void setJSTestObjConditionalAttr1(ExecState* exec, JSObject* thisObject, JSValue
     UNUSED_PARAM(exec);
     JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
     TestObj* impl = static_cast<TestObj*>(castedThis->impl());
-    impl->setConditionalAttr1(value.toInt32(exec));
+    impl->setConditionalAttr1(toInt32(exec, value, NormalConversion));
 }
 
 #endif
@@ -1416,7 +1416,7 @@ void setJSTestObjConditionalAttr2(ExecState* exec, JSObject* thisObject, JSValue
     UNUSED_PARAM(exec);
     JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
     TestObj* impl = static_cast<TestObj*>(castedThis->impl());
-    impl->setConditionalAttr2(value.toInt32(exec));
+    impl->setConditionalAttr2(toInt32(exec, value, NormalConversion));
 }
 
 #endif
@@ -1427,7 +1427,7 @@ void setJSTestObjConditionalAttr3(ExecState* exec, JSObject* thisObject, JSValue
     UNUSED_PARAM(exec);
     JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
     TestObj* impl = static_cast<TestObj*>(castedThis->impl());
-    impl->setConditionalAttr3(value.toInt32(exec));
+    impl->setConditionalAttr3(toInt32(exec, value, NormalConversion));
 }
 
 #endif
@@ -1494,7 +1494,7 @@ void setJSTestObjStrawberry(ExecState* exec, JSObject* thisObject, JSValue value
     UNUSED_PARAM(exec);
     JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
     TestObj* impl = static_cast<TestObj*>(castedThis->impl());
-    impl->setBlueberry(value.toInt32(exec));
+    impl->setBlueberry(toInt32(exec, value, NormalConversion));
 }
 
 
@@ -1512,7 +1512,7 @@ void setJSTestObjId(ExecState* exec, JSObject* thisObject, JSValue value)
     UNUSED_PARAM(exec);
     JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
     TestObj* impl = static_cast<TestObj*>(castedThis->impl());
-    impl->setId(value.toInt32(exec));
+    impl->setId(toInt32(exec, value, NormalConversion));
 }
 
 
@@ -1529,7 +1529,7 @@ void setJSTestObjNullableLongSettableAttribute(ExecState* exec, JSObject* thisOb
     UNUSED_PARAM(exec);
     JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
     TestObj* impl = static_cast<TestObj*>(castedThis->impl());
-    impl->setNullableLongSettableAttribute(value.toInt32(exec));
+    impl->setNullableLongSettableAttribute(toInt32(exec, value, NormalConversion));
 }
 
 
@@ -1538,7 +1538,7 @@ void setJSTestObjNullableStringValue(ExecState* exec, JSObject* thisObject, JSVa
     UNUSED_PARAM(exec);
     JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
     TestObj* impl = static_cast<TestObj*>(castedThis->impl());
-    impl->setNullableStringValue(value.toInt32(exec));
+    impl->setNullableStringValue(toInt32(exec, value, NormalConversion));
 }
 
 
@@ -1569,7 +1569,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethodWithArgs(ExecSt
     TestObj* impl = static_cast<TestObj*>(castedThis->impl());
     if (exec->argumentCount() < 3)
         return throwVMError(exec, createNotEnoughArgumentsError(exec));
-    int longArg(exec->argument(0).toInt32(exec));
+    int longArg(toInt32(exec, exec->argument(0), NormalConversion));
     if (exec->hadException())
         return JSValue::encode(jsUndefined());
     const String& strArg(exec->argument(1).isEmpty() ? String() : exec->argument(1).toString(exec)->value(exec));
@@ -1605,7 +1605,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionLongMethodWithArgs(ExecSt
     TestObj* impl = static_cast<TestObj*>(castedThis->impl());
     if (exec->argumentCount() < 3)
         return throwVMError(exec, createNotEnoughArgumentsError(exec));
-    int longArg(exec->argument(0).toInt32(exec));
+    int longArg(toInt32(exec, exec->argument(0), NormalConversion));
     if (exec->hadException())
         return JSValue::encode(jsUndefined());
     const String& strArg(exec->argument(1).isEmpty() ? String() : exec->argument(1).toString(exec)->value(exec));
@@ -1642,7 +1642,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethodWithArgs(ExecSta
     TestObj* impl = static_cast<TestObj*>(castedThis->impl());
     if (exec->argumentCount() < 3)
         return throwVMError(exec, createNotEnoughArgumentsError(exec));
-    int longArg(exec->argument(0).toInt32(exec));
+    int longArg(toInt32(exec, exec->argument(0), NormalConversion));
     if (exec->hadException())
         return JSValue::encode(jsUndefined());
     const String& strArg(exec->argument(1).isEmpty() ? String() : exec->argument(1).toString(exec)->value(exec));
@@ -1683,7 +1683,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodReturningSequence(E
     TestObj* impl = static_cast<TestObj*>(castedThis->impl());
     if (exec->argumentCount() < 1)
         return throwVMError(exec, createNotEnoughArgumentsError(exec));
-    int longArg(exec->argument(0).toInt32(exec));
+    int longArg(toInt32(exec, exec->argument(0), NormalConversion));
     if (exec->hadException())
         return JSValue::encode(jsUndefined());
 
@@ -1988,7 +1988,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArg(Exe
         return JSValue::encode(jsUndefined());
     }
 
-    int opt(exec->argument(0).toInt32(exec));
+    int opt(toInt32(exec, exec->argument(0), NormalConversion));
     if (exec->hadException())
         return JSValue::encode(jsUndefined());
     impl->methodWithOptionalArg(opt);
@@ -2005,7 +2005,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgA
     TestObj* impl = static_cast<TestObj*>(castedThis->impl());
     if (exec->argumentCount() < 1)
         return throwVMError(exec, createNotEnoughArgumentsError(exec));
-    int nonOpt(exec->argument(0).toInt32(exec));
+    int nonOpt(toInt32(exec, exec->argument(0), NormalConversion));
     if (exec->hadException())
         return JSValue::encode(jsUndefined());
 
@@ -2015,7 +2015,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgA
         return JSValue::encode(jsUndefined());
     }
 
-    int opt(exec->argument(1).toInt32(exec));
+    int opt(toInt32(exec, exec->argument(1), NormalConversion));
     if (exec->hadException())
         return JSValue::encode(jsUndefined());
     impl->methodWithNonOptionalArgAndOptionalArg(nonOpt, opt);
@@ -2032,7 +2032,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgA
     TestObj* impl = static_cast<TestObj*>(castedThis->impl());
     if (exec->argumentCount() < 1)
         return throwVMError(exec, createNotEnoughArgumentsError(exec));
-    int nonOpt(exec->argument(0).toInt32(exec));
+    int nonOpt(toInt32(exec, exec->argument(0), NormalConversion));
     if (exec->hadException())
         return JSValue::encode(jsUndefined());
 
@@ -2042,7 +2042,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgA
         return JSValue::encode(jsUndefined());
     }
 
-    int opt1(exec->argument(1).toInt32(exec));
+    int opt1(toInt32(exec, exec->argument(1), NormalConversion));
     if (exec->hadException())
         return JSValue::encode(jsUndefined());
     if (argsCount <= 2) {
@@ -2050,7 +2050,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgA
         return JSValue::encode(jsUndefined());
     }
 
-    int opt2(exec->argument(2).toInt32(exec));
+    int opt2(toInt32(exec, exec->argument(2), NormalConversion));
     if (exec->hadException())
         return JSValue::encode(jsUndefined());
     impl->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1, opt2);
@@ -2136,7 +2136,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonCallbackArgA
     TestObj* impl = static_cast<TestObj*>(castedThis->impl());
     if (exec->argumentCount() < 2)
         return throwVMError(exec, createNotEnoughArgumentsError(exec));
-    int nonCallback(exec->argument(0).toInt32(exec));
+    int nonCallback(toInt32(exec, exec->argument(0), NormalConversion));
     if (exec->hadException())
         return JSValue::encode(jsUndefined());
     if (exec->argumentCount() <= 1 || !exec->argument(1).isFunction())
@@ -2273,7 +2273,7 @@ static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod2(
         return JSValue::encode(jsUndefined());
     }
 
-    int longArg(exec->argument(1).toInt32(exec));
+    int longArg(toInt32(exec, exec->argument(1), NormalConversion));
     if (exec->hadException())
         return JSValue::encode(jsUndefined());
     impl->overloadedMethod(objArg, longArg);
@@ -2307,7 +2307,7 @@ static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod4(
     TestObj* impl = static_cast<TestObj*>(castedThis->impl());
     if (exec->argumentCount() < 1)
         return throwVMError(exec, createNotEnoughArgumentsError(exec));
-    int longArg(exec->argument(0).toInt32(exec));
+    int longArg(toInt32(exec, exec->argument(0), NormalConversion));
     if (exec->hadException())
         return JSValue::encode(jsUndefined());
     impl->overloadedMethod(longArg);
@@ -2481,7 +2481,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionClassMethodWithOptional
         return JSValue::encode(result);
     }
 
-    int arg(exec->argument(0).toInt32(exec));
+    int arg(toInt32(exec, exec->argument(0), NormalConversion));
     if (exec->hadException())
         return JSValue::encode(jsUndefined());
 
@@ -2501,7 +2501,7 @@ static EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionOverloadedMethod
 {
     if (exec->argumentCount() < 1)
         return throwVMError(exec, createNotEnoughArgumentsError(exec));
-    int arg(exec->argument(0).toInt32(exec));
+    int arg(toInt32(exec, exec->argument(0), NormalConversion));
     if (exec->hadException())
         return JSValue::encode(jsUndefined());
     TestObj::overloadedMethod1(arg);
@@ -2764,7 +2764,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionStrictFunction(ExecState*
     float a(exec->argument(1).toFloat(exec));
     if (exec->hadException())
         return JSValue::encode(jsUndefined());
-    int b(exec->argument(2).toInt32(exec));
+    int b(toInt32(exec, exec->argument(2), NormalConversion));
     if (exec->hadException())
         return JSValue::encode(jsUndefined());
 
index ac500b5..a021b28 100644 (file)
@@ -280,7 +280,7 @@ void setJSTestTypedefsUnsignedLongLongAttr(ExecState* exec, JSObject* thisObject
     UNUSED_PARAM(exec);
     JSTestTypedefs* castedThis = jsCast<JSTestTypedefs*>(thisObject);
     TestTypedefs* impl = static_cast<TestTypedefs*>(castedThis->impl());
-    impl->setUnsignedLongLongAttr(static_cast<unsigned long long>(value.toInteger(exec)));
+    impl->setUnsignedLongLongAttr(toUInt64(exec, value, NormalConversion));
 }
 
 
@@ -298,7 +298,7 @@ void setJSTestTypedefsAttrWithGetterException(ExecState* exec, JSObject* thisObj
     UNUSED_PARAM(exec);
     JSTestTypedefs* castedThis = jsCast<JSTestTypedefs*>(thisObject);
     TestTypedefs* impl = static_cast<TestTypedefs*>(castedThis->impl());
-    impl->setAttrWithGetterException(value.toInt32(exec));
+    impl->setAttrWithGetterException(toInt32(exec, value, NormalConversion));
 }
 
 
@@ -308,7 +308,7 @@ void setJSTestTypedefsAttrWithSetterException(ExecState* exec, JSObject* thisObj
     JSTestTypedefs* castedThis = jsCast<JSTestTypedefs*>(thisObject);
     TestTypedefs* impl = static_cast<TestTypedefs*>(castedThis->impl());
     ExceptionCode ec = 0;
-    impl->setAttrWithSetterException(value.toInt32(exec), ec);
+    impl->setAttrWithSetterException(toInt32(exec, value, NormalConversion), ec);
     setDOMException(exec, ec);
 }
 
index 710d673..99c74a1 100644 (file)
@@ -1,3 +1,12 @@
+2013-03-20  Michael Pruett  <michael@68k.org>
+
+        [JSC] Implement EnforceRange IDL attribute for integer conversions
+        https://bugs.webkit.org/show_bug.cgi?id=112506
+
+        Reviewed by Kentaro Hara.
+
+        * WebKit.vcproj/WebKitExports.def.in:
+
 2013-03-20  Rouslan Solomakhin  <rouslan@chromium.org>
 
         Copy-paste should not spellcheck when continuous spellcheck is turned off
index 00ce93e..51da7b4 100644 (file)
@@ -418,6 +418,10 @@ EXPORTS
         ?setAutofilled@HTMLInputElement@WebCore@@QAEX_N@Z
         ?captionPreferences@PageGroup@WebCore@@QAEPAVCaptionUserPreferences@2@XZ
         ?initGroup@Page@WebCore@@AAEXXZ
+        ?toInt32EnforceRange@WebCore@@YAHPAVExecState@JSC@@VJSValue@3@@Z
+        ?toInt64@WebCore@@YA_JPAVExecState@JSC@@VJSValue@3@W4IntegerConversionConfiguration@1@@Z
+        ?toUInt32EnforceRange@WebCore@@YAIPAVExecState@JSC@@VJSValue@3@@Z
+        ?toUInt64@WebCore@@YA_KPAVExecState@JSC@@VJSValue@3@W4IntegerConversionConfiguration@1@@Z
 
 #if ENABLE(WORKERS)
         ?workerThreadCount@WorkerThread@WebCore@@SAIXZ
index f3c1bb9..bb67e4c 100644 (file)
@@ -27,6 +27,8 @@ _ZN3WTF7CStringC2EPKcm;
 _ZN3WTF7CStringD1Ev;
 _ZN3WTF7CStringaSERKS0_;
 _ZN24DumpRenderTreeSupportGtk*;
+_ZN7WebCore19toInt32EnforceRangeEPN3JSC9ExecStateENS0_7JSValueE;
+_ZN7WebCore20toUInt32EnforceRangeEPN3JSC9ExecStateENS0_7JSValueE;
 _ZN7WebCore4Page13setPaginationERKNS_10PaginationE;
 _ZN7WebCore4Page18setPageScaleFactorEfRKNS_8IntPointE;
 _ZN7WebCore4Page20setDeviceScaleFactorEf;
@@ -41,11 +43,13 @@ _ZN7WebCore4toJSEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_19CSSStyleDeclarat
 _ZN7WebCore4toJSEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_5RangeE;
 _ZN7WebCore5Range6createEN3WTF10PassRefPtrINS_8DocumentEEENS2_INS_4NodeEEEiS6_i;
 _ZN7WebCore5RangeD1Ev;
+_ZN7WebCore7toInt64EPN3JSC9ExecStateENS0_7JSValueENS_30IntegerConversionConfigurationE;
 _ZN7WebCore8Document36updateLayoutIgnorePendingStylesheetsEv;
 _ZN7WebCore8Document8iconURLsEi;
 _ZN7WebCore8Document16shortcutIconURLsEv;
 _ZN7WebCore8Settings19minDOMTimerIntervalEv;
 _ZN7WebCore8Settings22setMinDOMTimerIntervalEd;
+_ZN7WebCore8toUInt64EPN3JSC9ExecStateENS0_7JSValueENS_30IntegerConversionConfigurationE;
 _ZN7WebCore9HTMLNames8inputTagE;
 _ZN7WebCore9HTMLNames11textareaTagE;
 _ZN7WebCore10JSDocument10putVirtualEPN3JSC9ExecStateERKNS1_10IdentifierENS1_7JSValueERNS1_15PutPropertySlotE;