Bug 993326 - Automatically restore apps launchable value. r=fabrice
authorMarco Castelluccio <mar.castelluccio@studenti.unina.it>
Thu, 17 Apr 2014 16:43:04 -0400
changeset 197704 0918894c1c03038988644b583987979b45ab13cd
parent 197703 2fc7f692314bc4d836c825384b57826eabb8123b
child 197705 2bea886b9aac17ba62e22989b6dfb76b60f9f0d0
push id3624
push userasasaki@mozilla.com
push dateMon, 09 Jun 2014 21:49:01 +0000
treeherdermozilla-beta@b1a5da15899a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfabrice
bugs993326
milestone31.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 993326 - Automatically restore apps launchable value. r=fabrice
content/base/test/csp/test_bug949549.html
dom/apps/tests/test_app_update.html
dom/apps/tests/test_bug_795164.html
dom/apps/tests/test_install_receipts.html
dom/apps/tests/test_packaged_app_common.js
dom/apps/tests/test_packaged_app_install.html
dom/apps/tests/test_packaged_app_update.html
dom/apps/tests/test_receipt_operations.html
dom/apps/tests/test_signed_pkg_install.html
dom/apps/tests/test_uninstall_errors.html
dom/browser-element/mochitest/browserElement_AppFramePermission.js
dom/indexedDB/test/webapp_clearBrowserData.js
dom/tests/mochitest/webapps/file_bug_779982.js
testing/mochitest/tests/SimpleTest/SimpleTest.js
testing/mochitest/tests/SimpleTest/TestRunner.js
testing/specialpowers/content/specialpowersAPI.js
toolkit/devtools/apps/tests/test_webapps_actor.html
--- a/content/base/test/csp/test_bug949549.html
+++ b/content/base/test/csp/test_bug949549.html
@@ -15,22 +15,22 @@
   // Ensure that `setRequestContext` doesn't throw with app:// URLs
 
   const csp = SpecialPowers.Cc["@mozilla.org/contentsecuritypolicy;1"]
               .createInstance(SpecialPowers.Ci.nsIContentSecurityPolicy);
 
   const gManifestURL = "http://www.example.com/chrome/dom/tests/mochitest/webapps/apps/basic.webapp";
 
   SimpleTest.waitForExplicitFinish();
-  var launchableValue, app;
+  var app;
 
   function setupTest() {
     // We have to install an app in order for the app URL to be valid
     // (otherwise we get a "DummyChannel" that throws NS_NOT_IMPLEMENTED)
-    launchableValue = SpecialPowers.setAllAppsLaunchable(true);
+    SpecialPowers.setAllAppsLaunchable(true);
     SpecialPowers.addPermission("webapps-manage", true, document);
     SpecialPowers.autoConfirmAppInstall(function () {
       let req = navigator.mozApps.install(gManifestURL);
       req.onsuccess = function () {
         app = this.result;
         runTest();
       }
     });
@@ -49,17 +49,16 @@
     } catch(e) {
       ok(false, "setRequestContext throws");
     }
 
     cleanup()
   }
 
   function cleanup() {
-    SpecialPowers.setAllAppsLaunchable(launchableValue);
     let req = navigator.mozApps.mgmt.uninstall(app);
     req.onsuccess = function () {
       SimpleTest.finish();
     };
   }
 
   setupTest();
 </script>
--- a/dom/apps/tests/test_app_update.html
+++ b/dom/apps/tests/test_app_update.html
@@ -13,17 +13,16 @@ https://bugzilla.mozilla.org/show_bug.cg
   /** Test for Bug 826058 **/
 
   SimpleTest.waitForExplicitFinish();
 
   var gBaseURL = 'http://test/tests/dom/apps/tests/';
   var gHostedManifestURL = gBaseURL + 'file_app.sjs?apptype=hosted&getmanifest=true';
   var gCachedManifestURL = gBaseURL + 'file_app.sjs?apptype=cached&getmanifest=true';
   var gGenerator = runTest();
-  var launchableValue = undefined;
 
   function go() {
     SpecialPowers.pushPermissions(
       [{ "type": "browser", "allow": 1, "context": document },
        { "type": "embed-apps", "allow": 1, "context": document },
        { "type": "webapps-manage", "allow": 1, "context": document }],
       function() { gGenerator.next() });
   }
@@ -51,17 +50,17 @@ https://bugzilla.mozilla.org/show_bug.cg
   function xhrAbort(url) {
     ok(false, "XHR abort loading " + url);
     finish();
   }
 
   function runTest() {
     // Set up.
 
-    launchableValue = SpecialPowers.setAllAppsLaunchable(true);
+    SpecialPowers.setAllAppsLaunchable(true);
     SpecialPowers.setBoolPref("dom.mozBrowserFramesEnabled", true);
 
     // Test Bug 927699 - navigator.mozApps.install(url) lets NS_ERROR_FAILURE
     //                   onto the web
     var request = navigator.mozApps.install("");
     request.onerror = function() {
       ok(request.error.name == "INVALID_URL", "Got expected INVALID_URL");
       continueTest();
@@ -269,17 +268,16 @@ https://bugzilla.mozilla.org/show_bug.cg
   function getAppURL(app) {
     if (!app)
       return gBaseURL + "file_app.sjs?apptype=hosted";
     return app.origin + app.manifest.launch_path;
   }
 
   function finish() {
     SpecialPowers.clearUserPref("dom.mozBrowserFramesEnabled");
-    //SpecialPowers.setAllAppsLaunchable(launchableValue);
     SimpleTest.finish();
   }
 
   function doReload() {
     window.location.reload(true);
   }
 
   </script>
--- a/dom/apps/tests/test_bug_795164.html
+++ b/dom/apps/tests/test_bug_795164.html
@@ -13,40 +13,39 @@ https://bugzilla.mozilla.org/show_bug.cg
   /** Test for Bug 795164 **/
 
   SimpleTest.waitForExplicitFinish();
 
   var url1 = 'http://test1.example.com/tests/dom/apps/tests/file_app.sjs?apptype=hosted&getmanifest=true';
   var url2 = 'http://test2.example.com/tests/dom/apps/tests/file_app.sjs?apptype=hosted&getmanifest=true';
 
   var gGenerator = runTest();
-  var launchableValue = undefined;
 
   function go() {
     SpecialPowers.pushPermissions(
       [{ "type": "webapps-manage", "allow": 1, "context": document }],
       function() { gGenerator.next() });
   }
 
   function continueTest() {
     try {
       gGenerator.next();
     } catch (e if e instanceof StopIteration) {
-      finish();
+      SimpleTest.finish();
     }
   }
 
   function mozAppsError() {
     ok(false, "mozApps error: " + this.error.name);
-    finish();
+    SimpleTest.finish();
   }
 
   function runTest() {
     // Set up.
-    launchableValue = SpecialPowers.setAllAppsLaunchable(true);
+    SpecialPowers.setAllAppsLaunchable(true);
     SpecialPowers.autoConfirmAppInstall(continueTest);
     yield undefined;
 
     // Keeping track of the number of times `mozApps.mgmt.onuninstall` gets triggered
     let uninstallCount = 0;
 
     navigator.mozApps.mgmt.onuninstall = function() {
       uninstallCount++;
@@ -87,21 +86,16 @@ https://bugzilla.mozilla.org/show_bug.cg
       continueTest();
     };
     yield undefined;
 
     is(uninstallCount, 2, "mgmt.onuninstall got triggered only twice");
 
     navigator.mozApps.mgmt.onuninstall = null;
   }
-
-  function finish() {
-    SpecialPowers.setAllAppsLaunchable(launchableValue);
-    SimpleTest.finish();
-  }
   </script>
 </head>
 <body onload="go()">
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=795164">Mozilla Bug 795164</a>
 <p id="display"></p>
 <div id="content" style="display: none">
 
 </div>
--- a/dom/apps/tests/test_install_receipts.html
+++ b/dom/apps/tests/test_install_receipts.html
@@ -47,17 +47,17 @@ function finish() {
 function cbError(aError) {
   ok(false, "Error callback invoked " + aError);
   finish();
 }
 
 SimpleTest.waitForExplicitFinish();
 
 function runTest() {
-  launchableValue = SpecialPowers.setAllAppsLaunchable(true);
+  SpecialPowers.setAllAppsLaunchable(true);
 
   SpecialPowers.autoConfirmAppInstall(continueTest);
   yield undefined;
 
   // Test install with three valid receipts
   let valid_receipt1 = 'eyJhbGciOiAiSFMyNTYiLCAidHlwIjogIkpXVCJ9.eyJwcm9kdWN0IjogeyJ1cmwiOiAiaHR0cHM6Ly93d3cubW96aWxsYS5vcmciLCAic3RvcmVkYXRhIjogIjUxNjkzMTQzNTYifSwgInJlaXNzdWUiOiAiaHR0cDovL21vY2hpLnRlc3Q6ODg4OC9yZWlzc3VlLzUxNjkzMTQzNTYiLCAidXNlciI6IHsidHlwZSI6ICJkaXJlY3RlZC1pZGVudGlmaWVyIiwgInZhbHVlIjogIjRmYjM1MTUxLTJiOWItNGJhMi04MjgzLWM0OWQzODE2NDBiZCJ9LCAidmVyaWZ5IjogImh0dHA6Ly9tb2NoaS50ZXN0Ojg4ODgvdmVyaWZ5LzUxNjkzMTQzNTYiLCAiaXNzIjogImh0dHA6Ly9tb2NoaS50ZXN0Ojg4ODgiLCAiaWF0IjogMTMxMzYwMTg4LCAidHlwIjogInB1cmNoYXNlLXJlY2VpcHQiLCAibmJmIjogMTMxMzYwMTg1LCAiZGV0YWlsIjogImh0dHA6Ly9tb2NoaS50ZXN0Ojg4ODgvcmVjZWlwdC81MTY5MzE0MzU2In0.eZpTEnCLUR3iP3rm9WyJOqx1k66mQaAxqcrvX11r5E0';
 
   let valid_receipt2 = 'eyJhbGciOiAiSFMyNTYiLCAidHlwIjogIkpXVCJ9.eyJwcm9kdWN0IjogeyJ1cmwiOiAiaHR0cHM6Ly93d3cubW96aWxsYS5vcmciLCAic3RvcmVkYXRhIjogIjUxNjkzMTQzNTcifSwgInJlaXNzdWUiOiAiaHR0cDovL21vY2hpLnRlc3Q6ODg4OC9yZWlzc3VlLzUxNjkzMTQzNTYiLCAidXNlciI6IHsidHlwZSI6ICJkaXJlY3RlZC1pZGVudGlmaWVyIiwgInZhbHVlIjogIjRmYjM1MTUxLTJiOWItNGJhMi04MjgzLWM0OWQzODE2NDBiZCJ9LCAidmVyaWZ5IjogImh0dHA6Ly9tb2NoaS50ZXN0Ojg4ODgvdmVyaWZ5LzUxNjkzMTQzNTYiLCAiaXNzIjogImh0dHA6Ly9tb2NoaS50ZXN0Ojg4ODgiLCAiaWF0IjogMTMxMzYwMTg4LCAidHlwIjogInB1cmNoYXNlLXJlY2VpcHQiLCAibmJmIjogMTMxMzYwMTg1LCAiZGV0YWlsIjogImh0dHA6Ly9tb2NoaS50ZXN0Ojg4ODgvcmVjZWlwdC81MTY5MzE0MzU2In0.k7tI0PTaMJf0w0keAHJR6couypGY-EtA38q2xOtSv6k';
--- a/dom/apps/tests/test_packaged_app_common.js
+++ b/dom/apps/tests/test_packaged_app_common.js
@@ -1,16 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 var PackagedTestHelper = (function PackagedTestHelper() {
   "use strict";
 
-  var launchableValue;
   var steps;
   var index = -1;
   var gSJSPath = "tests/dom/apps/tests/file_packaged_app.sjs";
   var gSJS = "http://test/" + gSJSPath;
   var gAppName = "appname";
   var gApp = null;
   var gInstallOrigin = "http://mochi.test:8888";
   var timeoutID;
@@ -47,17 +46,16 @@ var PackagedTestHelper = (function Packa
   function start() {
     next();
   }
 
   function finish() {
     if (timeoutID) {
       clearTimeout(timeoutID);
     }
-    SpecialPowers.setAllAppsLaunchable(launchableValue);
     SpecialPowers.removePermission("webapps-manage", document);
     SimpleTest.finish();
   }
 
   function mozAppsError() {
     ok(false, "mozApps error: " + this.error.name);
     finish();
   }
@@ -237,13 +235,12 @@ var PackagedTestHelper = (function Packa
     checkAppState: checkAppState,
     checkAppDownloadError: checkAppDownloadError,
     get gSJSPath() { return gSJSPath; },
     set gSJSPath(aValue) { gSJSPath = aValue },
     get gSJS() { return gSJS; },
     get gAppName() { return gAppName;},
     get gApp() { return gApp; },
     set gApp(aValue) { gApp = aValue; },
-    gInstallOrigin: gInstallOrigin,
-    launchableValue: launchableValue
+    gInstallOrigin: gInstallOrigin
   };
 
 })();
--- a/dom/apps/tests/test_packaged_app_install.html
+++ b/dom/apps/tests/test_packaged_app_install.html
@@ -76,18 +76,17 @@ function checkInstalledApp(aMiniManifest
   };
 }
 
 SimpleTest.waitForExplicitFinish();
 
 var steps = [
   function() {
     // Set up
-    PackagedTestHelper.launchableValue =
-      SpecialPowers.setAllAppsLaunchable(true);
+    SpecialPowers.setAllAppsLaunchable(true);
     SpecialPowers.addPermission("webapps-manage", true, document);
     ok(true, "Set up");
     PackagedTestHelper.next();
   },
   function() {
     ok(true, "autoConfirmAppInstall");
     SpecialPowers.autoConfirmAppInstall(PackagedTestHelper.next);
   },
--- a/dom/apps/tests/test_packaged_app_update.html
+++ b/dom/apps/tests/test_packaged_app_update.html
@@ -90,18 +90,17 @@ function updateApp(aExpectedReady, aPrev
                    true);
 
 }
 
 
 var steps = [
   function() {
     // Set up
-    PackagedTestHelper.launchableValue =
-      SpecialPowers.setAllAppsLaunchable(true);
+    SpecialPowers.setAllAppsLaunchable(true);
     SpecialPowers.addPermission("webapps-manage", true, document);
     ok(true, "Set up");
     PackagedTestHelper.next();
   },
   function() {
     ok(true, "autoConfirmAppInstall");
     SpecialPowers.autoConfirmAppInstall(PackagedTestHelper.next);
   },
--- a/dom/apps/tests/test_receipt_operations.html
+++ b/dom/apps/tests/test_receipt_operations.html
@@ -47,17 +47,17 @@ function finish() {
 function cbError(aError) {
   ok(false, "Error callback invoked " + aError);
   finish();
 }
 
 SimpleTest.waitForExplicitFinish();
 
 function runTest() {
-  launchableValue = SpecialPowers.setAllAppsLaunchable(true);
+  SpecialPowers.setAllAppsLaunchable(true);
 
   SpecialPowers.autoConfirmAppInstall(continueTest);
   yield undefined;
 
   var request = navigator.mozApps.install(gManifestURL);
   request.onerror = cbError;
   request.onsuccess = continueTest;
   yield undefined;
--- a/dom/apps/tests/test_signed_pkg_install.html
+++ b/dom/apps/tests/test_signed_pkg_install.html
@@ -22,17 +22,16 @@ https://bugzilla.mozilla.org/show_bug.cg
 <script class="testbody" type="text/javascript">
 
 "use strict";
 
 const Ci = SpecialPowers.Ci;
 const Cc = SpecialPowers.Cc;
 const Cu = SpecialPowers.Cu;
 
-var launchableValue;
 var index = -1;
 var gDebug = false;
 var gApp = null;
 var gAppName = "Simple App";
 var gInstallOrigin = "http://mochi.test:8888/";
 var gSJSPath = "tests/dom/apps/tests/signed_app.sjs";
 var gSJS = gInstallOrigin + gSJSPath;
 var gPackagePath = gInstallOrigin + "tests/dom/apps/tests/";
@@ -90,17 +89,17 @@ var steps = [
     // Set up
     info("Test Initial Setup");
     gSignedAppOriginsStr = SpecialPowers.getCharPref("dom.mozApps.signed_apps_installable_from");
     var signedAppOriginsStr = gSignedAppOriginsStr.concat("," + gInstallOrigin.slice(0, -1));
     SpecialPowers.pushPrefEnv({'set': [['dom.mozApps.signed_apps_installable_from', signedAppOriginsStr]]}, function() {
       var url = SimpleTest.getTestFileURL("chromeAddCert.js");
       var script = SpecialPowers.loadChromeScript(url);
       script.addMessageListener("addCertCompleted", function() {
-        launchableValue = SpecialPowers.setAllAppsLaunchable(true);
+        SpecialPowers.setAllAppsLaunchable(true);
         SpecialPowers.addPermission("webapps-manage", true, document);
         info("Test CA Certificate Selected");
         PackagedTestHelper.next();
         script.destroy();
       });
     });
   },
   function() {
--- a/dom/apps/tests/test_uninstall_errors.html
+++ b/dom/apps/tests/test_uninstall_errors.html
@@ -13,40 +13,39 @@ https://bugzilla.mozilla.org/show_bug.cg
   /** Test for Bug 830258 **/
 
   SimpleTest.waitForExplicitFinish();
 
   var url1 = 'http://test1.example.com/tests/dom/apps/tests/file_app.sjs?apptype=hosted&getmanifest=true';
   var url2 = 'http://test2.example.com/tests/dom/apps/tests/file_app.sjs?apptype=hosted&getmanifest=true';
 
   var gGenerator = runTest();
-  var launchableValue = undefined;
 
   function go() {
     SpecialPowers.pushPermissions(
       [{ "type": "webapps-manage", "allow": 1, "context": document }],
       function() { gGenerator.next() });
   }
 
   function continueTest() {
     try {
       gGenerator.next();
     } catch (e if e instanceof StopIteration) {
-      finish();
+      SimpleTest.finish();
     }
   }
 
   function mozAppsError() {
     ok(false, "mozApps error: " + this.error.name);
-    finish();
+    SimpleTest.finish();
   }
 
   function runTest() {
     // Set up.
-    launchableValue = SpecialPowers.setAllAppsLaunchable(true);
+    SpecialPowers.setAllAppsLaunchable(true);
     SpecialPowers.autoConfirmAppInstall(continueTest);
     yield undefined;
 
     let request = navigator.mozApps.install(url1);
     request.onerror = mozAppsError;
     request.onsuccess = continueTest;
     yield undefined;
     let app1 = request.result;
@@ -87,21 +86,16 @@ https://bugzilla.mozilla.org/show_bug.cg
       continueTest();
     };
     request.onerror = function() {
       ok(false, "Fail to uninstall the app2");
       continueTest();
     };
     yield undefined;
   }
-
-  function finish() {
-    SpecialPowers.setAllAppsLaunchable(launchableValue);
-    SimpleTest.finish();
-  }
   </script>
 </head>
 <body onload="go()">
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=830258">Mozilla Bug 830258</a>
 <p id="display"></p>
 <div id="content" style="display: none">
 
 </div>
--- a/dom/browser-element/mochitest/browserElement_AppFramePermission.js
+++ b/dom/browser-element/mochitest/browserElement_AppFramePermission.js
@@ -3,28 +3,17 @@
 
 // Bug 777384 - Test mozapp permission.
 "use strict";
 
 SimpleTest.waitForExplicitFinish();
 browserElementTestHelpers.setEnabledPref(true);
 browserElementTestHelpers.addPermission();
 
-function makeAllAppsLaunchable() {
-  var originalValue = SpecialPowers.setAllAppsLaunchable(true);
-
-  // Clean up after ourselves once tests are done so the test page is unloaded.
-  window.addEventListener("unload", function restoreAllAppsLaunchable(event) {
-    if (event.target == window.document) {
-      window.removeEventListener("unload", restoreAllAppsLaunchable, false);
-      SpecialPowers.setAllAppsLaunchable(originalValue);
-    }
-  }, false);
-}
-makeAllAppsLaunchable();
+SpecialPowers.setAllAppsLaunchable(true);
 
 function testAppElement(expectAnApp, callback) {
   var iframe = document.createElement('iframe');
   SpecialPowers.wrap(iframe).mozbrowser = true;
   iframe.setAttribute('mozapp', 'http://example.org/manifest.webapp');
   iframe.addEventListener('mozbrowsershowmodalprompt', function(e) {
     is(e.detail.message == 'app', expectAnApp, e.detail.message);
     SimpleTest.executeSoon(callback);
--- a/dom/indexedDB/test/webapp_clearBrowserData.js
+++ b/dom/indexedDB/test/webapp_clearBrowserData.js
@@ -116,26 +116,25 @@ function start()
     return;
   }
 
   SpecialPowers.addPermission("browser", true, document);
   SpecialPowers.addPermission("browser", true, { manifestURL: manifestURL,
                                                  isInBrowserElement: false });
   SpecialPowers.addPermission("embed-apps", true, document);
 
-  let originalAllAppsLaunchable = SpecialPowers.setAllAppsLaunchable(true);
+  SpecialPowers.setAllAppsLaunchable(true);
 
   window.addEventListener("unload", function cleanup(event) {
     if (event.target == document) {
       window.removeEventListener("unload", cleanup, false);
 
       SpecialPowers.removePermission("browser", location.href);
       SpecialPowers.removePermission("browser",
                                      location.protocol + "//" + appDomain);
       SpecialPowers.removePermission("embed-apps", location.href);
-      SpecialPowers.setAllAppsLaunchable(originalAllAppsLaunchable);
     }
   }, false);
 
   SpecialPowers.pushPrefEnv({
     "set": [["dom.mozBrowserFramesEnabled", true]]
   }, runTest);
 }
--- a/dom/tests/mochitest/webapps/file_bug_779982.js
+++ b/dom/tests/mochitest/webapps/file_bug_779982.js
@@ -1,10 +1,10 @@
 SimpleTest.waitForExplicitFinish();
-var originalAllAppsLaunchable = SpecialPowers.setAllAppsLaunchable(true);
+SpecialPowers.setAllAppsLaunchable(true);
 
 var fileTestOnCurrentOrigin = 'http://example.org/tests/dom/tests/mochitest/webapps/file_bug_779982.html';
 
 var gData = [
   // APP 1
   {
     app: 'http://example.org/manifest.webapp',
     action: 'getSelf',
@@ -63,17 +63,16 @@ function runTest() {
     }
 
     if (data.app || data.browser) {
       iframe.addEventListener('mozbrowsershowmodalprompt', function(e) {
         is(e.detail.message, 'success', data.message);
 
         i++;
         if (i >= gData.length) {
-          SpecialPowers.setAllAppsLaunchable(originalAllAppsLaunchable);
           SimpleTest.finish();
         } else {
           gTestRunner.next();
         }
       });
     }
 
     iframe.src = data.src + '?' + data.action + '&' + data.isnull;
--- a/testing/mochitest/tests/SimpleTest/SimpleTest.js
+++ b/testing/mochitest/tests/SimpleTest/SimpleTest.js
@@ -886,16 +886,17 @@ SimpleTest.finish = function () {
                            + "SimpleTest.waitForExplicitFinish() if you need "
                            + "it.)");
     }
 
     if (parentRunner) {
         /* We're running in an iframe, and the parent has a TestRunner */
         parentRunner.testFinished(SimpleTest._tests);
     } else {
+        SpecialPowers.flushAllAppsLaunchable();
         SpecialPowers.flushPermissions(function () {
           SpecialPowers.flushPrefEnv(function() {
             SimpleTest.showReport();
           });
         });
     }
 };
 
--- a/testing/mochitest/tests/SimpleTest/TestRunner.js
+++ b/testing/mochitest/tests/SimpleTest/TestRunner.js
@@ -473,16 +473,17 @@ TestRunner.testFinished = function(tests
         } else {
             interstitialURL = "/tests/SimpleTest/iframe-between-tests.html";
         }
         TestRunner._makeIframe(interstitialURL, 0);
     }
 
     SpecialPowers.executeAfterFlushingMessageQueue(function() {
         cleanUpCrashDumpFiles();
+        SpecialPowers.flushAllAppsLaunchable();
         SpecialPowers.flushPermissions(function () { SpecialPowers.flushPrefEnv(runNextTest); });
     });
 };
 
 TestRunner.testUnloaded = function() {
     // If we're in a debug build, check assertion counts.  This code is
     // similar to the code in Tester_nextTest in browser-test.js used
     // for browser-chrome mochitests.
--- a/testing/specialpowers/content/specialpowersAPI.js
+++ b/testing/specialpowers/content/specialpowersAPI.js
@@ -1026,21 +1026,28 @@ SpecialPowersAPI.prototype = {
   // The provided callback is invoked once the prompt is disabled.
   autoConfirmAppInstall: function(cb) {
     this.pushPrefEnv({set: [['dom.mozApps.auto_confirm_install', true]]}, cb);
   },
 
   // Allow tests to disable the per platform app validity checks so we can
   // test higher level WebApp functionality without full platform support.
   setAllAppsLaunchable: function(launchable) {
-    var message = {
+    this._sendSyncMessage("SPWebAppService", {
       op: "set-launchable",
       launchable: launchable
-    };
-    return this._sendSyncMessage("SPWebAppService", message);
+    });
+  },
+
+  // Restore the launchable property to its default value.
+  flushAllAppsLaunchable: function() {
+    this._sendSyncMessage("SPWebAppService", {
+      op: "set-launchable",
+      launchable: false
+    });
   },
 
   _proxiedObservers: {
     "specialpowers-http-notify-request": function(aMessage) {
       let uri = aMessage.json.uri;
       Services.obs.notifyObservers(null, "specialpowers-http-notify-request", uri);
     },
   },
--- a/toolkit/devtools/apps/tests/test_webapps_actor.html
+++ b/toolkit/devtools/apps/tests/test_webapps_actor.html
@@ -16,18 +16,16 @@ https://bugzilla.mozilla.org/show_bug.cg
 <div id="content" style="display: none">
 
 </div>
 <pre id="test">
 <script class="testbody" type="application/javascript;version=1.8">
 
 "use strict";
 
-var launchableValue = undefined;
-
 var index = -1;
 
 function debug(aMsg) {
   //dump("== Tests debug == " + aMsg + "\n");
 }
 
 function next() {
   index += 1;
@@ -42,17 +40,16 @@ function next() {
   }
 }
 
 function start() {
   next();
 }
 
 function finish() {
-  SpecialPowers.setAllAppsLaunchable(launchableValue);
   SpecialPowers.removePermission("webapps-manage", document);
   SimpleTest.finish();
 }
 
 function cbError(aError) {
   ok(false, "Error callback invoked " + aError);
   finish();
 }
@@ -68,17 +65,17 @@ const PACKAGED_APP_MANIFEST = PACKAGED_A
 const CERTIFIED_APP_ID = "test-certified-id";
 const CERTIFIED_APP_ORIGIN = "app://" + CERTIFIED_APP_ID;
 const CERTIFIED_APP_MANIFEST = CERTIFIED_APP_ORIGIN + "/manifest.webapp";
 
 var steps = [
   function() {
     info("== SETUP ==");
     // Set up
-    launchableValue = SpecialPowers.setAllAppsLaunchable(true);
+    SpecialPowers.setAllAppsLaunchable(true);
     SpecialPowers.addPermission("webapps-manage", true, document);
     SpecialPowers.addPermission("browser", true, document);
     SpecialPowers.addPermission("embed-apps", true, document);
 
     // Required on firefox as these prefs are only set on b2g:
     SpecialPowers.pushPrefEnv({
       set: [["dom.mozBrowserFramesEnabled", true],
             ["security.apps.privileged.CSP.default",