Closed Bug 1619277 Opened 4 years ago Closed 4 years ago

[wpt-sync] Sync PR 22038 - Fix module script descendant referrer tests to match spec PR

Categories

(Core :: DOM: Core & HTML, task, P4)

task

Tracking

()

RESOLVED FIXED
mozilla76
Tracking Status
firefox76 --- fixed

People

(Reporter: mozilla.org, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

Sync web-platform-tests PR 22038 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/22038
Details from upstream follow.

Dominic Farolino <domfarolino@gmail.com> wrote:

Fix module script descendant referrer tests to match spec PR

This PR fixes module script descendent referrer tests that I originally added in https://crrev.com/c/1809205. The tests I added match the spec, and we were going to change Chromium's implementation accordingly, however after more discussion in https://github.com/w3c/webappsec-referrer-policy/issues/123, we're aiming to change the spec to be more sane.

This PR makes the module script descendant scripts tests assert that a descendant script's referrer string is used in determining if the request is same-origin or not. Currently the spec computes same-origin-ness by comparing request's currently URL and request's origin (which can be its client's origin). It does not consider the referrer string, which may be different than its client's origin, via module scripts. Consider:

  • A.com/page.html fetches top-level module script B.com/x.js
  • B.com/x.js fetches a descendant script A.com/x.js

In this case, the request for A.com/x.js's referrer string is B.com/x.js, but it's client's origin is A.com. The point of the HTML Standard setting the descendant's referrer string to its parent's URL is to make the parent behave as the referrer in this case, but the Referrer Policy spec didn't respect this. https://github.com/w3c/webappsec-referrer-policy/issues/123 changes the Referrer Policy spec accordingly, and this PR considers the above request to be cross-origin (the descendant request is cross-origin relative its parent).

Component: web-platform-tests → DOM: Core & HTML
Product: Testing → Core
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → INVALID
Status: RESOLVED → REOPENED
Resolution: INVALID → ---

CI Results

Ran 13 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI

Total 47 tests

Status Summary

Firefox

OK : 2
PASS: 8[GitHub] 53[Gecko-android-em-7.0-x86_64-debug-geckoview, Gecko-android-em-7.0-x86_64-opt-geckoview, Gecko-linux1804-64-asan-opt, Gecko-linux1804-64-debug, Gecko-linux1804-64-opt, Gecko-linux1804-64-qr-debug, Gecko-linux1804-64-qr-opt, Gecko-windows10-64-debug, Gecko-windows10-64-opt, Gecko-windows10-64-qr-debug, Gecko-windows10-64-qr-opt, Gecko-windows7-32-debug, Gecko-windows7-32-opt]
FAIL: 4

Chrome

OK : 2
PASS: 12

Safari

OK : 2
PASS: 6
FAIL: 6

Links

Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base

Details

New Tests That Don't Pass

/html/semantics/scripting-1/the-script-element/module/referrer-origin-when-cross-origin.sub.html
Importing a remote-origin descendant script from a remote-origin top-level script with the origin-when-cross-origin policy.: FAIL (Chrome: PASS, Safari: FAIL)
Importing a same-origin descendant script from a remote-origin top-level script with the origin-when-cross-origin policy.: FAIL (Chrome: PASS, Safari: FAIL)
/html/semantics/scripting-1/the-script-element/module/referrer-same-origin.sub.html
Importing a remote-origin descendant script from a remote-origin top-level script with the same-origin policy.: FAIL (Chrome: PASS, Safari: FAIL)
Importing a same-origin descendant script from a remote-origin top-level script with the same-origin policy.: FAIL (Chrome: PASS, Safari: FAIL)

Pushed by wptsync@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/5f530faccf1f
[wpt PR 22038] - Fix module script descendant referrer tests to match spec PR, a=testonly
https://hg.mozilla.org/integration/autoland/rev/05528e0a2b6e
[wpt PR 22038] - Update wpt metadata, a=testonly
Status: REOPENED → RESOLVED
Closed: 4 years ago4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla76
You need to log in before you can comment on or make changes to this bug.