зеркало из https://github.com/mozilla/gecko-dev.git
19 строки
379 B
JavaScript
19 строки
379 B
JavaScript
// A simple worker script that forward intercepted url to the controlled window.
|
|
|
|
function responseMsg(msg) {
|
|
self.clients
|
|
.matchAll({
|
|
includeUncontrolled: true,
|
|
type: "window",
|
|
})
|
|
.then(clients => {
|
|
if (clients && clients.length) {
|
|
clients[0].postMessage(msg);
|
|
}
|
|
});
|
|
}
|
|
|
|
onfetch = function (e) {
|
|
responseMsg(e.request.url);
|
|
};
|