Ensure that every worker loaded script has the correct mClientInfo
Categories
(Core :: DOM: Workers, task)
Tracking
()
Tracking | Status | |
---|---|---|
firefox106 | --- | fixed |
People
(Reporter: yulia, Assigned: yulia)
References
Details
Attachments
(2 files)
TL;DR -- when implementing modules I realized that we need to store ClientInfo independently of the loader.
Previously, in an earlier refactoring -- I noticed that we were setting a ClientInfo in two places, once for use in the channel, which was used by importScripts:
This is passed here: https://searchfox.org/mozilla-central/rev/63d3ddbc815ee433a45a982d2e74e2994ebbc22c/dom/workers/ScriptLoader.cpp#1066-1071
And eventually used only by import scripts here:
The second place it was set was in a "reservedClientInfo" field, only to be used by main threads:
Since these two were storing the same information, and every creation of import scripts would create a new ClientInfo for that request, I simplified these two fields and went with only having one, stored on the loading. However, there is a subtle difference now, in that we can sometimes land in this code path with a main script:
This didn't result in any problems or test failures so I left it as it was.
However, Modules make this more complicated! We need to regenerate the client info for child modules, we cannot use one that is set globally on the loader as it will be out of date in comparison to the headers that come back from the load of an initial script. To prep for loading modules, scripts should be aware of what the client load info is, so we need to store it on the WorkerLoadContext.
Assignee | ||
Updated•3 years ago
|
Assignee | ||
Comment 1•3 years ago
|
||
Assignee | ||
Comment 2•3 years ago
|
||
Previously, we had the client info for main scripts on the ScriptLoader, and in the ScriptLoadInfo
for non-main scripts. This was a bit confusing, so I moved it all to the ScriptLoader as in the
importScripts case, it is always recreated with each new load. However, for modules this is not
true. In order to make it persistant for main scripts and modules, as well as ensure that it has the
correct data, it should always live on the
WorkerLoadContext.
Updated•3 years ago
|
Updated•3 years ago
|
Comment 4•3 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/6e7ce080121d
https://hg.mozilla.org/mozilla-central/rev/037726440c5f
Description
•