Title: [145175] trunk
Revision
145175
Author
morr...@google.com
Date
2013-03-07 20:25:52 -0800 (Thu, 07 Mar 2013)

Log Message

Custom Elements: CustomElement constructor shouldn't share function instance
https://bugs.webkit.org/show_bug.cgi?id=111807

Reviewed by Kentaro Hara.

Source/WebCore:

Adaptor functions of custom elements unintentionally share the instance.
This fix gives new one for each.

Test: Updated fast/dom/custom/document-register-basic.html

* bindings/v8/V8AdaptorFunction.cpp:
(WebCore::V8AdaptorFunction::wrap):

LayoutTests:

* fast/dom/custom/document-register-basic-expected.txt:
* fast/dom/custom/document-register-basic.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (145174 => 145175)


--- trunk/LayoutTests/ChangeLog	2013-03-08 04:24:23 UTC (rev 145174)
+++ trunk/LayoutTests/ChangeLog	2013-03-08 04:25:52 UTC (rev 145175)
@@ -1,3 +1,13 @@
+2013-03-07  Hajime Morrita  <morr...@google.com>
+
+        Custom Elements: CustomElement constructor shouldn't share function instance
+        https://bugs.webkit.org/show_bug.cgi?id=111807
+
+        Reviewed by Kentaro Hara.
+
+        * fast/dom/custom/document-register-basic-expected.txt:
+        * fast/dom/custom/document-register-basic.html:
+
 2013-03-07  Hayato Ito  <hay...@chromium.org>
 
         Unreviewed gardening.

Modified: trunk/LayoutTests/fast/dom/custom/document-register-basic-expected.txt (145174 => 145175)


--- trunk/LayoutTests/fast/dom/custom/document-register-basic-expected.txt	2013-03-08 04:24:23 UTC (rev 145174)
+++ trunk/LayoutTests/fast/dom/custom/document-register-basic-expected.txt	2013-03-08 04:25:52 UTC (rev 145175)
@@ -24,6 +24,7 @@
 PASS parsedFoo.__proto__ is fooConstructor.prototype
 PASS parsedFoo.tagName is 'X-FOO'
 PASS parsedFoo.someProperty is container.firstChild.someProperty
+PASS barConstructor !== fooConstructor is true
 PASS createdBar.tagName is 'X-BAR'
 PASS createdBaz.tagName is 'X-BAZ'
 PASS createdBaz.thisIsPrototype is true
@@ -40,6 +41,9 @@
 PASS (new (document.register('yz-bar', createRegisterParamters()))()).tagName is 'YZ-BAR'
 PASS (new (document.register('y-z-bar', createRegisterParamters()))()).tagName is 'Y-Z-BAR'
 PASS (new (document.register('y--bar', createRegisterParamters()))()).tagName is 'Y--BAR'
+PASS (new fooConstructor).tagName is 'X-FOO'
+PASS (new barConstructor).tagName is 'X-BAR'
+PASS (new bazConstructor).tagName is 'X-BAZ'
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/dom/custom/document-register-basic.html (145174 => 145175)


--- trunk/LayoutTests/fast/dom/custom/document-register-basic.html	2013-03-08 04:24:23 UTC (rev 145174)
+++ trunk/LayoutTests/fast/dom/custom/document-register-basic.html	2013-03-08 04:25:52 UTC (rev 145175)
@@ -77,6 +77,7 @@
 
 // Having another constructor
 var barConstructor = document.register("x-bar", createRegisterParamters());
+shouldBeTrue("barConstructor !== fooConstructor");
 var createdBar = new barConstructor();
 shouldBe("createdBar.tagName", "'X-BAR'");
 
@@ -107,6 +108,11 @@
 shouldBe("(new (document.register('y-z-bar', createRegisterParamters()))()).tagName", "'Y-Z-BAR'");
 shouldBe("(new (document.register('y--bar', createRegisterParamters()))()).tagName", "'Y--BAR'");
 
+// Constructor shouldn't interfere each otehr
+shouldBe("(new fooConstructor).tagName", "'X-FOO'");
+shouldBe("(new barConstructor).tagName", "'X-BAR'");
+shouldBe("(new bazConstructor).tagName", "'X-BAZ'");
+
 </script>
 <script src=""
 </body>

Modified: trunk/Source/WebCore/ChangeLog (145174 => 145175)


--- trunk/Source/WebCore/ChangeLog	2013-03-08 04:24:23 UTC (rev 145174)
+++ trunk/Source/WebCore/ChangeLog	2013-03-08 04:25:52 UTC (rev 145175)
@@ -1,3 +1,18 @@
+2013-03-07  Hajime Morrita  <morr...@google.com>
+
+        Custom Elements: CustomElement constructor shouldn't share function instance
+        https://bugs.webkit.org/show_bug.cgi?id=111807
+
+        Reviewed by Kentaro Hara.
+
+        Adaptor functions of custom elements unintentionally share the instance.
+        This fix gives new one for each.
+
+        Test: Updated fast/dom/custom/document-register-basic.html
+
+        * bindings/v8/V8AdaptorFunction.cpp:
+        (WebCore::V8AdaptorFunction::wrap):
+
 2013-03-07  Jared Wyles  <wy...@adobe.com>
 
         Reading border radius from style property returns in wrong order.

Modified: trunk/Source/WebCore/bindings/v8/V8AdaptorFunction.cpp (145174 => 145175)


--- trunk/Source/WebCore/bindings/v8/V8AdaptorFunction.cpp	2013-03-08 04:24:23 UTC (rev 145174)
+++ trunk/Source/WebCore/bindings/v8/V8AdaptorFunction.cpp	2013-03-08 04:25:52 UTC (rev 145175)
@@ -76,7 +76,7 @@
 {
     if (object.IsEmpty() || !object->IsObject())
         return v8::Handle<v8::Function>();
-    v8::Handle<v8::Function> adaptor = v8::Handle<v8::Function>::Cast(getTemplate(isolate, worldType(isolate))->GetFunction());
+    v8::Handle<v8::Function> adaptor = v8::Handle<v8::Function>::Cast(getTemplate(isolate, worldType(isolate))->GetFunction()->Clone());
     if (adaptor.IsEmpty())
         return v8::Handle<v8::Function>();
     adaptor->SetName(v8String(name.string(), isolate));
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to