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

Unified Diff: third_party/WebKit/LayoutTests/fast/dom/Window/orphaned-frame-access.html

Issue 2706923002: Rework security checks to be based on Window rather than Frame. (Closed)
Patch Set: Fix test typo Created 3 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: third_party/WebKit/LayoutTests/fast/dom/Window/orphaned-frame-access.html
diff --git a/third_party/WebKit/LayoutTests/fast/dom/Window/orphaned-frame-access.html b/third_party/WebKit/LayoutTests/fast/dom/Window/orphaned-frame-access.html
index 1a0ec1bdbf6cde672c173c5520e835b0fbcfc853..3d2c234b934471056898936b1c5a741e5dfeaacf 100644
--- a/third_party/WebKit/LayoutTests/fast/dom/Window/orphaned-frame-access.html
+++ b/third_party/WebKit/LayoutTests/fast/dom/Window/orphaned-frame-access.html
@@ -2,33 +2,27 @@
<html>
<head>
<title>Null frame access tests</title>
-<script src="../../../resources/js-test.js"></script>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
<script>
-description("This tests access to a window with a null frame. You should see \"PASS\" for each of the three tests below.");
+var t = async_test('This tests access to a window with a null frame.');
-window.jsTestIsAsync = true;
-window.onload = function() {
- if (window.testRunner) {
- testRunner.dumpAsText();
- testRunner.waitUntilDone();
- }
+window.onload = t.step_func(function () {
+ var childWindow = window[0];
+ childWindow.frameElement.remove();
+ // Removing the owner element from the DOM should null the frame. In Blink,
+ // this can be observed by checking childWindow.parent == null.
+ assert_equals(childWindow.parent, null);
- var tag = document.getElementById('subframe');
- var win = tag.contentWindow;
- // remove the element so the window has a null frame
- tag.parentNode.removeChild(tag);
-
- // schedule to run after the frame is null
- asyncGC(function() {
- debug("missing property: " + (win.test || 'PASS'))
- debug("missing array index: " + (win[20] || 'PASS'));
- debug("missing interface object: " + (win.Comment || 'PASS'));
- finishJSTest();
- });
-};
+ assert_equals(childWindow.test, 'abc', 'Named property should still be accessible.');
+ assert_equals(childWindow[20], '123', 'Indexed property should still be accessible.');
+ // TODO(dcheng): Why does this return null?
+ assert_equals(childWindow.Comment, undefined, 'Interface Object should be gone.');
dcheng 2017/03/06 06:59:46 I don't understand this, btw... but that seems to
+ t.done();
+});
</script>
</head>
<body>
-<iframe id="subframe" src="data:text/html,&lt;script&gt;window.test='FAIL ... ';window[20]='FAIL ... ';&lt;/script&gt;" />
+<iframe id="subframe" src="data:text/html,&lt;script&gt;window.test='abc';window[20]='123';&lt;/script&gt;" />
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698