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

Unified Diff: LayoutTests/fast/dom/Window/name-and-opener-on-detached-window.html

Issue 203493005: Add more checks to prevent crashes when accessing name/opener properties (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase results Created 6 years, 9 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
Index: LayoutTests/fast/dom/Window/name-and-opener-on-detached-window.html
diff --git a/LayoutTests/fast/dom/Window/name-and-opener-on-detached-window.html b/LayoutTests/fast/dom/Window/name-and-opener-on-detached-window.html
new file mode 100644
index 0000000000000000000000000000000000000000..29dcafa2d321fb9bda28fec01311e78a9a15e480
--- /dev/null
+++ b/LayoutTests/fast/dom/Window/name-and-opener-on-detached-window.html
@@ -0,0 +1,26 @@
+<html>
+<head>
+<script src="../../../resources/js-test.js"></script>
+<script>
+var childWindow;
+var propertiesToVerify = [];
+
+function runTest()
+{
+ description("Tests that getting and setting name and opener on a cached DOMWindow after the associated frame is removed from a web page does not crash.");
+ var frame = document.getElementById("frame");
+ childWindow = frame.contentWindow;
+ childWindow.name = "oldname";
+ shouldBe("childWindow.name", "'oldname'");
+ frame.parentNode.removeChild(frame);
+ childWindow.opener = null;
+ shouldBeNull("childWindow.opener");
+ childWindow.name = "newname";
+ shouldBe("childWindow.name", "''");
+}
+</script>
+</head>
+<body>
+<iframe id="frame" src="about:blank" onload="runTest()"></iframe>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698