diff --git a/addon-sdk/source/lib/dev/volcan.js b/addon-sdk/source/lib/dev/volcan.js index 6a68ed12d28d..004ed8ff3fa3 100644 --- a/addon-sdk/source/lib/dev/volcan.js +++ b/addon-sdk/source/lib/dev/volcan.js @@ -3296,17 +3296,6 @@ module.exports={ "_retval": "longstring" } } - }, - { - "name": "getRawPermissionsTable", - "request": { - "type": "getRawPermissionsTable" - }, - "response": { - "value": { - "_retval": "json" - } - } } ], "events": {} diff --git a/b2g/app/b2g.js b/b2g/app/b2g.js index 05f3c45d47f3..34a2bb318fb9 100644 --- a/b2g/app/b2g.js +++ b/b2g/app/b2g.js @@ -500,9 +500,6 @@ 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. @@ -939,9 +936,6 @@ pref("identity.fxaccounts.skipDeviceRegistration", true); // Enable mapped array buffer. pref("dom.mapped_arraybuffer.enabled", true); -// SystemUpdate API -pref("dom.system_update.enabled", true); - // UDPSocket API pref("dom.udpsocket.enabled", true); diff --git a/b2g/components/B2GComponents.manifest b/b2g/components/B2GComponents.manifest index 44848c9423e7..7247562632b3 100644 --- a/b2g/components/B2GComponents.manifest +++ b/b2g/components/B2GComponents.manifest @@ -9,13 +9,6 @@ contract @mozilla.org/system-alerts-service;1 {fe33c107-82a4-41d6-8c64-5353267e0 component {8c719f03-afe0-4aac-91ff-6c215895d467} ContentPermissionPrompt.js contract @mozilla.org/content-permission/prompt;1 {8c719f03-afe0-4aac-91ff-6c215895d467} -#ifdef MOZ_UPDATER -# 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 - #ifdef MOZ_B2G # DirectoryProvider.js component {9181eb7c-6f87-11e1-90b1-4f59d80dd2e5} DirectoryProvider.js diff --git a/b2g/components/ContentPermissionPrompt.js b/b2g/components/ContentPermissionPrompt.js index d6fd3e634a07..f78552171d18 100644 --- a/b2g/components/ContentPermissionPrompt.js +++ b/b2g/components/ContentPermissionPrompt.js @@ -24,7 +24,6 @@ const ALLOW_MULTIPLE_REQUESTS = ["audio-capture", "video-capture"]; Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/Services.jsm"); -Cu.import("resource://gre/modules/PermissionsTable.jsm"); var permissionManager = Cc["@mozilla.org/permissionmanager;1"].getService(Ci.nsIPermissionManager); var secMan = Cc["@mozilla.org/scriptsecuritymanager;1"].getService(Ci.nsIScriptSecurityManager); @@ -67,56 +66,6 @@ function buildDefaultChoices(aTypesInfo) { return choices; } -/** - * aTypesInfo is an array of {permission, access, action, deny} which keeps - * the information of each permission. This arrary is initialized in - * ContentPermissionPrompt.prompt and used among functions. - * - * aTypesInfo[].permission : permission name - * aTypesInfo[].access : permission name + request.access - * aTypesInfo[].action : the default action of this permission - * aTypesInfo[].deny : true if security manager denied this app's origin - * principal. - * Note: - * aTypesInfo[].permission will be sent to prompt only when - * aTypesInfo[].action is PROMPT_ACTION and aTypesInfo[].deny is false. - */ -function rememberPermission(aTypesInfo, aPrincipal, aSession) -{ - function convertPermToAllow(aPerm, aPrincipal) - { - let type = - permissionManager.testExactPermissionFromPrincipal(aPrincipal, aPerm); - if (shouldPrompt(aPerm, type)) { - debug("add " + aPerm + " to permission manager with ALLOW_ACTION"); - if (!aSession) { - permissionManager.addFromPrincipal(aPrincipal, - aPerm, - Ci.nsIPermissionManager.ALLOW_ACTION); - } else if (PERMISSION_NO_SESSION.indexOf(aPerm) < 0) { - permissionManager.addFromPrincipal(aPrincipal, - aPerm, - Ci.nsIPermissionManager.ALLOW_ACTION, - Ci.nsIPermissionManager.EXPIRE_SESSION, 0); - } - } - } - - for (let i in aTypesInfo) { - // Expand the permission to see if we have multiple access properties - // to convert - let perm = aTypesInfo[i].permission; - let access = PermissionsTable[perm].access; - if (access) { - for (let idx in access) { - convertPermToAllow(perm + "-" + access[idx], aPrincipal); - } - } else { - convertPermToAllow(perm, aPrincipal); - } - } -} - function ContentPermissionPrompt() {} ContentPermissionPrompt.prototype = { @@ -296,7 +245,6 @@ ContentPermissionPrompt.prototype = { this.sendToBrowserWindow("permission-prompt", request, typesInfo, function(type, remember, choices) { if (type == "permission-allow") { - rememberPermission(typesInfo, request.principal, !remember); if (callback) { callback(); } diff --git a/b2g/components/UpdatePrompt.js b/b2g/components/UpdatePrompt.js deleted file mode 100644 index 1df07204c68e..000000000000 --- a/b2g/components/UpdatePrompt.js +++ /dev/null @@ -1,783 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- - * vim: sw=2 ts=8 et : - */ -/* 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/. */ - -const Cc = Components.classes; -const Ci = Components.interfaces; -const Cu = Components.utils; -const Cr = Components.results; - -Cu.import("resource://gre/modules/XPCOMUtils.jsm"); -Cu.import("resource://gre/modules/Services.jsm"); -Cu.import("resource://gre/modules/AppConstants.jsm"); - -const VERBOSE = 1; -var log = - VERBOSE ? - function log_dump(msg) { dump("UpdatePrompt: "+ msg +"\n"); } : - function log_noop(msg) { }; - -const PREF_APPLY_PROMPT_TIMEOUT = "b2g.update.apply-prompt-timeout"; -const PREF_APPLY_IDLE_TIMEOUT = "b2g.update.apply-idle-timeout"; -const PREF_DOWNLOAD_WATCHDOG_TIMEOUT = "b2g.update.download-watchdog-timeout"; -const PREF_DOWNLOAD_WATCHDOG_MAX_RETRIES = "b2g.update.download-watchdog-max-retries"; - -const NETWORK_ERROR_OFFLINE = 111; -const HTTP_ERROR_OFFSET = 1000; - -const STATE_DOWNLOADING = 'downloading'; - -XPCOMUtils.defineLazyServiceGetter(Services, "aus", - "@mozilla.org/updates/update-service;1", - "nsIApplicationUpdateService"); - -XPCOMUtils.defineLazyServiceGetter(Services, "um", - "@mozilla.org/updates/update-manager;1", - "nsIUpdateManager"); - -XPCOMUtils.defineLazyServiceGetter(Services, "idle", - "@mozilla.org/widget/idleservice;1", - "nsIIdleService"); - -XPCOMUtils.defineLazyServiceGetter(Services, "settings", - "@mozilla.org/settingsService;1", - "nsISettingsService"); - -XPCOMUtils.defineLazyServiceGetter(Services, 'env', - '@mozilla.org/process/environment;1', - 'nsIEnvironment'); - -function useSettings() { - // When we're running in the real phone, then we can use settings. - // But when we're running as part of xpcshell, there is no settings database - // and trying to use settings in this scenario causes lots of weird - // assertions at shutdown time. - if (typeof useSettings.result === "undefined") { - useSettings.result = !Services.env.get("XPCSHELL_TEST_PROFILE_DIR"); - } - return useSettings.result; -} - -XPCOMUtils.defineLazyModuleGetter(this, "SystemAppProxy", - "resource://gre/modules/SystemAppProxy.jsm"); - -function UpdateCheckListener(updatePrompt) { - this._updatePrompt = updatePrompt; -} - -UpdateCheckListener.prototype = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIUpdateCheckListener]), - - _updatePrompt: null, - - onCheckComplete: function UCL_onCheckComplete(request, updates, updateCount) { - if (Services.um.activeUpdate) { - // We're actively downloading an update, that's the update the user should - // see, even if a newer update is available. - this._updatePrompt.setUpdateStatus("active-update"); - this._updatePrompt.showUpdateAvailable(Services.um.activeUpdate); - return; - } - - 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; - } - - this._updatePrompt.setUpdateStatus("check-complete"); - this._updatePrompt.showUpdateAvailable(update); - }, - - onError: function UCL_onError(request, update) { - // nsIUpdate uses a signed integer for errorCode while any platform errors - // require all 32 bits. - let errorCode = update.errorCode >>> 0; - let isNSError = (errorCode >>> 31) == 1; - let errorMsg = "check-error-"; - - if (errorCode == NETWORK_ERROR_OFFLINE) { - errorMsg = "retry-when-online"; - this._updatePrompt.setUpdateStatus(errorMsg); - } else if (isNSError) { - errorMsg = "check-error-" + errorCode; - this._updatePrompt.setUpdateStatus(errorMsg); - } else if (errorCode > HTTP_ERROR_OFFSET) { - let httpErrorCode = errorCode - HTTP_ERROR_OFFSET; - errorMsg = "check-error-http-" + httpErrorCode; - this._updatePrompt.setUpdateStatus(errorMsg); - } - - if (this._updatePrompt._systemUpdateListener) { - this._updatePrompt._systemUpdateListener.onError(errorMsg); - } - - Services.aus.QueryInterface(Ci.nsIUpdateCheckListener); - Services.aus.onError(request, update); - } -}; - -function UpdatePrompt() { - this.wrappedJSObject = this; - this._updateCheckListener = new UpdateCheckListener(this); -} - -UpdatePrompt.prototype = { - classID: Components.ID("{88b3eb21-d072-4e3b-886d-f89d8c49fe59}"), - QueryInterface: XPCOMUtils.generateQI([Ci.nsIUpdatePrompt, - Ci.nsIUpdateCheckListener, - Ci.nsIRequestObserver, - Ci.nsIProgressEventSink, - 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, - _updateErrorQueue: [ ], - _receivedUpdatePromptReady: 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); - }, - - get applyIdleTimeout() { - return Services.prefs.getIntPref(PREF_APPLY_IDLE_TIMEOUT); - }, - - handleContentStart: function UP_handleContentStart() { - SystemAppProxy.addEventListener("mozContentEvent", this); - }, - - // nsIUpdatePrompt - - // FIXME/bug 737601: we should have users opt-in to downloading - // updates when on a billed pipe. Initially, opt-in for 3g, but - // that doesn't cover all cases. - 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"); - this.downloadUpdate(aUpdate); - } - }, - - 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 - // update quietly without user intervention. - this.sendUpdateEvent("update-downloaded", aUpdate); - - if (Services.idle.idleTime >= this.applyIdleTimeout) { - this.showApplyPrompt(aUpdate); - return; - } - - let applyIdleTimeoutSeconds = this.applyIdleTimeout / 1000; - // We haven't been idle long enough, so register an observer - log("Update is ready to apply, registering idle timeout of " + - applyIdleTimeoutSeconds + " seconds before prompting."); - - this._update = aUpdate; - this.waitForIdle(); - }, - - storeUpdateError: function UP_storeUpdateError(aUpdate) { - log("Storing update error for later use"); - this._updateErrorQueue.push(aUpdate); - }, - - sendStoredUpdateError: function UP_sendStoredUpdateError() { - log("Sending stored update error"); - this._updateErrorQueue.forEach(aUpdate => { - this.sendUpdateEvent("update-error", aUpdate); - }); - this._updateErrorQueue = [ ]; - }, - - 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); - } - - if (!this._receivedUpdatePromptReady) { - this.storeUpdateError(aUpdate); - } else { - 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); - } - }, - - // Custom functions - - waitForIdle: function UP_waitForIdle() { - if (this._waitingForIdle) { - return; - } - - this._waitingForIdle = true; - Services.idle.addIdleObserver(this, this.applyIdleTimeout / 1000); - Services.obs.addObserver(this, "quit-application", false); - }, - - setUpdateStatus: function UP_setUpdateStatus(aStatus) { - this.setParameter("gecko.updateStatus", aStatus); - - if (useSettings()) { - log("Setting gecko.updateStatus: " + aStatus); - - let lock = Services.settings.createLock(); - lock.set("gecko.updateStatus", aStatus, null); - } - }, - - 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(); - return; - } - - if (AppConstants.MOZ_B2G_RIL) { - let window = Services.wm.getMostRecentWindow("navigator:browser"); - let pinReq = window.navigator.mozIccManager.getCardLock("pin"); - pinReq.onsuccess = function(e) { - if (e.target.result.enabled) { - // The SIM is pin locked. Don't use a fallback timer. This means that - // the user has to press Install to apply the update. If we use the - // timer, and the timer reboots the phone, then the phone will be - // unusable until the SIM is unlocked. - log("SIM is pin locked. Not starting fallback timer."); - } else { - // This means that no pin lock is enabled, so we go ahead and start - // the fallback timer. - this._applyPromptTimer = this.createTimer(this.applyPromptTimeout); - } - }.bind(this); - pinReq.onerror = function(e) { - this._applyPromptTimer = this.createTimer(this.applyPromptTimeout); - }.bind(this); - } else { - // Schedule a fallback timeout in case the UI is unable to respond or show - // a prompt for some reason. - this._applyPromptTimer = this.createTimer(this.applyPromptTimeout); - } - }, - - _copyProperties: ["appVersion", "buildID", "detailsURL", "displayVersion", - "errorCode", "isOSUpdate", "platformVersion", - "previousAppVersion", "state", "statusText"], - - sendUpdateEvent: function UP_sendUpdateEvent(aType, aUpdate) { - let detail = {}; - for (let property of this._copyProperties) { - detail[property] = aUpdate[property]; - } - - 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) { - detail.size = patch.size; - detail.updateType = patch.type; - } else { - log("Warning: no patches available in update"); - } - - this._update = aUpdate; - return this.sendChromeEvent(aType, detail); - }, - - sendChromeEvent: function UP_sendChromeEvent(aType, aDetail) { - let detail = aDetail || {}; - detail.type = aType; - - let sent = SystemAppProxy.dispatchEvent(detail); - if (!sent) { - log("Warning: Couldn't send update event " + aType + - ": no content browser. Will send again when content becomes available."); - return false; - } - return true; - }, - - handleAvailableResult: function UP_handleAvailableResult(aDetail) { - // If the user doesn't choose "download", the updater will implicitly call - // showUpdateAvailable again after a certain period of time - switch (aDetail.result) { - case "download": - this.downloadUpdate(this._update); - break; - } - }, - - handleApplyPromptResult: function UP_handleApplyPromptResult(aDetail) { - if (this._applyPromptTimer) { - this._applyPromptTimer.cancel(); - this._applyPromptTimer = null; - } - - switch (aDetail.result) { - // Battery not okay, do not wait for idle to re-prompt - case "low-battery": - break; - case "wait": - // Wait until the user is idle before prompting to apply the update - this.waitForIdle(); - break; - case "restart": - this.finishUpdate(); - this._update = null; - break; - } - }, - - downloadUpdate: function UP_downloadUpdate(aUpdate) { - if (!aUpdate) { - aUpdate = Services.um.activeUpdate; - if (!aUpdate) { - log("No active update found to download"); - return; - } - } - - let status = Services.aus.downloadUpdate(aUpdate, true); - if (status == STATE_DOWNLOADING) { - Services.aus.addDownloadListener(this); - return; - } - - // If the update has already been downloaded and applied, then - // Services.aus.downloadUpdate will return immediately and not - // call showUpdateDownloaded, so we detect this. - if (aUpdate.state == "applied" && aUpdate.errorCode == 0) { - this.showUpdateDownloaded(aUpdate, true); - return; - } - - log("Error downloading update " + aUpdate.name + ": " + aUpdate.errorCode); - let errorCode = aUpdate.errorCode >>> 0; - if (errorCode == Cr.NS_ERROR_FILE_TOO_BIG) { - aUpdate.statusText = "file-too-big"; - } - this.showUpdateError(aUpdate); - }, - - handleDownloadCancel: function UP_handleDownloadCancel() { - log("Pausing download"); - Services.aus.pauseDownload(); - }, - - finishUpdate: function UP_finishUpdate() { - if (!this._update.isOSUpdate) { - // Standard gecko+gaia updates will just need to restart the process - this.restartProcess(); - return; - } - - try { - Services.aus.applyOsUpdate(this._update); - } - catch (e) { - this._update.errorCode = Cr.NS_ERROR_FAILURE; - this.showUpdateError(this._update); - } - }, - - restartProcess: function UP_restartProcess() { - log("Update downloaded, restarting to apply it"); - - let callbackAfterSet = function() { - if (AppConstants.platform !== "gonk") { - let appStartup = Cc["@mozilla.org/toolkit/app-startup;1"] - .getService(Ci.nsIAppStartup); - appStartup.quit(appStartup.eForceQuit | appStartup.eRestart); - } else { - // NB: on Gonk, we rely on the system process manager to restart us. - let pmService = Cc["@mozilla.org/power/powermanagerservice;1"] - .getService(Ci.nsIPowerManagerService); - pmService.restart(); - } - } - - if (useSettings()) { - // Save current os version in deviceinfo.previous_os - let lock = Services.settings.createLock({ - handle: callbackAfterSet, - handleAbort: function(error) { - log("Abort callback when trying to set previous_os: " + error); - callbackAfterSet(); - } - }); - lock.get("deviceinfo.os", { - handle: function(name, value) { - log("Set previous_os to: " + value); - lock.set("deviceinfo.previous_os", value, null, null); - } - }); - } - }, - - forceUpdateCheck: function UP_forceUpdateCheck() { - log("Forcing update check"); - - let checker = Cc["@mozilla.org/updates/update-checker;1"] - .createInstance(Ci.nsIUpdateChecker); - checker.checkForUpdates(this._updateCheckListener, true); - }, - - handleEvent: function UP_handleEvent(evt) { - if (evt.type !== "mozContentEvent") { - return; - } - - let detail = evt.detail; - if (!detail) { - return; - } - - switch (detail.type) { - case "force-update-check": - this.forceUpdateCheck(); - break; - case "update-available-result": - this.handleAvailableResult(detail); - // If we started the apply prompt timer, this means that we're waiting - // for the user to press Later or Install Now. In this situation we - // don't want to clear this._update, becuase handleApplyPromptResult - // needs it. - if (this._applyPromptTimer == null && !this._waitingForIdle) { - this._update = null; - } - break; - case "update-download-cancel": - this.handleDownloadCancel(); - break; - case "update-prompt-apply-result": - this.handleApplyPromptResult(detail); - break; - case "update-prompt-ready": - this._receivedUpdatePromptReady = true; - this.sendStoredUpdateError(); - break; - } - }, - - // nsIObserver - - observe: function UP_observe(aSubject, aTopic, aData) { - switch (aTopic) { - case "idle": - this._waitingForIdle = false; - this.showApplyPrompt(this._update); - // Fall through - case "quit-application": - Services.idle.removeIdleObserver(this, this.applyIdleTimeout / 1000); - Services.obs.removeObserver(this, "quit-application"); - break; - } - }, - - // nsITimerCallback - - notify: function UP_notify(aTimer) { - if (aTimer == this._applyPromptTimer) { - log("Timed out waiting for result, restarting"); - this._applyPromptTimer = null; - this.finishUpdate(); - this._update = null; - return; - } - if (aTimer == this._watchdogTimer) { - log("Download watchdog fired"); - this._watchdogTimer = null; - this._autoRestartDownload = true; - Services.aus.pauseDownload(); - return; - } - }, - - createTimer: function UP_createTimer(aTimeoutMs) { - let timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer); - timer.initWithCallback(this, aTimeoutMs, timer.TYPE_ONE_SHOT); - return timer; - }, - - // nsIRequestObserver - - _startedSent: false, - - _watchdogTimer: null, - - _autoRestartDownload: false, - _autoRestartCount: 0, - - startWatchdogTimer: function UP_startWatchdogTimer() { - let watchdogTimeout = 120000; // 120 seconds - try { - watchdogTimeout = Services.prefs.getIntPref(PREF_DOWNLOAD_WATCHDOG_TIMEOUT); - } catch (e) { - // This means that the preference doesn't exist. watchdogTimeout will - // retain its default assigned above. - } - if (watchdogTimeout <= 0) { - // 0 implies don't bother using the watchdog timer at all. - this._watchdogTimer = null; - return; - } - if (this._watchdogTimer) { - this._watchdogTimer.cancel(); - } else { - this._watchdogTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer); - } - this._watchdogTimer.initWithCallback(this, watchdogTimeout, - Ci.nsITimer.TYPE_ONE_SHOT); - }, - - stopWatchdogTimer: function UP_stopWatchdogTimer() { - if (this._watchdogTimer) { - this._watchdogTimer.cancel(); - this._watchdogTimer = null; - } - }, - - touchWatchdogTimer: function UP_touchWatchdogTimer() { - this.startWatchdogTimer(); - }, - - onStartRequest: function UP_onStartRequest(aRequest, aContext) { - // Wait until onProgress to send the update-download-started event, in case - // this request turns out to fail for some reason - this._startedSent = false; - this.startWatchdogTimer(); - }, - - onStopRequest: function UP_onStopRequest(aRequest, aContext, aStatusCode) { - this.stopWatchdogTimer(); - Services.aus.removeDownloadListener(this); - let paused = !Components.isSuccessCode(aStatusCode); - if (!paused) { - // The download was successful, no need to restart - this._autoRestartDownload = false; - } - if (this._autoRestartDownload) { - this._autoRestartDownload = false; - let watchdogMaxRetries = Services.prefs.getIntPref(PREF_DOWNLOAD_WATCHDOG_MAX_RETRIES); - this._autoRestartCount++; - if (this._autoRestartCount > watchdogMaxRetries) { - log("Download - retry count exceeded - error"); - // We exceeded the max retries. Treat the download like an error, - // which will give the user a chance to restart manually later. - this._autoRestartCount = 0; - if (Services.um.activeUpdate) { - this.showUpdateError(Services.um.activeUpdate); - } - return; - } - log("Download - restarting download - attempt " + this._autoRestartCount); - this.downloadUpdate(null); - return; - } - this._autoRestartCount = 0; - this.sendChromeEvent("update-download-stopped", { - paused: paused - }); - }, - - // nsIProgressEventSink - - 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 - // the timer now. - this.stopWatchdogTimer(); - } else { - this.touchWatchdogTimer(); - } - if (!this._startedSent) { - this.sendChromeEvent("update-download-started", { - total: aProgressMax - }); - this._startedSent = true; - } - - this.sendChromeEvent("update-download-progress", { - progress: aProgress, - total: aProgressMax - }); - }, - - onStatus: function UP_onStatus(aRequest, aUpdate, aStatus, aStatusArg) { } -}; - -this.NSGetFactory = XPCOMUtils.generateNSGetFactory([UpdatePrompt]); diff --git a/b2g/components/moz.build b/b2g/components/moz.build index 91d25ed0be82..8e54c834d791 100644 --- a/b2g/components/moz.build +++ b/b2g/components/moz.build @@ -41,11 +41,6 @@ if CONFIG['MOZ_B2G']: 'RecoveryService.js', ] -if CONFIG['MOZ_UPDATER']: - EXTRA_COMPONENTS += [ - 'UpdatePrompt.js', - ] - EXTRA_JS_MODULES += [ 'AboutServiceWorkers.jsm', 'ActivityChannel.jsm', diff --git a/b2g/installer/package-manifest.in b/b2g/installer/package-manifest.in index f457e9f18de8..0a6d5efe7905 100644 --- a/b2g/installer/package-manifest.in +++ b/b2g/installer/package-manifest.in @@ -779,9 +779,6 @@ bin/libfreebl_32int64_3.so #endif @RESPATH@/components/AlertsService.js @RESPATH@/components/ContentPermissionPrompt.js -#ifdef MOZ_UPDATER -@RESPATH@/components/UpdatePrompt.js -#endif @RESPATH@/components/DirectoryProvider.js @RESPATH@/components/ProcessGlobal.js @RESPATH@/components/OMAContentHandler.js diff --git a/build/autoconf/nspr-build.m4 b/build/autoconf/nspr-build.m4 index fe6dab7210e7..bb4e630d262b 100644 --- a/build/autoconf/nspr-build.m4 +++ b/build/autoconf/nspr-build.m4 @@ -156,6 +156,8 @@ if test -n "$MOZ_SYSTEM_NSPR" -o -n "$NSPR_CFLAGS" -o -n "$NSPR_LIBS"; then , AC_MSG_ERROR([system NSPR does not support PR_UINT64 or including prtypes.h does not provide it])) CFLAGS=$_SAVE_CFLAGS + NSPR_INCLUDE_DIR=`echo ${NSPR_CFLAGS} | sed -e 's/.*-I\([^ ]*\).*/\1/'` + NSPR_LIB_DIR=`echo ${NSPR_LIBS} | sed -e 's/.*-L\([^ ]*\).*/\1/'` elif test -z "$JS_POSIX_NSPR"; then NSPR_INCLUDE_DIR="${DIST}/include/nspr" NSPR_CFLAGS="-I${NSPR_INCLUDE_DIR}" diff --git a/build/gyp.mozbuild b/build/gyp.mozbuild index ff04f6aac1ff..a0ddd6939c66 100644 --- a/build/gyp.mozbuild +++ b/build/gyp.mozbuild @@ -4,7 +4,9 @@ # 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/. -gyp_vars = { +include('gyp_base.mozbuild') + +gyp_vars.update({ 'lsan': 0, 'asan': 0, 'build_with_mozilla': 1, @@ -69,16 +71,9 @@ gyp_vars = { # linker to throw away uneeded bits. 'include_isac': 1, 'include_pcm16b': 1, -} +}) -os = CONFIG['OS_TARGET'] - -if os == 'WINNT': - gyp_vars.update( - MSVS_VERSION=CONFIG['_MSVS_VERSION'], - MSVS_OS_BITS=64 if CONFIG['HAVE_64BIT_BUILD'] else 32, - ) -elif os == 'Android': +if os == 'Android': if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk': gyp_vars['build_with_gonk'] = 1 gyp_vars['moz_widget_toolkit_gonk'] = 1 @@ -92,28 +87,6 @@ elif os == 'Android': android_toolchain=CONFIG.get('ANDROID_TOOLCHAIN', ''), ) -flavors = { - 'WINNT': 'win', - 'Android': 'linux' if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk' else 'android', - 'Linux': 'linux', - 'Darwin': 'mac' if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa' else 'ios', - 'SunOS': 'solaris', - 'GNU/kFreeBSD': 'freebsd', - 'DragonFly': 'dragonfly', - 'FreeBSD': 'freebsd', - 'NetBSD': 'netbsd', - 'OpenBSD': 'openbsd', -} -gyp_vars['OS'] = flavors.get(os) - -arches = { - 'x86_64': 'x64', - 'x86': 'ia32', - 'aarch64': 'arm64', -} - -gyp_vars['target_arch'] = arches.get(CONFIG['CPU_ARCH'], CONFIG['CPU_ARCH']) - if CONFIG['ARM_ARCH']: if int(CONFIG['ARM_ARCH']) < 7: gyp_vars['armv7'] = 0 diff --git a/build/gyp_base.mozbuild b/build/gyp_base.mozbuild new file mode 100644 index 000000000000..bbdaa0c58339 --- /dev/null +++ b/build/gyp_base.mozbuild @@ -0,0 +1,38 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# 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/. + +gyp_vars = {} + +os = CONFIG['OS_TARGET'] + +if os == 'WINNT': + gyp_vars.update( + MSVS_VERSION=CONFIG['_MSVS_VERSION'], + MSVS_OS_BITS=64 if CONFIG['HAVE_64BIT_BUILD'] else 32, + ) + +flavors = { + 'WINNT': 'win', + 'Android': 'linux' if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk' else 'android', + 'Linux': 'linux', + 'Darwin': 'mac' if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa' else 'ios', + 'SunOS': 'solaris', + 'GNU/kFreeBSD': 'freebsd', + 'DragonFly': 'dragonfly', + 'FreeBSD': 'freebsd', + 'NetBSD': 'netbsd', + 'OpenBSD': 'openbsd', +} +gyp_vars['OS'] = flavors.get(os) + +arches = { + 'x86_64': 'x64', + 'x86': 'ia32', + 'aarch64': 'arm64', +} + +gyp_vars['host_arch'] = arches.get(CONFIG['HOST_CPU_ARCH'], CONFIG['HOST_CPU_ARCH']) +gyp_vars['target_arch'] = arches.get(CONFIG['CPU_ARCH'], CONFIG['CPU_ARCH']) diff --git a/build/moz.configure/init.configure b/build/moz.configure/init.configure index d89c5bfdf8ee..dec2f18af6cf 100644 --- a/build/moz.configure/init.configure +++ b/build/moz.configure/init.configure @@ -520,6 +520,7 @@ def host_variables(host): HOST_OS_ARCH=os_arch, ) +set_config('HOST_CPU_ARCH', delayed_getattr(host, 'cpu')) set_config('HOST_OS_ARCH', delayed_getattr(host_variables, 'HOST_OS_ARCH')) add_old_configure_assignment('HOST_OS_ARCH', delayed_getattr(host_variables, 'HOST_OS_ARCH')) diff --git a/config/external/nss/Makefile.in b/config/external/nss/Makefile.in deleted file mode 100644 index 07f98901437c..000000000000 --- a/config/external/nss/Makefile.in +++ /dev/null @@ -1,485 +0,0 @@ -# -# 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/. - -ifndef MOZ_SYSTEM_NSS - -CC_WRAPPER = -CXX_WRAPPER = - -default:: - -include $(topsrcdir)/config/makefiles/functions.mk - -NSS_LIBS = \ - nss3 \ - nssutil3 \ - smime3 \ - ssl3 \ - $(NULL) - -ifdef MOZ_FOLD_LIBS -NSS_DLLS = $(LIBRARY_NAME) -else -NSS_DLLS = $(NSS_LIBS) -endif - -NSS_EXTRA_DLLS = \ - nssckbi \ - softokn3 \ - $(NULL) - -ifndef NSS_DISABLE_DBM -NSS_EXTRA_DLLS += nssdbm3 -endif - -SDK_LIBS = crmf - -ifneq (,$(filter WINNT,$(OS_ARCH))) -SDK_LIBS += $(NSS_DLLS) -endif - -# Default -HAVE_FREEBL_LIBS = 1 - -# 32-bit HP-UX PA-RISC -ifeq ($(OS_ARCH), HP-UX) -ifneq ($(OS_TEST), ia64) -ifndef HAVE_64BIT_BUILD -HAVE_FREEBL_LIBS = -HAVE_FREEBL_LIBS_32INT32 = 1 -HAVE_FREEBL_LIBS_32FPU = 1 -endif -endif -endif - -# SunOS SPARC -ifeq ($(OS_ARCH), SunOS) -ifneq (86,$(findstring 86,$(OS_TEST))) -ifdef HAVE_64BIT_BUILD -HAVE_FREEBL_LIBS = -HAVE_FREEBL_LIBS_64 = 1 -else -HAVE_FREEBL_LIBS = -HAVE_FREEBL_LIBS_32FPU = 1 -HAVE_FREEBL_LIBS_32INT64 = 1 -endif -endif -endif - -ifeq ($(OS_TARGET),Linux) -HAVE_FREEBL_LIBS = -HAVE_FREEBL_LIBS_PRIV = 1 -FREEBL_LOWHASH_FLAG = FREEBL_LOWHASH=1 -endif - -ifdef HAVE_FREEBL_LIBS -NSS_EXTRA_DLLS += freebl3 -endif -ifdef HAVE_FREEBL_LIBS_PRIV -NSS_EXTRA_DLLS += freeblpriv3 -endif -ifdef HAVE_FREEBL_LIBS_32INT32 -NSS_EXTRA_DLLS += freebl_32int_3 -endif -ifdef HAVE_FREEBL_LIBS_32FPU -NSS_EXTRA_DLLS += freebl_32fpu_3 -endif -ifdef HAVE_FREEBL_LIBS_32INT64 -NSS_EXTRA_DLLS += freebl_32int64_3 -endif -ifdef HAVE_FREEBL_LIBS_64 -NSS_EXTRA_DLLS += freebl_64int_3 -NSS_EXTRA_DLLS += freebl_64fpu_3 -endif - -# For all variables such as DLLFLAGS, that may contain $(DIST) -DIST := $(ABS_DIST) -# TODO: move this all to configure, but in Python -ifndef MOZ_BUILD_NSPR -NSPR_INCLUDE_DIR = $(firstword $(filter -I%,$(NSPR_CFLAGS))) -ifneq (,$(strip $(NSPR_INCLUDE_DIR))) -NSPR_INCLUDE_DIR := $(subst -I,,$(subst -I$(DIST),-I$(ABS_DIST),$(NSPR_INCLUDE_DIR))) -else -$(error Your NSPR CFLAGS are broken!) -endif -NSPR_LIB_DIR = $(firstword $(filter -L%,$(NSPR_LIBS))) -ifneq (,$(strip $(NSPR_LIB_DIR))) -NSPR_LIB_DIR := $(subst -L,,$(subst -L$(DIST),-L$(ABS_DIST),$(NSPR_LIB_DIR))) -else -$(error Your NSPR LDFLAGS are broken!) -endif -endif - -# To get debug symbols from NSS -export MOZ_DEBUG_SYMBOLS - -DEFAULT_GMAKE_FLAGS = -DEFAULT_GMAKE_FLAGS += CC='$(CC)' -DEFAULT_GMAKE_FLAGS += MT='$(MT)' -DEFAULT_GMAKE_FLAGS += LD='$(LD)' -DEFAULT_GMAKE_FLAGS += SOURCE_MD_DIR=$(ABS_DIST) -DEFAULT_GMAKE_FLAGS += SOURCE_MDHEADERS_DIR=$(NSPR_INCLUDE_DIR) -DEFAULT_GMAKE_FLAGS += DIST=$(ABS_DIST) -DEFAULT_GMAKE_FLAGS += NSPR_INCLUDE_DIR=$(NSPR_INCLUDE_DIR) -DEFAULT_GMAKE_FLAGS += NSPR_LIB_DIR=$(NSPR_LIB_DIR) -DEFAULT_GMAKE_FLAGS += MOZILLA_CLIENT=1 -DEFAULT_GMAKE_FLAGS += NO_MDUPDATE=1 -DEFAULT_GMAKE_FLAGS += NSS_ENABLE_ECC=1 -DEFAULT_GMAKE_FLAGS += NSS_ENABLE_TLS_1_3=1 -ifeq ($(OS_ARCH)_$(GNU_CC),WINNT_1) -DEFAULT_GMAKE_FLAGS += OS_DLLFLAGS='-static-libgcc' NSPR31_LIB_PREFIX=lib -endif -ifndef MOZ_SYSTEM_SQLITE -ifdef MOZ_FOLD_LIBS -DEFAULT_GMAKE_FLAGS += SQLITE_LIB_NAME=nss3 -else -DEFAULT_GMAKE_FLAGS += SQLITE_LIB_NAME=mozsqlite3 -DEFAULT_GMAKE_FLAGS += SQLITE_LIB_DIR=$(ABS_DIST)/../config/external/sqlite -endif # MOZ_FOLD_LIBS -DEFAULT_GMAKE_FLAGS += SQLITE_INCLUDE_DIR=$(ABS_DIST)/include -endif -ifdef NSS_DISABLE_DBM -DEFAULT_GMAKE_FLAGS += NSS_DISABLE_DBM=1 -endif -# Hack to force NSS build system to use "normal" object directories -DEFAULT_GMAKE_FLAGS += topsrcdir='$(topsrcdir)' -# topsrcdir can't be expanded here because msys path mangling likes to break -# paths in that case. -DEFAULT_GMAKE_FLAGS += BUILD='$(MOZ_BUILD_ROOT)/security/$$(subst $$(topsrcdir)/security/,,$$(CURDIR))' -DEFAULT_GMAKE_FLAGS += BUILD_TREE='$$(BUILD)' OBJDIR='$$(BUILD)' DEPENDENCIES='$$(BUILD)/.deps' SINGLE_SHLIB_DIR='$$(BUILD)' -DEFAULT_GMAKE_FLAGS += SOURCE_XP_DIR=$(ABS_DIST) -ifndef MOZ_DEBUG -DEFAULT_GMAKE_FLAGS += BUILD_OPT=1 OPT_CODE_SIZE=1 -endif -ifdef GNU_CC -DEFAULT_GMAKE_FLAGS += NS_USE_GCC=1 -else -DEFAULT_GMAKE_FLAGS += NS_USE_GCC= -endif -ifdef USE_N32 -# It is not really necessary to specify USE_PTHREADS=1. USE_PTHREADS -# merely adds _PTH to coreconf's OBJDIR name. -DEFAULT_GMAKE_FLAGS += USE_N32=1 USE_PTHREADS=1 -endif -ifdef HAVE_64BIT_BUILD -DEFAULT_GMAKE_FLAGS += USE_64=1 -endif -ifeq ($(OS_ARCH),WINNT) -DEFAULT_GMAKE_FLAGS += OS_TARGET=WIN95 -ifdef MOZ_DEBUG -ifndef MOZ_NO_DEBUG_RTL -DEFAULT_GMAKE_FLAGS += USE_DEBUG_RTL=1 -endif -endif -endif # WINNT -ifeq ($(OS_ARCH),Darwin) -# Make nsinstall use absolute symlinks by default when building NSS -# for Mozilla on Mac OS X. (Bugzilla bug 193164) -ifndef NSDISTMODE -DEFAULT_GMAKE_FLAGS += NSDISTMODE=absolute_symlink -endif -ifdef MACOS_SDK_DIR -DEFAULT_GMAKE_FLAGS += MACOS_SDK_DIR=$(MACOS_SDK_DIR) -endif -endif - -# Turn off TLS compression support because it requires system zlib. -# See bug 580679 comment 18. -DEFAULT_GMAKE_FLAGS += NSS_SSL_ENABLE_ZLIB= - -# Disable building of the test programs in security/nss/lib/zlib -DEFAULT_GMAKE_FLAGS += PROGRAMS= - -# Disable creating .chk files. They will be generated from packager.mk -# When bug 681624 lands, we can replace CHECKLOC= with SKIP_SHLIBSIGN=1 -DEFAULT_GMAKE_FLAGS += CHECKLOC= - -ifdef CROSS_COMPILE - -DEFAULT_GMAKE_FLAGS += \ - NATIVE_CC='$(HOST_CC)' \ - CC='$(CC)' \ - CCC='$(CXX)' \ - AS='$(AS)' \ - AR='$(AR) $(AR_FLAGS:$@=$$@)' \ - RANLIB='$(RANLIB)' \ - RC='$(RC) $(RCFLAGS)' \ - OS_ARCH='$(OS_ARCH)' \ - OS_TEST='$(OS_TEST)' \ - CPU_ARCH='$(TARGET_CPU)' \ - $(NULL) - -# Android has pthreads integrated into -lc, so OS_PTHREAD is set to nothing -ifeq ($(OS_TARGET), Android) -DEFAULT_GMAKE_FLAGS += \ - OS_RELEASE='2.6' \ - OS_PTHREAD= \ - $(NULL) - -DEFAULT_GMAKE_FLAGS += ARCHFLAG='$(filter-out -W%,$(CFLAGS)) -DCHECK_FORK_GETPID $(addprefix -DANDROID_VERSION=,$(ANDROID_VERSION)) -include $(topsrcdir)/security/manager/android_stub.h' -endif -endif - -ifdef WRAP_LDFLAGS -NSS_EXTRA_LDFLAGS += $(WRAP_LDFLAGS) -endif - -# The SHARED_LIBS part is needed unconditionally on Android. It's not -# clear why this is the case, but see bug 1133073 (starting around -# comment #8) for context. -ifneq (,$(or $(MOZ_GLUE_WRAP_LDFLAGS), $(filter Android, $(OS_TARGET)))) -NSS_EXTRA_LDFLAGS += $(SHARED_LIBS:$(DEPTH)%=$(MOZ_BUILD_ROOT)%) $(MOZ_GLUE_WRAP_LDFLAGS) -endif - -ifneq (,$(NSS_EXTRA_LDFLAGS)) -DEFAULT_GMAKE_FLAGS += \ - LDFLAGS='$(LDFLAGS) $(NSS_EXTRA_LDFLAGS)' \ - DSO_LDOPTS='$(DSO_LDOPTS) $(LDFLAGS) $(NSS_EXTRA_LDFLAGS)' \ - $(NULL) -endif - -DEFAULT_GMAKE_FLAGS += FREEBL_NO_DEPEND=0 $(FREEBL_LOWHASH_FLAG) -DEFAULT_GMAKE_FLAGS += NSS_ALLOW_SSLKEYLOGFILE=1 - -ifdef MOZ_NO_WLZDEFS -DEFAULT_GMAKE_FLAGS += ZDEFS_FLAG= -endif -ifdef MOZ_CFLAGS_NSS -NSS_XCFLAGS += $(filter-out -W%,$(CFLAGS)) -DEFAULT_GMAKE_FLAGS += DARWIN_DYLIB_VERSIONS='-compatibility_version 1 -current_version 1 $(LDFLAGS)' -endif -ifeq (1_1,$(CLANG_CL)_$(MOZ_ASAN)) -XLDFLAGS := $(OS_LDFLAGS) -DEFAULT_GMAKE_FLAGS += XLDFLAGS='$(XLDFLAGS)' -endif - -DEFAULT_GMAKE_FLAGS += NSS_NO_PKCS11_BYPASS=1 - -# Put NSS headers directly under $(DIST)/include -DEFAULT_GMAKE_FLAGS += PUBLIC_EXPORT_DIR='$(ABS_DIST)/include/$$(MODULE)' -DEFAULT_GMAKE_FLAGS += SOURCE_XPHEADERS_DIR='$$(SOURCE_XP_DIR)/include/$$(MODULE)' -DEFAULT_GMAKE_FLAGS += MODULE_INCLUDES='$$(addprefix -I$$(SOURCE_XP_DIR)/include/,$$(REQUIRES))' - -# Work around NSS's MAKE_OBJDIR being racy. See bug #836220 -DEFAULT_GMAKE_FLAGS += MAKE_OBJDIR='$$(INSTALL) -D $$(OBJDIR)' - -# Work around NSS adding IMPORT_LIBRARY to TARGETS with no rule for -# it, creating race conditions. See bug #836220 -DEFAULT_GMAKE_FLAGS += TARGETS='$$(LIBRARY) $$(SHARED_LIBRARY) $$(PROGRAM)' - -ifdef MOZ_FOLD_LIBS_FLAGS -NSS_XCFLAGS += $(MOZ_FOLD_LIBS_FLAGS) -endif - -# Pass on the MSVC target arch from the main build system. -# Note this is case- and switch-character sensitive, while -# the MSVC option is not. -ifeq (WINNT,$(OS_TARGET)) -NSS_XCFLAGS += $(filter -arch:%,$(CFLAGS)) -endif - -# Export accumulated XCFLAGS to modify nss defaults. -DEFAULT_GMAKE_FLAGS += XCFLAGS='$(NSS_XCFLAGS)' - -NSS_SRCDIR = $(topsrcdir) - -NSS_DIRS = -ifndef MOZ_FOLD_LIBS -NSS_DIRS += nss/lib -else -ifndef NSS_DISABLE_DBM -NSS_DIRS += nss/lib/dbm -endif -endif -NSS_DIRS += \ - nss/cmd/lib \ - nss/cmd/shlibsign \ - $(NULL) - -ifdef ENABLE_TESTS -NSS_DIRS += \ - nss/cmd/certutil \ - nss/cmd/pk12util \ - nss/cmd/modutil \ - $(NULL) -endif - -ifneq (,$(filter %--build-id,$(LDFLAGS))) -DEFAULT_GMAKE_ENV = LDFLAGS=-Wl,--build-id -endif - -ifdef MOZ_FOLD_LIBS -# TODO: The following can be replaced by something simpler when bug 844880 -# is fixed. -# All static libraries required for nss, smime, ssl and nssutil. -# The strip is needed to remove potential linefeed characters, since they hang -# around in some cases on Windows. -NSS_STATIC_LIBS := $(strip $(shell $(MAKE) --no-print-directory -f $(srcdir)/nss.mk DEPTH='$(DEPTH)' topsrcdir='$(topsrcdir)' srcdir='$(srcdir)' echo-variable-libs)) -# Corresponding build directories -NSS_STATIC_DIRS := $(foreach lib,$(NSS_STATIC_LIBS),$(patsubst %/,%,$(dir $(lib)))) -NSS_DIRS += $(NSS_STATIC_DIRS) - -# TODO: The following can be replaced by something simpler when bug 844884 -# is fixed. -# Remaining nss/lib directories -NSS_DIRS += nss/lib/freebl nss/lib/softoken nss/lib/jar nss/lib/crmf nss/lib/ckfw - -DEFAULT_GMAKE_FLAGS += NSS_DISABLE_LIBPKIX=1 - -ifeq (WINNT,$(OS_TARGET)) -NSS_DIRS += nss/lib/zlib -endif -endif # MOZ_FOLD_LIBS - -# Filter-out $(LIBRARY_NAME) because it's already handled in config/rules.mk. -NSS_DIST_DLL_FILES := $(addprefix $(DIST)/lib/$(DLL_PREFIX),$(addsuffix $(DLL_SUFFIX),$(filter-out $(LIBRARY_NAME),$(NSS_DLLS)) $(NSS_EXTRA_DLLS))) -NSS_DIST_DLL_DEST := $(DIST)/bin -NSS_DIST_DLL_TARGET := target -INSTALL_TARGETS += NSS_DIST_DLL - -ifeq ($(OS_ARCH)_$(1), SunOS_softokn3) -# has to use copy mode on Solaris, see #665509 -$(DIST)/bin/$(DLL_PREFIX)softokn3$(DLL_SUFFIX): INSTALL := $(INSTALL) -t -endif - -NSS_SDK_LIB_FILES := \ - $(addprefix $(DIST)/lib/$(LIB_PREFIX),$(addsuffix .$(LIB_SUFFIX),$(SDK_LIBS))) \ - $(addprefix $(DIST)/bin/$(DLL_PREFIX),$(addsuffix $(DLL_SUFFIX),$(NSS_DLLS))) \ - $(NULL) -NSS_SDK_LIB_DEST := $(DIST)/sdk/lib -NSS_SDK_LIB_TARGET := target -INSTALL_TARGETS += NSS_SDK_LIB - -ifdef MOZ_FOLD_LIBS -# Add all static libraries for nss, smime, ssl and nssutil -STATIC_LIBS += $(addprefix $(DEPTH)/security/,$(NSS_STATIC_LIBS)) - -IMPORT_LIB_FILES = $(IMPORT_LIBRARY) -IMPORT_LIB_DEST ?= $(DIST)/lib -IMPORT_LIB_TARGET = target -INSTALL_TARGETS += IMPORT_LIB - -endif # MOZ_FOLD_LIBS - -include $(topsrcdir)/config/rules.mk - -ifeq (1,$(ALLOW_COMPILER_WARNINGS)) -DEFAULT_GMAKE_FLAGS += NSS_ENABLE_WERROR=0 -endif - -# Can't pass this in DEFAULT_GMAKE_FLAGS because that overrides -# definitions in NSS, so just export it into the sub-make's environment. -ifeq (WINNT_1,$(OS_TARGET)_$(MOZ_MEMORY)) -DLLFLAGS := -LIBPATH:$(ABS_DIST)/../mozglue/build -DEFAULTLIB:mozglue -export DLLFLAGS -endif - -ifdef MOZ_FOLD_LIBS -# Force the linker to include everything from the static libraries. -EXPAND_LIBS_EXEC += --extract - -$(SHARED_LIBRARY): $(addprefix $(DEPTH)/security/,$(NSS_STATIC_LIBS)) - -ifdef IMPORT_LIB_SUFFIX -IMPORT_PREFIX = $(LIB_PREFIX) -IMPORT_SUFFIX = .$(IMPORT_LIB_SUFFIX) -else -IMPORT_PREFIX = $(DLL_PREFIX) -IMPORT_SUFFIX = $(DLL_SUFFIX) -endif - -NSPR_IMPORT_LIBS = $(addprefix $(DIST)/lib/$(IMPORT_PREFIX),$(addsuffix $(IMPORT_SUFFIX),nspr4 plc4 plds4)) -SQLITE_IMPORT_LIB = $(DIST)/lib/$(IMPORT_PREFIX)mozsqlite3$(IMPORT_SUFFIX) - -# TODO: The following can be replaced by something simpler when bug 844884 -# is fixed. -# Associate target files with the rules that build them. -$(DIST)/lib/$(LIB_PREFIX)crmf.$(LIB_SUFFIX): libs-nss/lib/crmf -$(DIST)/lib/$(DLL_PREFIX)freebl3$(DLL_SUFFIX): libs-nss/lib/freebl -$(DIST)/lib/$(DLL_PREFIX)nssckbi$(DLL_SUFFIX): libs-nss/lib/ckfw -$(DIST)/lib/$(DLL_PREFIX)softokn3$(DLL_SUFFIX): libs-nss/lib/softoken -$(DIST)/lib/$(DLL_PREFIX)nssdbm3$(DLL_SUFFIX): libs-nss/lib/softoken -$(foreach lib,$(NSS_STATIC_LIBS),$(eval $(DEPTH)/security/$(lib): libs-$(patsubst %/,%,$(dir $(lib))))) - -# Create fake import libraries for the folded libraries, so that linking -# against them works both for the NSS build system (see dependencies below) -# and for the rest of the mozilla build system. -$(NSPR_IMPORT_LIBS) \ -$(SQLITE_IMPORT_LIB) \ -$(DIST)/lib/$(IMPORT_PREFIX)nssutil3$(IMPORT_SUFFIX) \ -$(DIST)/lib/$(IMPORT_PREFIX)ssl3$(IMPORT_SUFFIX) \ -$(DIST)/lib/$(IMPORT_PREFIX)smime3$(IMPORT_SUFFIX): $(DIST)/lib/$(IMPORT_PREFIX)nss3$(IMPORT_SUFFIX) -ifeq (WINNT,$(OS_TARGET)) - cp $< $@ -else - ln -sf $< $@ -endif - -# Interdependencies between nss sub-directories, and dependencies on NSPR/SQLite -libs-nss/lib/ckfw: libs-nss/lib/nss/../base $(NSPR_IMPORT_LIBS) -libs-nss/lib/softoken: $(NSPR_IMPORT_LIBS) $(SQLITE_IMPORT_LIB) -libs-nss/lib/softoken: libs-nss/lib/freebl -ifndef NSS_DISABLE_DBM -libs-nss/lib/softoken: libs-nss/lib/dbm -endif -libs-nss/lib/softoken: $(DIST)/lib/$(IMPORT_PREFIX)nssutil3$(IMPORT_SUFFIX) -libs-nss/lib/freebl: $(DIST)/lib/$(IMPORT_PREFIX)nssutil3$(IMPORT_SUFFIX) $(NSPR_IMPORT_LIBS) - -# For each directory where we build static libraries, force the NSS build system -# to only build static libraries. -$(addprefix libs-,$(NSS_STATIC_DIRS)): DEFAULT_GMAKE_FLAGS += SHARED_LIBRARY= IMPORT_LIBRARY= -else -$(STATIC_LIBS) $(NSS_DIST_DLL_FILES) $(NSS_SDK_LIB_FILES): libs-nss/lib -endif # MOZ_FOLD_LIBS - -ifeq ($(NSINSTALL_PY),$(NSINSTALL)) -DEFAULT_GMAKE_FLAGS += PYTHON='$(PYTHON)' -DEFAULT_GMAKE_FLAGS += NSINSTALL_PY='$(abspath $(topsrcdir)/config/nsinstall.py)' -DEFAULT_GMAKE_FLAGS += NSINSTALL='$$(PYTHON) $$(NSINSTALL_PY)' -else -DEFAULT_GMAKE_FLAGS += NSINSTALL='$(abspath $(NSINSTALL))' -endif -ifeq ($(OS_ARCH),WINNT) -DEFAULT_GMAKE_FLAGS += INSTALL='$$(NSINSTALL) -t' -endif -DEFAULT_GMAKE_FLAGS += $(EXTRA_GMAKE_FLAGS) - -$(addprefix libs-,$(NSS_DIRS)): libs-%: -# Work around NSS's export rule being racy when recursing for private_export -# See bug #836220. -$(addprefix export-,$(NSS_DIRS)): EXTRA_GMAKE_FLAGS = PRIVATE_EXPORTS= -$(addprefix export-,$(NSS_DIRS)): export-%: private_export-% -$(addprefix private_export-,$(NSS_DIRS)): EXTRA_GMAKE_FLAGS = -$(addprefix private_export-,$(NSS_DIRS)): private_export-%: - -$(foreach p,libs export private_export,$(addprefix $(p)-,$(NSS_DIRS))): - $(DEFAULT_GMAKE_ENV) $(MAKE) -C $(NSS_SRCDIR)/security/$* $(@:-$*=) $(DEFAULT_GMAKE_FLAGS) - -export:: $(addprefix export-,$(NSS_DIRS)) - -$(addprefix clean-,$(NSS_DIRS)): clean-%: - $(MAKE) -C $(NSS_SRCDIR)/security/$* $(DEFAULT_GMAKE_FLAGS) clean - -clean clobber clobber_all realclean distclean depend:: $(addprefix clean-,$(NSS_DIRS)) - -NSS_CMD_TARGETS := $(addprefix libs-,$(filter-out nss/cmd/lib,$(filter nss/cmd/%,$(NSS_DIRS)))) -target:: $(NSS_CMD_TARGETS) - -ifdef MOZ_FOLD_LIBS -$(NSS_CMD_TARGETS): $(addprefix $(DIST)/lib/$(IMPORT_PREFIX),$(addsuffix $(IMPORT_SUFFIX),$(NSS_LIBS))) -libs-nss/cmd/modutil: libs-nss/lib/jar -ifeq (WINNT,$(OS_TARGET)) -libs-nss/cmd/modutil: libs-nss/lib/zlib -endif -$(NSS_CMD_TARGETS): libs-nss/cmd/lib -else -$(NSS_CMD_TARGETS): libs-nss/lib libs-nss/cmd/lib -endif # MOZ_FOLD_LIBS - -# Work around NSS build system race condition creating certdata.c in -# security/nss/lib/ckfw/builtins. See bug #836220. -libs-nss/lib$(if $(MOZ_FOLD_LIBS),/ckfw): $(call mkdir_deps,$(DEPTH)/security/nss/lib/ckfw/builtins) - -endif diff --git a/config/external/nss/crmf/moz.build b/config/external/nss/crmf/moz.build deleted file mode 100644 index d2004a509005..000000000000 --- a/config/external/nss/crmf/moz.build +++ /dev/null @@ -1,20 +0,0 @@ -# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- -# vim: set filetype=python: -# 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/. - -Library('crmf') - -if CONFIG['MOZ_SYSTEM_NSS']: - OS_LIBS += [l for l in CONFIG['NSS_LIBS'] if l.startswith('-L')] - OS_LIBS += ['-lcrmf'] -else: - USE_LIBS += [ - # The dependency on nss is not real, but is required to force the - # parent directory being built before this one. This has no - # practical effect on linkage, since the only thing linking crmf - # will need nss anyways. - 'nss', - 'static:/security/nss/lib/crmf/crmf', - ] diff --git a/config/external/nss/moz.build b/config/external/nss/moz.build deleted file mode 100644 index 1c61b28fdef6..000000000000 --- a/config/external/nss/moz.build +++ /dev/null @@ -1,42 +0,0 @@ -# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- -# vim: set filetype=python: -# 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/. - -DIRS += ['crmf'] - -if CONFIG['MOZ_SYSTEM_NSS']: - Library('nss') - OS_LIBS += CONFIG['NSS_LIBS'] -elif CONFIG['MOZ_FOLD_LIBS']: - GeckoSharedLibrary('nss', linkage=None) - # TODO: The library name can be changed when bug 845217 is fixed. - SHARED_LIBRARY_NAME = 'nss3' - - SDK_LIBRARY = True - - USE_LIBS += [ - 'nspr4', - 'plc4', - 'plds4', - ] - - OS_LIBS += CONFIG['REALTIME_LIBS'] - - SYMBOLS_FILE = 'nss.symbols' -else: - Library('nss') - USE_LIBS += [ - '/security/nss/lib/nss/nss3', - '/security/nss/lib/smime/smime3', - '/security/nss/lib/ssl/ssl3', - '/security/nss/lib/util/nssutil3', - 'sqlite', - ] - -# XXX: We should fix these warnings. -ALLOW_COMPILER_WARNINGS = True - -if CONFIG['NSS_EXTRA_SYMBOLS_FILE']: - DEFINES['NSS_EXTRA_SYMBOLS_FILE'] = CONFIG['NSS_EXTRA_SYMBOLS_FILE'] diff --git a/config/external/nss/nss.mk b/config/external/nss/nss.mk deleted file mode 100644 index 38d234a0b921..000000000000 --- a/config/external/nss/nss.mk +++ /dev/null @@ -1,27 +0,0 @@ -# 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 $(DEPTH)/config/autoconf.mk - -include $(topsrcdir)/config/config.mk - -dirs := - -define add_dirs -SHARED_LIBRARY_DIRS := -include $(topsrcdir)/security/$(1)/config.mk -dirs += $$(addprefix $(1)/,$$(SHARED_LIBRARY_DIRS)) $(1) -endef -$(foreach dir,util nss ssl smime,$(eval $(call add_dirs,nss/lib/$(dir)))) - -libs := -define add_lib -LIBRARY_NAME := -include $(topsrcdir)/security/$(1)/manifest.mn -libs += $$(addprefix $(1)/,$(LIB_PREFIX)$$(LIBRARY_NAME).$(LIB_SUFFIX)) -endef -$(foreach dir,$(dirs),$(eval $(call add_lib,$(dir)))) - -echo-variable-%: - @echo $($*) diff --git a/devtools/client/locales/en-US/webide.dtd b/devtools/client/locales/en-US/webide.dtd index 5e1a80ccde8e..750bb5546240 100644 --- a/devtools/client/locales/en-US/webide.dtd +++ b/devtools/client/locales/en-US/webide.dtd @@ -32,8 +32,6 @@ - - @@ -141,10 +139,6 @@ - - - - diff --git a/devtools/client/webide/content/jar.mn b/devtools/client/webide/content/jar.mn index db79fdb51338..73b7b62097a2 100644 --- a/devtools/client/webide/content/jar.mn +++ b/devtools/client/webide/content/jar.mn @@ -12,8 +12,6 @@ webide.jar: content/details.js (details.js) content/addons.js (addons.js) content/addons.xhtml (addons.xhtml) - content/permissionstable.js (permissionstable.js) - content/permissionstable.xhtml (permissionstable.xhtml) content/runtimedetails.js (runtimedetails.js) content/runtimedetails.xhtml (runtimedetails.xhtml) content/prefs.js (prefs.js) diff --git a/devtools/client/webide/content/permissionstable.js b/devtools/client/webide/content/permissionstable.js deleted file mode 100644 index 22c74bd0d7e5..000000000000 --- a/devtools/client/webide/content/permissionstable.js +++ /dev/null @@ -1,78 +0,0 @@ -/* 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/. */ - -var Cu = Components.utils; -const {require} = Cu.import("resource://devtools/shared/Loader.jsm", {}); -const Services = require("Services"); -const {AppManager} = require("devtools/client/webide/modules/app-manager"); -const {Connection} = require("devtools/shared/client/connection-manager"); - -window.addEventListener("load", function onLoad() { - window.removeEventListener("load", onLoad); - document.querySelector("#close").onclick = CloseUI; - AppManager.on("app-manager-update", OnAppManagerUpdate); - BuildUI(); -}, true); - -window.addEventListener("unload", function onUnload() { - window.removeEventListener("unload", onUnload); - AppManager.off("app-manager-update", OnAppManagerUpdate); -}); - -function CloseUI() { - window.parent.UI.openProject(); -} - -function OnAppManagerUpdate(event, what) { - if (what == "connection" || what == "runtime-global-actors") { - BuildUI(); - } -} - -function generateFields(json) { - let table = document.querySelector("table"); - let permissionsTable = json.rawPermissionsTable; - for (let name in permissionsTable) { - let tr = document.createElement("tr"); - tr.className = "line"; - let td = document.createElement("td"); - td.textContent = name; - tr.appendChild(td); - for (let type of ["app", "privileged", "certified"]) { - let td = document.createElement("td"); - if (permissionsTable[name][type] == json.ALLOW_ACTION) { - td.textContent = "✓"; - td.className = "permallow"; - } - if (permissionsTable[name][type] == json.PROMPT_ACTION) { - td.textContent = "!"; - td.className = "permprompt"; - } - if (permissionsTable[name][type] == json.DENY_ACTION) { - td.textContent = "✕"; - td.className = "permdeny"; - } - tr.appendChild(td); - } - table.appendChild(tr); - } -} - -var getRawPermissionsTablePromise; // Used by tests -function BuildUI() { - let table = document.querySelector("table"); - let lines = table.querySelectorAll(".line"); - for (let line of lines) { - line.remove(); - } - - if (AppManager.connection && - AppManager.connection.status == Connection.Status.CONNECTED && - AppManager.deviceFront) { - getRawPermissionsTablePromise = AppManager.deviceFront.getRawPermissionsTable() - .then(json => generateFields(json)); - } else { - CloseUI(); - } -} diff --git a/devtools/client/webide/content/permissionstable.xhtml b/devtools/client/webide/content/permissionstable.xhtml deleted file mode 100644 index 361cfece882a..000000000000 --- a/devtools/client/webide/content/permissionstable.xhtml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - %webideDTD; -]> - - -
- - - - - - - -&permissionstable_name_header; | -type:web | -type:privileged | -type:certified | -
---|
- - -- - - diff --git a/dom/permission/tests/test_idle.html b/dom/permission/tests/test_idle.html deleted file mode 100644 index ef37c3efd6bd..000000000000 --- a/dom/permission/tests/test_idle.html +++ /dev/null @@ -1,46 +0,0 @@ - - - - - -
- - -- - - diff --git a/dom/permission/tests/test_input-manage.html b/dom/permission/tests/test_input-manage.html deleted file mode 100644 index a60a19467338..000000000000 --- a/dom/permission/tests/test_input-manage.html +++ /dev/null @@ -1,69 +0,0 @@ - - - - - -
- - -- - - diff --git a/dom/permission/tests/test_keyboard.html b/dom/permission/tests/test_keyboard.html deleted file mode 100644 index f7916afc6c07..000000000000 --- a/dom/permission/tests/test_keyboard.html +++ /dev/null @@ -1,51 +0,0 @@ -- - - - - -
- - -- - - diff --git a/dom/permission/tests/test_networkstats-manage.html b/dom/permission/tests/test_networkstats-manage.html deleted file mode 100644 index 4fdc847717d1..000000000000 --- a/dom/permission/tests/test_networkstats-manage.html +++ /dev/null @@ -1,31 +0,0 @@ - - - - - -
- - -- - - diff --git a/dom/permission/tests/test_power.html b/dom/permission/tests/test_power.html deleted file mode 100644 index 51c2e8b538da..000000000000 --- a/dom/permission/tests/test_power.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - -
- - -- - - diff --git a/dom/permission/tests/test_presentation-device-manage.html b/dom/permission/tests/test_presentation-device-manage.html deleted file mode 100644 index 67904030a28b..000000000000 --- a/dom/permission/tests/test_presentation-device-manage.html +++ /dev/null @@ -1,38 +0,0 @@ - - - - - -
- - -- - - diff --git a/dom/permission/tests/test_systemXHR.html b/dom/permission/tests/test_systemXHR.html deleted file mode 100644 index dd16fddfaf91..000000000000 --- a/dom/permission/tests/test_systemXHR.html +++ /dev/null @@ -1,38 +0,0 @@ - - - - - -
- - -- - - diff --git a/dom/permission/tests/test_tcp-socket.html b/dom/permission/tests/test_tcp-socket.html deleted file mode 100644 index 5a80cff85933..000000000000 --- a/dom/permission/tests/test_tcp-socket.html +++ /dev/null @@ -1,52 +0,0 @@ - - - - - -
- - -- - - diff --git a/dom/permission/tests/test_time.html b/dom/permission/tests/test_time.html deleted file mode 100644 index d7fea7031e14..000000000000 --- a/dom/permission/tests/test_time.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - -
- - -- - - diff --git a/dom/permission/tests/test_udp-socket.html b/dom/permission/tests/test_udp-socket.html deleted file mode 100644 index 566e7a8763d3..000000000000 --- a/dom/permission/tests/test_udp-socket.html +++ /dev/null @@ -1,47 +0,0 @@ - - - - - -
- - -- - - diff --git a/dom/permission/tests/unit/test_bug808734.js b/dom/permission/tests/unit/test_bug808734.js deleted file mode 100644 index 8dfbd9458b2b..000000000000 --- a/dom/permission/tests/unit/test_bug808734.js +++ /dev/null @@ -1,73 +0,0 @@ -var Cu = Components.utils; -const READWRITE = "readwrite"; -const UNKNOWN = "foobar"; - -var gData = [ -// test normal expansion -{ - permission: "contacts", - access: READWRITE, - expected: ["contacts-read", "contacts-create", - "contacts-write"] -}, -// test additional expansion and access not having read+create+write -{ - permission: "settings", - access: READWRITE, - expected: ["settings-read", "settings-write", - "settings-api-read", "settings-api-write", - "indexedDB-chrome-settings-read", - "indexedDB-chrome-settings-write"] -}, -// test unknown access -{ - permission: "contacts", - access: UNKNOWN, - expected: [] -}, -// test unknown permission -{ - permission: UNKNOWN, - access: READWRITE, - expected: [] -} -]; - -// check if 2 arrays contain the same elements -function do_check_set_eq(a1, a2) { - do_check_eq(a1.length, a2.length) - - Array.sort(a1); - Array.sort(a2); - - for (let i = 0; i < a1.length; ++i) { - do_check_eq(a1[i], a2[i]) - } -} - -function test_substitute_does_not_break_substituted(scope) { - const Ci = Components.interfaces; - - // geolocation-noprompt substitutes for geolocation ... - do_check_eq(scope.PermissionsTable["geolocation-noprompt"].substitute[0], - "geolocation"); - // ... and sets silent allow ... - do_check_eq(scope.PermissionsTable["geolocation-noprompt"].certified, - Ci.nsIPermissionManager.ALLOW_ACTION) - // ... which works ... - do_check_false(scope.isExplicitInPermissionsTable("geolocation-noprompt", Ci.nsIPrincipal.APP_STATUS_CERTIFIED)); - // ... but does not interfere with geolocation's PROMPT value - do_check_true(scope.isExplicitInPermissionsTable("geolocation", Ci.nsIPrincipal.APP_STATUS_CERTIFIED)); -} - -function run_test() { - var scope = {}; - Cu.import("resource://gre/modules/PermissionsTable.jsm", scope); - - for (var i = 0; i < gData.length; i++) { - var perms = scope.expandPermissions(gData[i].permission, - gData[i].access); - do_check_set_eq(perms, gData[i].expected); - } - test_substitute_does_not_break_substituted(scope); -} diff --git a/dom/permission/tests/unit/xpcshell.ini b/dom/permission/tests/unit/xpcshell.ini deleted file mode 100644 index 1c296a77c0c7..000000000000 --- a/dom/permission/tests/unit/xpcshell.ini +++ /dev/null @@ -1,5 +0,0 @@ -[DEFAULT] -head = -tail = - -[test_bug808734.js] diff --git a/dom/settings/SettingsRequestManager.jsm b/dom/settings/SettingsRequestManager.jsm index bdfd9965907f..d7616319af2e 100644 --- a/dom/settings/SettingsRequestManager.jsm +++ b/dom/settings/SettingsRequestManager.jsm @@ -16,7 +16,6 @@ this.EXPORTED_SYMBOLS = ["SettingsRequestManager"]; Cu.import("resource://gre/modules/SettingsDB.jsm"); Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/Services.jsm"); -Cu.import("resource://gre/modules/PermissionsTable.jsm"); var DEBUG = false; var VERBOSE = false; diff --git a/dom/system/SystemUpdate.manifest b/dom/system/SystemUpdate.manifest deleted file mode 100644 index cd72a86aaa6c..000000000000 --- a/dom/system/SystemUpdate.manifest +++ /dev/null @@ -1,2 +0,0 @@ -component {e8530001-ba5b-46ab-a306-7fbeb692d0fe} SystemUpdateManager.js -contract @mozilla.org/system-update-manager;1 {e8530001-ba5b-46ab-a306-7fbeb692d0fe} diff --git a/dom/system/SystemUpdateManager.js b/dom/system/SystemUpdateManager.js deleted file mode 100644 index a944767ece8d..000000000000 --- a/dom/system/SystemUpdateManager.js +++ /dev/null @@ -1,253 +0,0 @@ -/* 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"); - -var 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]); diff --git a/dom/system/SystemUpdateService.jsm b/dom/system/SystemUpdateService.jsm deleted file mode 100644 index 908aad0c2a07..000000000000 --- a/dom/system/SystemUpdateService.jsm +++ /dev/null @@ -1,376 +0,0 @@ -/* 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; - -var 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 = Components.classesByID[aProvider.id].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) { - 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(); diff --git a/dom/system/moz.build b/dom/system/moz.build index 3cff531b5858..03d47b71f8bb 100644 --- a/dom/system/moz.build +++ b/dom/system/moz.build @@ -19,7 +19,6 @@ elif toolkit in ('gtk2', 'gtk3'): XPIDL_SOURCES += [ 'nsIOSFileConstantsService.idl', - 'nsISystemUpdateProvider.idl', ] XPIDL_MODULE = 'dom_system' @@ -40,12 +39,6 @@ UNIFIED_SOURCES += [ EXTRA_COMPONENTS += [ 'NetworkGeolocationProvider.js', 'NetworkGeolocationProvider.manifest', - 'SystemUpdate.manifest', - 'SystemUpdateManager.js', -] - -EXTRA_JS_MODULES += [ - 'SystemUpdateService.jsm', ] include('/ipc/chromium/chromium-config.mozbuild') diff --git a/dom/system/nsISystemUpdateProvider.idl b/dom/system/nsISystemUpdateProvider.idl deleted file mode 100644 index 38e61eb606ad..000000000000 --- a/dom/system/nsISystemUpdateProvider.idl +++ /dev/null @@ -1,73 +0,0 @@ -/* 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(); -}; diff --git a/dom/system/tests/mochitest.ini b/dom/system/tests/mochitest.ini index 72bdf5cf6ea1..a7c0ae8d02d5 100644 --- a/dom/system/tests/mochitest.ini +++ b/dom/system/tests/mochitest.ini @@ -1,8 +1,5 @@ [DEFAULT] support-files = - preload-SystemUpdateManager-jsm.js file_bug1197901.html [test_bug1197901.html] -[test_system_update_enabled.html] -skip-if = true # Tests only ran on B2G diff --git a/dom/system/tests/preload-SystemUpdateManager-jsm.js b/dom/system/tests/preload-SystemUpdateManager-jsm.js deleted file mode 100644 index 005b704615fb..000000000000 --- a/dom/system/tests/preload-SystemUpdateManager-jsm.js +++ /dev/null @@ -1,80 +0,0 @@ -/* 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; - }, -}; - -var 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); - -var 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'); \ No newline at end of file diff --git a/dom/system/tests/test_system_update_enabled.html b/dom/system/tests/test_system_update_enabled.html deleted file mode 100644 index 1d820d37dba6..000000000000 --- a/dom/system/tests/test_system_update_enabled.html +++ /dev/null @@ -1,175 +0,0 @@ - - - - - -