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

Fix module script descendant referrer tests to match spec PR #22038

Merged
merged 1 commit into from
Mar 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,15 @@
test(t => {
assert_equals(
referrerSame, location.href,
"Referrer should be sent for the same-origin top-level script.");
"Full referrer should be sent for the same-origin top-level script.");
}, "Importing a same-origin top-level script with the " +
"origin-when-cross-origin policy.");

test(t => {
assert_equals(
referrerRemote, origin,
"Referrer should be sent for the remote-origin top-level script.");
"Referrer should be stripped to the origin when importing " +
"remote-origin top-level script.");
}, "Importing a remote-origin top-level script with the " +
"origin-when-cross-origin policy.");

Expand All @@ -45,31 +46,34 @@
new URL("resources/import-referrer-checker.sub.js", location.href)
assert_equals(
referrerSameSame, scriptURL + "?name=same_same",
"Referrer should be sent for the same-origin descendant script.");
"Full referrer should be sent for same-origin descendant script" +
"imported by same-origin top-level script.");
}, "Importing a same-origin descendant script from a same-origin top-level " +
"script with the origin-when-cross-origin policy.");

test(t => {
assert_equals(
referrerSameRemote, origin,
"Referrer should be sent for the remote-origin descendant script.");
"Referrer should be stripped to the origin for the remote-origin " +
"descendant script imported from same-origin top-level script.");
}, "Importing a remote-origin descendant script from a same-origin top-level " +
"script with the origin-when-cross-origin policy.");

test(t => {
assert_equals(
referrerRemoteRemote, remoteOrigin,
"Referrer should be sent for the remote-origin descendant script.");
const scriptURL = new URL(
"html/semantics/scripting-1/the-script-element/module/resources/" +
"import-referrer-checker.sub.js",
remoteOrigin);
assert_equals(referrerRemoteRemote, scriptURL + "?name=remote_remote",
"Full referrer should be sent for the remote-origin descendant script " +
"imported from a remote-origin top-level script.");
}, "Importing a remote-origin descendant script from a remote-origin " +
"top-level script with the origin-when-cross-origin policy.");

test(t => {
const scriptURL = new URL(
"html/semantics/scripting-1/the-script-element/module/resources/" +
"import-same-origin-referrer-checker-from-remote-origin.sub.js",
remoteOrigin);
assert_equals(referrerRemoteSame, scriptURL + "?name=remote_same",
"Referrer should be sent for the same-origin descendant script.");
assert_equals(referrerRemoteSame, remoteOrigin,
"Referrer should be stripped to the origin for the same-origin " +
"descendant script imported by remote-origin top-level script.");
}, "Importing a same-origin descendant script from a remote-origin " +
"top-level script with the origin-when-cross-origin policy.");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,21 @@
"script with the same-origin policy.");

test(t => {
const scriptURL = new URL(
"html/semantics/scripting-1/the-script-element/module/resources/" +
"import-referrer-checker.sub.js", remoteOrigin);
assert_equals(
referrerRemoteRemote, "",
"Referrer should not be sent for the remote-origin descendant script " +
"even if it is imported from the script in the same remote-origin.");
referrerRemoteRemote, scriptURL + "?name=remote_remote",
"Referrer should be sent for the remote-origin descendant script " +
"when it is imported from a top-level script in the same remote-origin.");
}, "Importing a remote-origin descendant script from a remote-origin " +
"top-level script with the same-origin policy.");

test(t => {
const scriptURL = new URL(
"html/semantics/scripting-1/the-script-element/module/resources/" +
"import-same-origin-referrer-checker-from-remote-origin.sub.js",
remoteOrigin);
assert_equals(
referrerRemoteSame, scriptURL + "?name=remote_same",
"Referrer should be sent for the same-origin descendant script " +
"even if it is imported from the script in the remote-origin.");
referrerRemoteSame, "",
"Referrer should not be sent for the same-origin descendant script " +
"when it is imported from a top-level remote-origin script.");
}, "Importing a same-origin descendant script from a remote-origin " +
"top-level script with the same-origin policy.");

Expand Down