Open Bug 1808189 Opened 1 year ago Updated 1 year ago

[Fetch] Determine referrer when the global is not a Window object

Categories

(Core :: DOM: Workers, task)

task

Tracking

()

People

(Reporter: allstars.chh, Unassigned)

References

(Blocks 1 open bug)

Details

According to https://w3c.github.io/webappsec-referrer-policy/#determine-requests-referrer

Step 3. Switch on request’s referrer:
"client"
Step 2. Otherwise, let referrerSource be environment’s creation URL.

However in FetchUtil::SetReferrer, it doesn't implement non-window case,
(For example, for workers and worklets)
https://searchfox.org/mozilla-central/rev/f24503d2f5d8b7e4341be8bc20d94a04a6b223d6/dom/fetch/FetchUtil.cpp#139

The workers creation URL can be found in https://html.spec.whatwg.org/multipage/workers.html#script-settings-for-workers:concept-environment-creation-url

The worklet's creation URL can be found in https://html.spec.whatwg.org/multipage/worklets.html#script-settings-for-worklets:concept-environment-creation-url

ReferrerInfo::CreateForFetch seems to be used in multiple places - It seems when the doc is null, we simply create a ReferrerInfo with an _empty policy.

Blocks: fetch
Component: DOM: Networking → DOM: Workers
You need to log in before you can comment on or make changes to this bug.