mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-01 14:45:29 +00:00
Bug 536295 - e10s HTTP: offline application cache [r=mfinkle]
This commit is contained in:
parent
bc7bfefdea
commit
eedabd6d0c
@ -2323,7 +2323,7 @@ ProgressController.prototype = {
|
||||
};
|
||||
|
||||
var OfflineApps = {
|
||||
offlineAppRequested: function(aRequest) {
|
||||
offlineAppRequested: function(aRequest, aTarget) {
|
||||
if (!Services.prefs.getBoolPref("browser.offline-apps.notify"))
|
||||
return;
|
||||
|
||||
@ -2356,7 +2356,7 @@ var OfflineApps = {
|
||||
accessKey: null,
|
||||
callback: function() {
|
||||
for (let i = 0; i < notification.documents.length; i++)
|
||||
OfflineApps.allowSite(notification.documents[i]);
|
||||
OfflineApps.allowSite(notification.documents[i], aTarget);
|
||||
}
|
||||
},{
|
||||
label: strings.getString("offlineApps.never"),
|
||||
@ -2379,13 +2379,14 @@ var OfflineApps = {
|
||||
}
|
||||
},
|
||||
|
||||
allowSite: function(aRequest) {
|
||||
allowSite: function(aRequest, aTarget) {
|
||||
let currentURI = Services.io.newURI(aRequest.location, aRequest.charset, null);
|
||||
Services.perms.add(currentURI, "offline-app", Ci.nsIPermissionManager.ALLOW_ACTION);
|
||||
|
||||
// When a site is enabled while loading, manifest resources will start
|
||||
// fetching immediately. This one time we need to do it ourselves.
|
||||
this._startFetching(aRequest);
|
||||
// The update must be started on the content process.
|
||||
aTarget.messageManager.sendAsyncMessage("Browser:MozApplicationCache:Fetch", aRequest);
|
||||
},
|
||||
|
||||
disallowSite: function(aRequest) {
|
||||
@ -2393,17 +2394,9 @@ var OfflineApps = {
|
||||
Services.perms.add(currentURI, "offline-app", Ci.nsIPermissionManager.DENY_ACTION);
|
||||
},
|
||||
|
||||
_startFetching: function(aRequest) {
|
||||
let currentURI = Services.io.newURI(aRequest.location, aRequest.charset, null);
|
||||
let manifestURI = Services.io.newURI(aRequest.manifest, aRequest.charset, currentURI);
|
||||
|
||||
let updateService = Cc["@mozilla.org/offlinecacheupdate-service;1"].getService(Ci.nsIOfflineCacheUpdateService);
|
||||
updateService.scheduleUpdate(manifestURI, currentURI);
|
||||
},
|
||||
|
||||
receiveMessage: function receiveMessage(aMessage) {
|
||||
if (aMessage.name == "Browser:MozApplicationManifest") {
|
||||
this.offlineAppRequested(aMessage.json);
|
||||
this.offlineAppRequested(aMessage.json, aMessage.target);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -293,6 +293,7 @@ function Content() {
|
||||
addMessageListener("Browser:MouseUp", this);
|
||||
addMessageListener("Browser:SaveAs", this);
|
||||
addMessageListener("Browser:ZoomToPoint", this);
|
||||
addMessageListener("Browser:MozApplicationCache:Fetch", this);
|
||||
|
||||
if (Util.isParentProcess())
|
||||
addEventListener("DOMActivate", this, true);
|
||||
@ -454,6 +455,15 @@ Content.prototype = {
|
||||
sendAsyncMessage("Browser:ZoomToPoint:Return", { x: x, y: y, rect: rect });
|
||||
break;
|
||||
}
|
||||
|
||||
case "Browser:MozApplicationCache:Fetch": {
|
||||
let currentURI = Services.io.newURI(json.location, json.charset, null);
|
||||
let manifestURI = Services.io.newURI(json.manifest, json.charset, currentURI);
|
||||
let updateService = Cc["@mozilla.org/offlinecacheupdate-service;1"]
|
||||
.getService(Ci.nsIOfflineCacheUpdateService);
|
||||
updateService.scheduleUpdate(manifestURI, currentURI, content);
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user