summaryrefslogtreecommitdiffstats
path: root/LayoutTests/fast/dom/Attr/script-tests/access-after-element-destruction.js
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-09-07 16:06:44 +0100
committerSteve Block <steveblock@google.com>2010-09-07 16:36:45 +0100
commiteff69b907ef2cd3a9af0351287a929c66f58e3f6 (patch)
treec0d8835711b71631a15c3fb20d93c195ee3d5064 /LayoutTests/fast/dom/Attr/script-tests/access-after-element-destruction.js
parent66945f3db6c497fb182ef8a187b8c69e683dbb26 (diff)
downloadexternal_webkit-eff69b907ef2cd3a9af0351287a929c66f58e3f6.zip
external_webkit-eff69b907ef2cd3a9af0351287a929c66f58e3f6.tar.gz
external_webkit-eff69b907ef2cd3a9af0351287a929c66f58e3f6.tar.bz2
Adds a number of fast/ LayoutTest directories to the triaged set
Tests are added at r66079. All tests pass fast/constructors/ fast/cookies/ fast/dom/Attr/ fast/dom/CSSStyleDeclaration/ fast/dom/DOMImplementation/ fast/dom/DeviceMotion/ fast/dom/EntityReference/ fast/dom/HTMLAnchorElement/ fast/dom/HTMLButtonElement/ fast/dom/HTMLFontElement/ fast/dom/HTMLFormElement/ fast/dom/HTMLHtmlElement/ fast/dom/HTMLKeygenElement/ fast/dom/HTMLLabelElement/ fast/dom/HTMLMetaElement/ fast/dom/HTMLTableRowElement/ fast/dom/HTMLTableSectionElement/ fast/dom/Node/ fast/dom/NodeList/ fast/dom/Selection/ fast/dom/StyleSheet/ fast/dom/Text/ fast/dom/TreeWalker/ fast/dom/beforeload/ fast/dom/getElementsByClassName/ fast/leaks/ Change-Id: I9a2c401151f7abf5bb22b764b1327022ab651e04
Diffstat (limited to 'LayoutTests/fast/dom/Attr/script-tests/access-after-element-destruction.js')
-rw-r--r--LayoutTests/fast/dom/Attr/script-tests/access-after-element-destruction.js55
1 files changed, 55 insertions, 0 deletions
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
new file mode 100644
index 0000000..91588a3
--- /dev/null
+++ b/LayoutTests/fast/dom/Attr/script-tests/access-after-element-destruction.js
@@ -0,0 +1,55 @@
+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);
+}
+
+var element = document.createElement("p");
+element.setAttribute("a", "b");
+var attributes = element.attributes;
+element = null;
+
+gc();
+
+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).specified", "true");
+shouldBe("attributes.item(0).value", "'b'");
+shouldBe("attributes.item(0).ownerElement.tagName", "'P'");
+shouldBe("attributes.item(0).style", "null");
+
+attributes.item(0).value = 'c';
+
+shouldBe("attributes.item(0).value", "'c'");
+
+attributes.removeNamedItem('a');
+
+shouldBe("attributes.length", "0");
+
+element = document.createElement("p");
+element.setAttribute("a", "b");
+var attr = element.attributes.item(0);
+element = null;
+
+gc();
+
+shouldBe("attr.name", "'a'");
+shouldBe("attr.specified", "true");
+shouldBe("attr.value", "'b'");
+shouldBe("attr.ownerElement.tagName", "'P'");
+shouldBe("attr.style", "null");
+
+attr.value = 'c';
+
+shouldBe("attr.value", "'c'");
+
+var successfullyParsed = true;