Closed Bug 1637101 Opened 3 months ago Closed 3 months ago

[wpt-sync] Sync PR 23516 - Fix module script referrer port

Categories

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

task

Tracking

()

RESOLVED FIXED
mozilla78
Tracking Status
firefox78 --- fixed

People

(Reporter: mozilla.org, Unassigned)

References

(Depends on 1 open bug, )

Details

(Whiteboard: [wptsync downstream])

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

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

Dominic Farolino <domfarolino@gmail.com> wrote:

Fix module script referrer port

The origin-when-cross-origin module script descendant test requires maintaining a variable remoteOrigin, whose value is the "cross-origin" origin that we're using to host remote-origin scripts for the test. It is initialized as:

const remoteOrigin = "http://{{domains[www1]}}:{{ports[http][0]}}/";

The problematic bit is ports[http][0]. When running this locally, it is not port 80, so tests such as this one report a referrer with a non-80 port, and the comparison works.

However on sites like wpt.live, this test seems to fail (in Chrome, whose implementation is spec-conformant, and obviously in any browser that isn't). It is because referrerOrigin contains the port number :80, but the generated Referer from the browser never contains the port number :80 if that's where the site is hosted. There are two solutions:

  • Definitely use a non-80 port-number (which is what this PR does)
  • Detect if {{ports[http][0]}} == 80, and strip the :80 from referrerOrigin
    • This seemed complex, so I didn't do it

Anne, do you know why browsers do not include :80 in the Referer? I couldn't find it from an admittedly cursory search through Fetch and Referrer Policy.

Component: web-platform-tests → DOM: Core & HTML
Product: Testing → Core

CI Results

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

Total 1 tests and 6 subtests

Status Summary

Firefox

OK : 1
PASS: 4
FAIL: 2

Chrome

OK : 1
PASS: 6

Safari

OK : 1
PASS: 3
FAIL: 3

Links

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)

Pushed by wptsync@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/4bdd2bf8bfdc
[wpt PR 23516] - Fix module script referrer port, a=testonly
Pushed by wptsync@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/eb53db0f2b4e
[wpt PR 23516] - Fix module script referrer port, a=testonly
Status: NEW → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla78
You need to log in before you can comment on or make changes to this bug.