DevTools "script override" should defeat the not-overridden cache in SharedScriptCache
Categories
(Core :: JavaScript Engine, task, P3)
Tracking
()
People
(Reporter: arai, Assigned: arai)
References
(Blocks 2 open bugs)
Details
Attachments
(4 files)
Possibly similar to bug 1946348.
DevTools Debugger provides "script override", and that feature stops working if navigation cache is enabled (also with applied to preload),
possibly because the request doesn't reach the "override" part.
Force-reload reads the overridden file, but normal reload after that reads not-overridden cached file.
This would need some combination of the following:
- (a) The "script override" should clear the cached content for the specific file, so that ScriptLoader doesn't use the cached content, and the subsequent request reaches the "override" part
- (b) The "script override" should return "no-cache" to the ScriptLoader, if not yet
- (c) ScriptLoader should evict the cache if it receives "no-cache" response, so that the subsequent request won't use either of not-overridden or overridden cache, but always reaches the "override" part
(c) may apply also to stylesheet, given it's part of SharedSubResourceCache.
Assignee | ||
Comment 1•1 month ago
|
||
Actually this issue doesn't happen with stylesheet, because the stylesheet case also uses the SharedSubResourceCache for incomplete load.
Assignee | ||
Comment 2•1 month ago
|
||
The related code in DevTools's side would be the following:
Services.obs.addObserver(
this.#httpBeforeConnect,
"http-on-before-connect"
);
#httpBeforeConnect = DevToolsInfaillibleUtils.makeInfallible(
(subject, topic) => {
if (
this.#isDestroyed ||
topic != "http-on-before-connect" ||
!(subject instanceof Ci.nsIHttpChannel)
) {
return;
}
...
// Handle overrides in http-on-before-connect because we need to redirect
// the request to the override before reaching the server.
this.#checkForContentOverride(httpActivity);
#checkForContentOverride(httpActivity) {
const channel = httpActivity.channel;
const overridePath = this.#overrides.get(channel.URI.spec);
if (!overridePath) {
return false;
}
...
try {
lazy.NetworkOverride.overrideChannelWithFilePath(channel, overridePath);
Then, apparently the feature is also used for other resources, accessible from the network monitor.
setNetworkOverride(toolbox.commands, url, content, window)
And I confirmed the override isn't reflected to the stylesheets until force-reload, if the file is cached.
Assignee | ||
Comment 3•1 month ago
|
||
(In reply to Tooru Fujisawa [:arai] from comment #0)
- (b) The "script override" should return "no-cache" to the ScriptLoader, if not yet
This seems to be already done.
To the ScriptLoader, the overridden response is not cacheable.
Updated•1 month ago
|
Updated•1 month ago
|
Assignee | ||
Comment 4•1 month ago
|
||
Prototyped the cache API in bug 1947158 and integrated into the network override, and just realized that the http-on-before-connect
notification is used only when the necko cache is also disabled, or not cached.
This means, just evicting the corresponding cache from the in-memory cache doesn't actually solve bug 1933455.
But at least this keeps the previous behavior.
If necessary, we can look into integrating the network override to the necko cache in separate bug.
Assignee | ||
Comment 5•29 days ago
|
||
Assignee | ||
Comment 6•29 days ago
|
||
Assignee | ||
Comment 7•29 days ago
|
||
Once the SharedScriptCache is enabled, the order of the requests inside the
Network Monitor isn't stable inside the testcase.
Assignee | ||
Comment 8•29 days ago
|
||
Updated•27 days ago
|
Updated•12 days ago
|
Updated•12 days ago
|
Updated•12 days ago
|
Updated•12 days ago
|
Description
•