Title: [97581] trunk/Source/WebCore
Revision
97581
Author
hara...@chromium.org
Date
2011-10-16 20:13:53 -0700 (Sun, 16 Oct 2011)

Log Message

Generate XMLHttpRequest constructor for JSC by [Constructor] IDL
https://bugs.webkit.org/show_bug.cgi?id=70208

Reviewed by Adam Barth.

This patch generates an XMLHttpRequest constructor for JSC by [Constructor] IDL,
but V8 is still using a custom constructor since the V8 constructor requires a special logic.

Tests: fast/dom/global-constructors.html
       fast/dom/XMLHttpRequest-constants.html
       fast/dom/xmlhttprequest-constructor-in-detached-document.html
       http/tests/security/cookies/xmlhttprequest.html

* bindings/js/JSXMLHttpRequestCustom.cpp: Removed an XMLHttpRequest custom constructor.
* bindings/scripts/CodeGeneratorV8.pm: Currently, CodeGeneratorV8.pm generates constructor code whenever [Constructor] is specified, even if [V8CustomConstructor] is specified. This is wrong. This patch fixes the condition where the constructor code is generated.
* bindings/scripts/test/V8/V8TestObj.cpp: Updated a run-binding-tests result.
* xml/XMLHttpRequest.h: Added a necessary header.
* xml/XMLHttpRequest.idl: V8 is still using a custom constructor.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (97580 => 97581)


--- trunk/Source/WebCore/ChangeLog	2011-10-17 02:02:18 UTC (rev 97580)
+++ trunk/Source/WebCore/ChangeLog	2011-10-17 03:13:53 UTC (rev 97581)
@@ -1,5 +1,26 @@
 2011-10-16  Kentaro Hara  <hara...@chromium.org>
 
+        Generate XMLHttpRequest constructor for JSC by [Constructor] IDL
+        https://bugs.webkit.org/show_bug.cgi?id=70208
+
+        Reviewed by Adam Barth.
+
+        This patch generates an XMLHttpRequest constructor for JSC by [Constructor] IDL,
+        but V8 is still using a custom constructor since the V8 constructor requires a special logic.
+
+        Tests: fast/dom/global-constructors.html
+               fast/dom/XMLHttpRequest-constants.html
+               fast/dom/xmlhttprequest-constructor-in-detached-document.html
+               http/tests/security/cookies/xmlhttprequest.html
+
+        * bindings/js/JSXMLHttpRequestCustom.cpp: Removed an XMLHttpRequest custom constructor.
+        * bindings/scripts/CodeGeneratorV8.pm: Currently, CodeGeneratorV8.pm generates constructor code whenever [Constructor] is specified, even if [V8CustomConstructor] is specified. This is wrong. This patch fixes the condition where the constructor code is generated.
+        * bindings/scripts/test/V8/V8TestObj.cpp: Updated a run-binding-tests result.
+        * xml/XMLHttpRequest.h: Added a necessary header.
+        * xml/XMLHttpRequest.idl: V8 is still using a custom constructor.
+
+2011-10-16  Kentaro Hara  <hara...@chromium.org>
+
         Generate XSLTProcessor constructor for JSC by [Constructor] IDL.
         https://bugs.webkit.org/show_bug.cgi?id=70206
 

Modified: trunk/Source/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp (97580 => 97581)


--- trunk/Source/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp	2011-10-17 02:02:18 UTC (rev 97580)
+++ trunk/Source/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp	2011-10-17 03:13:53 UTC (rev 97581)
@@ -203,15 +203,4 @@
     return jsUndefined();
 }
 
-EncodedJSValue JSC_HOST_CALL JSXMLHttpRequestConstructor::constructJSXMLHttpRequest(ExecState* exec)
-{
-    JSXMLHttpRequestConstructor* jsConstructor = static_cast<JSXMLHttpRequestConstructor*>(exec->callee());
-    ScriptExecutionContext* context = jsConstructor->scriptExecutionContext();
-    if (!context)
-        return throwVMError(exec, createReferenceError(exec, "XMLHttpRequest constructor associated document is unavailable"));
-
-    RefPtr<XMLHttpRequest> xmlHttpRequest = XMLHttpRequest::create(context);
-    return JSValue::encode(CREATE_DOM_WRAPPER(exec, jsConstructor->globalObject(), XMLHttpRequest, xmlHttpRequest.get()));
-}
-
 } // namespace WebCore

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm (97580 => 97581)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2011-10-17 02:02:18 UTC (rev 97580)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2011-10-17 03:13:53 UTC (rev 97581)
@@ -2153,9 +2153,7 @@
 }
 
 END
-    }
-
-    if ($dataNode->extendedAttributes->{"Constructor"}) {
+    } elsif ($dataNode->extendedAttributes->{"CanBeConstructed"} && !($dataNode->extendedAttributes->{"V8CustomConstructor"} || $dataNode->extendedAttributes->{"CustomConstructor"})) {
         GenerateConstructorCallback($dataNode->constructor, $dataNode, $interfaceName);
     }
 

Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp (97580 => 97581)


--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp	2011-10-17 02:02:18 UTC (rev 97580)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp	2011-10-17 03:13:53 UTC (rev 97581)
@@ -1386,24 +1386,6 @@
 COMPILE_ASSERT(0X20 == TestObj::CONST_VALUE_13, TestObjEnumCONST_VALUE_13IsWrongUseDontCheckEnums);
 COMPILE_ASSERT(0x1abc == TestObj::CONST_VALUE_14, TestObjEnumCONST_VALUE_14IsWrongUseDontCheckEnums);
 
-v8::Handle<v8::Value> V8TestObj::constructorCallback(const v8::Arguments& args)
-{
-    INC_STATS("DOM.TestObj.Constructor");
-
-    if (!args.IsConstructCall())
-        return throwError("DOM object constructor cannot be called as a function.", V8Proxy::TypeError);
-
-    if (AllowAllocation::current())
-        return args.Holder();
-
-    RefPtr<TestObj> obj = TestObj::create();
-
-    V8DOMWrapper::setDOMWrapper(args.Holder(), &info, obj.get());
-    obj->ref();
-    V8DOMWrapper::setJSWrapperForDOMObject(obj.get(), v8::Persistent<v8::Object>::New(args.Holder()));
-    return args.Holder();
-}
-
 static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestObjTemplate(v8::Persistent<v8::FunctionTemplate> desc)
 {
     desc->ReadOnlyPrototype();

Modified: trunk/Source/WebCore/xml/XMLHttpRequest.h (97580 => 97581)


--- trunk/Source/WebCore/xml/XMLHttpRequest.h	2011-10-17 02:02:18 UTC (rev 97580)
+++ trunk/Source/WebCore/xml/XMLHttpRequest.h	2011-10-17 03:13:53 UTC (rev 97581)
@@ -27,6 +27,7 @@
 #include "EventTarget.h"
 #include "FormData.h"
 #include "ResourceResponse.h"
+#include "SecurityOrigin.h"
 #include "ThreadableLoaderClient.h"
 #include "XMLHttpRequestProgressEventThrottle.h"
 #include <wtf/OwnPtr.h>

Modified: trunk/Source/WebCore/xml/XMLHttpRequest.idl (97580 => 97581)


--- trunk/Source/WebCore/xml/XMLHttpRequest.idl	2011-10-17 02:02:18 UTC (rev 97580)
+++ trunk/Source/WebCore/xml/XMLHttpRequest.idl	2011-10-17 03:13:53 UTC (rev 97581)
@@ -31,7 +31,9 @@
     interface [
         ActiveDOMObject,
         CanBeConstructed,
-        CustomConstructor,
+        Constructor,
+        CallWith=ScriptExecutionContext,
+        V8CustomConstructor,
         CustomMarkFunction,
         EventTarget,
         NoStaticTables
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to