OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
2 <title>Service Worker: document close during controllerchange</title> | |
3 <script src="../../resources/testharness.js"></script> | |
4 <script src="../../resources/testharnessreport.js"></script> | |
5 <script src="../resources/test-helpers.js"></script> | |
6 <script> | |
7 | |
8 async_test(function(t) { | |
9 var scope = '../resources/blank.html'; | |
10 var url1 = '../resources/empty.js'; | |
11 var url2 = '../resources/skip-waiting-worker.js'; | |
12 | |
13 service_worker_unregister_and_register(t, url1, scope) | |
14 .then(function(registration) { | |
15 return wait_for_update(t, registration); | |
falken
2014/12/04 06:15:38
this can just be:
return wait_for_state(t, registr
| |
16 }) | |
17 .then(function(sw) { | |
18 return wait_for_state(t, sw, 'activated'); | |
19 }) | |
20 .then(function() { | |
21 return with_iframe(scope); | |
22 }) | |
23 .then(function(frame) { | |
24 var frame_sw = frame.contentWindow.navigator.serviceWorker; | |
falken
2014/12/04 06:15:38
I'm wondering if this test actually exercises what
xiang
2014/12/04 08:17:26
I think use-after-free could happen in both JS & C
falken
2014/12/04 08:59:12
My doubt with that is it doesn't test what happens
xiang
2014/12/11 11:24:32
You're right, the gc() won't real happen before re
| |
25 frame_sw.oncontrollerchange = t.step_func(function() { | |
26 unload_iframe(frame) | |
27 .then(function() { | |
28 assert_equals(frame_sw.controller.state, 'activating', | |
29 'Controller should still be accessible'); | |
30 service_worker_unregister_and_done(t); | |
31 }); | |
32 }); | |
33 navigator.serviceWorker.register(url2, {scope: scope}); | |
34 }) | |
35 .catch(unreached_rejection(t)); | |
36 }, 'Access ServiceWorkerContainer after its document removed.'); | |
37 | |
38 </script> | |
OLD | NEW |