-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5150 from lyzadanger/browsing-context-names-parent
HTML: Extend Test Coverage for _parent named browsing context (7.1.5)
- Loading branch information
Showing
19 changed files
with
140 additions
and
28 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
html/browsers/windows/browsing-context-names/browsing-context-choose-parent-001.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>HTML Test: Choose browsing context - '_parent'</title> | ||
<link rel="author" title="Intel" href="http://www.intel.com/"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<div id="log"></div> | ||
<script> | ||
async_test(t => { | ||
window.addEventListener('message', t.step_func_done(e => { | ||
assert_equals(e.data.name, 'parentWin'); | ||
})); | ||
}, 'The parent browsing context must be chosen if the given name is `_parent`'); | ||
</script> | ||
<iframe id="embedded" src="resources/parent-iframe-1.html" name="parentWin" style="display:none"></iframe> |
17 changes: 17 additions & 0 deletions
17
html/browsers/windows/browsing-context-names/browsing-context-choose-parent-002.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>HTML Test: Choose browsing context - '_parent' (nested contexts)</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<div id="log"></div> | ||
<script> | ||
async_test(t => { | ||
var topWindow; | ||
t.add_cleanup(() => topWindow.close()); | ||
window.addEventListener('message', t.step_func_done(e => { | ||
assert_equals(e.data.name, 'iframeParent'); | ||
assert_false(e.data.isTop, 'window.parent is not top'); | ||
})); | ||
topWindow = window.open('resources/parent-top.html', '_blank'); | ||
}, 'choosing _parent context: multiple nested contexts'); | ||
</script> |
17 changes: 17 additions & 0 deletions
17
html/browsers/windows/browsing-context-names/browsing-context-choose-parent-003.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>HTML Test: Choose browsing context - '_parent' (via window.open)</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<div id="log"></div> | ||
<script> | ||
async_test(t => { | ||
var topWindow; | ||
t.add_cleanup(() => topWindow.close()); | ||
window.addEventListener('message', t.step_func_done(e => { | ||
assert_equals(e.data.name, 'parentTopReplace'); | ||
assert_equals(e.data.isTop, true); | ||
})); | ||
topWindow = window.open('resources/parent-top-replace.html', 'parentTopReplace'); | ||
}, '_parent should reuse window.parent context'); | ||
</script> |
16 changes: 16 additions & 0 deletions
16
html/browsers/windows/browsing-context-names/browsing-context-choose-parent-004.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>HTML Test: Choose browsing context - '_parent' (case-sensitivity)</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<div id="log"></div> | ||
<iframe src="resources/parent-iframe-insensitive-1.html" name="parentWin" style="display:none"></iframe> | ||
|
||
<script> | ||
async_test(t => { | ||
window.addEventListener('message', t.step_func_done(e => { | ||
assert_equals(e.data.name, 'parentWin', "The browsing context name should be 'parentWin'."); | ||
assert_equals(e.data.isTop, false); | ||
})); | ||
}, 'choosing _parent context should be case-insensitive'); | ||
</script> |
20 changes: 0 additions & 20 deletions
20
html/browsers/windows/browsing-context-names/browsing-context-choose-parent.html
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
html/browsers/windows/browsing-context-names/resources/parent-iframe-3.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>HTML Test: browsing context name - parent</title> | ||
<script> | ||
window.open("post-to-opener.html", "_parent"); | ||
</script> |
4 changes: 4 additions & 0 deletions
4
html/browsers/windows/browsing-context-names/resources/parent-iframe-insensitive-1.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>HTML Test: browsing context name - parent</title> | ||
<iframe src="parent-iframe-insensitive-2.html"></iframe> |
8 changes: 8 additions & 0 deletions
8
html/browsers/windows/browsing-context-names/resources/parent-iframe-insensitive-2.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>HTML Test: browsing context name - parent (case-insensitive)</title> | ||
<script> | ||
|
||
window.open("post-to-top-or-close.html", "_pARent"); | ||
|
||
</script> |
4 changes: 4 additions & 0 deletions
4
html/browsers/windows/browsing-context-names/resources/parent-top-nested.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>HTML Test: browsing context name - parent: nested context</title> | ||
<iframe name="iframeChild" src="parent-iframe-2.html"></iframe> |
4 changes: 4 additions & 0 deletions
4
html/browsers/windows/browsing-context-names/resources/parent-top-replace.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>HTML Test: browsing context name - parent: top-level context (gets replaced)</title> | ||
<iframe name="iframeOpener" src="parent-iframe-3.html"></iframe> |
12 changes: 12 additions & 0 deletions
12
html/browsers/windows/browsing-context-names/resources/parent-top.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>HTML Test: browsing context name - parent: top-level context</title> | ||
<iframe name="iframeParent" src="parent-top-nested.html"></iframe> | ||
<script> | ||
// Relay a message from child context to opener context | ||
window.addEventListener('message', e => { | ||
if (window.opener) { | ||
window.opener.postMessage(e.data, '*'); | ||
} | ||
}); | ||
</script> |
12 changes: 12 additions & 0 deletions
12
html/browsers/windows/browsing-context-names/resources/post-to-opener.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>HTML Test: post window's name to top browsing context</title> | ||
<link rel="author" title="Intel" href="http://www.intel.com/"> | ||
<script> | ||
if (window.opener) { | ||
window.opener.postMessage({ | ||
name: window.name, | ||
isTop: (window.top === window) | ||
}, "*"); | ||
} | ||
</script> |
16 changes: 16 additions & 0 deletions
16
html/browsers/windows/browsing-context-names/resources/post-to-top-or-close.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>HTML Test: post window's name to top browsing context</title> | ||
<link rel="author" title="Intel" href="http://www.intel.com/"> | ||
<script> | ||
if (window.top === window) { | ||
// This is an implicit failure; go ahead and close now | ||
// so that this window isn't left hanging around | ||
window.close(); | ||
} else { | ||
top.postMessage({ | ||
name: window.name, | ||
isTop: (window.top === window) | ||
}, "*"); | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters