diff --git a/b2g/app/b2g.js b/b2g/app/b2g.js index bd8f30d3d7c..d74046a0429 100644 --- a/b2g/app/b2g.js +++ b/b2g/app/b2g.js @@ -1153,12 +1153,6 @@ pref("dom.performance.enable_notify_performance_timing", true); pref("b2g.multiscreen.chrome_remote_url", "chrome://b2g/content/shell_remote.html"); pref("b2g.multiscreen.system_remote_url", "index_remote.html"); -// Blocklist service -pref("extensions.blocklist.enabled", true); -pref("extensions.blocklist.interval", 86400); -pref("extensions.blocklist.url", "https://blocklist.addons.mozilla.org/blocklist/3/%APP_ID%/%APP_VERSION%/%PRODUCT%/%BUILD_ID%/%BUILD_TARGET%/%LOCALE%/%CHANNEL%/%OS_VERSION%/%DISTRIBUTION%/%DISTRIBUTION_VERSION%/%PING_COUNT%/%TOTAL_PING_COUNT%/%DAYS_SINCE_LAST_PING%/"); -pref("extensions.blocklist.detailsURL", "https://www.mozilla.com/%LOCALE%/blocklist/"); - // Because we can't have nice things. #ifdef MOZ_GRAPHENE #include ../graphene/graphene.js diff --git a/b2g/installer/package-manifest.in b/b2g/installer/package-manifest.in index 39801b6206f..9a1261f014f 100644 --- a/b2g/installer/package-manifest.in +++ b/b2g/installer/package-manifest.in @@ -537,16 +537,15 @@ #endif // MOZ_WIDGET_GONK && MOZ_B2G_RIL #ifndef MOZ_WIDGET_GONK +@RESPATH@/components/extensions.manifest @RESPATH@/components/addonManager.js @RESPATH@/components/amContentHandler.js @RESPATH@/components/amInstallTrigger.js @RESPATH@/components/amWebInstallListener.js - +@RESPATH@/components/nsBlocklistService.js @RESPATH@/components/OopCommandLine.js @RESPATH@/components/CommandLine.js #endif -@RESPATH@/components/extensions.manifest -@RESPATH@/components/nsBlocklistService.js @RESPATH@/components/BootstrapCommandLine.js #ifdef MOZ_UPDATER diff --git a/dom/apps/AppsUtils.jsm b/dom/apps/AppsUtils.jsm index a6b3049d993..7b42a95e238 100644 --- a/dom/apps/AppsUtils.jsm +++ b/dom/apps/AppsUtils.jsm @@ -131,10 +131,6 @@ function _setAppProperties(aObj, aApp) { aObj.enabled = aApp.enabled !== undefined ? aApp.enabled : true; aObj.sideloaded = aApp.sideloaded; aObj.extensionVersion = aApp.extensionVersion; - aObj.blockedStatus = - aApp.blockedStatus !== undefined ? aApp.blockedStatus - : Ci.nsIBlocklistService.STATE_NOT_BLOCKED; - aObj.blocklistId = aApp.blocklistId; #ifdef MOZ_B2GDROID aObj.android_packagename = aApp.android_packagename; aObj.android_classname = aApp.android_classname; diff --git a/dom/apps/ImportExport.jsm b/dom/apps/ImportExport.jsm index cf759de7309..7657db3ea65 100644 --- a/dom/apps/ImportExport.jsm +++ b/dom/apps/ImportExport.jsm @@ -251,9 +251,7 @@ this.ImportExport = { throw "NoManifestFound"; } - return [readObjectFromZip(appZipReader, "manifest.webapp"), - readObjectFromZip(appZipReader, "update.webapp"), - file]; + return [readObjectFromZip(appZipReader, "manifest.webapp"), file]; }, // Returns a promise that resolves to the temp file path. @@ -309,7 +307,6 @@ this.ImportExport = { let meta; let appDir; let manifest; - let updateManifest; let zipReader = Cc["@mozilla.org/libjar/zip-reader;1"] .createInstance(Ci.nsIZipReader); try { @@ -356,7 +353,7 @@ this.ImportExport = { let appFile; if (isPackage) { - [manifest, updateManifest, appFile] = + [manifest, appFile] = this._importPackagedApp(zipReader, meta.manifestURL, appDir); } else { manifest = this._importHostedApp(zipReader, meta.manifestURL); @@ -398,11 +395,6 @@ this.ImportExport = { meta.installerIsBrowser = false; meta.role = manifest.role; - // If there is an id in the mini-manifest, use it for blocklisting purposes. - if (isPackage && updateManifest && ("id" in updateManifest)) { - meta.blocklistId = updateManifest["id"]; - } - let devMode = false; try { devMode = Services.prefs.getBoolPref("dom.apps.developer_mode"); diff --git a/dom/apps/Webapps.jsm b/dom/apps/Webapps.jsm index c659248b5a2..0df8e17fcc7 100644 --- a/dom/apps/Webapps.jsm +++ b/dom/apps/Webapps.jsm @@ -348,10 +348,6 @@ this.DOMApplicationRegistry = { app.enabled = true; } - if (app.blockedStatus === undefined) { - app.blockedStatus = Ci.nsIBlocklistService.STATE_NOT_BLOCKED; - } - // At startup we can't be downloading, and the $TMP directory // will be empty so we can't just apply a staged update. app.downloading = false; @@ -1215,7 +1211,6 @@ this.DOMApplicationRegistry = { ppmm.removeMessageListener(msgName, this); }).bind(this)); Services.obs.removeObserver(this, "xpcom-shutdown"); - Services.obs.removeObserver(this, "memory-pressure"); cpmm = null; ppmm = null; if (AppConstants.MOZ_B2GDROID) { @@ -1227,55 +1222,6 @@ this.DOMApplicationRegistry = { } }, - // Check extensions to be blocked. - blockExtensions: function(aExtensions) { - debug("blockExtensions"); - let app; - let runtime = Services.appinfo.QueryInterface(Ci.nsIXULRuntime); - - aExtensions.filter(extension => { - // Filter out id-less items and those who don't have a matching installed - // extension. - if (!extension.attributes.has("id")) { - return false; - } - // Check that we have an app with this extension id. - let extId = extension.attributes.get("id"); - for (let id in this.webapps) { - if (this.webapps[id].blocklistId == extId) { - app = this.webapps[id]; - return true; - } - } - // No webapp found for this extension id. - return false; - }).forEach(extension => { - // `extension` is a object such as: - // {"versions":[{"minVersion":"0.1", - // "maxVersion":"1.3.328.4", - // "severity":"1", - // "vulnerabilityStatus":0, - // "targetApps":{ - // "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}":[{"minVersion":"3.7a1pre","maxVersion":"*"}] - // } - // }], - // "prefs":[], - // "blockID":"i24", - // "attributes": Map() - // } - // - // `versions` is array of BlocklistItemData (see nsBlocklistService.js) - let severity = Ci.nsIBlocklistService.STATE_NOT_BLOCKED; - for (let item of extension.versions) { - if (item.includesItem(app.extensionVersion, runtime.version, runtime.platformVersion)) { - severity = item.severity; - break; - } - } - this.setBlockedStatus(app.manifestURL, severity); - }); - }, - formatMessage: function(aData) { let msg = aData; delete msg["mm"]; @@ -1973,9 +1919,6 @@ this.DOMApplicationRegistry = { delete app.retryingDownload; - // Once updated we are not in the blocklist anymore. - app.blockedStatus = Ci.nsIBlocklistService.STATE_NOT_BLOCKED; - // Update the asm.js scripts we need to compile. yield ScriptPreloader.preload(app, newManifest); @@ -3018,10 +2961,6 @@ this.DOMApplicationRegistry = { this._writeManifestFile(app.id, false, aManifest); if (aUpdateManifest) { this._writeManifestFile(app.id, true, aUpdateManifest); - // If there is an id in the mini-manifest, use it for blocklisting purposes. - if (aData.isPackage && ("id" in aUpdateManifest)) { - this.webapps[app.id].blocklistId = aUpdateManifest["id"]; - } } this._saveApps().then(() => { @@ -3056,10 +2995,6 @@ this.DOMApplicationRegistry = { let jsonManifest = aData.isPackage ? app.updateManifest : app.manifest; yield this._writeManifestFile(id, aData.isPackage, jsonManifest); - // If there is an id in the mini-manifest, use it for blocklisting purposes. - if (aData.isPackage && ("id" in jsonManifest)) { - app.blocklistId = jsonManifest["id"]; - } debug("app.origin: " + app.origin); let manifest = @@ -4646,20 +4581,6 @@ this.DOMApplicationRegistry = { }); }, - setBlockedStatus: function(aManifestURL, aSeverity) { - let id = this._appIdForManifestURL(aManifestURL); - if (!id || !this.webapps[id]) { - return; - } - - debug(`Setting blocked status ${aSeverity} on ${id}`); - let app = this.webapps[id]; - - app.blockedStatus = aSeverity; - let enabled = aSeverity == Ci.nsIBlocklistService.STATE_NOT_BLOCKED; - this.setEnabled({ manifestURL: aManifestURL, enabled }); - }, - setEnabled: function(aData) { debug("setEnabled " + aData.manifestURL + " : " + aData.enabled); let id = this._appIdForManifestURL(aData.manifestURL); @@ -4669,13 +4590,7 @@ this.DOMApplicationRegistry = { debug("Enabling " + id); let app = this.webapps[id]; - - // If we try to enable an app, check if it's not blocked. - if (!aData.enabled || - app.blockedStatus == Ci.nsIBlocklistService.STATE_NOT_BLOCKED) { - app.enabled = aData.enabled; - } - + app.enabled = aData.enabled; this._saveApps().then(() => { MessageBroadcaster.broadcastMessage("Webapps:UpdateState", { app: app, diff --git a/dom/apps/tests/addons/update.webapp b/dom/apps/tests/addons/update.webapp index b92deccb2f5..5a58a33ff23 100644 --- a/dom/apps/tests/addons/update.webapp +++ b/dom/apps/tests/addons/update.webapp @@ -2,6 +2,5 @@ "name": "Addon app", "description": "Let me inject script and css!", "developer": { "name": "The Mozilla Community" }, - "package_path" : "application.zip", - "id": "webextension@mochitest" + "package_path" : "application.zip" } diff --git a/dom/apps/tests/mochitest.ini b/dom/apps/tests/mochitest.ini index c24a9f9b7b6..e45722b677f 100644 --- a/dom/apps/tests/mochitest.ini +++ b/dom/apps/tests/mochitest.ini @@ -39,8 +39,6 @@ support-files = [test_app_addons.html] skip-if = os == "android" || toolkit == "gonk" # embed-apps doesn't work in mochitest app -[test_app_blocklist.html] -skip-if = buildapp != 'b2g' [test_app_enabled.html] [test_app_update.html] skip-if = os == "android" || toolkit == "gonk" # embed-apps doesn't work in mochitest app diff --git a/dom/apps/tests/test_app_blocklist.html b/dom/apps/tests/test_app_blocklist.html deleted file mode 100644 index 57fc653377a..00000000000 --- a/dom/apps/tests/test_app_blocklist.html +++ /dev/null @@ -1,193 +0,0 @@ - - - -
-- -- - diff --git a/toolkit/mozapps/extensions/extensions.manifest b/toolkit/mozapps/extensions/extensions.manifest index ab98caaad48..edf05f20ee9 100644 --- a/toolkit/mozapps/extensions/extensions.manifest +++ b/toolkit/mozapps/extensions/extensions.manifest @@ -4,8 +4,8 @@ category profile-after-change nsBlocklistService @mozilla.org/extensions/blockli component {e0a106ed-6ad4-47a4-b6af-2f1c8aa4712d} nsBlocklistServiceContent.js process=content contract @mozilla.org/extensions/blocklist;1 {e0a106ed-6ad4-47a4-b6af-2f1c8aa4712d} process=content -category update-timer nsBlocklistService @mozilla.org/extensions/blocklist;1,getService,blocklist-background-update-timer,extensions.blocklist.interval,86400 #ifndef MOZ_WIDGET_GONK +category update-timer nsBlocklistService @mozilla.org/extensions/blocklist;1,getService,blocklist-background-update-timer,extensions.blocklist.interval,86400 component {4399533d-08d1-458c-a87a-235f74451cfa} addonManager.js contract @mozilla.org/addons/integration;1 {4399533d-08d1-458c-a87a-235f74451cfa} category update-timer addonManager @mozilla.org/addons/integration;1,getService,addon-background-update-timer,extensions.update.interval,86400 diff --git a/toolkit/mozapps/extensions/moz.build b/toolkit/mozapps/extensions/moz.build index ce047efe301..11015b17a72 100644 --- a/toolkit/mozapps/extensions/moz.build +++ b/toolkit/mozapps/extensions/moz.build @@ -21,12 +21,12 @@ EXTRA_COMPONENTS += [ 'amContentHandler.js', 'amInstallTrigger.js', 'amWebInstallListener.js', - 'nsBlocklistService.js', 'nsBlocklistServiceContent.js', ] EXTRA_PP_COMPONENTS += [ 'extensions.manifest', + 'nsBlocklistService.js', ] EXTRA_JS_MODULES += [ diff --git a/toolkit/mozapps/extensions/nsBlocklistService.js b/toolkit/mozapps/extensions/nsBlocklistService.js index b0eee110982..f45b7c2906a 100644 --- a/toolkit/mozapps/extensions/nsBlocklistService.js +++ b/toolkit/mozapps/extensions/nsBlocklistService.js @@ -12,7 +12,6 @@ const Cr = Components.results; Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); Components.utils.import("resource://gre/modules/Services.jsm"); -Components.utils.import("resource://gre/modules/AppConstants.jsm"); try { // AddonManager.jsm doesn't allow itself to be imported in the child @@ -30,8 +29,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "OS", "resource://gre/modules/osfile.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "Task", "resource://gre/modules/Task.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "DOMApplicationRegistry", - "resource://gre/modules/Webapps.jsm"); const TOOLKIT_ID = "toolkit@mozilla.org"; const KEY_PROFILEDIR = "ProfD"; @@ -110,16 +107,15 @@ XPCOMUtils.defineLazyGetter(this, "gABI", function bls_gABI() { catch (e) { LOG("BlockList Global gABI: XPCOM ABI unknown."); } +#ifdef XP_MACOSX + // Mac universal build should report a different ABI than either macppc + // or mactel. + let macutils = Cc["@mozilla.org/xpcom/mac-utils;1"]. + getService(Ci.nsIMacUtils); - if (AppConstants.platform == "macosx") { - // Mac universal build should report a different ABI than either macppc - // or mactel. - let macutils = Cc["@mozilla.org/xpcom/mac-utils;1"]. - getService(Ci.nsIMacUtils); - - if (macutils.isUniversalBinary) - abi += "-u-" + macutils.architecturesInBinary; - } + if (macutils.isUniversalBinary) + abi += "-u-" + macutils.architecturesInBinary; +#endif return abi; }); @@ -896,21 +892,10 @@ Blocklist.prototype = { continue; switch (element.localName) { case "emItems": - // Special case for b2g, since we don't use the addon manager. - if (AppConstants.MOZ_B2G) { - let extensions = this._processItemNodes(element.childNodes, "em", - this._handleEmItemNode); - DOMApplicationRegistry.blockExtensions(extensions); - return; - } this._addonEntries = this._processItemNodes(element.childNodes, "em", this._handleEmItemNode); break; case "pluginItems": - // We don't support plugins on b2g. - if (AppConstants.MOZ_B2G) { - return; - } this._pluginEntries = this._processItemNodes(element.childNodes, "plugin", this._handlePluginItemNode); break; @@ -1075,15 +1060,14 @@ Blocklist.prototype = { /* See nsIBlocklistService */ getPluginBlocklistState: function Blocklist_getPluginBlocklistState(plugin, appVersion, toolkitVersion) { - if (AppConstants.platform == "android" || - AppConstants.MOZ_B2G) { - return Ci.nsIBlocklistService.STATE_NOT_BLOCKED; - } else { - if (!this._isBlocklistLoaded()) - this._loadBlocklist(); - return this._getPluginBlocklistState(plugin, this._pluginEntries, - appVersion, toolkitVersion); - } +#ifdef ANDROID + return Ci.nsIBlocklistService.STATE_NOT_BLOCKED; +#else + if (!this._isBlocklistLoaded()) + this._loadBlocklist(); + return this._getPluginBlocklistState(plugin, this._pluginEntries, + appVersion, toolkitVersion); +#endif // ifdef ANDROID }, /** @@ -1223,10 +1207,6 @@ Blocklist.prototype = { }, _blocklistUpdated: function Blocklist_blocklistUpdated(oldAddonEntries, oldPluginEntries) { - if (AppConstants.MOZ_B2G) { - return; - } - var addonList = []; // A helper function that reverts the prefs passed to default values.