forked from web-platform-tests/wpt
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replacement: 008.html will be replaced by this test.
- Loading branch information
Showing
2 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
...he-web/navigating-across-documents/010-form-action-javascript-url-direct-call-runner.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,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> |
30 changes: 30 additions & 0 deletions
30
...wsing-the-web/navigating-across-documents/010-form-action-javascript-url-direct-call.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,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> | ||
|