Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Unified Diff: LayoutTests/fast/dom/Attr/script-tests/access-after-element-destruction.js

Issue 317203005: Oilpan: Temporary fix for leaks through mapping from element to attribute node list. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Maintain Attr value when Element is deent dies. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/core/dom/Attr.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/dom/Attr/script-tests/access-after-element-destruction.js
diff --git a/LayoutTests/fast/dom/Attr/script-tests/access-after-element-destruction.js b/LayoutTests/fast/dom/Attr/script-tests/access-after-element-destruction.js
index 6dc85c773c7c8b2a978bf3c24cce7d3b879855f2..d36a03ff40925a317fad33432106fbcefcfe6626 100644
--- a/LayoutTests/fast/dom/Attr/script-tests/access-after-element-destruction.js
+++ b/LayoutTests/fast/dom/Attr/script-tests/access-after-element-destruction.js
@@ -1,47 +1,43 @@
description("Tests that accessing Attr after its Element has been destroyed works without crashing.");
-function gc()
-{
- if (window.GCController)
- return GCController.collect();
-
- // Trigger garbage collection indirectly.
- for (var i = 0; i < 100000; i++)
- new String(i);
-}
+jsTestIsAsync = true;
var element = document.createElement("p");
element.setAttribute("a", "b");
var attributes = element.attributes;
element = null;
+var attr = null;
-gc();
+asyncGC(function() {
+ shouldBe("attributes.length", "1");
+ shouldBe("attributes[0]", "attributes.item(0)");
+ shouldBe("attributes.getNamedItem('a')", "attributes.item(0)");
-shouldBe("attributes.length", "1");
-shouldBe("attributes[0]", "attributes.item(0)");
-shouldBe("attributes.getNamedItem('a')", "attributes.item(0)");
+ shouldBe("attributes.item(0).name", "'a'");
+ shouldBe("attributes.item(0).value", "'b'");
-shouldBe("attributes.item(0).name", "'a'");
-shouldBe("attributes.item(0).value", "'b'");
+ attributes.item(0).value = 'c';
-attributes.item(0).value = 'c';
+ shouldBe("attributes.item(0).value", "'c'");
-shouldBe("attributes.item(0).value", "'c'");
+ attributes.removeNamedItem('a');
-attributes.removeNamedItem('a');
+ shouldBe("attributes.length", "0");
-shouldBe("attributes.length", "0");
+ element = document.createElement("p");
+ element.setAttribute("a", "b");
+ attr = element.attributes.item(0);
+ element = null;
-element = document.createElement("p");
-element.setAttribute("a", "b");
-var attr = element.attributes.item(0);
-element = null;
+ asyncGC(function() {
-gc();
+ shouldBe("attr.name", "'a'");
+ shouldBe("attr.value", "'b'");
-shouldBe("attr.name", "'a'");
-shouldBe("attr.value", "'b'");
+ attr.value = 'c';
-attr.value = 'c';
+ shouldBe("attr.value", "'c'");
-shouldBe("attr.value", "'c'");
+ finishJSTest();
+ });
+});
« no previous file with comments | « no previous file | Source/core/dom/Attr.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698