| Index: content/test/data/background_sync/background_sync_test_helpers.js
|
| diff --git a/content/test/data/background_sync/background_sync_test_helpers.js b/content/test/data/background_sync/background_sync_test_helpers.js
|
| index ac175df9fd816f8033359308dec41bfc81a89aad..b74694aaf19d5b2cc89161ad056a264ea8f47703 100644
|
| --- a/content/test/data/background_sync/background_sync_test_helpers.js
|
| +++ b/content/test/data/background_sync/background_sync_test_helpers.js
|
| @@ -43,6 +43,15 @@ function registerOneShot(tag) {
|
| .catch(sendErrorToTest);
|
| }
|
|
|
| +function registerOneShotFromServiceWorker(tag) {
|
| + navigator.serviceWorker.ready
|
| + .then(function(swRegistration) {
|
| + swRegistration.active.postMessage({action: 'registerOneShot', tag: tag});
|
| + sendResultToTest('ok - ' + tag + ' register sent to SW');
|
| + })
|
| + .catch(sendErrorToTest);
|
| +}
|
| +
|
| function unregisterOneShot(tag) {
|
| navigator.serviceWorker.ready
|
| .then(function(swRegistration) {
|
| @@ -97,6 +106,16 @@ function getRegistrationOneShot(tag) {
|
| .catch(sendErrorToTest);
|
| }
|
|
|
| +function getRegistrationOneShotFromServiceWorker(tag) {
|
| + navigator.serviceWorker.ready
|
| + .then(function(swRegistration) {
|
| + swRegistration.active.postMessage(
|
| + {action: 'getRegistrationOneShot', tag: tag});
|
| + sendResultToTest('ok - getRegistration sent to SW');
|
| + })
|
| + .catch(sendErrorToTest);
|
| +}
|
| +
|
| function getRegistrationsOneShot(tag) {
|
| navigator.serviceWorker.ready
|
| .then(function(swRegistration) {
|
| @@ -111,6 +130,15 @@ function getRegistrationsOneShot(tag) {
|
| .catch(sendErrorToTest);
|
| }
|
|
|
| +function getRegistrationsOneShotFromServiceWorker() {
|
| + navigator.serviceWorker.ready
|
| + .then(function(swRegistration) {
|
| + swRegistration.active.postMessage({action: 'getRegistrationsOneShot'});
|
| + sendResultToTest('ok - getRegistrations sent to SW');
|
| + })
|
| + .catch(sendErrorToTest);
|
| +}
|
| +
|
| function completeDelayedOneShot() {
|
| navigator.serviceWorker.ready
|
| .then(function(swRegistration) {
|
| @@ -203,6 +231,6 @@ ResultQueue.prototype.popImmediately = function() {
|
|
|
| navigator.serviceWorker.addEventListener('message', function(event) {
|
| var message = event.data;
|
| - if (message.type == 'sync')
|
| + if (message.type == 'sync' || message.type === 'register')
|
| resultQueue.push(message.data);
|
| -}, false);
|
| +}, false);
|
|
|