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 f72f60c71e4f53ebbe2332fdc96891d31ada3cf6..6bed2f1460ccb43a2f7b11e2e5749747b113cfbe 100644 |
--- a/LayoutTests/http/tests/serviceworker/resources/test-helpers.js |
+++ b/LayoutTests/http/tests/serviceworker/resources/test-helpers.js |
@@ -66,28 +66,18 @@ |
} |
function wait_for_update(test, registration) { |
- if (!registration || registration.unregister == undefined) { |
- return Promise.reject(new Error( |
- 'wait_for_update must be passed a ServiceWorkerRegistration')); |
- } |
- |
- return new Promise(test.step_func(function(resolve) { |
- registration.addEventListener('updatefound', test.step_func(function() { |
- resolve(registration.installing); |
- })); |
+ return new Promise(test.step_func(function(resolve) { |
+ registration.addEventListener('updatefound', test.step_func(function() { |
+ resolve(registration.installing); |
+ })); |
})); |
} |
function wait_for_state(test, worker, state) { |
- if (!worker || worker.state == undefined) { |
- return Promise.reject(new Error( |
- 'wait_for_state must be passed a ServiceWorker')); |
- } |
- |
- return new Promise(test.step_func(function(resolve) { |
- worker.addEventListener('statechange', test.step_func(function() { |
- if (worker.state === state) |
- resolve(state); |
+ return new Promise(test.step_func(function(resolve) { |
+ worker.addEventListener('statechange', test.step_func(function() { |
+ if (worker.state === state) |
+ resolve(state); |
})); |
})); |
} |