commit d2fc907d6278f08920fac6c066fbba287aac2f2f
parent cae6e73ae8fe8bb48aabdc73958644e8964bca16
Author: Tooru Fujisawa <arai_a@mac.com>
Date: Fri, 21 Nov 2025 12:33:46 +0000
Bug 2001368 - Add notification for the SharedScriptCache invalidation. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D273441
Diffstat:
2 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/dom/base/test/head.js b/dom/base/test/head.js
@@ -37,6 +37,22 @@ function optional_ev(...args) {
}
async function jsCacheContentTask(test, item) {
+ const defaultSkippedEvents = test.skippedEvents ?? [
+ // The compilation is not target of this test.
+ "compile:main thread",
+ // This is triggered by 'invalidateMemory' below, but we don't have to
+ // track it.
+ "memorycache:invalidate",
+ // The disk cache handling for the in-memory cache can happen multiple
+ // times depending on the scheduling and speed
+ // (e.g. debug vs opt, verify mode).
+ "diskcache:noschedule",
+ ];
+ const nonSkippedEvents = test.nonSkippedEvents ?? [];
+ const skippedEvents = defaultSkippedEvents.filter(
+ ev => !nonSkippedEvents.includes(ev)
+ );
+
function match(param, event) {
if (event.event !== param.event) {
return false;
@@ -102,21 +118,12 @@ async function jsCacheContentTask(test, item) {
param[m[1]] = m[2];
}
- if (param.event === "compile:main thread") {
- return;
- }
-
if (consumeIfMatched(param, item.events)) {
dump("@@@ Got expected event: " + data + "\n");
if (item.events.length === 0) {
resolve();
}
- } else if (param.event === "diskcache:noschedule") {
- // The disk cache handling for the in-memory cache can happen multiple
- // times depending on the scheduling and speed
- // (e.g. debug vs opt, verify mode).
- //
- // Ignore any unmatching message here.
+ } else if (skippedEvents.includes(param.event)) {
dump("@@@ Ignoring: " + data + "\n");
} else {
dump("@@@ Got unexpected event: " + data + "\n");
diff --git a/dom/script/SharedScriptCache.cpp b/dom/script/SharedScriptCache.cpp
@@ -182,6 +182,7 @@ void SharedScriptCache::Invalidate() {
if (sSingleton) {
sSingleton->InvalidateInProcess();
}
+ TRACE_FOR_TEST_0("memorycache:invalidate");
}
void SharedScriptCache::InvalidateInProcess() {