Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor, clean up, validate browsing context names tests
- Refactor _self tests - Rename test files for consistency - Refactor _blank tests - Refactor default-002 test to be a valid test - Refactor choose-existing test
- Loading branch information
1 parent
1df4318
commit afa8f8e
Showing
31 changed files
with
126 additions
and
163 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
25 changes: 0 additions & 25 deletions
25
html/browsers/windows/browsing-context-names/browsing-context-choose-existing.html
This file was deleted.
Oops, something went wrong.
20 changes: 0 additions & 20 deletions
20
html/browsers/windows/browsing-context-names/browsing-context-choose-self-1.html
This file was deleted.
Oops, something went wrong.
20 changes: 0 additions & 20 deletions
20
html/browsers/windows/browsing-context-names/browsing-context-choose-self-2.html
This file was deleted.
Oops, something went wrong.
File renamed without changes.
21 changes: 21 additions & 0 deletions
21
html/browsers/windows/browsing-context-names/choose-_blank-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,21 @@ | ||
<!doctype html> | ||
<title>Link with target=_blank, rel=noreferrer</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/common/PrefixedLocalStorage.js"></script> | ||
<div id="log"></div> | ||
<a href="resources/report-has-opener.html" rel="noreferrer" target="_blank">Link</a> | ||
<script> | ||
var prefixedStorage; | ||
setup (() => prefixedStorage = new PrefixedLocalStorageTest()); | ||
|
||
async_test(t => { | ||
t.add_cleanup(() => prefixedStorage.cleanup()); | ||
var a = document.getElementsByTagName('a')[0]; | ||
a.href = prefixedStorage.url(a.href); | ||
prefixedStorage.onSet('hasOpener', t.step_func_done(e => { | ||
assert_equals(e.newValue, 'false'); | ||
})); | ||
a.click(); | ||
}, 'Context for opened noreferrer link targeted to "_blank" should not have opener reference'); | ||
</script> |
20 changes: 20 additions & 0 deletions
20
html/browsers/windows/browsing-context-names/choose-_blank-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,20 @@ | ||
<!doctype html> | ||
<title>Link with target=_blank, no rel</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/common/PrefixedLocalStorage.js"></script> | ||
<div id="log"></div> | ||
<a href="resources/report-has-opener.html" target="_blank">Link</a> | ||
<script> | ||
var prefixedStorage; | ||
setup(() => prefixedStorage = new PrefixedLocalStorageTest()); | ||
async_test(t => { | ||
t.add_cleanup(() => prefixedStorage.cleanup()); | ||
prefixedStorage.onSet('hasOpener', t.step_func_done(e => { | ||
assert_equals(e.newValue, 'true'); | ||
})); | ||
var a = document.getElementsByTagName('a')[0]; | ||
a.href = prefixedStorage.url(a.href); | ||
a.click(); | ||
}, 'Context created by link targeting "_blank" should retain opener reference'); | ||
</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
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
15 changes: 15 additions & 0 deletions
15
html/browsers/windows/browsing-context-names/choose-_self-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 - the given name is '_self'</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> | ||
<iframe src="resources/choose-_self-001-iframe.html" style="display:none"></iframe> | ||
<script> | ||
async_test(t => { | ||
window.addEventListener('message', t.step_func_done(e => { | ||
assert_equals(e.data.name, 'myownself'); | ||
}), false); | ||
}, 'The current browsing context must be chosen if the given name is "_self"'); | ||
</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
16 changes: 16 additions & 0 deletions
16
html/browsers/windows/browsing-context-names/choose-default-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,16 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>HTML Test: Browsing context names - empty string</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.isTop, false); | ||
assert_equals(e.data.name, 'hellothere', 'Empty-string browsing context should choose current context'); | ||
}), false); | ||
}, 'The current browsing context must be chosen if the given name is empty string'); | ||
</script> | ||
<iframe name="hellothere" src="resources/choose-default-002-iframe.html"></iframe> |
17 changes: 17 additions & 0 deletions
17
html/browsers/windows/browsing-context-names/choose-existing-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,17 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>HTML Test: Choose browsing context - the given name is same as an existing browsing context's name</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> | ||
<iframe src="resources/choose-existing-001-iframe.html" style="display:none"></iframe> | ||
<iframe name="iExist" style="display:none"></iframe> | ||
<script> | ||
async_test(t => { | ||
window.addEventListener('message', t.step_func_done(e => { | ||
assert_equals(e.data.name, 'iExist'); | ||
}), false); | ||
|
||
}, 'An existing browsing context must be chosen if the given name is the same as its name'); | ||
</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
2 changes: 1 addition & 1 deletion
2
...xt-names/resources/parent-top-nested.html → .../resources/choose-_parent-002-iframe.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 |
---|---|---|
@@ -1,4 +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> | ||
<iframe name="iframeChild" src="open-in-_parent.html"></iframe> |
2 changes: 1 addition & 1 deletion
2
...g-context-names/resources/parent-top.html → .../resources/choose-_parent-002-window.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
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...t-names/resources/parent-top-replace.html → .../resources/choose-_parent-003-window.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 |
---|---|---|
@@ -1,4 +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> | ||
<iframe name="iframeOpener" src="choose-_parent-003-iframe.html"></iframe> |
2 changes: 1 addition & 1 deletion
2
...esources/parent-iframe-insensitive-1.html → ...esources/choose-_parent-004-iframe-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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>HTML Test: browsing context name - parent</title> | ||
<iframe src="parent-iframe-insensitive-2.html"></iframe> | ||
<iframe src="choose-_parent-004-iframe-2.html"></iframe> |
File renamed without changes.
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
17 changes: 17 additions & 0 deletions
17
html/browsers/windows/browsing-context-names/resources/choose-default-002-iframe.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> | ||
<html> | ||
<meta charset="utf-8"> | ||
<title>HTML Test: browsing context name - Empty string</title> | ||
<link rel="author" title="Intel" href="http://www.intel.com/"> | ||
<body onload="followLink()"> | ||
</body> | ||
<script> | ||
function followLink() { | ||
var a = document.createElement('a'); | ||
a.href = 'post-to-top.html'; | ||
a.target = ''; // Target is empty string | ||
document.body.appendChild(a); | ||
a.click(); | ||
} | ||
</script> | ||
</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
File renamed without changes.
8 changes: 8 additions & 0 deletions
8
html/browsers/windows/browsing-context-names/resources/report-has-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,8 @@ | ||
<!doctype html> | ||
<script src="/common/PrefixedLocalStorage.js"></script> | ||
<script> | ||
var prefixedStorage = new PrefixedLocalStorageResource({ | ||
close_on_cleanup: true | ||
}); | ||
prefixedStorage.setItem('hasOpener', window.opener !== null); | ||
</script> |
This file was deleted.
Oops, something went wrong.