Title: [128655] trunk/Source/WebCore
- Revision
- 128655
- Author
- [email protected]
- Date
- 2012-09-14 14:43:39 -0700 (Fri, 14 Sep 2012)
Log Message
Support constructor-type attribute in idls other than DOMWindow.
https://bugs.webkit.org/show_bug.cgi?id=96821
Patch by Chang Shu <[email protected]> on 2012-09-14
Reviewed by Kentaro Hara.
In CodeGeneratorJS.pm, we should not assume only DOMWindow uses Constructor
attribute. So for other interfaces, we should pass castedThis->globalObject()
instead of castedThis.
Test: bindings/scripts/test/JS/JSTestObj.idl
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateImplementation):
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::jsTestObjConstructorTestSubObj):
(WebCore::jsTestObjConditionalAttr4Constructor):
(WebCore::jsTestObjConditionalAttr5Constructor):
(WebCore::jsTestObjConditionalAttr6Constructor):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (128654 => 128655)
--- trunk/Source/WebCore/ChangeLog 2012-09-14 21:34:10 UTC (rev 128654)
+++ trunk/Source/WebCore/ChangeLog 2012-09-14 21:43:39 UTC (rev 128655)
@@ -1,3 +1,24 @@
+2012-09-14 Chang Shu <[email protected]>
+
+ Support constructor-type attribute in idls other than DOMWindow.
+ https://bugs.webkit.org/show_bug.cgi?id=96821
+
+ Reviewed by Kentaro Hara.
+
+ In CodeGeneratorJS.pm, we should not assume only DOMWindow uses Constructor
+ attribute. So for other interfaces, we should pass castedThis->globalObject()
+ instead of castedThis.
+
+ Test: bindings/scripts/test/JS/JSTestObj.idl
+
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (GenerateImplementation):
+ * bindings/scripts/test/JS/JSTestObj.cpp:
+ (WebCore::jsTestObjConstructorTestSubObj):
+ (WebCore::jsTestObjConditionalAttr4Constructor):
+ (WebCore::jsTestObjConditionalAttr5Constructor):
+ (WebCore::jsTestObjConditionalAttr6Constructor):
+
2012-09-14 Tom Sepez <[email protected]>
ImageLoader can't be cleared when video element poster attribute removed.
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (128654 => 128655)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2012-09-14 21:34:10 UTC (rev 128654)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2012-09-14 21:43:39 UTC (rev 128655)
@@ -1878,9 +1878,14 @@
} elsif ($attribute->signature->type =~ /Constructor$/) {
my $constructorType = $codeGenerator->StripModule($attribute->signature->type);
$constructorType =~ s/Constructor$//;
- # Constructor attribute is only used by DOMWindow.idl, so it's correct to pass castedThis as the global object
- # Once JSDOMWrappers have a back-pointer to the globalObject we can pass castedThis->globalObject()
- push(@implContent, " return JS" . $constructorType . "::getConstructor(exec, castedThis);\n");
+ # When Constructor attribute is used by DOMWindow.idl, it's correct to pass castedThis as the global object
+ # When JSDOMWrappers have a back-pointer to the globalObject we can pass castedThis->globalObject()
+ if ($interfaceName eq "DOMWindow") {
+ push(@implContent, " return JS" . $constructorType . "::getConstructor(exec, castedThis);\n");
+ } else {
+ AddToImplIncludes("JS" . $constructorType . ".h", $attribute->signature->extendedAttributes->{"Conditional"});
+ push(@implContent, " return JS" . $constructorType . "::getConstructor(exec, castedThis->globalObject());\n");
+ }
} elsif (!@{$attribute->getterExceptions}) {
push(@implContent, " UNUSED_PARAM(exec);\n") if !$attribute->signature->extendedAttributes->{"CallWith"};
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (128654 => 128655)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2012-09-14 21:34:10 UTC (rev 128654)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2012-09-14 21:43:39 UTC (rev 128655)
@@ -38,6 +38,7 @@
#include "JSScriptProfile.h"
#include "JSTestCallback.h"
#include "JSTestObj.h"
+#include "JSTestSubObj.h"
#include "JSa.h"
#include "JSb.h"
#include "JSbool.h"
@@ -438,7 +439,7 @@
JSValue jsTestObjConstructorTestSubObj(ExecState* exec, JSValue slotBase, PropertyName)
{
JSTestObj* castedThis = jsCast<JSTestObj*>(asObject(slotBase));
- return JSTestSubObj::getConstructor(exec, castedThis);
+ return JSTestSubObj::getConstructor(exec, castedThis->globalObject());
}
@@ -815,7 +816,7 @@
JSValue jsTestObjConditionalAttr4Constructor(ExecState* exec, JSValue slotBase, PropertyName)
{
JSTestObj* castedThis = jsCast<JSTestObj*>(asObject(slotBase));
- return JSTestObjectA::getConstructor(exec, castedThis);
+ return JSTestObjectA::getConstructor(exec, castedThis->globalObject());
}
#endif
@@ -824,7 +825,7 @@
JSValue jsTestObjConditionalAttr5Constructor(ExecState* exec, JSValue slotBase, PropertyName)
{
JSTestObj* castedThis = jsCast<JSTestObj*>(asObject(slotBase));
- return JSTestObjectB::getConstructor(exec, castedThis);
+ return JSTestObjectB::getConstructor(exec, castedThis->globalObject());
}
#endif
@@ -833,7 +834,7 @@
JSValue jsTestObjConditionalAttr6Constructor(ExecState* exec, JSValue slotBase, PropertyName)
{
JSTestObj* castedThis = jsCast<JSTestObj*>(asObject(slotBase));
- return JSTestObjectC::getConstructor(exec, castedThis);
+ return JSTestObjectC::getConstructor(exec, castedThis->globalObject());
}
#endif
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes