Closed Bug 1877596 Opened 1 year ago Closed 1 year ago

Worker script loader should use original URI for internal scheme

Categories

(Core :: DOM: Workers, task)

task

Tracking

()

RESOLVED FIXED
124 Branch
Tracking Status
firefox124 --- fixed

People

(Reporter: arai, Assigned: arai)

References

Details

Attachments

(1 file)

worker loader uses nsIChannel::GetURI for request's base URL:

https://searchfox.org/mozilla-central/rev/2a867dd1ab015c3ef24b774a57709fb3b3dc4961/dom/workers/loader/NetworkLoadHandler.cpp#191

channel->GetURI(getter_AddRefs(loadContext->mRequest->mBaseURL));

main thread loader uses nsIChannel::GetOriginalURI for internal scheme, to avoid using file:.

https://searchfox.org/mozilla-central/rev/2a867dd1ab015c3ef24b774a57709fb3b3dc4961/dom/script/ScriptLoader.cpp#3865-3875

nsCOMPtr<nsIURI> uri;
rv = channel->GetOriginalURI(getter_AddRefs(uri));
NS_ENSURE_SUCCESS(rv, rv);

// Fixup moz-extension: and resource: URIs, because the channel URI will
// point to file:, which won't be allowed to load.
if (uri && IsInternalURIScheme(uri)) {
  aRequest->mBaseURL = uri;
} else {
  channel->GetURI(getter_AddRefs(aRequest->mBaseURL));
}

This blocks bug 1803810, because the module URI doesn't match between sync and async loaders, due to resource: vs file:, and results in loading module twice.

worker loader should do the same as main thread loader

Assignee: nobody → arai.unmht
Status: NEW → ASSIGNED
Pushed by arai_a@mac.com: https://hg.mozilla.org/integration/autoland/rev/778e884de4e5 Use original URL as base URL for internal scheme also in worker. r=jonco,dom-storage-reviewers,janv,dom-worker-reviewers,smaug
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 124 Branch
Blocks: 1876047

arai, should this get backported somewhere if it fixes bug 1876047? I don't know how common of an issue that is. Thanks.

Flags: needinfo?(arai.unmht)

I doubt this fixes bug 1876047's issue.

The change for the worker URI can lead to different behavior for internal resources if relative/absolute path is used against those URLs which goes beyond the mapping of each directory (so, the file pointed by resolved path results in different file than file:// URI, for example the case in dom/quota),
but this doesn't directly affect hang or GC.

Possibilities are:

  • The fix for dom/quota/test/modules/system/worker/Utils.js changed something
  • There's some other place that resulted in different behavior due to the relative/absolute path, possibly in in-tree code, or extensions, or something injected via AutoConfig etc (for example, if the hang is caused by some script and the script stops working with this change, that can explain the behavior)

anyway, I'm hesitant to ask for uplift without understanding the issue and reasoning behind the fix.

Forwarding to janv to see if the fix for dom/quota can be related to the issue.

Flags: needinfo?(arai.unmht) → needinfo?(jvarga)

(In reply to Tooru Fujisawa [:arai] from comment #5)

Possibilities are:

Utils.js is only used in our tests

Flags: needinfo?(jvarga)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: