-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
navigating-across-documents: additional revisions, and additions 010-017
- Loading branch information
Showing
20 changed files
with
391 additions
and
178 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
...documents/010-form-action-javascript-url-document-writes-script-element-intermediary.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> | ||
<iframe id="test" name="test"></iframe> | ||
<form target="test" action="javascript:document.write(`<script>parent.onjsurl({data:'javascript:url'});</script>`);1"></form> | ||
<a target="test" onclick="document.forms[0].submit();" href="href.html">Test</a> | ||
<script> | ||
window.onjsurl = window.onmessage = function(e) { | ||
parent.postMessage(e.data, "*"); | ||
}; | ||
window.onload = function() { | ||
document.querySelector("a").click(); | ||
}; | ||
</script> |
39 changes: 39 additions & 0 deletions
39
...ating-across-documents/010-form-action-javascript-url-document-writes-script-element.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,39 @@ | ||
<!doctype html> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigating-across-documents"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/links.html#following-hyperlinks"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/browsing-the-web.html#javascript-protocol"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#concept-form-submit"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#submit-get-action"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#plan-to-navigate"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#planned-navigation"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/webappapis.html#dom-manipulation-task-source"> | ||
<title>Link with onclick form submit to navigate "javascript: url" that document.writes a script in a nested browsing context, is aborted by href navigation</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<div id="log"></div> | ||
<iframe src="010-form-action-javascript-url-document-writes-script-element-intermediary.html"></iframe> | ||
<script> | ||
var test = async_test(); | ||
window.onjsurl = window.onmessage = test.step_func_done(function(e) { | ||
assert_equals(e.data, "href", "'javascript: url' code is expected to run asynchronously."); | ||
}); | ||
</script> | ||
|
||
<!-- | ||
In an iframe... | ||
1. This test creates an iframe, a form with `action="javascript: ..."` (which implicitly returns | ||
a string containing a script element that will attempt to call a synchronous handler in the intermediary) and an anchor with both an `onclick` and `href`. | ||
2. The test "clicks" the anchor, triggering the `onclick` handler operation, | ||
which will attempt to submit the form, which targets the iframe. | ||
3. The form action "javascript: url" navigation is queued in a task which contains the | ||
steps to evaluate the code contents. | ||
4. Navigating the iframe to the anchor's `href` must cancel the iframe | ||
"javascript: url" navigation. | ||
5. If the semantics are implemented correctly, a single message will be | ||
received from href.html | ||
(There will be no message from the "javascript: url" code, because it | ||
is aborted by the navigation to "href.html") | ||
--> |
20 changes: 20 additions & 0 deletions
20
...vigating-across-documents/010-form-action-javascript-url-executes-async-intermediary.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> | ||
<iframe id="test" name="test"></iframe> | ||
<form target="test" action="javascript:((e,n)=>{while(e()<n);return 1;})(Date.now,Date.now()+4000);"></form> | ||
<a target="test" onclick="times.push(Date.now());document.forms[0].submit();times.push(Date.now());" href="href.html">Test</a> | ||
<script> | ||
var times = []; | ||
window.onmessage = function(e) { | ||
// Prevent further calls | ||
window.onmessage = null; | ||
|
||
if (times.length === 0 || times[1] - times[0] >= 4000) { | ||
parent.postMessage("FAIL", "*"); | ||
return; | ||
} | ||
parent.postMessage(e.data, "*"); | ||
}; | ||
window.onload = function() { | ||
document.querySelector("a").click(); | ||
}; | ||
</script> |
39 changes: 39 additions & 0 deletions
39
...ng-the-web/navigating-across-documents/010-form-action-javascript-url-executes-async.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,39 @@ | ||
<!doctype html> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigating-across-documents"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/links.html#following-hyperlinks"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/browsing-the-web.html#javascript-protocol"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#concept-form-submit"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#submit-get-action"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#plan-to-navigate"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#planned-navigation"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/webappapis.html#dom-manipulation-task-source"> | ||
<title>Link with onclick form submit to navigate "javascript: url" that executes blocking code, which should be evaluated async. Handling activation behavior/onclick should occur before the href navigation</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<div id="log"></div> | ||
<iframe src="010-form-action-javascript-url-executes-async-intermediary.html"></iframe> | ||
<script> | ||
var test = async_test(); | ||
window.onjsurl = window.onmessage = test.step_func_done(function(e) { | ||
assert_equals(e.data, "href", "'javascript: url' code is expected to run asynchronously."); | ||
}); | ||
</script> | ||
|
||
<!-- | ||
In an iframe... | ||
1. This test creates an iframe, a form with `action="javascript: ..."` (which implicitly returns | ||
a string containing a script element that will attempt to call a synchronous handler in the intermediary) and an anchor with both an `onclick` and `href`. | ||
2. The test "clicks" the anchor, triggering the `onclick` handler operation, | ||
which will attempt to submit the form, which targets the iframe. | ||
3. The form action "javascript: url" navigation is queued in a task which contains the | ||
steps to evaluate the code contents. | ||
4. Navigating the iframe to the anchor's `href` must cancel the iframe | ||
"javascript: url" navigation. | ||
5. If the semantics are implemented correctly, a single message will be | ||
received from href.html | ||
(There will be no message from the "javascript: url" code, because it | ||
is aborted by the navigation to "href.html") | ||
--> |
12 changes: 12 additions & 0 deletions
12
...-across-documents/010-form-action-javascript-url-returns-script-element-intermediary.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> | ||
<iframe id="test" name="test"></iframe> | ||
<form target="test" action="javascript:`<script>parent.onjsurl({data:'javascript:url'});</script>`"></form> | ||
<a target="test" onclick="document.forms[0].submit();" href="href.html">Test</a> | ||
<script> | ||
window.onjsurl = window.onmessage = function(e) { | ||
parent.postMessage(e.data, "*"); | ||
}; | ||
window.onload = function() { | ||
document.querySelector("a").click(); | ||
}; | ||
</script> |
39 changes: 39 additions & 0 deletions
39
...eb/navigating-across-documents/010-form-action-javascript-url-returns-script-element.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,39 @@ | ||
<!doctype html> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigating-across-documents"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/links.html#following-hyperlinks"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/browsing-the-web.html#javascript-protocol"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#concept-form-submit"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#submit-get-action"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#plan-to-navigate"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#planned-navigation"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/webappapis.html#dom-manipulation-task-source"> | ||
<title>Link with onclick form submit to navigate "javascript: url" that returns a string containing a script to write to a nested browsing context, is aborted by href navigation</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<div id="log"></div> | ||
<iframe src="010-form-action-javascript-url-returns-script-element-intermediary.html"></iframe> | ||
<script> | ||
var test = async_test(); | ||
window.onjsurl = window.onmessage = test.step_func_done(function(e) { | ||
assert_equals(e.data, "href", "'javascript: url' code is expected to run asynchronously."); | ||
}); | ||
</script> | ||
|
||
<!-- | ||
In an iframe... | ||
1. This test creates an iframe, a form with `action="javascript: ..."` (which implicitly returns | ||
a string containing a script element that will attempt to call a synchronous handler in the intermediary) and an anchor with both an `onclick` and `href`. | ||
2. The test "clicks" the anchor, triggering the `onclick` handler operation, | ||
which will attempt to submit the form, which targets the iframe. | ||
3. The form action "javascript: url" navigation is queued in a task which contains the | ||
steps to evaluate the code contents. | ||
4. Navigating the iframe to the anchor's `href` must cancel the iframe | ||
"javascript: url" navigation. | ||
5. If the semantics are implemented correctly, a single message will be | ||
received from href.html | ||
(There will be no message from the "javascript: url" code, because it | ||
is aborted by the navigation to "href.html") | ||
--> |
12 changes: 12 additions & 0 deletions
12
...tion-javascript-url-document-writes-script-element-delayed-href-cancels-intermediary.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> | ||
<iframe id="test" name="test"></iframe> | ||
<form target="test" action="javascript:`<script>parent.onjsurl({data:'javascript:url'});</script>`"></form> | ||
<a target="test" onclick="document.forms[0].submit();" href="href.html?pipe=trickle(d2)">Test</a> | ||
<script> | ||
window.onjsurl = window.onmessage = function(e) { | ||
parent.postMessage(e.data, "*"); | ||
}; | ||
window.onload = function() { | ||
document.querySelector("a").click(); | ||
}; | ||
</script> |
47 changes: 15 additions & 32 deletions
47
...javascript-url-aborted-by-navigation.html → ...-script-element-delayed-href-cancels.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,56 +1,39 @@ | ||
<!doctype html> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigating-across-documents"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/links.html#following-hyperlinks"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/browsing-the-web.html#javascript-protocol"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#concept-form-submit"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#submit-get-action"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#plan-to-navigate"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#planned-navigation"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/webappapis.html#dom-manipulation-task-source"> | ||
<title>Link with onclick form submit to navigate "javascript: url" in nested browsing context, is aborted by href navigation</title> | ||
<title>Link with onclick form submit to navigate "javascript: url" that document.writes a script in a nested browsing context, is aborted by href navigation</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<div id="log"></div> | ||
<iframe id="test" name="test"></iframe> | ||
<!-- Everything seen in the action="" is necessary to prevent a blank page in Chrome --> | ||
<form target="test" action="javascript:parent.postMessage(location.href, '*');"></form> | ||
<a target="test" onclick="document.forms[0].submit();reports.push('onclick');" href="href.html">Test</a> | ||
<iframe src="011-form-action-javascript-url-document-writes-script-element-delayed-href-cancels-intermediary.html"></iframe> | ||
<script> | ||
var test = async_test(); | ||
var reports = []; | ||
|
||
window.onmessage = test.step_func(function(e) { | ||
reports.push(e.data); | ||
// "href" is expected last, if this is not received last or | ||
// not received at all, the test must fail. | ||
if (e.data === "href") { | ||
assert_equals(reports[0], "click"); | ||
assert_equals(reports[1], "onclick"); | ||
assert_equals(reports[2], "href"); | ||
assert_equals(reports.length, 3); | ||
} else { | ||
|
||
|
||
} | ||
test.done(); | ||
}); | ||
|
||
test.step(function() { | ||
reports.push("click"); | ||
document.querySelector("a").click(); | ||
window.onjsurl = window.onmessage = test.step_func_done(function(e) { | ||
assert_equals(e.data, "href", "'javascript: url' code is expected to run asynchronously."); | ||
}); | ||
</script> | ||
|
||
<!-- | ||
In an iframe... | ||
1. This test creates an iframe, a form with `action="javascript:...", and | ||
an anchor with both an `onclick` and `href`. | ||
2. The test "clicks" the anchor, triggering the `onclick` handler operation, | ||
which will attempt to submit the form, which targets the iframe. | ||
3. The form action "javascript: url" navigation is queued in a task. | ||
4. Navigating the iframe to the anchor's `href` must abort the iframe | ||
"javascript: url" navigation. | ||
5. If the semantics are implemented correctly, reports will be | ||
["click", "onclick", "href"]. | ||
(There will be no report from the "javascript: url" code, because it | ||
3. The form action "javascript: url" navigation is queued in a task which contains the | ||
steps to evaluate the code contents. | ||
4. Navigating the iframe to the anchor's `href` must cancel the iframe | ||
"javascript: url" navigation, regardless of the delayed response. | ||
5. If the semantics are implemented correctly, a single message will be | ||
received from href.html | ||
(There will be no message from the "javascript: url" code, because it | ||
is aborted by the navigation to "href.html") | ||
--> |
12 changes: 12 additions & 0 deletions
12
...-form-action-javascript-url-returns-script-element-delayed-href-cancels-intermediary.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> | ||
<iframe id="test" name="test"></iframe> | ||
<form target="test" action="javascript:`<script>parent.onjsurl({data:'javascript:url'});</script>`"></form> | ||
<a target="test" onclick="document.forms[0].submit();" href="href.html?pipe=trickle(d1)">Test</a> | ||
<script> | ||
window.onjsurl = window.onmessage = function(e) { | ||
parent.postMessage(e.data, "*"); | ||
}; | ||
window.onload = function() { | ||
document.querySelector("a").click(); | ||
}; | ||
</script> |
39 changes: 39 additions & 0 deletions
39
...documents/011-form-action-javascript-url-returns-script-element-delayed-href-cancels.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,39 @@ | ||
<!doctype html> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigating-across-documents"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/links.html#following-hyperlinks"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/browsing-the-web.html#javascript-protocol"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#concept-form-submit"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#submit-get-action"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#plan-to-navigate"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#planned-navigation"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/webappapis.html#dom-manipulation-task-source"> | ||
<title>Link with onclick form submit to navigate "javascript: url" that returns a string containing a script to write to a nested browsing context, is aborted by href navigation</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<div id="log"></div> | ||
<iframe src="011-form-action-javascript-url-returns-script-element-delayed-href-cancels-intermediary.html"></iframe> | ||
<script> | ||
var test = async_test(); | ||
window.onjsurl = window.onmessage = test.step_func_done(function(e) { | ||
assert_equals(e.data, "href", "'javascript: url' code is expected to run asynchronously."); | ||
}); | ||
</script> | ||
|
||
<!-- | ||
In an iframe... | ||
1. This test creates an iframe, a form with `action="javascript:...", and | ||
an anchor with both an `onclick` and `href`. | ||
2. The test "clicks" the anchor, triggering the `onclick` handler operation, | ||
which will attempt to submit the form, which targets the iframe. | ||
3. The form action "javascript: url" navigation is queued in a task which contains the | ||
steps to evaluate the code contents. | ||
4. Navigating the iframe to the anchor's `href` must cancel the iframe | ||
"javascript: url" navigation, regardless of the delayed response. | ||
5. If the semantics are implemented correctly, a single message will be | ||
received from href.html | ||
(There will be no message from the "javascript: url" code, because it | ||
is aborted by the navigation to "href.html") | ||
--> |
44 changes: 0 additions & 44 deletions
44
html/browsers/browsing-the-web/navigating-across-documents/012-async-timeout.html
This file was deleted.
Oops, something went wrong.
46 changes: 0 additions & 46 deletions
46
...ers/browsing-the-web/navigating-across-documents/012-blocking-then-async-postmessage.html
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.