Merge b2ginbound to central, a=merge a=yolo

This commit is contained in:
Wes Kocher 2015-07-13 15:47:28 -07:00
commit fea7f307dc
38 changed files with 1503 additions and 27 deletions

View File

@ -623,6 +623,9 @@ pref("app.update.socket.maxErrors", 20);
// Enable update logging for now, to diagnose growing pains in the
// field.
pref("app.update.log", true);
// SystemUpdate API
pref("dom.system_update.active", "@mozilla.org/updates/update-prompt;1");
#else
// Explicitly disable the shutdown watchdog. It's enabled by default.
// When the updater is disabled, we want to know about shutdown hangs.
@ -1111,6 +1114,9 @@ pref("dom.mapped_arraybuffer.enabled", true);
// BroadcastChannel API
pref("dom.broadcastChannel.enabled", true);
// SystemUpdate API
pref("dom.system_update.enabled", true);
// UDPSocket API
pref("dom.udpsocket.enabled", true);

View File

@ -18,6 +18,7 @@ Cu.import('resource://gre/modules/Keyboard.jsm');
Cu.import('resource://gre/modules/ErrorPage.jsm');
Cu.import('resource://gre/modules/AlertsHelper.jsm');
Cu.import('resource://gre/modules/RequestSyncService.jsm');
Cu.import('resource://gre/modules/SystemUpdateService.jsm');
#ifdef MOZ_WIDGET_GONK
Cu.import('resource://gre/modules/NetworkStatsService.jsm');
Cu.import('resource://gre/modules/ResourceStatsService.jsm');

View File

@ -13,6 +13,7 @@ contract @mozilla.org/content-permission/prompt;1 {8c719f03-afe0-4aac-91ff-6c215
# UpdatePrompt.js
component {88b3eb21-d072-4e3b-886d-f89d8c49fe59} UpdatePrompt.js
contract @mozilla.org/updates/update-prompt;1 {88b3eb21-d072-4e3b-886d-f89d8c49fe59}
category system-update-provider MozillaProvider @mozilla.org/updates/update-prompt;1,{88b3eb21-d072-4e3b-886d-f89d8c49fe59}
#endif
# DirectoryProvider.js

View File

@ -84,12 +84,22 @@ UpdateCheckListener.prototype = {
if (updateCount == 0) {
this._updatePrompt.setUpdateStatus("no-updates");
if (this._updatePrompt._systemUpdateListener) {
this._updatePrompt._systemUpdateListener.onError("no-updates");
}
return;
}
let update = Services.aus.selectUpdate(updates, updateCount);
if (!update) {
this._updatePrompt.setUpdateStatus("already-latest-version");
if (this._updatePrompt._systemUpdateListener) {
this._updatePrompt._systemUpdateListener.onError("already-latest-version");
}
return;
}
@ -102,14 +112,22 @@ UpdateCheckListener.prototype = {
// require all 32 bits.
let errorCode = update.errorCode >>> 0;
let isNSError = (errorCode >>> 31) == 1;
let errorMsg = "check-error-";
if (errorCode == NETWORK_ERROR_OFFLINE) {
this._updatePrompt.setUpdateStatus("retry-when-online");
errorMsg = "retry-when-online";
this._updatePrompt.setUpdateStatus(errorMsg);
} else if (isNSError) {
this._updatePrompt.setUpdateStatus("check-error-" + errorCode);
errorMsg = "check-error-" + errorCode;
this._updatePrompt.setUpdateStatus(errorMsg);
} else if (errorCode > HTTP_ERROR_OFFSET) {
let httpErrorCode = errorCode - HTTP_ERROR_OFFSET;
this._updatePrompt.setUpdateStatus("check-error-http-" + httpErrorCode);
errorMsg = "check-error-http-" + httpErrorCode;
this._updatePrompt.setUpdateStatus(errorMsg);
}
if (this._updatePrompt._systemUpdateListener) {
this._updatePrompt._systemUpdateListener.onError(errorMsg);
}
Services.aus.QueryInterface(Ci.nsIUpdateCheckListener);
@ -129,13 +147,93 @@ UpdatePrompt.prototype = {
Ci.nsIUpdateCheckListener,
Ci.nsIRequestObserver,
Ci.nsIProgressEventSink,
Ci.nsIObserver]),
Ci.nsIObserver,
Ci.nsISystemUpdateProvider]),
_xpcom_factory: XPCOMUtils.generateSingletonFactory(UpdatePrompt),
_update: null,
_applyPromptTimer: null,
_waitingForIdle: false,
_updateCheckListner: null,
_systemUpdateListener: null,
_availableParameters: {
"deviceinfo.last_updated": null,
"gecko.updateStatus": null,
"app.update.channel": null,
"app.update.interval": null,
"app.update.url": null,
},
_pendingUpdateAvailablePackageInfo: null,
_isPendingUpdateReady: false,
// nsISystemUpdateProvider
checkForUpdate: function() {
this.forceUpdateCheck();
},
startDownload: function() {
this.downloadUpdate(this._update);
},
stopDownload: function() {
this.handleDownloadCancel();
},
applyUpdate: function() {
this.handleApplyPromptResult({result: "restart"});
},
setParameter: function(aName, aValue) {
if (!this._availableParameters.hasOwnProperty(aName)) {
return false;
}
this._availableParameters[aName] = aValue;
switch (aName) {
case "app.update.channel":
case "app.update.url":
Services.prefs.setCharPref(aName, aValue);
break;
case "app.update.interval":
Services.prefs.setIntPref(aName, parseInt(aValue, 10));
break;
}
return true;
},
getParameter: function(aName) {
if (!this._availableParameters.hasOwnProperty(aName)) {
return null;
}
return this._availableParameters[aName];
},
setListener: function(aListener) {
this._systemUpdateListener = aListener;
// If an update is available or ready, trigger the event right away at this point.
if (this._pendingUpdateAvailablePackageInfo) {
this._systemUpdateListener.onUpdateAvailable(this._pendingUpdateAvailablePackageInfo.type,
this._pendingUpdateAvailablePackageInfo.version,
this._pendingUpdateAvailablePackageInfo.description,
this._pendingUpdateAvailablePackageInfo.buildDate,
this._pendingUpdateAvailablePackageInfo.size);
// Set null when the listener is attached.
this._pendingUpdateAvailablePackageInfo = null;
}
if (this._isPendingUpdateReady) {
this._systemUpdateListener.onUpdateReady();
this._isPendingUpdateReady = false;
}
},
unsetListener: function(aListener) {
this._systemUpdateListener = null;
},
get applyPromptTimeout() {
return Services.prefs.getIntPref(PREF_APPLY_PROMPT_TIMEOUT);
@ -157,6 +255,37 @@ UpdatePrompt.prototype = {
checkForUpdates: function UP_checkForUpdates() { },
showUpdateAvailable: function UP_showUpdateAvailable(aUpdate) {
let packageInfo = {};
packageInfo.version = aUpdate.displayVersion;
packageInfo.description = aUpdate.statusText;
packageInfo.buildDate = aUpdate.buildID;
let patch = aUpdate.selectedPatch;
if (!patch && aUpdate.patchCount > 0) {
// For now we just check the first patch to get size information if a
// patch hasn't been selected yet.
patch = aUpdate.getPatchAt(0);
}
if (patch) {
packageInfo.size = patch.size;
packageInfo.type = patch.type;
} else {
log("Warning: no patches available in update");
}
this._pendingUpdateAvailablePackageInfo = packageInfo;
if (this._systemUpdateListener) {
this._systemUpdateListener.onUpdateAvailable(packageInfo.type,
packageInfo.version,
packageInfo.description,
packageInfo.buildDate,
packageInfo.size);
// Set null since the event is fired.
this._pendingUpdateAvailablePackageInfo = null;
}
if (!this.sendUpdateEvent("update-available", aUpdate)) {
log("Unable to prompt for available update, forcing download");
@ -165,6 +294,12 @@ UpdatePrompt.prototype = {
},
showUpdateDownloaded: function UP_showUpdateDownloaded(aUpdate, aBackground) {
if (this._systemUpdateListener) {
this._systemUpdateListener.onUpdateReady();
} else {
this._isPendingUpdateReady = true;
}
// The update has been downloaded and staged. We send the update-downloaded
// event right away. After the user has been idle for a while, we send the
// update-prompt-restart event, increasing the chances that we can apply the
@ -188,12 +323,18 @@ UpdatePrompt.prototype = {
showUpdateError: function UP_showUpdateError(aUpdate) {
log("Update error, state: " + aUpdate.state + ", errorCode: " +
aUpdate.errorCode);
if (this._systemUpdateListener) {
this._systemUpdateListener.onError("update-error: " + aUpdate.errorCode + " " + aUpdate.statusText);
}
this.sendUpdateEvent("update-error", aUpdate);
this.setUpdateStatus(aUpdate.statusText);
},
showUpdateHistory: function UP_showUpdateHistory(aParent) { },
showUpdateInstalled: function UP_showUpdateInstalled() {
this.setParameter("deviceinfo.last_updated", Date.now());
if (useSettings()) {
let lock = Services.settings.createLock();
lock.set("deviceinfo.last_updated", Date.now(), null, null);
@ -213,6 +354,8 @@ UpdatePrompt.prototype = {
},
setUpdateStatus: function UP_setUpdateStatus(aStatus) {
this.setParameter("gecko.updateStatus", aStatus);
if (useSettings()) {
log("Setting gecko.updateStatus: " + aStatus);
@ -222,6 +365,14 @@ UpdatePrompt.prototype = {
},
showApplyPrompt: function UP_showApplyPrompt(aUpdate) {
// Notify update package is ready to apply
if (this._systemUpdateListener) {
this._systemUpdateListener.onUpdateReady();
} else {
// Set the flag to true and fire the onUpdateReady event when the listener is attached.
this._isPendingUpdateReady = true;
}
if (!this.sendUpdateEvent("update-prompt-apply", aUpdate)) {
log("Unable to prompt, forcing restart");
this.restartProcess();
@ -581,6 +732,10 @@ UpdatePrompt.prototype = {
onProgress: function UP_onProgress(aRequest, aContext, aProgress,
aProgressMax) {
if (this._systemUpdateListener) {
this._systemUpdateListener.onProgress(aProgress, aProgressMax);
}
if (aProgress == aProgressMax) {
// The update.mar validation done by onStopRequest may take
// a while before the onStopRequest callback is made, so stop

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="e862ab9177af664f00b4522e2350f4cb13866d73">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="a7439b6ca88264734171ff5ea0b6a0b8df3f258e"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="a4278e41c08fa619edbd6537b6182d46dc475a4e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="c490ae41c67f892232599f4ef049467a922b613e"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
@ -23,7 +23,7 @@
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="46584eaae13051a5d1b3bc3f49f9b38d423a1e86"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="42b31cf3248acf7acd1fd30c7491871c50305fa8"/>
<!-- Stock Android things -->
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="e862ab9177af664f00b4522e2350f4cb13866d73">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="a7439b6ca88264734171ff5ea0b6a0b8df3f258e"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="a4278e41c08fa619edbd6537b6182d46dc475a4e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="c490ae41c67f892232599f4ef049467a922b613e"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
@ -23,7 +23,7 @@
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="46584eaae13051a5d1b3bc3f49f9b38d423a1e86"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="42b31cf3248acf7acd1fd30c7491871c50305fa8"/>
<!-- Stock Android things -->
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/>

View File

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="a7439b6ca88264734171ff5ea0b6a0b8df3f258e"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="a4278e41c08fa619edbd6537b6182d46dc475a4e"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="c490ae41c67f892232599f4ef049467a922b613e"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="87a2d8ab9248540910e56921654367b78a587095"/>

View File

@ -17,10 +17,10 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="a7439b6ca88264734171ff5ea0b6a0b8df3f258e"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="a4278e41c08fa619edbd6537b6182d46dc475a4e"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="c490ae41c67f892232599f4ef049467a922b613e"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="657894b4a1dc0a926117f4812e0940229f9f676f"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="46584eaae13051a5d1b3bc3f49f9b38d423a1e86"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="42b31cf3248acf7acd1fd30c7491871c50305fa8"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<!-- Stock Android things -->

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="e862ab9177af664f00b4522e2350f4cb13866d73">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="a7439b6ca88264734171ff5ea0b6a0b8df3f258e"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="a4278e41c08fa619edbd6537b6182d46dc475a4e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="c490ae41c67f892232599f4ef049467a922b613e"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
@ -23,7 +23,7 @@
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="46584eaae13051a5d1b3bc3f49f9b38d423a1e86"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="42b31cf3248acf7acd1fd30c7491871c50305fa8"/>
<!-- Stock Android things -->
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="f92a936f2aa97526d4593386754bdbf02db07a12"/>
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="6e47ff2790f5656b5b074407829ceecf3e6188c4"/>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="61e82f99bb8bc78d52b5717e9a2481ec7267fa33">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="a7439b6ca88264734171ff5ea0b6a0b8df3f258e"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="a4278e41c08fa619edbd6537b6182d46dc475a4e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="c490ae41c67f892232599f4ef049467a922b613e"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
@ -23,7 +23,7 @@
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="46584eaae13051a5d1b3bc3f49f9b38d423a1e86"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="42b31cf3248acf7acd1fd30c7491871c50305fa8"/>
<!-- Stock Android things -->
<project groups="pdk,linux" name="platform/prebuilts/clang/linux-x86/host/3.5" path="prebuilts/clang/linux-x86/host/3.5" revision="ffc05a232799fe8fcb3e47b7440b52b1fb4244c0"/>
<project groups="pdk,linux,arm" name="platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8" path="prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8" revision="337e0ef5e40f02a1ae59b90db0548976c70a7226"/>

View File

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="a7439b6ca88264734171ff5ea0b6a0b8df3f258e"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="a4278e41c08fa619edbd6537b6182d46dc475a4e"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="c490ae41c67f892232599f4ef049467a922b613e"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="87a2d8ab9248540910e56921654367b78a587095"/>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="e862ab9177af664f00b4522e2350f4cb13866d73">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="a7439b6ca88264734171ff5ea0b6a0b8df3f258e"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="a4278e41c08fa619edbd6537b6182d46dc475a4e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="c490ae41c67f892232599f4ef049467a922b613e"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
@ -23,7 +23,7 @@
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="46584eaae13051a5d1b3bc3f49f9b38d423a1e86"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="42b31cf3248acf7acd1fd30c7491871c50305fa8"/>
<!-- Stock Android things -->
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/>

View File

@ -1,9 +1,9 @@
{
"git": {
"git_revision": "a7439b6ca88264734171ff5ea0b6a0b8df3f258e",
"git_revision": "a4278e41c08fa619edbd6537b6182d46dc475a4e",
"remote": "https://git.mozilla.org/releases/gaia.git",
"branch": ""
},
"revision": "3073356ae6c82391651cf4d6ca066433c4efd928",
"revision": "37f6eb95a19e04cdf27af3c4c0efe08a167b0fc1",
"repo_path": "integration/gaia-central"
}

View File

@ -17,10 +17,10 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="a7439b6ca88264734171ff5ea0b6a0b8df3f258e"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="a4278e41c08fa619edbd6537b6182d46dc475a4e"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="c490ae41c67f892232599f4ef049467a922b613e"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="657894b4a1dc0a926117f4812e0940229f9f676f"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="46584eaae13051a5d1b3bc3f49f9b38d423a1e86"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="42b31cf3248acf7acd1fd30c7491871c50305fa8"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<!-- Stock Android things -->

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="61e82f99bb8bc78d52b5717e9a2481ec7267fa33">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="a7439b6ca88264734171ff5ea0b6a0b8df3f258e"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="a4278e41c08fa619edbd6537b6182d46dc475a4e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="c490ae41c67f892232599f4ef049467a922b613e"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
@ -23,7 +23,7 @@
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="46584eaae13051a5d1b3bc3f49f9b38d423a1e86"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="42b31cf3248acf7acd1fd30c7491871c50305fa8"/>
<!-- Stock Android things -->
<project groups="pdk,linux" name="platform/prebuilts/clang/linux-x86/host/3.5" path="prebuilts/clang/linux-x86/host/3.5" revision="ffc05a232799fe8fcb3e47b7440b52b1fb4244c0"/>
<project groups="pdk,linux,arm" name="platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8" path="prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8" revision="337e0ef5e40f02a1ae59b90db0548976c70a7226"/>

View File

@ -690,6 +690,9 @@
@RESPATH@/components/EngineeringModeAPI.js
@RESPATH@/components/EngineeringModeService.js
@RESPATH@/components/SystemUpdate.manifest
@RESPATH@/components/SystemUpdateManager.js
#ifdef MOZ_DEBUG
@RESPATH@/components/TestInterfaceJS.js
@RESPATH@/components/TestInterfaceJS.manifest

View File

@ -548,6 +548,12 @@ this.PermissionsTable = { geolocation: {
trusted: DENY_ACTION,
privileged: ALLOW_ACTION,
certified: ALLOW_ACTION
},
"system-update": {
app: DENY_ACTION,
trusted: DENY_ACTION,
privileged: DENY_ACTION,
certified: ALLOW_ACTION
}
};

View File

@ -0,0 +1,2 @@
component {e8530001-ba5b-46ab-a306-7fbeb692d0fe} SystemUpdateManager.js
contract @mozilla.org/system-update-manager;1 {e8530001-ba5b-46ab-a306-7fbeb692d0fe}

View File

@ -0,0 +1,262 @@
/* 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._sendPromise(function(aResolverId) {
cpmm.sendAsyncMessage("SystemUpdate:GetProviders", {
requestId: aResolverId,
});
});
},
getActiveProvider: function() {
return this._sendPromise(function(aResolverId) {
cpmm.sendAsyncMessage("SystemUpdate:GetActiveProvider", {
requestId: aResolverId,
});
});
},
setActiveProvider: function(aUuid) {
return this._sendPromise(function(aResolverId) {
cpmm.sendAsyncMessage("SystemUpdate:SetActiveProvider", {
requestId: aResolverId,
uuid: aUuid
});
});
},
_sendPromise: function(aCallback) {
let self = this;
return this.createPromise(function(aResolve, aReject) {
let resolverId = self.getPromiseResolverId({resolve: aResolve,
reject: aReject});
aCallback(resolverId);
});
}
};
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([SystemUpdateManager]);

View File

@ -0,0 +1,382 @@
/* 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;
this.EXPORTED_SYMBOLS = ["SystemUpdateService"];
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
const CATEGORY_SYSTEM_UPDATE_PROVIDER = "system-update-provider";
const PROVIDER_ACTIVITY_IDLE = 0;
const PROVIDER_ACTIVITY_CHECKING = 1;
const PROVIDER_ACTIVITY_DOWNLOADING = 1 << 1;
const PROVIDER_ACTIVITY_APPLYING = 1 << 2;
let debug = Services.prefs.getBoolPref("dom.system_update.debug")
? (aMsg) => dump("-*- SystemUpdateService.jsm : " + aMsg + "\n")
: (aMsg) => {};
XPCOMUtils.defineLazyServiceGetter(this, "ppmm",
"@mozilla.org/parentprocessmessagemanager;1",
"nsIMessageBroadcaster");
function ActiveProvider(aProvider) {
this.id = aProvider.id;
this._instance = Cc[aProvider.contractId].getService(Ci.nsISystemUpdateProvider);
this._instance.setListener(this);
}
ActiveProvider.prototype = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsISystemUpdateListener]),
_activity: PROVIDER_ACTIVITY_IDLE,
destroy: function() {
if (this._instance) {
this._instance.unsetListener();
this._instance = null;
}
this.id = null;
},
checkForUpdate: function() {
this._execFuncIfNotInActivity(PROVIDER_ACTIVITY_CHECKING,
this._instance.checkForUpdate);
},
startDownload: function() {
this._execFuncIfNotInActivity(PROVIDER_ACTIVITY_DOWNLOADING,
this._instance.startDownload);
},
stopDownload: function() {
this._execFuncIfNotInActivity(PROVIDER_ACTIVITY_DOWNLOADING,
this._instance.stopDownload);
},
applyUpdate: function() {
this._execFuncIfNotInActivity(PROVIDER_ACTIVITY_APPLYING,
this._instance.applyUpdate);
},
setParameter: function(aName, aValue) {
return this._instance.setParameter(aName, aValue);
},
getParameter: function(aName) {
return this._instance.getParameter(aName);
},
// nsISystemUpdateListener
onUpdateAvailable: function(aType, aVersion, aDescription, aBuildDate, aSize) {
this._execFuncIfActiveAndInAction(PROVIDER_ACTIVITY_CHECKING, function() {
ppmm.broadcastAsyncMessage("SystemUpdate:OnUpdateAvailable", {
uuid: this.id,
packageInfo: {
type: aType,
version: aVersion,
description: aDescription,
buildDate: aBuildDate,
size: aSize,
}
});
this._unsetActivity(PROVIDER_ACTIVITY_CHECKING);
}.bind(this));
},
onProgress: function(aLoaded, aTotal) {
this._execFuncIfActiveAndInAction(PROVIDER_ACTIVITY_DOWNLOADING, function() {
ppmm.broadcastAsyncMessage("SystemUpdate:OnProgress", {
uuid: this.id,
loaded: aLoaded,
total: aTotal,
});
}.bind(this));
},
onUpdateReady: function() {
this._execFuncIfActiveAndInAction(PROVIDER_ACTIVITY_DOWNLOADING, function() {
ppmm.broadcastAsyncMessage("SystemUpdate:OnUpdateReady", {
uuid: this.id,
});
this._unsetActivity(PROVIDER_ACTIVITY_DOWNLOADING);
}.bind(this));
},
onError: function(aErrMsg) {
if (!SystemUpdateService._isActiveProviderId(this.id)) {
return;
}
ppmm.broadcastAsyncMessage("SystemUpdate:OnError", {
uuid: this.id,
message: aErrMsg,
});
this._activity = PROVIDER_ACTIVITY_IDLE;
},
isIdle: function() {
return this._activity === PROVIDER_ACTIVITY_IDLE;
},
_isInActivity: function(aActivity) {
return (this._activity & aActivity) !== PROVIDER_ACTIVITY_IDLE;
},
_setActivity: function(aActivity) {
this._activity |= aActivity;
},
_unsetActivity: function(aActivity) {
this._activity &= ~aActivity;
},
_execFuncIfNotInActivity: function(aActivity, aFunc) {
if (!this._isInActivity(aActivity)) {
this._setActivity(aActivity);
aFunc();
}
},
_execFuncIfActiveAndInAction: function(aActivity, aFunc) {
if (!SystemUpdateService._isActiveProviderId(this.id)) {
return;
}
if (this._isInActivity(aActivity)) {
aFunc();
}
},
};
this.SystemUpdateService = {
_providers: [],
_activeProvider: null,
_updateActiveProvider: function(aProvider) {
if (this._activeProvider) {
this._activeProvider.destroy();
}
this._activeProvider = new ActiveProvider(aProvider);
},
_isActiveProviderId: function(aId) {
return (this._activeProvider && this._activeProvider.id === aId);
},
init: function() {
debug("init");
let messages = ["SystemUpdate:GetProviders",
"SystemUpdate:GetActiveProvider",
"SystemUpdate:SetActiveProvider",
"SystemUpdate:CheckForUpdate",
"SystemUpdate:StartDownload",
"SystemUpdate:StopDownload",
"SystemUpdate:ApplyUpdate",
"SystemUpdate:SetParameter",
"SystemUpdate:GetParameter"];
messages.forEach((function(aMsgName) {
ppmm.addMessageListener(aMsgName, this);
}).bind(this));
// load available provider list
let catMan = Cc["@mozilla.org/categorymanager;1"].getService(Ci.nsICategoryManager);
let entries = catMan.enumerateCategory(CATEGORY_SYSTEM_UPDATE_PROVIDER);
while (entries.hasMoreElements()) {
let name = entries.getNext().QueryInterface(Ci.nsISupportsCString).data;
let [contractId, id] = catMan.getCategoryEntry(CATEGORY_SYSTEM_UPDATE_PROVIDER, name).split(",");
this._providers.push({
id: id,
name: name,
contractId: contractId
});
}
debug("available providers: " + JSON.stringify(this._providers));
// setup default active provider
let defaultActive;
try {
defaultActive = Services.prefs.getCharPref("dom.system_update.active");
} catch (e) {}
if (defaultActive) {
let defaultProvider = this._providers.find(function(aProvider) {
return aProvider.contractId === defaultActive;
});
if (defaultProvider) {
this._updateActiveProvider(defaultProvider);
}
}
},
addProvider: function(aClassId, aContractId, aName) {
debug("addProvider");
//did not allow null or empty string to add.
if(!aClassId || !aContractId || !aName) {
return;
}
let existedProvider = this._providers.find(function(provider) {
return provider.id === aClassId;
});
//skip if adding the existed provider.
if (existedProvider) {
debug("existing providers: " + JSON.stringify(existedProvider));
return;
}
//dynamically add the provider info to list.
this._providers.push({
id: aClassId,
name: aName,
contractId: aContractId
});
debug("available providers: " + JSON.stringify(this._providers));
},
getProviders: function(aData, aMm) {
debug("getProviders");
aData.providers = [];
for (let provider of this._providers) {
aData.providers.push({
name: provider.name,
uuid: provider.id
});
}
aMm.sendAsyncMessage("SystemUpdate:GetProviders:Result:OK", aData);
},
getActiveProvider: function(aData, aMm) {
debug("getActiveProvider");
let self = this;
let providerInfo = this._providers.find(function(provider) {
return self._isActiveProviderId(provider.id);
});
if (!providerInfo) {
aData.error = "NotFoundError";
aMm.sendAsyncMessage("SystemUpdate:GetActiveProvider:Result:Error", aData);
return;
}
aData.provider = {
name: providerInfo.name,
uuid: providerInfo.id
};
aMm.sendAsyncMessage("SystemUpdate:GetActiveProvider:Result:OK", aData);
},
setActiveProvider: function(aData, aMm) {
debug("setActiveProvider");
let self = this;
let selectedProvider = this._providers.find(function(provider) {
return provider.id === aData.uuid;
});
if (!selectedProvider) {
aData.error = "DataError";
aMm.sendAsyncMessage("SystemUpdate:SetActiveProvider:Result:Error", aData);
return;
}
if (!this._isActiveProviderId(selectedProvider.id)) {
// not allow changing active provider while there is an ongoing update activity
if (this.activeProvider && !this._activeProvider.isIdle()) {
aData.error = "DataError";
aMm.sendAsyncMessage("SystemUpdate:SetActiveProvider:Result:Error", aData);
return;
}
this._updateActiveProvider(selectedProvider);
Services.prefs.setCharPref("dom.system_update.active", selectedProvider.contractId);
}
aData.provider = {
name: selectedProvider.name,
uuid: selectedProvider.id
};
aMm.sendAsyncMessage("SystemUpdate:SetActiveProvider:Result:OK", aData);
},
receiveMessage: function(aMessage) {
if (!aMessage.target.assertPermission("system-update")) {
debug("receive message " + aMessage.name +
" from a content process with no 'system-update' privileges.");
return null;
}
let msg = aMessage.data || {};
let mm = aMessage.target;
switch (aMessage.name) {
case "SystemUpdate:GetProviders": {
this.getProviders(msg, mm);
break;
}
case "SystemUpdate:GetActiveProvider": {
this.getActiveProvider(msg, mm);
break;
}
case "SystemUpdate:SetActiveProvider": {
this.setActiveProvider(msg, mm);
break;
}
case "SystemUpdate:CheckForUpdate": {
if (this._isActiveProviderId(msg.uuid)) {
this._activeProvider.checkForUpdate();
}
break;
}
case "SystemUpdate:StartDownload": {
if (this._isActiveProviderId(msg.uuid)) {
this._activeProvider.startDownload();
}
break;
}
case "SystemUpdate:StopDownload": {
if (this._isActiveProviderId(msg.uuid)) {
this._activeProvider.stopDownload();
}
break;
}
case "SystemUpdate:ApplyUpdate": {
if (this._isActiveProviderId(msg.uuid)) {
this._activeProvider.applyUpdate();
}
break;
}
case "SystemUpdate:SetParameter": {
if (this._isActiveProviderId(msg.uuid)) {
return this._activeProvider.setParameter(msg.name, msg.value);
}
break;
}
case "SystemUpdate:GetParameter": {
if (this._isActiveProviderId(msg.uuid)) {
return this._activeProvider.getParameter(msg.name);
}
break;
}
}
},
};
SystemUpdateService.init();

View File

@ -19,6 +19,7 @@ elif toolkit == 'gonk':
XPIDL_SOURCES += [
'nsIOSFileConstantsService.idl',
'nsISystemUpdateProvider.idl',
]
XPIDL_MODULE = 'dom_system'
@ -39,6 +40,12 @@ UNIFIED_SOURCES += [
EXTRA_COMPONENTS += [
'NetworkGeolocationProvider.js',
'NetworkGeolocationProvider.manifest',
'SystemUpdate.manifest',
'SystemUpdateManager.js',
]
EXTRA_JS_MODULES += [
'SystemUpdateService.jsm',
]
FAIL_ON_WARNINGS = True
@ -57,3 +64,4 @@ DEFINES['DLL_PREFIX'] = '"%s"' % CONFIG['DLL_PREFIX']
DEFINES['DLL_SUFFIX'] = '"%s"' % CONFIG['DLL_SUFFIX']
MOCHITEST_CHROME_MANIFESTS += ['tests/chrome.ini']
MOCHITEST_MANIFESTS += ['tests/mochitest.ini']

View File

@ -0,0 +1,73 @@
/* 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/. */
#include "nsISupports.idl"
[scriptable, uuid(775edbf5-b4a9-400c-b0ad-ea3c3a027097)]
interface nsISystemUpdateListener : nsISupports
{
/**
* callback for notifying an update package is available for download.
*/
void onUpdateAvailable(in DOMString type,
in DOMString version,
in DOMString description,
in unsigned long long buildDate,
in unsigned long long size);
/**
* callback for notifying the download progress.
*/
void onProgress(in unsigned long long loaded, in unsigned long long total);
/**
* callback for notifying an update package is ready to apply.
*/
void onUpdateReady();
/**
* callback for notifying any error while
* checking/downloading/applying an update package.
*/
void onError(in DOMString errMsg);
};
[scriptable, uuid(c9b7c166-b9cf-4396-a6de-39275e1c0a36)]
interface nsISystemUpdateProvider : nsISupports
{
void checkForUpdate();
void startDownload();
void stopDownload();
void applyUpdate();
/**
* Set the available parameter to the update provider.
* The available parameter is implementation-dependent.
* e.g. "update-url", "last-update-date", "update-status", "update-interval"
*
* @param name The number of languages.
* @param languages An array of languages.
* @return true when setting an available parameter,
* false when setting an unavailable parameter.
*/
bool setParameter(in DOMString name, in DOMString value);
/**
* Get the available parameter from the update provider.
* The available parameter is implementation-dependent.
*
* @param name The available parameter.
* @return The corresponding value to the name.
* Return null if try to get unavailable parameter.
*/
DOMString getParameter(in DOMString name);
/**
* NOTE TO IMPLEMENTORS:
* Need to consider if it is necessary to fire the pending event when
* registering the listener.
* (E.g. UpdateAvailable or UpdateReady event.)
*/
void setListener(in nsISystemUpdateListener listener);
void unsetListener();
};

View File

@ -0,0 +1,6 @@
[DEFAULT]
skip-if = buildapp != 'b2g'
support-files =
preload-SystemUpdateManager-jsm.js
[test_system_update_enabled.html]

View File

@ -0,0 +1,80 @@
/* 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, manager: Cm} = Components;
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
const cid = '{17a84227-28f4-453d-9b80-9ae75a5682e0}';
const contractId = '@mozilla.org/test-update-provider;1';
function TestUpdateProvider() {}
TestUpdateProvider.prototype = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsISystemUpdateProvider]),
checkForUpdate: function() {
dump('check for update');
this._listener.onUpdateAvailable('test-type', 'test-version', 'test-description', Date.now().valueOf(), 5566);
},
startDownload: function() {
dump('test start download');
this._listener.onProgress(10, 100);
},
stopDownload: function() {
dump('test stop download');
},
applyUpdate: function() {
dump('apply update');
},
setParameter: function(name, value) {
dump('set parameter');
return (name === 'dummy' && value === 'dummy-value');
},
getParameter: function(name) {
dump('get parameter');
if (name === 'dummy') {
return 'dummy-value';
}
},
setListener: function(listener) {
this._listener = listener;
},
unsetListener: function() {
this._listener = null;
},
};
let factory = {
createInstance: function(outer, iid) {
if (outer) {
throw Components.results.NS_ERROR_NO_AGGREGATION;
}
return new TestUpdateProvider().QueryInterface(iid);
},
lockFactory: function(aLock) {
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsIFactory])
};
Cm.nsIComponentRegistrar.registerFactory(Components.ID(cid), '', contractId, factory);
let cm = Cc['@mozilla.org/categorymanager;1'].getService(Ci.nsICategoryManager);
cm.addCategoryEntry('system-update-provider', 'DummyProvider',
contractId + ',' + cid, false, true);
Cu.import('resource://gre/modules/SystemUpdateService.jsm');
this.SystemUpdateService.addProvider('{17a84227-28f4-453d-9b80-9ae75a5682e0}',
'@mozilla.org/test-update-provider;1',
'DummyProvider');

View File

@ -0,0 +1,175 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1037329
-->
<head>
<meta charset="utf-8">
<title>System Update API Test</title>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1037329">Test System Update API</a>
<script type="application/javascript;version=1.8">
'use strict';
SimpleTest.waitForExplicitFinish();
function setup() {
window.gUrl = SimpleTest.getTestFileURL('preload-SystemUpdateManager-jsm.js');
window.gScript = SpecialPowers.loadChromeScript(gUrl);
return Promise.resolve();
}
function testGetProviders() {
return new Promise(function(resolve, reject) {
navigator.updateManager.getProviders().then(function(providerInfos) {
info('num of providers: ' + providerInfos.length);
for (let providerInfo of providerInfos) {
info('provider info: ' + JSON.stringify(providerInfo));
}
resolve(providerInfos);
});
});
}
function testSetActiveProvider(providerInfos) {
return new Promise(function(resolve, reject) {
//Find the mock provider for our testing provider instead.
//Set the mock provider as active provider.
let targetProvider = providerInfos[0];
for(let provider of providerInfos) {
if(provider.uuid == "{17a84227-28f4-453d-9b80-9ae75a5682e0}") {
info('target provider uuid: ' + provider.uuid);
targetProvider = provider;
break;
}
}
is("{17a84227-28f4-453d-9b80-9ae75a5682e0}", targetProvider.uuid, 'get the dynamically added provider');
navigator.updateManager.setActiveProvider(targetProvider.uuid).then(function(activeProvider) {
info('active provider info: ' + JSON.stringify(activeProvider.info));
is(activeProvider.name, targetProvider.name, 'expected name of active provider');
is(activeProvider.uuid, targetProvider.uuid, 'expected uuid of active provider');
resolve({name : activeProvider.name, uuid : activeProvider.uuid});
});
});
}
function testGetActiveProvider(providerInfo) {
info('test GetActiveProvider');
return new Promise(function(resolve, reject) {
navigator.updateManager.getActiveProvider().then(function(activeProvider) {
is(activeProvider.name, providerInfo.name, 'expected name of active provider');
is(activeProvider.uuid, providerInfo.uuid, 'expected uuid of active provider');
resolve(activeProvider);
});
});
}
function testCheckForUpdate(provider) {
info('test CheckForUpdate');
return new Promise(function(resolve, reject) {
provider.addEventListener('updateavailable', function(event) {
ok(true, 'receive updateavailable event');
info('event: ' + JSON.stringify(event.detail));
resolve(provider);
});
provider.checkForUpdate();
});
}
function testStartDownload(provider) {
info('test StartDownload');
return new Promise(function(resolve, reject) {
provider.addEventListener('progress', function(event) {
ok(true, 'receive progress event');
is(event.loaded, 10, 'expected loaded');
is(event.total, 100, 'expected total');
resolve(provider);
});
provider.startDownload();
});
}
function testStopDownload(provider) {
info('test StopDownload');
return new Promise(function(resolve, reject) {
provider.stopDownload();
resolve(provider);
});
}
function testApplyUpdate(provider) {
info('test ApplyUpdate');
return new Promise(function(resolve, reject) {
provider.applyUpdate();
resolve(provider);
});
}
function testGetParameter(provider) {
info('test GetParameter');
return new Promise(function(resolve, reject) {
let dummy = provider.getParameter('dummy');
is(dummy, 'dummy-value', 'expected parameter');
resolve(provider);
});
}
function testSetParameter(provider) {
info('test SetParameter');
return new Promise(function(resolve, reject) {
provider.setParameter('dummy', 'dummy-value');
resolve();
});
}
function testSetActiveProviderError() {
info('test setActiveProvider error');
return new Promise(function(resolve, reject) {
navigator.updateManager.setActiveProvider('something not exsited').then(function(provider) {
ok(false, 'should not success');
resolve();
}, function(reason) {
info('error message: ' + reason);
ok(true, 'expected error while setActiveProvider');
resolve();
});
});
}
function runTest() {
ok(navigator.updateManager, 'should have navigator.updateManager');
setup()
.then(testGetProviders)
.then(testSetActiveProvider)
.then(testGetActiveProvider)
.then(testCheckForUpdate)
.then(testStartDownload)
.then(testStopDownload)
.then(testApplyUpdate)
.then(testGetParameter)
.then(testSetParameter)
.then(testSetActiveProviderError)
.then(function() {
info('test finished');
gScript.destroy();
SimpleTest.finish();
});
}
SpecialPowers.pushPermissions([
{type: 'system-update', allow: true, context: document},
], function() {
SpecialPowers.pushPrefEnv({
'set': [
['dom.system_update.enabled', true],
['dom.system_update.debug', true],
['dom.system_update.active', '@mozilla.org/test-update-provider;1'],
]
}, runTest);
}
);
</script>
</pre>
</body>
</html>

View File

@ -0,0 +1,48 @@
/* 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/. */
dictionary SystemUpdateProviderInfo {
DOMString name = "";
DOMString uuid = "";
};
dictionary SystemUpdatePackageInfo {
DOMString type = "";
DOMString version = "";
DOMString description = "";
DOMTimeStamp buildDate = 0;
unsigned long long size = 0;
};
[JSImplementation="@mozilla.org/system-update-provider;1",
CheckPermissions="system-update",
Pref="dom.system_update.enabled"]
interface SystemUpdateProvider : EventTarget {
readonly attribute DOMString name;
readonly attribute DOMString uuid;
attribute EventHandler onupdateavailable;
attribute EventHandler onprogress;
attribute EventHandler onupdateready;
attribute EventHandler onerror;
void checkForUpdate();
void startDownload();
void stopDownload();
void applyUpdate();
boolean setParameter(DOMString name, DOMString value);
DOMString getParameter(DOMString name);
};
[NavigatorProperty="updateManager",
JSImplementation="@mozilla.org/system-update-manager;1",
CheckPermissions="system-update",
Pref="dom.system_update.enabled"]
interface SystemUpdateManager {
Promise<sequence<SystemUpdateProviderInfo>> getProviders();
Promise<SystemUpdateProvider> setActiveProvider(DOMString uuid);
Promise<SystemUpdateProvider> getActiveProvider();
};

View File

@ -508,6 +508,7 @@ WEBIDL_FILES = [
'SVGViewElement.webidl',
'SVGZoomAndPan.webidl',
'SVGZoomEvent.webidl',
'SystemUpdate.webidl',
'Telephony.webidl',
'TelephonyCall.webidl',
'TelephonyCallGroup.webidl',

View File

@ -4804,6 +4804,10 @@ pref("dom.caches.enabled", true);
pref("camera.control.low_memory_thresholdMB", 404);
#endif
// SystemUpdate API
pref("dom.system_update.enabled", false);
pref("dom.system_update.debug", false);
// UDPSocket API
pref("dom.udpsocket.enabled", false);

View File

@ -1 +1 @@
0.0.17
0.0.18

View File

@ -36,6 +36,10 @@ def check_task(task):
print('Invalid base repository', repo, file=sys.stderr)
return -1
if "MOZHARNESS_CONFIG" in payload["env"] and \
"blobfree" in payload["env"]["MOZHARNESS_CONFIG"]:
return 0
locations = task["extra"]["locations"]
if "img" in locations:
img = locations["img"]

View File

@ -18,15 +18,19 @@ flags:
- win32_gecko # b2g desktop win 32 bit
- flame-kk-ota
- flame-kk # b2g flame kitkat
- flame-kk-blobfree
- flame-kk-eng # b2g flame eng build
- flame-kk-spark-eng
- flame-kk-eng-blobfree
- dolphin
- dolphin-eng
- dolphin-512
- dolphin-512-eng
- aries
- aries-blobfree
- aries-ota
- aries-eng
- aries-eng-blobfree
- aries-dogfood
- android-api-11
- linux64

View File

@ -6,6 +6,26 @@ $inherits:
from: tasks/branches/base_jobs.yml
builds:
aries-blobfree:
platforms:
- b2g
types:
opt:
task: tasks/builds/b2g_aries_spark_opt_blobfree.yml
debug:
task: tasks/builds/b2g_aries_spark_debug_blobfree.yml
aries-dogfood:
platforms:
- b2g
types:
opt:
task: tasks/builds/b2g_aries_spark_dogfood.yml
aries-eng-blobfree:
platforms:
- b2g
types:
opt:
task: tasks/builds/b2g_aries_spark_eng_blobfree.yml
aries-ota:
platforms:
- b2g
@ -14,12 +34,20 @@ builds:
task: tasks/builds/b2g_aries_spark_ota_opt.yml
debug:
task: tasks/builds/b2g_aries_spark_ota_debug.yml
aries-dogfood:
flame-kk-blobfree:
platforms:
- b2g
types:
opt:
task: tasks/builds/b2g_aries_spark_dogfood.yml
task: tasks/builds/b2g_flame_kk_opt_blobfree.yml
debug:
task: tasks/builds/b2g_flame_kk_debug_blobfree.yml
flame-kk-eng-blobfree:
platforms:
- b2g
types:
opt:
task: tasks/builds/b2g_flame_kk_eng_blobfree.yml
flame-kk-ota:
platforms:
- b2g

View File

@ -0,0 +1,40 @@
$inherits:
from: 'tasks/builds/b2g_phone_base.yml'
variables:
build_name: 'aries-blobfree'
build_type: 'debug'
task:
workerType: flame-kk
scopes:
- 'docker-worker:cache:build-aries-debug-blobfree'
metadata:
name: 'B2G Aries Debug (blobfree)'
payload:
cache:
build-aries-debug-blobfree: /home/worker/workspace
env:
TARGET: 'aries'
DEBUG: 0
VARIANT: userdebug
GAIA_OPTIMIZE: '1'
B2G_SYSTEM_APPS: '1'
MOZHARNESS_CONFIG: b2g/taskcluster-spark-blobfree.py
command:
- >
checkout-gecko workspace &&
cd ./workspace/gecko/testing/taskcluster/scripts/phone-builder &&
buildbot_step 'Build' ./build-phone.sh $HOME/workspace
extra:
treeherderEnv:
- staging
treeherder:
symbol: Bf
groupSymbol: Aries
groupName: Aries Device Image
machine:
platform: b2g-device-image
collection:
debug: true
locations:
img: 'public/build/aries.zip'

View File

@ -0,0 +1,38 @@
$inherits:
from: 'tasks/builds/b2g_phone_base.yml'
variables:
build_name: 'aries-eng-blobfree'
build_type: 'opt'
task:
workerType: flame-kk
scopes:
- 'docker-worker:cache:build-aries-eng-blobfree'
metadata:
name: 'B2G Aries Eng (blobfree)'
payload:
cache:
build-aries-eng-blobfree: /home/worker/workspace
env:
TARGET: 'aries'
DEBUG: 0
VARIANT: eng
GAIA_OPTIMIZE: '1'
B2G_SYSTEM_APPS: '1'
MOZHARNESS_CONFIG: b2g/taskcluster-spark-blobfree.py
command:
- >
checkout-gecko workspace &&
cd ./workspace/gecko/testing/taskcluster/scripts/phone-builder &&
buildbot_step 'Build' ./build-phone.sh $HOME/workspace
extra:
treeherderEnv:
- staging
treeherder:
symbol: Bef
groupSymbol: Aries
groupName: Aries Device Image
machine:
platform: b2g-device-image
locations:
img: 'public/build/aries.zip'

View File

@ -0,0 +1,38 @@
$inherits:
from: 'tasks/builds/b2g_phone_base.yml'
variables:
build_name: 'aries-blobfree'
build_type: 'opt'
task:
workerType: flame-kk
scopes:
- 'docker-worker:cache:build-aries-opt-blobfree'
metadata:
name: 'B2G Aries Opt (blobfree)'
payload:
cache:
build-aries-opt-blobfree: /home/worker/workspace
env:
TARGET: 'aries'
DEBUG: 0
VARIANT: user
GAIA_OPTIMIZE: '1'
B2G_SYSTEM_APPS: '1'
MOZHARNESS_CONFIG: b2g/taskcluster-spark-blobfree.py
command:
- >
checkout-gecko workspace &&
cd ./workspace/gecko/testing/taskcluster/scripts/phone-builder &&
buildbot_step 'Build' ./build-phone.sh $HOME/workspace
extra:
treeherderEnv:
- staging
treeherder:
symbol: Bf
groupSymbol: Aries
groupName: Aries Device Image
machine:
platform: b2g-device-image
locations:
img: 'public/build/aries.zip'

View File

@ -0,0 +1,38 @@
$inherits:
from: 'tasks/builds/b2g_phone_base.yml'
variables:
build_name: 'flame-kk-blobfree'
build_type: 'debug'
task:
workerType: flame-kk
scopes:
- 'docker-worker:cache:build-flame-kk-debug-blobfree'
metadata:
name: 'B2G Flame KK Debug (blobfree)'
payload:
cache:
build-flame-kk-debug-blobfree: /home/worker/workspace
env:
TARGET: 'flame-kk'
DEBUG: 0
VARIANT: userdebug
MOZHARNESS_CONFIG: b2g/taskcluster-phone-blobfree.py
command:
- >
checkout-gecko workspace &&
cd ./workspace/gecko/testing/taskcluster/scripts/phone-builder &&
buildbot_step 'Build' ./build-phone.sh $HOME/workspace
extra:
treeherderEnv:
- staging
treeherder:
symbol: Bf
groupSymbol: Flame-KK
groupName: Flame KitKat Device Image
machine:
platform: b2g-device-image
collection:
debug: true
locations:
img: 'public/build/flame-kk.zip'

View File

@ -0,0 +1,38 @@
$inherits:
from: 'tasks/builds/b2g_phone_base.yml'
variables:
build_name: 'flame-kk-eng-blobfree'
build_type: 'opt'
task:
workerType: flame-kk
scopes:
- 'docker-worker:cache:build-flame-kk-eng-blobfree'
metadata:
name: 'B2G Flame KK Eng (blobfree)'
payload:
cache:
build-flame-kk-eng-blobfree: /home/worker/workspace
env:
TARGET: 'flame-kk'
DEBUG: 0
VARIANT: eng
GAIA_OPTIMIZE: '1'
B2G_SYSTEM_APPS: '1'
MOZHARNESS_CONFIG: b2g/taskcluster-phone-blobfree.py
command:
- >
checkout-gecko workspace &&
cd ./workspace/gecko/testing/taskcluster/scripts/phone-builder &&
buildbot_step 'Build' ./build-phone.sh $HOME/workspace
extra:
treeherderEnv:
- staging
treeherder:
symbol: Bef
groupSymbol: Flame-KK
groupName: Flame KitKat Device Image
machine:
platform: b2g-device-image
locations:
img: 'public/build/flame-kk.zip'

View File

@ -0,0 +1,35 @@
$inherits:
from: 'tasks/builds/b2g_phone_base.yml'
variables:
build_name: 'flame-kk-blobfree'
build_type: 'opt'
task:
workerType: flame-kk
scopes:
- 'docker-worker:cache:build-flame-kk-opt-blobfree'
metadata:
name: 'B2G Flame KK Opt (blobfree)'
payload:
cache:
build-flame-kk-opt-blobfree: /home/worker/workspace
env:
TARGET: 'flame-kk'
DEBUG: 0
MOZHARNESS_CONFIG: b2g/taskcluster-phone-blobfree.py
command:
- >
checkout-gecko workspace &&
cd ./workspace/gecko/testing/taskcluster/scripts/phone-builder &&
buildbot_step 'Build' ./build-phone.sh $HOME/workspace
extra:
treeherderEnv:
- staging
treeherder:
symbol: Bf
groupSymbol: Flame-KK
groupName: Flame KitKat Device Image
machine:
platform: b2g-device-image
locations:
img: 'public/build/flame-kk.zip'