2 <title>ServiceWorkerGlobalScope: update
</title>
3 <script src='../../resources/testharness.js'
></script>
4 <script src='../../resources/testharnessreport.js'
></script>
5 <script src='../resources/test-helpers.js'
></script>
8 promise_test(function(t
) {
9 var script
= 'resources/update-worker.php';
10 var scope
= 'resources/scope/update';
14 return service_worker_unregister_and_register(t
, script
, scope
)
17 return wait_for_state(t
, registration
.installing
, 'activated');
19 .then(function() { return with_iframe(scope
); })
22 registration
.active
.postMessage('update');
23 return wait_for_update(t
, registration
);
25 .then(function() { return with_iframe(scope
); })
26 .then(function(frame2
) {
27 var expected_events_seen
= [
28 'updatefound', // by register().
32 'updatefound', // by update() in the message handler.
36 frame2
.contentDocument
.body
.textContent
,
37 expected_events_seen
.toString(),
38 'events seen by the worker');
41 return service_worker_unregister_and_done(t
, scope
);
43 }, 'Update a registration on ServiceWorkerGlobalScope');