1
0
Fork 0
firefox/dom/serviceworkers/test/close_test.js
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

24 lines
596 B
JavaScript

/* eslint-disable mozilla/no-comparison-or-assignment-inside-ok */
function ok(v, msg) {
client.postMessage({ status: "ok", result: !!v, message: msg });
}
var client;
onmessage = function (e) {
if (e.data.message == "start") {
self.clients.matchAll().then(function (clients) {
client = clients[0];
try {
close();
ok(false, "close() should throw");
} catch (ex) {
ok(
ex.name === "InvalidAccessError",
"close() should throw InvalidAccessError"
);
}
client.postMessage({ status: "done" });
});
}
};