mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:18:48 +00:00
fe0509a62e
- Bug 904479 - Added createPromiseWithId() that returns id of resolver r=kanru,nsm (2ac672d882) - Bug 1166580 - Disable mozHasPendingMessage tests on non-browser platform. r=me (03c689964b) - Bug 1162281 - Invalid system message handler in an App Manifest can break the entire system. r=fabrice (e192a95f9c) - Bug 1198988 - Turn off some useless dump() calls r=ferjm (34fc83b236) - Bug 1164498: Remove |DispatchBluetoothReply|, r=btian (6143335efa) - Bug 1001757 - Add ability to store core apps outside of profile on desktop b2g; r=fabrice (f6b605e7aa) - Bug 1155245 - Set the app status correctly for hosted certified apps in developer mode. r=fabrice (131178b80e) - Bug 1179052 - Add some raptor markers to b2g gecko startup r=gwagner (222256fad8) - Bug 1163904 - handle -url command line argument. r=fabrice (ee61af1ff9) - Bug 1167275 - JS error in shell.js handleCmdLine() r=me (32e75c604f) - Bug 1167197 - Fix GMPProvider on Android r=cpearce Bug 1181209 - Make changes to Gecko needed for b2gdroid to boot. r=fabrice (b35d3a372f) - Bug 1158544 - Remove FTPChannelChild::mWasOpened and make the base class mWasOpened protected; r=mcmanus (9111e1bc00) - Bug 1171716 - Part 2: Use NS_ReleaseOnMainThread in nsBaseChannel. r=froydnj (f138124f14) - partial of Bug 1177175 - Add a UITour target inside the TP panel. (603cc719b3) - Bug 1175545 - Dont process alt-svc on 421 r=hurley (ad0f2f6e91) - Bug 1191291 - convert nsHttpChannel::RetargetDeliveryTo warning to log r=michal.novotny (b9c6003df8) - Bug 1182487 - Don't try to write to HTTP cache entry in nsHttpChannel when entry is open for reading only. r=michal (b36d7014a0) - Bug 1173069 - Don't accumulate the cache hit telemetry for intercepted channels; r=mayhemer,jdm (aaed79183d) - Bug 1208755 HttpBaseChannel::ShouldIntercept() should not assume every channel has a LoadInfo. r=ckerschb (d55be94901) - Bug 1201229 - Return an empty string for a header when an error occurs; r=dragana (256d0462c8) - Bug 1048048 - add preload content policy types - web platform test updates (r=dveditz) (baa1004dd6) - Bug 1048048 - add preload content policy types - csp changes (r=dveditz) (17914dadba) - Bug 1048048 - add preload content policy types for stylesheets (r=cam) (29af13263a) - Bug 1048048 - add preload content policy types (r=ehsan) (f58a32d51b) - Bug 1201747 - Don't inspect the subject principal in StorageAllowedForPrincipal. r=mystor (4f2c100882) - Bug 1176829 - Remove custom elements base element queue. r=smaug (03a520c13d) - Bug 1176829 follow-up, finish removing unused member to fix bustage. CLOSED TREE (29c6150af8) - Bug 1179909: Build fix. r=me CLOSED TREE (40e3bdb971) - Bug 1188932 - Allow the User-Agent header to be explicitly set by requests, r=bkelly, r=jgraham (37aacbd37d)
254 lines
7.7 KiB
JavaScript
254 lines
7.7 KiB
JavaScript
/* 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/. */
|
|
|
|
"use strict";
|
|
|
|
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
|
|
|
|
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
|
Cu.import("resource://gre/modules/Services.jsm");
|
|
Cu.import("resource://gre/modules/DOMRequestHelper.jsm");
|
|
|
|
let debug = Services.prefs.getBoolPref("dom.system_update.debug")
|
|
? (aMsg) => dump("-*- SystemUpdateManager.js : " + aMsg + "\n")
|
|
: (aMsg) => {};
|
|
|
|
const SYSTEMUPDATEPROVIDER_CID = Components.ID("{11fbea3d-fd94-459a-b8fb-557fe19e473a}");
|
|
const SYSTEMUPDATEMANAGER_CID = Components.ID("{e8530001-ba5b-46ab-a306-7fbeb692d0fe}");
|
|
const SYSTEMUPDATEMANAGER_CONTRACTID = "@mozilla.org/system-update-manager;1";
|
|
|
|
XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
|
|
"@mozilla.org/childprocessmessagemanager;1",
|
|
"nsISyncMessageSender");
|
|
|
|
function SystemUpdateProvider(win, provider) {
|
|
this.initDOMRequestHelper(win, [
|
|
{name: "SystemUpdate:OnUpdateAvailable", weakRef: true},
|
|
{name: "SystemUpdate:OnProgress", weakRef: true},
|
|
{name: "SystemUpdate:OnUpdateReady", weakRef: true},
|
|
{name: "SystemUpdate:OnError", weakRef: true},
|
|
]);
|
|
this._provider = Cu.cloneInto(provider, win);
|
|
}
|
|
|
|
SystemUpdateProvider.prototype = {
|
|
__proto__: DOMRequestIpcHelper.prototype,
|
|
|
|
classID: SYSTEMUPDATEPROVIDER_CID,
|
|
QueryInterface: XPCOMUtils.generateQI([Ci.nsISupportsWeakReference,
|
|
Ci.nsIObserver]),
|
|
|
|
receiveMessage: function(aMsg) {
|
|
if (!aMsg || !aMsg.json) {
|
|
return;
|
|
}
|
|
|
|
let json = aMsg.json;
|
|
|
|
if (json.uuid !== this._provider.uuid) {
|
|
return;
|
|
}
|
|
|
|
debug("receive msg: " + aMsg.name);
|
|
switch (aMsg.name) {
|
|
case "SystemUpdate:OnUpdateAvailable": {
|
|
let detail = {
|
|
detail: {
|
|
packageInfo: json.packageInfo
|
|
}
|
|
};
|
|
let event = new this._window.CustomEvent("updateavailable",
|
|
Cu.cloneInto(detail, this._window));
|
|
this.__DOM_IMPL__.dispatchEvent(event);
|
|
break;
|
|
}
|
|
case "SystemUpdate:OnProgress": {
|
|
let event = new this._window.ProgressEvent("progress", {lengthComputable: true,
|
|
loaded: json.loaded,
|
|
total: json.total});
|
|
this.__DOM_IMPL__.dispatchEvent(event);
|
|
break;
|
|
}
|
|
case "SystemUpdate:OnUpdateReady": {
|
|
let event = new this._window.Event("updateready");
|
|
this.__DOM_IMPL__.dispatchEvent(event);
|
|
break;
|
|
}
|
|
case "SystemUpdate:OnError": {
|
|
let event = new this._window.ErrorEvent("error", {message: json.message});
|
|
this.__DOM_IMPL__.dispatchEvent(event);
|
|
break;
|
|
}
|
|
}
|
|
},
|
|
|
|
destroy: function() {
|
|
this.destroyDOMRequestHelper();
|
|
},
|
|
|
|
get name() {
|
|
return this._provider.name;
|
|
},
|
|
|
|
get uuid() {
|
|
return this._provider.uuid;
|
|
},
|
|
|
|
get onupdateavailable() {
|
|
return this.__DOM_IMPL__.getEventHandler("onupdateavailable");
|
|
},
|
|
set onupdateavailable(aHandler) {
|
|
this.__DOM_IMPL__.setEventHandler("onupdateavailable", aHandler);
|
|
},
|
|
get onprogress() {
|
|
return this.__DOM_IMPL__.getEventHandler("onprogress");
|
|
},
|
|
set onprogress(aHandler) {
|
|
this.__DOM_IMPL__.setEventHandler("onprogress", aHandler);
|
|
},
|
|
get onupdateready() {
|
|
return this.__DOM_IMPL__.getEventHandler("onupdateready");
|
|
},
|
|
set onupdateready(aHandler) {
|
|
this.__DOM_IMPL__.setEventHandler("onupdateready", aHandler);
|
|
},
|
|
get onerror() {
|
|
return this.__DOM_IMPL__.getEventHandler("onerror");
|
|
},
|
|
set onerror(aHandler) {
|
|
this.__DOM_IMPL__.setEventHandler("onerror", aHandler);
|
|
},
|
|
|
|
checkForUpdate: function() {
|
|
let self = this;
|
|
cpmm.sendAsyncMessage("SystemUpdate:CheckForUpdate", {
|
|
uuid: self._provider.uuid
|
|
});
|
|
},
|
|
startDownload: function() {
|
|
let self = this;
|
|
cpmm.sendAsyncMessage("SystemUpdate:StartDownload", {
|
|
uuid: self._provider.uuid
|
|
});
|
|
},
|
|
stopDownload: function() {
|
|
let self = this;
|
|
cpmm.sendAsyncMessage("SystemUpdate:StopDownload", {
|
|
uuid: self._provider.uuid
|
|
});
|
|
},
|
|
applyUpdate: function() {
|
|
let self = this;
|
|
cpmm.sendAsyncMessage("SystemUpdate:ApplyUpdate", {
|
|
uuid: self._provider.uuid
|
|
});
|
|
},
|
|
setParameter: function(aName, aValue) {
|
|
let self = this;
|
|
return cpmm.sendSyncMessage("SystemUpdate:SetParameter", {
|
|
uuid: self._provider.uuid,
|
|
name: aName,
|
|
value: aValue
|
|
})[0];
|
|
},
|
|
getParameter: function(aName) {
|
|
let self = this;
|
|
return cpmm.sendSyncMessage("SystemUpdate:GetParameter", {
|
|
uuid: self._provider.uuid,
|
|
name: aName
|
|
})[0];
|
|
},
|
|
};
|
|
|
|
function SystemUpdateManager() {}
|
|
|
|
SystemUpdateManager.prototype = {
|
|
__proto__: DOMRequestIpcHelper.prototype,
|
|
|
|
classID: SYSTEMUPDATEMANAGER_CID,
|
|
QueryInterface: XPCOMUtils.generateQI([Ci.nsISupportsWeakReference,
|
|
Ci.nsIObserver,
|
|
Ci.nsIDOMGlobalPropertyInitializer]),
|
|
|
|
receiveMessage: function(aMsg) {
|
|
if (!aMsg || !aMsg.json) {
|
|
return;
|
|
}
|
|
|
|
let json = aMsg.json;
|
|
let resolver = this.takePromiseResolver(json.requestId);
|
|
|
|
if (!resolver) {
|
|
return;
|
|
}
|
|
|
|
debug("receive msg: " + aMsg.name);
|
|
switch (aMsg.name) {
|
|
case "SystemUpdate:GetProviders:Result:OK": {
|
|
resolver.resolve(Cu.cloneInto(json.providers, this._window));
|
|
break;
|
|
}
|
|
case "SystemUpdate:SetActiveProvider:Result:OK":
|
|
case "SystemUpdate:GetActiveProvider:Result:OK": {
|
|
let updateProvider = new SystemUpdateProvider(this._window, json.provider);
|
|
resolver.resolve(this._window.SystemUpdateProvider._create(this._window,
|
|
updateProvider));
|
|
break;
|
|
}
|
|
case "SystemUpdate:GetProviders:Result:Error":
|
|
case "SystemUpdate:GetActiveProvider:Result:Error":
|
|
case "SystemUpdate:SetActiveProvider:Result:Error": {
|
|
resolver.reject(json.error);
|
|
break;
|
|
}
|
|
}
|
|
},
|
|
|
|
init: function(aWindow) {
|
|
this.initDOMRequestHelper(aWindow, [
|
|
{name: "SystemUpdate:GetProviders:Result:OK", weakRef: true},
|
|
{name: "SystemUpdate:GetProviders:Result:Error", weakRef: true},
|
|
{name: "SystemUpdate:GetActiveProvider:Result:OK", weakRef: true},
|
|
{name: "SystemUpdate:GetActiveProvider:Result:Error", weakRef: true},
|
|
{name: "SystemUpdate:SetActiveProvider:Result:OK", weakRef: true},
|
|
{name: "SystemUpdate:SetActiveProvider:Result:Error", weakRef: true},
|
|
]);
|
|
},
|
|
|
|
uninit: function() {
|
|
let self = this;
|
|
|
|
this.forEachPromiseResolver(function(aKey) {
|
|
self.takePromiseResolver(aKey).reject("SystemUpdateManager got destroyed");
|
|
});
|
|
},
|
|
|
|
getProviders: function() {
|
|
return this.createPromiseWithId(function(aResolverId) {
|
|
cpmm.sendAsyncMessage("SystemUpdate:GetProviders", {
|
|
requestId: aResolverId,
|
|
});
|
|
});
|
|
},
|
|
|
|
getActiveProvider: function() {
|
|
return this.createPromiseWithId(function(aResolverId) {
|
|
cpmm.sendAsyncMessage("SystemUpdate:GetActiveProvider", {
|
|
requestId: aResolverId,
|
|
});
|
|
});
|
|
},
|
|
|
|
setActiveProvider: function(aUuid) {
|
|
return this.createPromiseWithId(function(aResolverId) {
|
|
cpmm.sendAsyncMessage("SystemUpdate:SetActiveProvider", {
|
|
requestId: aResolverId,
|
|
uuid: aUuid
|
|
});
|
|
});
|
|
}
|
|
};
|
|
|
|
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([SystemUpdateManager]);
|