Diff
Modified: trunk/LayoutTests/fast/dom/constants-expected.txt (166412 => 166413)
--- trunk/LayoutTests/fast/dom/constants-expected.txt 2014-03-28 17:32:01 UTC (rev 166412)
+++ trunk/LayoutTests/fast/dom/constants-expected.txt 2014-03-28 17:51:51 UTC (rev 166413)
@@ -27,7 +27,7 @@
PASS: nodeFilter.FILTER_ACCEPT should be 1 and is.
PASS: nodeFilter.FILTER_REJECT should be 2 and is.
PASS: nodeFilter.FILTER_SKIP should be 3 and is.
-PASS: nodeFilter.SHOW_ALL should be -1 and is.
+PASS: nodeFilter.SHOW_ALL should be 4294967295 and is.
PASS: nodeFilter.SHOW_ELEMENT should be 1 and is.
PASS: nodeFilter.SHOW_ATTRIBUTE should be 2 and is.
PASS: nodeFilter.SHOW_TEXT should be 4 and is.
@@ -43,7 +43,7 @@
PASS: window.NodeFilter.FILTER_ACCEPT should be 1 and is.
PASS: window.NodeFilter.FILTER_REJECT should be 2 and is.
PASS: window.NodeFilter.FILTER_SKIP should be 3 and is.
-PASS: window.NodeFilter.SHOW_ALL should be -1 and is.
+PASS: window.NodeFilter.SHOW_ALL should be 4294967295 and is.
PASS: window.NodeFilter.SHOW_ELEMENT should be 1 and is.
PASS: window.NodeFilter.SHOW_ATTRIBUTE should be 2 and is.
PASS: window.NodeFilter.SHOW_TEXT should be 4 and is.
Modified: trunk/LayoutTests/fast/dom/constants.html (166412 => 166413)
--- trunk/LayoutTests/fast/dom/constants.html 2014-03-28 17:32:01 UTC (rev 166412)
+++ trunk/LayoutTests/fast/dom/constants.html 2014-03-28 17:51:51 UTC (rev 166413)
@@ -80,7 +80,7 @@
shouldBe("nodeFilter.FILTER_ACCEPT", 1);
shouldBe("nodeFilter.FILTER_REJECT", 2);
shouldBe("nodeFilter.FILTER_SKIP", 3);
- shouldBe("nodeFilter.SHOW_ALL", -1);
+ shouldBe("nodeFilter.SHOW_ALL", 0xFFFFFFFF);
shouldBe("nodeFilter.SHOW_ELEMENT", 0x00000001);
shouldBe("nodeFilter.SHOW_ATTRIBUTE", 0x00000002);
shouldBe("nodeFilter.SHOW_TEXT", 0x00000004);
@@ -97,7 +97,7 @@
shouldBe("window.NodeFilter.FILTER_ACCEPT", 1);
shouldBe("window.NodeFilter.FILTER_REJECT", 2);
shouldBe("window.NodeFilter.FILTER_SKIP", 3);
- shouldBe("window.NodeFilter.SHOW_ALL", -1);
+ shouldBe("window.NodeFilter.SHOW_ALL", 0xFFFFFFFF);
shouldBe("window.NodeFilter.SHOW_ELEMENT", 0x00000001);
shouldBe("window.NodeFilter.SHOW_ATTRIBUTE", 0x00000002);
shouldBe("window.NodeFilter.SHOW_TEXT", 0x00000004);
Modified: trunk/Source/WebCore/ChangeLog (166412 => 166413)
--- trunk/Source/WebCore/ChangeLog 2014-03-28 17:32:01 UTC (rev 166412)
+++ trunk/Source/WebCore/ChangeLog 2014-03-28 17:51:51 UTC (rev 166413)
@@ -1,3 +1,46 @@
+2014-03-26 Antonio Gomes <[email protected]>
+
+ [Bindings] constants are always typed to 'int'
+ https://bugs.webkit.org/show_bug.cgi?id=130775
+
+ Reviewed by Darin Adler.
+
+ Patch fixes a bug where all constant getter generated
+ methods were returning 'integer' values due to static_cast.
+
+ Compilers should be smarth enough to properly infer which
+ jsNumber class construtor to call given a literal value.
+
+ Patch also fixes a bug where values whose representation
+ is bigger an integer maximum were overflowing. For instance,
+ NodeFilter.SHOW_ALL (0xFFFFFFFF).
+
+ Tests:
+ Binding tests updated.
+ Rebaselined fast/dom/constants.html
+
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (GenerateImplementation):
+ * bindings/scripts/test/JS/JSTestInterface.cpp:
+ (WebCore::jsTestInterfaceIMPLEMENTSCONSTANT1):
+ (WebCore::jsTestInterfaceIMPLEMENTSCONSTANT2):
+ (WebCore::jsTestInterfaceSUPPLEMENTALCONSTANT1):
+ (WebCore::jsTestInterfaceSUPPLEMENTALCONSTANT2):
+ * bindings/scripts/test/JS/JSTestObj.cpp:
+ (WebCore::jsTestObjCONDITIONAL_CONST):
+ (WebCore::jsTestObjCONST_VALUE_0):
+ (WebCore::jsTestObjCONST_VALUE_1):
+ (WebCore::jsTestObjCONST_VALUE_2):
+ (WebCore::jsTestObjCONST_VALUE_4):
+ (WebCore::jsTestObjCONST_VALUE_8):
+ (WebCore::jsTestObjCONST_VALUE_9):
+ (WebCore::jsTestObjCONST_VALUE_11):
+ (WebCore::jsTestObjCONST_VALUE_12):
+ (WebCore::jsTestObjCONST_VALUE_13):
+ (WebCore::jsTestObjCONST_VALUE_14):
+ (WebCore::jsTestObjCONST_JAVASCRIPT):
+ (WebCore::jsTestObjReadonly):
+
2014-03-28 Myles C. Maxfield <[email protected]>
A TrailingObject's endpoint might get decremented twice
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (166412 => 166413)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2014-03-28 17:32:01 UTC (rev 166412)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2014-03-28 17:51:51 UTC (rev 166413)
@@ -2821,14 +2821,13 @@
push(@implContent, "#if ${conditionalString}\n");
}
- # FIXME: this casts into int to match our previous behavior which turned 0xFFFFFFFF in -1 for NodeFilter.SHOW_ALL
push(@implContent, "EncodedJSValue ${getter}(ExecState* exec, JSObject*, EncodedJSValue, PropertyName)\n");
push(@implContent, "{\n");
if ($constant->type eq "DOMString") {
push(@implContent, " return JSValue::encode(jsStringOrNull(exec, String(" . $constant->value . ")));\n");
} else {
push(@implContent, " UNUSED_PARAM(exec);\n");
- push(@implContent, " return JSValue::encode(jsNumber(static_cast<int>(" . $constant->value . ")));\n");
+ push(@implContent, " return JSValue::encode(jsNumber(" . $constant->value . "));\n");
}
push(@implContent, "}\n\n");
push(@implContent, "#endif\n") if $conditional;
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp (166412 => 166413)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp 2014-03-28 17:32:01 UTC (rev 166412)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp 2014-03-28 17:51:51 UTC (rev 166413)
@@ -932,7 +932,7 @@
EncodedJSValue jsTestInterfaceIMPLEMENTSCONSTANT1(ExecState* exec, JSObject*, EncodedJSValue, PropertyName)
{
UNUSED_PARAM(exec);
- return JSValue::encode(jsNumber(static_cast<int>(1)));
+ return JSValue::encode(jsNumber(1));
}
#endif
@@ -940,7 +940,7 @@
EncodedJSValue jsTestInterfaceIMPLEMENTSCONSTANT2(ExecState* exec, JSObject*, EncodedJSValue, PropertyName)
{
UNUSED_PARAM(exec);
- return JSValue::encode(jsNumber(static_cast<int>(2)));
+ return JSValue::encode(jsNumber(2));
}
#endif
@@ -948,7 +948,7 @@
EncodedJSValue jsTestInterfaceSUPPLEMENTALCONSTANT1(ExecState* exec, JSObject*, EncodedJSValue, PropertyName)
{
UNUSED_PARAM(exec);
- return JSValue::encode(jsNumber(static_cast<int>(1)));
+ return JSValue::encode(jsNumber(1));
}
#endif
@@ -956,7 +956,7 @@
EncodedJSValue jsTestInterfaceSUPPLEMENTALCONSTANT2(ExecState* exec, JSObject*, EncodedJSValue, PropertyName)
{
UNUSED_PARAM(exec);
- return JSValue::encode(jsNumber(static_cast<int>(2)));
+ return JSValue::encode(jsNumber(2));
}
#endif
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (166412 => 166413)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2014-03-28 17:32:01 UTC (rev 166412)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2014-03-28 17:51:51 UTC (rev 166413)
@@ -4689,44 +4689,44 @@
EncodedJSValue jsTestObjCONDITIONAL_CONST(ExecState* exec, JSObject*, EncodedJSValue, PropertyName)
{
UNUSED_PARAM(exec);
- return JSValue::encode(jsNumber(static_cast<int>(0)));
+ return JSValue::encode(jsNumber(0));
}
#endif
EncodedJSValue jsTestObjCONST_VALUE_0(ExecState* exec, JSObject*, EncodedJSValue, PropertyName)
{
UNUSED_PARAM(exec);
- return JSValue::encode(jsNumber(static_cast<int>(0)));
+ return JSValue::encode(jsNumber(0));
}
EncodedJSValue jsTestObjCONST_VALUE_1(ExecState* exec, JSObject*, EncodedJSValue, PropertyName)
{
UNUSED_PARAM(exec);
- return JSValue::encode(jsNumber(static_cast<int>(1)));
+ return JSValue::encode(jsNumber(1));
}
EncodedJSValue jsTestObjCONST_VALUE_2(ExecState* exec, JSObject*, EncodedJSValue, PropertyName)
{
UNUSED_PARAM(exec);
- return JSValue::encode(jsNumber(static_cast<int>(2)));
+ return JSValue::encode(jsNumber(2));
}
EncodedJSValue jsTestObjCONST_VALUE_4(ExecState* exec, JSObject*, EncodedJSValue, PropertyName)
{
UNUSED_PARAM(exec);
- return JSValue::encode(jsNumber(static_cast<int>(4)));
+ return JSValue::encode(jsNumber(4));
}
EncodedJSValue jsTestObjCONST_VALUE_8(ExecState* exec, JSObject*, EncodedJSValue, PropertyName)
{
UNUSED_PARAM(exec);
- return JSValue::encode(jsNumber(static_cast<int>(8)));
+ return JSValue::encode(jsNumber(8));
}
EncodedJSValue jsTestObjCONST_VALUE_9(ExecState* exec, JSObject*, EncodedJSValue, PropertyName)
{
UNUSED_PARAM(exec);
- return JSValue::encode(jsNumber(static_cast<int>(-1)));
+ return JSValue::encode(jsNumber(-1));
}
EncodedJSValue jsTestObjCONST_VALUE_10(ExecState* exec, JSObject*, EncodedJSValue, PropertyName)
@@ -4737,37 +4737,37 @@
EncodedJSValue jsTestObjCONST_VALUE_11(ExecState* exec, JSObject*, EncodedJSValue, PropertyName)
{
UNUSED_PARAM(exec);
- return JSValue::encode(jsNumber(static_cast<int>(0xffffffff)));
+ return JSValue::encode(jsNumber(0xffffffff));
}
EncodedJSValue jsTestObjCONST_VALUE_12(ExecState* exec, JSObject*, EncodedJSValue, PropertyName)
{
UNUSED_PARAM(exec);
- return JSValue::encode(jsNumber(static_cast<int>(0x01)));
+ return JSValue::encode(jsNumber(0x01));
}
EncodedJSValue jsTestObjCONST_VALUE_13(ExecState* exec, JSObject*, EncodedJSValue, PropertyName)
{
UNUSED_PARAM(exec);
- return JSValue::encode(jsNumber(static_cast<int>(0X20)));
+ return JSValue::encode(jsNumber(0X20));
}
EncodedJSValue jsTestObjCONST_VALUE_14(ExecState* exec, JSObject*, EncodedJSValue, PropertyName)
{
UNUSED_PARAM(exec);
- return JSValue::encode(jsNumber(static_cast<int>(0x1abc)));
+ return JSValue::encode(jsNumber(0x1abc));
}
EncodedJSValue jsTestObjCONST_JAVASCRIPT(ExecState* exec, JSObject*, EncodedJSValue, PropertyName)
{
UNUSED_PARAM(exec);
- return JSValue::encode(jsNumber(static_cast<int>(15)));
+ return JSValue::encode(jsNumber(15));
}
EncodedJSValue jsTestObjReadonly(ExecState* exec, JSObject*, EncodedJSValue, PropertyName)
{
UNUSED_PARAM(exec);
- return JSValue::encode(jsNumber(static_cast<int>(0)));
+ return JSValue::encode(jsNumber(0));
}
bool JSTestObjOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)