blob: 174199b14a566a2bc920ef9e0dc424d95f820038 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
const gRoot = "http://mochi.test:8888/tests/dom/serviceworkers/test/";
const gTestURL = gRoot + "test_notification_openWindow.html";
const gClientURL = gRoot + "file_notification_openWindow.html";
onmessage = function(event) {
if (event.data !== "DONE") {
dump(`ERROR: received unexpected message: ${JSON.stringify(event.data)}\n`);
}
event.waitUntil(
clients.matchAll({ includeUncontrolled: true }).then(cl => {
for (let client of cl) {
// The |gClientURL| window closes itself after posting the DONE message,
// so we don't need to send it anything here.
if (client.url === gTestURL) {
client.postMessage("DONE");
}
}
})
);
};
onnotificationclick = function(event) {
clients.openWindow(gClientURL);
};
|