Index: third_party/WebKit/LayoutTests/fast/dom/HTMLCollection/HTMLCollection-namedItem-invalidate-no-crash.html |
diff --git a/third_party/WebKit/LayoutTests/fast/dom/HTMLCollection/HTMLCollection-namedItem-invalidate-no-crash.html b/third_party/WebKit/LayoutTests/fast/dom/HTMLCollection/HTMLCollection-namedItem-invalidate-no-crash.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5f3e8c9580933b0b2fd23573b1feb6193bbead76 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/fast/dom/HTMLCollection/HTMLCollection-namedItem-invalidate-no-crash.html |
@@ -0,0 +1,30 @@ |
+<!DOCTYPE html> |
+<html> |
+<head> |
+<script src="../../../resources/js-test.js"></script> |
+</head> |
+<body> |
+<pre id=p1></pre> |
+<pre id=p1></pre> |
+<pre id=p1></pre> |
+<script> |
+description("Invalidation of cached id-name collections must not crash."); |
+ |
+if (window.testRunner) |
+ testRunner.dumpAsText(); |
+ |
+var is = window["p1"]; |
+var div = document.createElement('div'); |
+document.body.appendChild(div); |
+div.appendChild(is[is.length - 2]); |
+// Invalidate the underlying cache. |
+is.namedItem("p1").remove(); |
+// Out of bounds index, updates the collection length. |
+is.item(13); |
+// Remove parent of collection member; must invalidate cached length. |
+div.remove(); |
+// Force re-caching. |
+is.namedItem("p1"); |
+</script> |
+</body> |
+</html> |