5898137a4ac4864eb91be2b21f772ed308345d44
[WebKit-https.git] / LayoutTests / http / tests / workers / service / service-worker-registration-gc-event.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="resources/sw-test-pre.js"></script>
5 </head>
6 <body>
7 <script>
8 let updatefoundCount = 0;
9
10 navigator.serviceWorker.register("resources/empty-worker.js", { }).then(function(registration) {
11     registration.addEventListener("updatefound", function() {
12         gc();
13         log("updatefound event fired");
14         updatefoundCount++;
15         if (updatefoundCount == 2)
16             finishSWTest();
17     });
18     registration.update();
19     setTimeout(function() {
20         gc();
21     }, 0);
22 });
23 </script>
24 </body>
25 </html>