| 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 07465387f254aa0b4a3ee4778a420697d225b5aa..e48bfb85ab2cdd2b6a64babffc906d39bd34a2a5 100644
|
| --- a/content/test/data/background_sync/background_sync_test_helpers.js
|
| +++ b/content/test/data/background_sync/background_sync_test_helpers.js
|
| @@ -42,6 +42,45 @@ function registerOneShot(tag) {
|
| .catch(sendErrorToTest);
|
| }
|
|
|
| +function unregisterOneShot(tag) {
|
| + navigator.serviceWorker.ready
|
| + .then(function(swRegistration) {
|
| + return swRegistration.sync.getRegistration(tag);
|
| + })
|
| + .then(function(syncRegistration) {
|
| + if (!syncRegistration) {
|
| + sendResultToTest('error - ' + tag + ' not found');
|
| + return;
|
| + }
|
| + return syncRegistration.unregister();
|
| + })
|
| + .then(function() {
|
| + sendResultToTest('ok - ' + tag + ' unregistered');
|
| + })
|
| + .catch(sendErrorToTest);
|
| +}
|
| +
|
| +function unregisterOneShotTwice(tag) {
|
| + navigator.serviceWorker.ready
|
| + .then(function(swRegistration) {
|
| + return swRegistration.sync.getRegistration(tag);
|
| + })
|
| + .then(function(syncRegistration) {
|
| + if (!syncRegistration) {
|
| + sendResultToTest('error - ' + tag + ' not found');
|
| + return;
|
| + }
|
| + return syncRegistration.unregister();
|
| + })
|
| + .then(function() {
|
| + return syncRegistration.unregister();
|
| + })
|
| + .then(sendErrorToTest, function() {
|
| + sendResultToTest('ok - ' + tag + ' failed to unregister twice');
|
| + })
|
| + .catch(sendErrorToTest);
|
| +}
|
| +
|
| function getRegistrationOneShot(tag) {
|
| navigator.serviceWorker.ready
|
| .then(function(swRegistration) {
|
|
|