Bug 1199295 - Pass right loadingPrincipal to uriloader/prefetch - dom/apps (r=fabrice)
authorChristoph Kerschbaumer <mozilla@christophkerschbaumer.com>
Fri, 02 Oct 2015 09:16:07 -0700
changeset 299201 5e9bf8fead19f79266a3405f6da17ceed96cea64
parent 299200 dd3f94001ecdc0fa86225ceb89b0619e39e2cbf0
child 299202 8d76980d51998798b68cdf4f931b139c62ce2a06
push id5392
push userraliiev@mozilla.com
push dateMon, 14 Dec 2015 20:08:23 +0000
treeherdermozilla-beta@16ce8562a975 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfabrice
bugs1199295
milestone44.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 1199295 - Pass right loadingPrincipal to uriloader/prefetch - dom/apps (r=fabrice)
dom/apps/Webapps.jsm
--- a/dom/apps/Webapps.jsm
+++ b/dom/apps/Webapps.jsm
@@ -1984,18 +1984,22 @@ this.DOMApplicationRegistry = {
         error: null,
         app: {
           downloading: true,
           installState: aApp.installState,
           progress: 0
         },
         id: aApp.id
       });
+      let appURI = NetUtil.newURI(aApp.origin, null, null);
+      let principal =
+        Services.scriptSecurityManager.createCodebasePrincipal(appURI,
+                                                               {appId: aApp.localId});
       let cacheUpdate = updateSvc.scheduleAppUpdate(
-        appcacheURI, docURI, aApp.localId, false, aProfileDir);
+        appcacheURI, docURI, principal, aApp.localId, false, aProfileDir);
 
       // We save the download details for potential further usage like
       // cancelling it.
       let download = {
         cacheUpdate: cacheUpdate,
         appId: this._appIdForManifestURL(aApp.manifestURL),
         previousState: aIsUpdate ? "installed" : "pending"
       };
@@ -2134,18 +2138,22 @@ this.DOMApplicationRegistry = {
               sendError("NOT_UPDATABLE");
             }
           }
         };
         let helper =
           new ManifestHelper(manifest, aData.origin, aData.manifestURL);
         debug("onlyCheckAppCache - launch updateSvc.checkForUpdate for " +
               helper.fullAppcachePath());
+        let appURI = NetUtil.newURI(aApp.origin, null, null);
+        let principal =
+          Services.scriptSecurityManager.createCodebasePrincipal(appURI,
+                                                                 {appId: aApp.localId});
         updateSvc.checkForUpdate(Services.io.newURI(helper.fullAppcachePath(), null, null),
-                                 app.localId, false, updateObserver);
+                                 principal, app.localId, false, updateObserver);
       });
       return;
     }
 
     // On xhr load request event
     function onload(xhr, oldManifest) {
       debug("Got http status=" + xhr.status + " for " + aData.manifestURL);
       let oldHash = app.manifestHash;
@@ -2404,19 +2412,23 @@ this.DOMApplicationRegistry = {
       });
     } else {
       // Check if the appcache is updatable, and send "downloadavailable" or
       // "downloadapplied".
       debug("updateHostedApp: updateSvc.checkForUpdate for " +
             manifest.fullAppcachePath());
 
       let updateDeferred = Promise.defer();
+      let appURI = NetUtil.newURI(aApp.origin, null, null);
+      let principal =
+        Services.scriptSecurityManager.createCodebasePrincipal(appURI,
+                                                               {appId: aApp.localId});
 
       updateSvc.checkForUpdate(Services.io.newURI(manifest.fullAppcachePath(), null, null),
-                               aApp.localId, false,
+                               principal, aApp.localId, false,
                                (aSubject, aTopic, aData) => updateDeferred.resolve(aTopic));
 
       let topic = yield updateDeferred.promise;
 
       debug("updateHostedApp: updateSvc.checkForUpdate return for " +
             aApp.manifestURL + " - event is " + topic);
 
       let eventType =