Bug 1174110 - The service worker still remains registered when uninstalling the service-worker-enabled application. r=fabrice
authorFernando Jimenez <ferjmoreno@gmail.com>
Wed, 17 Jun 2015 11:50:24 +0200
changeset 249326 a1b614ffa0424a29c0392a9e6f1ccf8fb4fd8267
parent 249325 9ea2dfc3325d47a4198f54a3d9ff7f8b081e592e
child 249327 9708f0fcc1b0e02a9b5ca2c7ab1236e8bfca22e2
push id28923
push userryanvm@gmail.com
push dateWed, 17 Jun 2015 18:57:11 +0000
treeherdermozilla-central@099d6cd6725e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfabrice
bugs1174110
milestone41.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 1174110 - The service worker still remains registered when uninstalling the service-worker-enabled application. r=fabrice
dom/apps/AppsUtils.jsm
dom/apps/tests/unit/test_moziapplication.js
--- a/dom/apps/AppsUtils.jsm
+++ b/dom/apps/AppsUtils.jsm
@@ -47,24 +47,17 @@ this.mozIApplication = function(aApp) {
   _setAppProperties(this, aApp);
 }
 
 mozIApplication.prototype = {
   hasPermission: function(aPermission) {
     // This helper checks an URI inside |aApp|'s origin and part of |aApp| has a
     // specific permission. It is not checking if browsers inside |aApp| have such
     // permission.
-    let principal = this.principal;
-    if (this.installerIsBrowser) {
-      let uri = Services.io.newURI(this.origin, null, null);
-      principal =
-        Services.scriptSecurityManager.getAppCodebasePrincipal(uri, this.localId,
-                                                               /*mozbrowser*/false);
-    }
-    let perm = Services.perms.testExactPermissionFromPrincipal(principal,
+    let perm = Services.perms.testExactPermissionFromPrincipal(this.principal,
                                                                aPermission);
     return (perm === Ci.nsIPermissionManager.ALLOW_ACTION);
   },
 
   hasWidgetPage: function(aPageURL) {
     let uri = Services.io.newURI(aPageURL, null, null);
     let filepath = AppsUtils.getFilePath(uri.path);
     let eliminatedUri = Services.io.newURI(uri.prePath + filepath, null, null);
@@ -79,17 +72,17 @@ mozIApplication.prototype = {
     }
 
     this._principal = null;
 
     try {
       this._principal = Services.scriptSecurityManager.getAppCodebasePrincipal(
         Services.io.newURI(this.origin, null, null),
         this.localId,
-        this.installerIsBrowser
+        false /* mozbrowser */
       );
     } catch(e) {
       dump("Could not create app principal " + e + "\n");
     }
 
     return this._principal;
   },
 
--- a/dom/apps/tests/unit/test_moziapplication.js
+++ b/dom/apps/tests/unit/test_moziapplication.js
@@ -50,16 +50,16 @@ add_test(() => {
                  "app[" + key + "] should be equal to mozapp[" + key + "]");
   });
 
   Assert.ok(mozapp.principal, "app principal should exist");
   let expectedPrincipalOrigin = app.origin + "!appId=" + app.localId;
   Assert.equal(mozapp.principal.origin, expectedPrincipalOrigin,
                "app principal origin ok");
   Assert.equal(mozapp.principal.appId, app.localId, "app principal appId ok");
-  Assert.equal(mozapp.principal.isInBrowserElement, app.installerIsBrowser,
+  Assert.equal(mozapp.principal.isInBrowserElement, false,
                "app principal isInBrowserElement ok");
   run_next_test();
 });
 
 function run_test() {
   run_next_test();
 }