Title: [121615] trunk
Revision
121615
Author
[email protected]
Date
2012-06-29 20:32:05 -0700 (Fri, 29 Jun 2012)

Log Message

[V8] HTMLCollection wrappers are not retained
https://bugs.webkit.org/show_bug.cgi?id=90208

Reviewed by Adam Barth.

Source/WebCore:

Generate visitDOMWrapper for HTMLCollection and HTMLAllCollection so that we add an implicit reference from the owner
to the collection.

Tests: fast/dom/htmlallcollection-reachable.html
       fast/dom/htmlcollection-reachable.html

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateImplementation): Instead of hard coding to use base() for HTMLAllCollection and HTMLCollection we now
annotate the IDL file to use GenerateIsReachable=ImplBaseRoot.
* bindings/scripts/CodeGeneratorV8.pm:
(GenerateVisitDOMWrapper): Generate visitDOMWrapper if GenerateIsReachable is ImplBaseRoot.
* bindings/scripts/IDLAttributes.txt: Added ImplBaseRoot.
* html/HTMLAllCollection.idl: Added annotations.
* html/HTMLCollection.idl: Ditto.

LayoutTests:

* fast/dom/htmlallcollection-reachable-expected.txt: Added.
* fast/dom/htmlallcollection-reachable.html: Added.
* fast/dom/htmlcollection-reachable-expected.txt: Added.
* fast/dom/htmlcollection-reachable.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (121614 => 121615)


--- trunk/LayoutTests/ChangeLog	2012-06-30 03:27:12 UTC (rev 121614)
+++ trunk/LayoutTests/ChangeLog	2012-06-30 03:32:05 UTC (rev 121615)
@@ -1,3 +1,15 @@
+2012-06-29  Erik Arvidsson  <[email protected]>
+
+        [V8] HTMLCollection wrappers are not retained
+        https://bugs.webkit.org/show_bug.cgi?id=90208
+
+        Reviewed by Adam Barth.
+
+        * fast/dom/htmlallcollection-reachable-expected.txt: Added.
+        * fast/dom/htmlallcollection-reachable.html: Added.
+        * fast/dom/htmlcollection-reachable-expected.txt: Added.
+        * fast/dom/htmlcollection-reachable.html: Added.
+
 2012-06-29  Tony Chang  <[email protected]>
 
         All child elements of a flex container should be turned into a flex item

Added: trunk/LayoutTests/fast/dom/htmlallcollection-reachable-expected.txt (0 => 121615)


--- trunk/LayoutTests/fast/dom/htmlallcollection-reachable-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/htmlallcollection-reachable-expected.txt	2012-06-30 03:32:05 UTC (rev 121615)
@@ -0,0 +1,5 @@
+PASS document.all.customProperty is 42
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/dom/htmlallcollection-reachable.html (0 => 121615)


--- trunk/LayoutTests/fast/dom/htmlallcollection-reachable.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/htmlallcollection-reachable.html	2012-06-30 03:32:05 UTC (rev 121615)
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<script src=""
+<script>
+
+document.all.customProperty = 42;
+gc();
+shouldBe('document.all.customProperty', '42');
+
+</script>
+<script src=""

Added: trunk/LayoutTests/fast/dom/htmlcollection-reachable-expected.txt (0 => 121615)


--- trunk/LayoutTests/fast/dom/htmlcollection-reachable-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/htmlcollection-reachable-expected.txt	2012-06-30 03:32:05 UTC (rev 121615)
@@ -0,0 +1,21 @@
+PASS document.anchors.customProperty is 0
+PASS document.applets.customProperty is 1
+PASS document.embeds.customProperty is 2
+PASS document.forms.customProperty is 3
+PASS document.images.customProperty is 4
+PASS document.links.customProperty is 5
+PASS document.plugins.customProperty is 6
+PASS document.scripts.customProperty is 7
+PASS element.children.customProperty is 8
+PASS fieldset.elements.customProperty is 9
+PASS form.elements.customProperty is 10
+PASS map.areas.customProperty is 11
+PASS section.rows.customProperty is 12
+PASS select.selectedOptions.customProperty is 13
+PASS table.rows.customProperty is 14
+PASS table.tBodies.customProperty is 15
+PASS tableRow.cells.customProperty is 16
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/dom/htmlcollection-reachable.html (0 => 121615)


--- trunk/LayoutTests/fast/dom/htmlcollection-reachable.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/htmlcollection-reachable.html	2012-06-30 03:32:05 UTC (rev 121615)
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<script src=""
+<form></form>
+<table><tbody><tr></tr></tbody></table>
+<fieldset></fieldset>
+<select></select>
+<datalist></datalist>
+<map></map>
+<script>
+
+var datalist = document.querySelector('datalist');
+var element = document.createElement('span');
+var fieldset = document.querySelector('fieldset');
+var form = document.querySelector('form');
+var map = document.querySelector('map');
+var section = document.querySelector('tbody');
+var select = document.querySelector('select');
+var table = document.querySelector('table');
+var tableRow = document.querySelector('tr');
+
+var collections = [
+    // datalist is not enabled by default.
+    // 'datalist.options',
+    'document.anchors',
+    'document.applets',
+    'document.embeds',
+    'document.forms',
+    'document.images',
+    'document.links',
+    'document.plugins',
+    'document.scripts',
+    'element.children',
+    'fieldset.elements',
+    'form.elements',
+    'map.areas',
+    'section.rows',
+    'select.selectedOptions',
+    'table.rows',
+    'table.tBodies',
+    'tableRow.cells',
+];
+
+for (var i = 0; i < collections.length; i++) {
+    var code = collections[i];
+    eval(code).customProperty = i;
+    gc();
+    shouldBe(code + '.customProperty', '' + i);
+}
+
+</script>
+<script src=""

Modified: trunk/Source/WebCore/ChangeLog (121614 => 121615)


--- trunk/Source/WebCore/ChangeLog	2012-06-30 03:27:12 UTC (rev 121614)
+++ trunk/Source/WebCore/ChangeLog	2012-06-30 03:32:05 UTC (rev 121615)
@@ -1,3 +1,25 @@
+2012-06-29  Erik Arvidsson  <[email protected]>
+
+        [V8] HTMLCollection wrappers are not retained
+        https://bugs.webkit.org/show_bug.cgi?id=90208
+
+        Reviewed by Adam Barth.
+
+        Generate visitDOMWrapper for HTMLCollection and HTMLAllCollection so that we add an implicit reference from the owner
+        to the collection.
+
+        Tests: fast/dom/htmlallcollection-reachable.html
+               fast/dom/htmlcollection-reachable.html
+
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateImplementation): Instead of hard coding to use base() for HTMLAllCollection and HTMLCollection we now
+        annotate the IDL file to use GenerateIsReachable=ImplBaseRoot.
+        * bindings/scripts/CodeGeneratorV8.pm:
+        (GenerateVisitDOMWrapper): Generate visitDOMWrapper if GenerateIsReachable is ImplBaseRoot.
+        * bindings/scripts/IDLAttributes.txt: Added ImplBaseRoot.
+        * html/HTMLAllCollection.idl: Added annotations.
+        * html/HTMLCollection.idl: Ditto.
+
 2012-06-29  Tony Chang  <[email protected]>
 
         All child elements of a flex container should be turned into a flex item

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (121614 => 121615)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2012-06-30 03:27:12 UTC (rev 121614)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2012-06-30 03:32:05 UTC (rev 121615)
@@ -2346,7 +2346,7 @@
                 $rootString .= "    void* root = WebCore::root(element);\n";
             } elsif ($interfaceName eq "CanvasRenderingContext") {
                 $rootString  = "    void* root = WebCore::root(js${implClassName}->impl()->canvas());\n";
-            } elsif ($interfaceName eq "HTMLCollection" or $interfaceName eq "HTMLAllCollection") {
+            } elsif (GetGenerateIsReachable($dataNode) eq "ImplBaseRoot") {
                 $rootString  = "    void* root = WebCore::root(js${implClassName}->impl()->base());\n";
             } else {
                 $rootString  = "    void* root = WebCore::root(js${implClassName}->impl());\n";

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm (121614 => 121615)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2012-06-30 03:27:12 UTC (rev 121614)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2012-06-30 03:32:05 UTC (rev 121615)
@@ -214,12 +214,14 @@
 END
     if (GetGenerateIsReachable($dataNode) eq  "ImplElementRoot" ||
         GetGenerateIsReachable($dataNode) eq  "ImplOwnerRoot" ||
-        GetGenerateIsReachable($dataNode) eq  "ImplOwnerNodeRoot") {
+        GetGenerateIsReachable($dataNode) eq  "ImplOwnerNodeRoot" ||
+        GetGenerateIsReachable($dataNode) eq  "ImplBaseRoot") {
 
         my $methodName;
         $methodName = "element" if (GetGenerateIsReachable($dataNode) eq "ImplElementRoot");
         $methodName = "owner" if (GetGenerateIsReachable($dataNode) eq "ImplOwnerRoot");
         $methodName = "ownerNode" if (GetGenerateIsReachable($dataNode) eq "ImplOwnerNodeRoot");
+        $methodName = "base" if (GetGenerateIsReachable($dataNode) eq "ImplBaseRoot");
 
         push(@implContent, <<END);
     if (Node* owner = impl->${methodName}()) {

Modified: trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt (121614 => 121615)


--- trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt	2012-06-30 03:27:12 UTC (rev 121614)
+++ trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt	2012-06-30 03:32:05 UTC (rev 121615)
@@ -52,7 +52,7 @@
 DoNotCheckSecurityOnSetter
 EventTarget
 ExtendsDOMGlobalObject
-GenerateIsReachable=|Impl|ImplContext|ImplDocument|ImplElementRoot|ImplFrame
+GenerateIsReachable=ImplElementRoot|ImplBaseRoot
 Immutable
 ImplementedAs=*
 IndexedGetter
@@ -75,7 +75,7 @@
 JSCustomSetter
 JSCustomToJSObject
 JSCustomToNativeObject
-JSGenerateIsReachable=|Impl|ImplContext|ImplDocument|ImplElementRoot|ImplFrame
+JSGenerateIsReachable=|Impl|ImplContext|ImplDocument|ImplElementRoot|ImplFrame|ImplBaseRoot
 JSGenerateToJSObject
 JSGenerateToNativeObject
 JSInlineGetOwnPropertySlot
@@ -116,6 +116,6 @@
 V8DoNotCheckSignature
 V8EnabledAtRuntime=*
 V8EnabledPerContext=*
-V8GenerateIsReachable=|ImplElementRoot|ImplOwnerRoot|ImplOwnerNodeRoot
+V8GenerateIsReachable=ImplElementRoot|ImplOwnerRoot|ImplOwnerNodeRoot|ImplBaseRoot
 V8ReadOnly
 V8Unforgeable

Modified: trunk/Source/WebCore/html/HTMLAllCollection.idl (121614 => 121615)


--- trunk/Source/WebCore/html/HTMLAllCollection.idl	2012-06-30 03:27:12 UTC (rev 121614)
+++ trunk/Source/WebCore/html/HTMLAllCollection.idl	2012-06-30 03:32:05 UTC (rev 121615)
@@ -30,7 +30,8 @@
         NamedGetter,
         CustomCall,
         MasqueradesAsUndefined,
-        JSGenerateIsReachable
+        GenerateIsReachable=ImplBaseRoot,
+        V8DependentLifetime
     ] HTMLAllCollection {
         readonly attribute unsigned long length;
         [Custom] Node item(in [Optional=DefaultIsUndefined] unsigned long index);

Modified: trunk/Source/WebCore/html/HTMLCollection.idl (121614 => 121615)


--- trunk/Source/WebCore/html/HTMLCollection.idl	2012-06-30 03:27:12 UTC (rev 121614)
+++ trunk/Source/WebCore/html/HTMLCollection.idl	2012-06-30 03:32:05 UTC (rev 121615)
@@ -24,7 +24,8 @@
         IndexedGetter,
         NamedGetter,
         CustomToJSObject,
-        JSGenerateIsReachable,
+        GenerateIsReachable=ImplBaseRoot,
+        V8DependentLifetime,
         ObjCPolymorphic
     ] HTMLCollection {
         readonly attribute unsigned long length;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to