We may need to fix this issue before adding tests:
"Interestingly, after the off-the-main-thread module loading patch is landed (see c#37), module workers start fetching the top-level module script with a referrer that is the same with the request's URL. Before the patch, the referrer was the parent document's URL. I'll investigate it next week."
Copied from https://bugs.chromium.org/p/chromium/issues/detail?id=680046#c38
Note for c#1: The referrer is set in BaseFetchContext::AddAdditionalRequestHeaders. GetOutgoingReferrer() asks an associated ExecutionContext about the referrer. Before the patch, it's Document. After the patch, it's WorkerGlobalScope. This is the reason why the top-level module script is loaded using its URL as referrer.
Summary: Fix referrer policy on dedicated workers loaded as module scripts (was: Add WPTs for referrer policy on dedicated workers loaded as module scripts)
I found another issue. Dedicated Workers need to have its own referrer policy served by response's HTTP header. For classic script loading this is correctly set in DedicatedWorker:OnFinished(), but for module script loading it's not set.
Comment 1 by nhiroki@chromium.org
, May 14 2018