Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"javascript:" urls: execute in correct global scope #17083

Merged
merged 8 commits into from Sep 9, 2017

"javascript:" urls: add web-platform-test

  • Loading branch information
danielj41 committed Aug 23, 2017
commit af41769d70e134fa7013127604e8ecbf7ace24a5
{}
]
],
"url/a-element-href-javascript.html": [
[
"/url/a-element-href-javascript.html",
{}
]
],
"url/a-element-origin-xhtml.xhtml": [
[
"/url/a-element-origin-xhtml.xhtml",
"3dacc2783865ba292f20b72bc4c3942de521d9b0",
"support"
],
"url/a-element-href-javascript.html": [
"567d16dde294a2f3e75fdb8139d1af9a8c73e0fc",

This comment has been minimized.

Copy link
@jdm

jdm Aug 24, 2017

Member

Be sure to run ./mach update-manifest after moving the test (and making any changes to it).

"testharness"
],
"url/a-element-origin-xhtml.xhtml": [
"56019fd2d3870324ba412e3e0c602bad3b90ef49",
"testharness"
@@ -0,0 +1,28 @@
<!doctype html>

This comment has been minimized.

Copy link
@jdm

jdm Aug 24, 2017

Member

This file belongs in web-platform-tests/html/browsers/navigating-across-documents instead; tests are organized according to the layout of the specification that they are testing.

This comment has been minimized.

Copy link
@danielj41

danielj41 Aug 29, 2017

Author Contributor

Thank you for the review! Fixed in fc23cb1

<meta charset=utf-8>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>

<script>
var linkStatus = 'link not clicked';

function changeStatus() {
linkStatus = 'link has been clicked';
}
</script>

<a id="javascript-link" href="javascript:changeStatus()">link</a>

<script>
setup({explicit_done:true});

document.querySelector("#javascript-link").click();

step_timeout(function() {

This comment has been minimized.

Copy link
@jdm

jdm Aug 24, 2017

Member

Let's do this instead:

<script>
function changeStatus() {
  t.done();
}

var t = async_test(function(t) {
  document.querySelector("#javascript-link").click();
}, "javascript: scheme urls should be executed in current global scope");
</script>

This comment has been minimized.

Copy link
@danielj41

danielj41 Aug 29, 2017

Author Contributor

Fixed in fc23cb1

test(function() {
assert_equals(linkStatus, "link has been clicked");
}, "javascript: scheme urls should be executed in correct global scope");

done();
});
</script>
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.