Skip to content

Commit

Permalink
navigating-across-documents: revisions and explanations for 010-015, …
Browse files Browse the repository at this point in the history
…plus new tests

commit ad4a48b
Author: Rick Waldron <[email protected]>
Date:   Mon Jan 15 14:23:53 2018 -0500

    Minor nits: use a string for js: url return; file name typo fix;

commit 083c1ee
Author: Rick Waldron <[email protected]>
Date:   Mon Jan 15 13:47:28 2018 -0500

    Replacement: 008.html will be replaced by this test.

commit 6c17335
Author: Rick Waldron <[email protected]>
Date:   Mon Jan 15 13:18:37 2018 -0500

    Major refactor: simplification, eliminate async false positives, consistent test + test-runner.html, convert comment blocks into test names and assertion descriptions

    - Eliminating use of postMessage as a test signaling mechanism serves to "reveal" async false positives.
    - Implement "*-runner.html" machinery for all tests that use an iframe as a "target nested browsing context", this will prevent tests from producing blank screens when run in webkit (where javascript: url code executions ignore target)
    - Compute "*-runner.html" for each test file, instead of maintaining the file name directly in each test file.

commit 43a1f83
Author: Rick Waldron <[email protected]>
Date:   Wed Jan 10 10:52:13 2018 -0500

    Minor fixes

commit 884ada3
Author: Rick Waldron <[email protected]>
Date:   Thu Nov 16 16:31:33 2017 -0500

    navigating-across-documents: additional revisions, and additions 010-017

commit 2826fc1
Author: Rick Waldron <[email protected]>
Date:   Wed Nov 1 15:47:32 2017 -0400

    navigating-across-documents: revisions and explanations for 010-*, 011, 012-*, 013, 014 & 015
  • Loading branch information
rwaldron committed Jan 30, 2018
1 parent 1702e9c commit 488bce5
Show file tree
Hide file tree
Showing 33 changed files with 472 additions and 119 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!doctype html>
<iframe id="test" name="test"></iframe>
<form target="test" action="javascript:(()=>{document.write(`<script>parent.verifyNavigation(false)</script>`); return `<!-- this should not be successful --><script>parent.verifyNavigation(false)</script>`})()"></form>
<a target="test" onclick="document.forms[0].submit();" href="call-verify-navigation.html">Test</a>
<script>
window.verifyNavigation = parent.verifyNavigation;
window.onload = function() {
document.querySelector("a").click();
};
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!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/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">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<iframe src=""></iframe>
<script>
const runner = location.href.slice(location.href.lastIndexOf("/") + 1, location.href.length)
.replace(".html", "-runner.html");

async_test(function(test) {

window.verifyNavigation = test.step_func_done(function(signal) {
assert_equals(signal, true, "The navigation via 'javascript: url' code was not canceled by the default href navigation. This might occur if the 'javascript:url' code is not evaluated async, and/or the default href navigation does not cancel the navigation via 'javascript: url'.");
});

document.querySelector("iframe").src = runner;

}, `A navigation via 'javascript: url' code (in ${runner}) must be evaluated async; to pass this test, that navigation must be aborted by the default href navigation (of the clicked link) before that evaluation can complete.`);
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!doctype html>
<iframe id="test" name="test"></iframe>
<form target="test" action="javascript:parent.verifyNavigation(false);'1';"><!-- 'javascript: url' ending with a "'1';" is intentional --></form>
<a target="test" onclick="document.forms[0].submit();" href="call-verify-navigation.html">Test</a>
<script>
window.verifyNavigation = parent.verifyNavigation;
window.onload = function() {
document.querySelector("a").click();
};
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!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/text-level-semantics.html#the-a-element">
<link rel="help" href="https://html.spec.whatwg.org/multipage/webappapis.html#the-event-handler-processing-algorithm">
<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/iframe-embed-object.html#the-iframe-element:about:blank">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<iframe src=""></iframe>
<script>
const runner = location.href.slice(location.href.lastIndexOf("/") + 1, location.href.length)
.replace(".html", "-runner.html");

async_test(function(test) {

window.verifyNavigation = test.step_func_done(function(signal) {
assert_equals(signal, true, "The navigation via 'javascript: url' code was not canceled by the default href navigation. This might occur if the 'javascript:url' code is not evaluated async, and/or the default href navigation does not cancel the navigation via 'javascript: url'.");
});

document.querySelector("iframe").src = runner;

}, `A navigation via 'javascript: url' code (in ${runner}) must be evaluated async; to pass this test, that navigation must be aborted by the default href navigation (of the clicked link) before that evaluation can complete.`);
</script>

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!doctype html>
<iframe id="test" name="test"></iframe>
<form target="test" action="javascript:document.write(`<!-- this should not be successful --><script>parent.verifyNavigation(false);</script>`);'1';"><!-- 'javascript: url' ending with a "'1';" is intentional --></form>
<a target="test" onclick="document.forms[0].submit();" href="call-verify-navigation.html">Test</a>
<script>
window.verifyNavigation = parent.verifyNavigation;
window.onload = function() {
document.querySelector("a").click();
};
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!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">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<iframe src=""></iframe>
<script>
const runner = location.href.slice(location.href.lastIndexOf("/") + 1, location.href.length)
.replace(".html", "-runner.html");

async_test(function(test) {

window.verifyNavigation = test.step_func_done(function(signal) {
assert_equals(signal, true, "The navigation via 'javascript: url' code was not canceled by the default href navigation. This might occur if the 'javascript:url' code is not evaluated async, and/or the default href navigation does not cancel the navigation via 'javascript: url'.");
});

document.querySelector("iframe").src = runner;

}, `A navigation via 'javascript: url' code (in ${runner}) must be evaluated async; to pass this test, that navigation must be aborted by the default href navigation (of the clicked link) before that evaluation can complete.`);
</script>

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!doctype html>
<iframe id="test" name="test"></iframe>
<form target="test" action="javascript:/*this should not be successful*/((e,n)=>{while(e()<n);parent.verifyNavigation(false);})(Date.now,Date.now()+4000);'1';"><!-- 'javascript: url' ending with a "'1';" is intentional --></form>
<a target="test" onclick="document.forms[0].submit();" href="call-verify-navigation.html">Test</a>
<script>
window.verifyNavigation = parent.verifyNavigation;
window.onload = function() {
document.querySelector("a").click();
};
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!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">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<iframe src=""></iframe>
<script>
const runner = location.href.slice(location.href.lastIndexOf("/") + 1, location.href.length)
.replace(".html", "-runner.html");

async_test(function(test) {

window.verifyNavigation = test.step_func_done(function(signal) {
assert_equals(signal, true, "The navigation via 'javascript: url' code was not canceled by the default href navigation. This might occur if the 'javascript:url' code is not evaluated async, and/or the default href navigation does not cancel the navigation via 'javascript: url'.");
});

document.querySelector("iframe").src = runner;

}, `A navigation via 'javascript: url' code (in: ${runner}) must be evaluated async; to pass this test, that navigation must be aborted by the default href navigation (of the clicked link) before that evaluation can complete. Most importantly: the execution of the code in the 'javascript:url' must NOT block the default href navigation.`);
</script>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!doctype html>
<iframe id="test" name="test"></iframe>
<form target="test" action="javascript:document.write(`<script>parent.verifyNavigation(false);</script>`);'1';"><!-- 'javascript: url' ending with a "'1';" is intentional --></form>
<a target="test" onclick="document.forms[0].submit();" href="call-verify-navigation.html?pipe=trickle(d2)">Test</a>
<script>
window.verifyNavigation = parent.verifyNavigation;
window.onload = function() {
document.querySelector("a").click();
};
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!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">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<iframe src=""></iframe>
<script>
const runner = location.href.slice(location.href.lastIndexOf("/") + 1, location.href.length)
.replace(".html", "-runner.html");

async_test(function(test) {

window.verifyNavigation = test.step_func_done(function(signal) {
assert_equals(signal, true, "The navigation via 'javascript: url' code was not canceled by the default href navigation. This might occur if the 'javascript:url' code is not evaluated async, and/or the default href navigation does not cancel the navigation via 'javascript: url'.");
});

document.querySelector("iframe").src = runner;

}, `A navigation via 'javascript: url' code (in: ${runner}) must be evaluated async; to pass this test, that navigation must be aborted by the default href navigation (of the clicked link) before that evaluation can complete. This test will delay the _response_ of the default href navigation, but that must NOT impact the cancellation of the navigation via 'javascript:url'.`);
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!doctype html>
<iframe id="test" name="test"></iframe>
<form target="test" action="javascript:'<script>parent.verifyNavigation(false);</script>';"></form>
<a target="test" onclick="document.forms[0].submit();" href="call-verify-navigation.html?pipe=trickle(d2)">Test</a>
<script>
window.verifyNavigation = parent.verifyNavigation;
window.onload = function() {
document.querySelector("a").click();
};
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!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">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<iframe src=""></iframe>
<script>
const runner = location.href.slice(location.href.lastIndexOf("/") + 1, location.href.length)
.replace(".html", "-runner.html");

async_test(function(test) {

window.verifyNavigation = test.step_func_done(function(signal) {
assert_equals(signal, true, "The navigation via 'javascript: url' code was not canceled by the default href navigation. This might occur if the 'javascript:url' code is not evaluated async, and/or the default href navigation does not cancel the navigation via 'javascript: url'.");
});

document.querySelector("iframe").src = runner;

}, `A navigation via 'javascript: url' code (in: ${runner}) must be evaluated async; to pass this test, that navigation must be aborted by the default href navigation (of the clicked link) before that evaluation can complete. This test will delay the _response_ of the default href navigation, but that must NOT impact the cancellation of the navigation via 'javascript:url'.`);
</script>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!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">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<iframe id="test" name="test"></iframe>
<a target="test" onclick="document.querySelector('iframe').contentWindow.location='call-verify-navigation.html';return false;" href="javascript:parent.verifyNavigation(false);">Test</a>
<script>
async_test(function(test) {

window.verifyNavigation = test.step_func_done(function(signal) {
assert_equals(signal, true, "The navigation initiated in the onclick handler was erroneously canceled by the default href navigation.");
});

document.querySelector("a").click();

}, "An onlick handler that returns false must prevent the default href navigation from occuring. To pass this test, verifyNavigation(true) must be called from the successful navigation to call-verify-navigation.html.");
</script>

This file was deleted.

Loading

0 comments on commit 488bce5

Please sign in to comment.