Index: LayoutTests/fast/js/webidl-type-mapping.html |
diff --git a/LayoutTests/fast/js/webidl-type-mapping.html b/LayoutTests/fast/js/webidl-type-mapping.html |
index ab7f6d4308ade78f913bef27a09adbbee7158cf6..12a498418fd3e339fd723a1fd40105b7e259f498 100644 |
--- a/LayoutTests/fast/js/webidl-type-mapping.html |
+++ b/LayoutTests/fast/js/webidl-type-mapping.html |
@@ -56,6 +56,7 @@ function testNonNumericToNumericEnforceRange(attribute) |
type = "testLong"; |
verifyAttribute(type); |
convert(type, "0"); |
+convert(type, "-0", "0"); |
convert(type, "-1"); |
convert(type, "1"); |
convert(type, "0x7F"); |
@@ -90,6 +91,7 @@ debug(""); |
type = "testEnforceRangeLong"; |
verifyAttribute(type); |
convert(type, "0"); |
+convert(type, "-0", "0"); |
convert(type, "-1"); |
convert(type, "1"); |
convert(type, "0x7F"); |
@@ -124,6 +126,7 @@ debug(""); |
type = "testUnsignedLong"; |
verifyAttribute(type); |
convert(type, "0"); |
+convert(type, "-0", "0"); |
convert(type, "-1", "0xFFFFFFFF"); |
convert(type, "1"); |
convert(type, "0x7F"); |
@@ -158,6 +161,7 @@ debug(""); |
type = "testEnforceRangeUnsignedLong"; |
verifyAttribute(type); |
convert(type, "0"); |
+convert(type, "-0", "0"); |
convertThrows(type, "-1"); |
convert(type, "1"); |
convert(type, "0x7F"); |
@@ -192,6 +196,7 @@ debug(""); |
type = "testLongLong"; |
verifyAttribute(type); |
convert(type, "0"); |
+convert(type, "-0", "0"); |
convert(type, "-1"); |
convert(type, "1"); |
convert(type, "0x7F"); |
@@ -226,6 +231,7 @@ debug(""); |
type = "testEnforceRangeLongLong"; |
verifyAttribute(type); |
convert(type, "0"); |
+convert(type, "-0", "0"); |
convert(type, "-1"); |
convert(type, "1"); |
convert(type, "0x7F"); |
@@ -260,6 +266,7 @@ debug(""); |
type = "testUnsignedLongLong"; |
verifyAttribute(type); |
convert(type, "0"); |
+convert(type, "-0", "0"); |
convert(type, "-1", "0xFFFFFFFFFFFFFFFF"); |
convert(type, "1"); |
convert(type, "0x7F"); |
@@ -294,6 +301,7 @@ debug(""); |
type = "testEnforceRangeUnsignedLongLong"; |
verifyAttribute(type); |
convert(type, "0"); |
+convert(type, "-0", "0"); |
convertThrows(type, "-1"); |
convert(type, "1"); |
convert(type, "0x7F"); |
@@ -328,6 +336,7 @@ debug(""); |
type = "testByte"; |
verifyAttribute(type); |
convert(type, "0"); |
+convert(type, "-0", "0"); |
convert(type, "-1"); |
convert(type, "1"); |
convert(type, "0x7F"); |
@@ -336,6 +345,7 @@ convert(type, "-0x7F"); |
convert(type, "-0x80"); |
convert(type, "-0x81", "0x7F"); |
convert(type, "0x1234", "0x34"); |
+convert(type, "0xDCBA9876543210", "0x10"); |
convert(type, "Number.MIN_VALUE", "0"); |
convert(type, "-Number.MIN_VALUE", "0"); |
convert(type, "Number.MAX_VALUE", "0"); |
@@ -353,6 +363,7 @@ debug(""); |
type = "testEnforceRangeByte"; |
verifyAttribute(type); |
convert(type, "0"); |
+convert(type, "-0", "0"); |
convert(type, "-1"); |
convert(type, "1"); |
convert(type, "0x7F"); |
@@ -378,6 +389,7 @@ debug(""); |
type = "testOctet"; |
verifyAttribute(type); |
convert(type, "0"); |
+convert(type, "-0", "0"); |
convert(type, "-1", "0xFF"); |
convert(type, "1"); |
convert(type, "0x7F"); |
@@ -388,6 +400,7 @@ convert(type, "0x101", "1"); |
convert(type, "-0x80", "0x80"); |
convert(type, "-0x81", "0x7F"); |
convert(type, "0x1234", "0x34"); |
+convert(type, "0xDCBA9876543210", "0x10"); |
convert(type, "Number.MAX_VALUE", "0"); |
convert(type, "Number.MIN_VALUE", "0"); |
convert(type, "-Number.MAX_VALUE", "0"); |
@@ -405,6 +418,7 @@ debug(""); |
type = "testEnforceRangeOctet"; |
verifyAttribute(type); |
convert(type, "0"); |
+convert(type, "-0", "0"); |
convertThrows(type, "-1"); |
convert(type, "1"); |
convert(type, "0x7F"); |
@@ -429,4 +443,126 @@ testNonNumericToNumericEnforceRange(type); |
convertThrows(type, "{valueOf:function(){throw new Error('custom');}}"); |
debug(""); |
+type = "testShort"; |
+verifyAttribute(type); |
+convert(type, "0"); |
+convert(type, "-0", "0"); |
+convert(type, "-1"); |
+convert(type, "1"); |
+convert(type, "0x7F"); |
+convert(type, "0x80"); |
+convert(type, "0xFF"); |
+convert(type, "-0x80"); |
+convert(type, "-0x81"); |
+convert(type, "0x7FFF"); |
+convert(type, "0x8000", "-0x8000"); |
+convert(type, "0xFFFF", "-1"); |
+convert(type, "-0x8000"); |
+convert(type, "-0x8001", "0x7FFF"); |
+convert(type, "0xDCBA9876543210", "0x3210"); |
+convert(type, "Number.MAX_VALUE", "0"); |
+convert(type, "Number.MIN_VALUE", "0"); |
+convert(type, "-Number.MAX_VALUE", "0"); |
+convert(type, "-Number.MIN_VALUE", "0"); |
+convert(type, "1.99", "1"); |
+convert(type, "-1.99", "-1"); |
+convert(type, "Infinity", "0"); |
+convert(type, "-Infinity", "0"); |
+convert(type, "NaN", "0"); |
+testNonNumericToNumeric(type); |
+convertThrows(type, "{valueOf:function(){throw new Error('custom');}}"); |
+debug(""); |
+ |
+type = "testEnforceRangeShort"; |
+verifyAttribute(type); |
+convert(type, "0"); |
+convert(type, "-0", "0"); |
+convert(type, "-1"); |
+convert(type, "1"); |
+convert(type, "0x7F"); |
+convert(type, "0x80"); |
+convert(type, "0xFF"); |
+convert(type, "-0x80"); |
+convert(type, "-0x81"); |
+convert(type, "0x7FFF"); |
+convertThrows(type, "0x8000"); |
+convertThrows(type, "0xFFFF"); |
+convert(type, "-0x8000"); |
+convertThrows(type, "-0x8001"); |
+convertThrows(type, "0xDCBA9876543210"); |
+convertThrows(type, "Number.MAX_VALUE"); |
+convert(type, "Number.MIN_VALUE", "0"); |
+convertThrows(type, "-Number.MAX_VALUE"); |
+convert(type, "-Number.MIN_VALUE", "0"); |
+convert(type, "1.99", "1"); |
+convert(type, "-1.99", "-1"); |
+convertThrows(type, "Infinity"); |
+convertThrows(type, "-Infinity"); |
+convertThrows(type, "NaN"); |
+testNonNumericToNumericEnforceRange(type); |
+convertThrows(type, "{valueOf:function(){throw new Error('custom');}}"); |
+debug(""); |
+ |
+type = "testUnsignedShort"; |
+verifyAttribute(type); |
+convert(type, "0"); |
+convert(type, "-0", "0"); |
+convert(type, "-1", "0xFFFF"); |
+convert(type, "1"); |
+convert(type, "0x7F"); |
+convert(type, "0x80"); |
+convert(type, "0xFF"); |
+convert(type, "-0x80", "0xFF80"); |
+convert(type, "-0x81", "0xFF7F"); |
+convert(type, "0x7FFF"); |
+convert(type, "0x8000"); |
+convert(type, "0xFFFF"); |
+convert(type, "0x10000", "0"); |
+convert(type, "-0x8000", "0x8000"); |
+convert(type, "-0x8001", "0x7FFF"); |
+convert(type, "0xDCBA9876543210", "0x3210"); |
+convert(type, "Number.MAX_VALUE", "0"); |
+convert(type, "Number.MIN_VALUE", "0"); |
+convert(type, "-Number.MAX_VALUE", "0"); |
+convert(type, "-Number.MIN_VALUE", "0"); |
+convert(type, "1.99", "1"); |
+convert(type, "-1.99", "0xFFFF"); |
+convert(type, "Infinity", "0"); |
+convert(type, "-Infinity", "0"); |
+convert(type, "NaN", "0"); |
+testNonNumericToNumeric(type); |
+convertThrows(type, "{valueOf:function(){throw new Error('custom');}}"); |
+debug(""); |
+ |
+type = "testEnforceRangeUnsignedShort"; |
+verifyAttribute(type); |
+convert(type, "0"); |
+convert(type, "-0", "0"); |
+convertThrows(type, "-1"); |
+convert(type, "1"); |
+convert(type, "0x7F"); |
+convert(type, "0x80"); |
+convert(type, "0xFF"); |
+convertThrows(type, "-0x80"); |
+convertThrows(type, "-0x81"); |
+convert(type, "0x7FFF"); |
+convert(type, "0x8000"); |
+convert(type, "0xFFFF"); |
+convertThrows(type, "0x10000"); |
+convertThrows(type, "-0x8000"); |
+convertThrows(type, "-0x8001"); |
+convert(type, "0x3210"); |
+convertThrows(type, "Number.MAX_VALUE"); |
+convert(type, "Number.MIN_VALUE", "0"); |
+convertThrows(type, "-Number.MAX_VALUE"); |
+convert(type, "-Number.MIN_VALUE", "0"); |
+convert(type, "1.99", "1"); |
+convertThrows(type, "-1.99"); |
+convertThrows(type, "Infinity"); |
+convertThrows(type, "-Infinity"); |
+convertThrows(type, "NaN"); |
+testNonNumericToNumericEnforceRange(type); |
+convertThrows(type, "{valueOf:function(){throw new Error('custom');}}"); |
+debug(""); |
+ |
</script> |