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..6d5f65eb47d362c855f5c700bbe9e9d1ff58af64 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}); |
jkarlin
2015/10/08 15:43:14
4 space indent for the argument to the function ca
|
+ 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); |