| Index: LayoutTests/http/tests/serviceworker/resources/test-helpers.js
|
| diff --git a/LayoutTests/http/tests/serviceworker/resources/test-helpers.js b/LayoutTests/http/tests/serviceworker/resources/test-helpers.js
|
| index 8ff035e5cc975dab233206ca9dc6fac5f5c2fbaf..1af9804f07127b4d7a5f8e3eb56015035420fb6c 100644
|
| --- a/LayoutTests/http/tests/serviceworker/resources/test-helpers.js
|
| +++ b/LayoutTests/http/tests/serviceworker/resources/test-helpers.js
|
| @@ -65,6 +65,21 @@ function normalizeURL(url) {
|
| return new URL(url, document.location).toString().replace(/#.*$/, '');
|
| }
|
|
|
| +function get_newest_worker(registration) {
|
| + if (!registration) {
|
| + return Promise.reject(new Error(
|
| + 'get_newest_worker must be passed a ServiceWorkerRegistration'));
|
| + }
|
| + if (registration.installing)
|
| + return Promise.resolve(registration.installing);
|
| + if (registration.waiting)
|
| + return Promise.resolve(registration.waiting);
|
| + if (registration.active)
|
| + return Promise.resolve(registration.active);
|
| + return Promise.reject(new Error(
|
| + 'registration must have at least one version'));
|
| +}
|
| +
|
| function wait_for_update(test, registration) {
|
| if (!registration || registration.unregister == undefined) {
|
| return Promise.reject(new Error(
|
|
|