From 64204fdb8302c8bf483d724430dd83f43c1cb6ff Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Sat, 14 Apr 2018 11:29:12 -0400 Subject: Bump Phoenix extensions to allow installing up to Firefox 56.9 --- toolkit/mozapps/extensions/internal/XPIProvider.jsm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'toolkit/mozapps/extensions') diff --git a/toolkit/mozapps/extensions/internal/XPIProvider.jsm b/toolkit/mozapps/extensions/internal/XPIProvider.jsm index d5f1ab5dd..27ecee7d8 100644 --- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm +++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm @@ -129,7 +129,7 @@ const PREFIX_NS_EM = "http://www.mozilla.org/2004/em-rdf#"; const TOOLKIT_ID = "toolkit@mozilla.org"; #ifdef MOZ_PHOENIX_EXTENSIONS const FIREFOX_ID = "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}" -const FIREFOX_APPCOMPATVERSION = "27.9" +const FIREFOX_APPCOMPATVERSION = "56.9" #endif // The value for this is in Makefile.in -- cgit v1.2.3 From d31fa89c8aa7f676844e91dbd0bbd162ce12904a Mon Sep 17 00:00:00 2001 From: adeshkp Date: Sun, 15 Apr 2018 19:28:43 +0000 Subject: [Tycho AM] Remove test for experiments framework --- toolkit/mozapps/extensions/test/browser/browser-common.ini | 2 -- 1 file changed, 2 deletions(-) (limited to 'toolkit/mozapps/extensions') diff --git a/toolkit/mozapps/extensions/test/browser/browser-common.ini b/toolkit/mozapps/extensions/test/browser/browser-common.ini index eaab29f75..3e88833ef 100644 --- a/toolkit/mozapps/extensions/test/browser/browser-common.ini +++ b/toolkit/mozapps/extensions/test/browser/browser-common.ini @@ -39,8 +39,6 @@ skip-if = true # Bug 1093190 - Disabled due to leak [browser_discovery.js] skip-if = e10s # Bug ?????? - test times out on try on all platforms, but works locally for markh! [browser_dragdrop.js] -skip-if = buildapp == 'mulet' -[browser_experiments.js] skip-if = e10s [browser_list.js] [browser_metadataTimeout.js] -- cgit v1.2.3 From 931950a880b3550490422b1855c509be10586858 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Mon, 16 Apr 2018 14:47:03 +0200 Subject: Mass-replace global-scope let with var in Pale Moon and TychoAM tag #155 --- toolkit/mozapps/extensions/AddonManager.jsm | 6 +++--- toolkit/mozapps/extensions/DeferredSave.jsm | 6 +++--- toolkit/mozapps/extensions/addonManager.js | 4 ++-- toolkit/mozapps/extensions/amInstallTrigger.js | 2 +- toolkit/mozapps/extensions/amWebInstallListener.js | 2 +- toolkit/mozapps/extensions/content/extensions.js | 2 +- toolkit/mozapps/extensions/content/update.js | 4 ++-- toolkit/mozapps/extensions/internal/AddonRepository.jsm | 4 ++-- .../extensions/internal/AddonRepository_SQLiteMigrator.jsm | 2 +- toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm | 2 +- toolkit/mozapps/extensions/internal/Content.js | 4 ++-- toolkit/mozapps/extensions/internal/GMPProvider.jsm | 8 ++++---- .../extensions/internal/LightweightThemeImageOptimizer.jsm | 8 ++++---- toolkit/mozapps/extensions/internal/PluginProvider.jsm | 2 +- toolkit/mozapps/extensions/internal/XPIProvider.jsm | 4 ++-- toolkit/mozapps/extensions/internal/XPIProviderUtils.js | 2 +- 16 files changed, 31 insertions(+), 31 deletions(-) (limited to 'toolkit/mozapps/extensions') diff --git a/toolkit/mozapps/extensions/AddonManager.jsm b/toolkit/mozapps/extensions/AddonManager.jsm index 681c4240a..3913c2088 100644 --- a/toolkit/mozapps/extensions/AddonManager.jsm +++ b/toolkit/mozapps/extensions/AddonManager.jsm @@ -88,9 +88,9 @@ Cu.import("resource://gre/modules/Log.jsm"); // Configure a logger at the parent 'addons' level to format // messages for all the modules under addons.* const PARENT_LOGGER_ID = "addons"; -let parentLogger = Log.repository.getLogger(PARENT_LOGGER_ID); +var parentLogger = Log.repository.getLogger(PARENT_LOGGER_ID); parentLogger.level = Log.Level.Warn; -let formatter = new Log.BasicFormatter(); +var formatter = new Log.BasicFormatter(); // Set parent logger (and its children) to append to // the Javascript section of the Browser Console parentLogger.addAppender(new Log.ConsoleAppender(formatter)); @@ -101,7 +101,7 @@ parentLogger.addAppender(new Log.DumpAppender(formatter)); // Create a new logger (child of 'addons' logger) // for use by the Addons Manager const LOGGER_ID = "addons.manager"; -let logger = Log.repository.getLogger(LOGGER_ID); +var logger = Log.repository.getLogger(LOGGER_ID); // Provide the ability to enable/disable logging // messages at runtime. diff --git a/toolkit/mozapps/extensions/DeferredSave.jsm b/toolkit/mozapps/extensions/DeferredSave.jsm index d7f5b8864..7587ce83b 100644 --- a/toolkit/mozapps/extensions/DeferredSave.jsm +++ b/toolkit/mozapps/extensions/DeferredSave.jsm @@ -12,7 +12,7 @@ Cu.import("resource://gre/modules/osfile.jsm"); Cu.import("resource://gre/modules/Promise.jsm"); // Make it possible to mock out timers for testing -let MakeTimer = () => Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer); +var MakeTimer = () => Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer); this.EXPORTED_SYMBOLS = ["DeferredSave"]; @@ -23,9 +23,9 @@ Cu.import("resource://gre/modules/Log.jsm"); //Configure a logger at the parent 'DeferredSave' level to format //messages for all the modules under DeferredSave.* const DEFERREDSAVE_PARENT_LOGGER_ID = "DeferredSave"; -let parentLogger = Log.repository.getLogger(DEFERREDSAVE_PARENT_LOGGER_ID); +var parentLogger = Log.repository.getLogger(DEFERREDSAVE_PARENT_LOGGER_ID); parentLogger.level = Log.Level.Warn; -let formatter = new Log.BasicFormatter(); +var formatter = new Log.BasicFormatter(); //Set parent logger (and its children) to append to //the Javascript section of the Browser Console parentLogger.addAppender(new Log.ConsoleAppender(formatter)); diff --git a/toolkit/mozapps/extensions/addonManager.js b/toolkit/mozapps/extensions/addonManager.js index 862b1ea69..731e70c6c 100644 --- a/toolkit/mozapps/extensions/addonManager.js +++ b/toolkit/mozapps/extensions/addonManager.js @@ -31,9 +31,9 @@ const CHILD_SCRIPT = "resource://gre/modules/addons/Content.js"; Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/Services.jsm"); -let gSingleton = null; +var gSingleton = null; -let gParentMM = null; +var gParentMM = null; function amManager() { diff --git a/toolkit/mozapps/extensions/amInstallTrigger.js b/toolkit/mozapps/extensions/amInstallTrigger.js index b83cbe60b..a18fe84c4 100644 --- a/toolkit/mozapps/extensions/amInstallTrigger.js +++ b/toolkit/mozapps/extensions/amInstallTrigger.js @@ -18,7 +18,7 @@ const MSG_INSTALL_ADDONS = "WebInstallerInstallAddonsFromWebpage"; const MSG_INSTALL_CALLBACK = "WebInstallerInstallCallback"; -let log = Log.repository.getLogger("AddonManager.InstallTrigger"); +var log = Log.repository.getLogger("AddonManager.InstallTrigger"); log.level = Log.Level[Preferences.get("extensions.logging.enabled", false) ? "Warn" : "Trace"]; function CallbackObject(id, callback, urls, mediator) { diff --git a/toolkit/mozapps/extensions/amWebInstallListener.js b/toolkit/mozapps/extensions/amWebInstallListener.js index 901beef07..ac6e2495d 100644 --- a/toolkit/mozapps/extensions/amWebInstallListener.js +++ b/toolkit/mozapps/extensions/amWebInstallListener.js @@ -37,7 +37,7 @@ const LOGGER_ID = "addons.weblistener"; // Create a new logger for use by the Addons Web Listener // (Requires AddonManager.jsm) -let logger = Log.repository.getLogger(LOGGER_ID); +var logger = Log.repository.getLogger(LOGGER_ID); function notifyObservers(aTopic, aBrowser, aUri, aInstalls) { let info = { diff --git a/toolkit/mozapps/extensions/content/extensions.js b/toolkit/mozapps/extensions/content/extensions.js index 6f2a47482..8d9c132e6 100644 --- a/toolkit/mozapps/extensions/content/extensions.js +++ b/toolkit/mozapps/extensions/content/extensions.js @@ -2456,7 +2456,7 @@ var gSearchView = { this._allResultsLink.setAttribute("href", AddonRepository.getSearchURL(this._lastQuery)); this._allResultsLink.hidden = false; - }, + }, updateListAttributes: function gSearchView_updateListAttributes() { var item = this._listBox.querySelector("richlistitem[remote='true'][first]"); diff --git a/toolkit/mozapps/extensions/content/update.js b/toolkit/mozapps/extensions/content/update.js index 3d87f4d4b..afc74dca8 100644 --- a/toolkit/mozapps/extensions/content/update.js +++ b/toolkit/mozapps/extensions/content/update.js @@ -22,7 +22,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "AddonRepository", "resource://gre/modul XPCOMUtils.defineLazyModuleGetter(this, "Task", "resource://gre/modules/Task.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "Promise", "resource://gre/modules/Promise.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "Log", "resource://gre/modules/Log.jsm"); -let logger = null; +var logger = null; var gUpdateWizard = { // When synchronizing app compatibility info this contains all installed @@ -169,7 +169,7 @@ var gOfflinePage = { } // Addon listener to count addons enabled/disabled by metadata checks -let listener = { +var listener = { onDisabled: function listener_onDisabled(aAddon) { gUpdateWizard.affectedAddonIDs.add(aAddon.id); gUpdateWizard.metadataDisabled++; diff --git a/toolkit/mozapps/extensions/internal/AddonRepository.jsm b/toolkit/mozapps/extensions/internal/AddonRepository.jsm index adcecbee7..76a7528c7 100644 --- a/toolkit/mozapps/extensions/internal/AddonRepository.jsm +++ b/toolkit/mozapps/extensions/internal/AddonRepository.jsm @@ -72,7 +72,7 @@ const LOGGER_ID = "addons.repository"; // Create a new logger for use by the Addons Repository // (Requires AddonManager.jsm) -let logger = Log.repository.getLogger(LOGGER_ID); +var logger = Log.repository.getLogger(LOGGER_ID); // A map between XML keys to AddonSearchResult keys for string values // that require no extra parsing from XML @@ -101,7 +101,7 @@ const INTEGER_KEY_MAP = { }; // Wrap the XHR factory so that tests can override with a mock -let XHRequest = Components.Constructor("@mozilla.org/xmlextras/xmlhttprequest;1", +var XHRequest = Components.Constructor("@mozilla.org/xmlextras/xmlhttprequest;1", "nsIXMLHttpRequest"); function convertHTMLToPlainText(html) { diff --git a/toolkit/mozapps/extensions/internal/AddonRepository_SQLiteMigrator.jsm b/toolkit/mozapps/extensions/internal/AddonRepository_SQLiteMigrator.jsm index 128146bbe..11944ddf5 100644 --- a/toolkit/mozapps/extensions/internal/AddonRepository_SQLiteMigrator.jsm +++ b/toolkit/mozapps/extensions/internal/AddonRepository_SQLiteMigrator.jsm @@ -30,7 +30,7 @@ const LOGGER_ID = "addons.repository.sqlmigrator"; // Create a new logger for use by the Addons Repository SQL Migrator // (Requires AddonManager.jsm) -let logger = Log.repository.getLogger(LOGGER_ID); +var logger = Log.repository.getLogger(LOGGER_ID); this.EXPORTED_SYMBOLS = ["AddonRepository_SQLiteMigrator"]; diff --git a/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm b/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm index d68a0f175..939e2e269 100644 --- a/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm +++ b/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm @@ -52,7 +52,7 @@ const LOGGER_ID = "addons.update-checker"; // Create a new logger for use by the Addons Update Checker // (Requires AddonManager.jsm) -let logger = Log.repository.getLogger(LOGGER_ID); +var logger = Log.repository.getLogger(LOGGER_ID); /** * A serialisation method for RDF data that produces an identical string diff --git a/toolkit/mozapps/extensions/internal/Content.js b/toolkit/mozapps/extensions/internal/Content.js index 29c0ed8ce..61a8b0323 100644 --- a/toolkit/mozapps/extensions/internal/Content.js +++ b/toolkit/mozapps/extensions/internal/Content.js @@ -8,9 +8,9 @@ const {classes: Cc, interfaces: Ci, utils: Cu} = Components; -let {Services} = Cu.import("resource://gre/modules/Services.jsm", {}); +var {Services} = Cu.import("resource://gre/modules/Services.jsm", {}); -let nsIFile = Components.Constructor("@mozilla.org/file/local;1", "nsIFile", +var nsIFile = Components.Constructor("@mozilla.org/file/local;1", "nsIFile", "initWithPath"); const MSG_JAR_FLUSH = "AddonJarFlush"; diff --git a/toolkit/mozapps/extensions/internal/GMPProvider.jsm b/toolkit/mozapps/extensions/internal/GMPProvider.jsm index a55457f6e..52affa9ba 100644 --- a/toolkit/mozapps/extensions/internal/GMPProvider.jsm +++ b/toolkit/mozapps/extensions/internal/GMPProvider.jsm @@ -64,11 +64,11 @@ XPCOMUtils.defineLazyGetter(this, "pluginsBundle", XPCOMUtils.defineLazyGetter(this, "gmpService", () => Cc["@mozilla.org/gecko-media-plugin-service;1"].getService(Ci.mozIGeckoMediaPluginChromeService)); -let messageManager = Cc["@mozilla.org/globalmessagemanager;1"] +var messageManager = Cc["@mozilla.org/globalmessagemanager;1"] .getService(Ci.nsIMessageListenerManager); -let gLogger; -let gLogAppenderDump = null; +var gLogger; +var gLogAppenderDump = null; function configureLogging() { if (!gLogger) { @@ -443,7 +443,7 @@ GMPWrapper.prototype = { }, }; -let GMPProvider = { +var GMPProvider = { get name() { return "GMPProvider"; }, _plugins: null, diff --git a/toolkit/mozapps/extensions/internal/LightweightThemeImageOptimizer.jsm b/toolkit/mozapps/extensions/internal/LightweightThemeImageOptimizer.jsm index fccde9a81..1e7d6b0d8 100644 --- a/toolkit/mozapps/extensions/internal/LightweightThemeImageOptimizer.jsm +++ b/toolkit/mozapps/extensions/internal/LightweightThemeImageOptimizer.jsm @@ -49,7 +49,7 @@ this.LightweightThemeImageOptimizer = { Object.freeze(LightweightThemeImageOptimizer); -let ImageCropper = { +var ImageCropper = { _inProgress: {}, getCroppedImageURL: @@ -119,7 +119,7 @@ let ImageCropper = { } }; -let ImageFile = { +var ImageFile = { read: function ImageFile_read(aURI, aCallback) { this._netUtil.asyncFetch2( aURI, @@ -158,7 +158,7 @@ let ImageFile = { XPCOMUtils.defineLazyModuleGetter(ImageFile, "_netUtil", "resource://gre/modules/NetUtil.jsm", "NetUtil"); -let ImageTools = { +var ImageTools = { decode: function ImageTools_decode(aInputStream, aContentType) { let outParam = {value: null}; @@ -187,7 +187,7 @@ let ImageTools = { XPCOMUtils.defineLazyServiceGetter(ImageTools, "_imgTools", "@mozilla.org/image/tools;1", "imgITools"); -let Utils = { +var Utils = { createCopy: function Utils_createCopy(aData) { let copy = {}; for (let [k, v] in Iterator(aData)) { diff --git a/toolkit/mozapps/extensions/internal/PluginProvider.jsm b/toolkit/mozapps/extensions/internal/PluginProvider.jsm index 04a4f9d7c..cb07dcb12 100644 --- a/toolkit/mozapps/extensions/internal/PluginProvider.jsm +++ b/toolkit/mozapps/extensions/internal/PluginProvider.jsm @@ -23,7 +23,7 @@ const LOGGER_ID = "addons.plugins"; // Create a new logger for use by the Addons Plugin Provider // (Requires AddonManager.jsm) -let logger = Log.repository.getLogger(LOGGER_ID); +var logger = Log.repository.getLogger(LOGGER_ID); function getIDHashForString(aStr) { // return the two-digit hexadecimal code for a byte diff --git a/toolkit/mozapps/extensions/internal/XPIProvider.jsm b/toolkit/mozapps/extensions/internal/XPIProvider.jsm index 27ecee7d8..2c5e3dfa7 100644 --- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm +++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm @@ -222,7 +222,7 @@ const LOGGER_ID = "addons.xpi"; // Create a new logger for use by all objects in this Addons XPI Provider module // (Requires AddonManager.jsm) -let logger = Log.repository.getLogger(LOGGER_ID); +var logger = Log.repository.getLogger(LOGGER_ID); const LAZY_OBJECTS = ["XPIDatabase"]; @@ -7822,7 +7822,7 @@ WinRegInstallLocation.prototype = { }; #endif -let addonTypes = [ +var addonTypes = [ new AddonManagerPrivate.AddonType("extension", URI_EXTENSION_STRINGS, STRING_TYPE_NAME, AddonManager.VIEW_TYPE_LIST, 4000, diff --git a/toolkit/mozapps/extensions/internal/XPIProviderUtils.js b/toolkit/mozapps/extensions/internal/XPIProviderUtils.js index 2cef907f1..d26029455 100644 --- a/toolkit/mozapps/extensions/internal/XPIProviderUtils.js +++ b/toolkit/mozapps/extensions/internal/XPIProviderUtils.js @@ -29,7 +29,7 @@ const LOGGER_ID = "addons.xpi-utils"; // Create a new logger for use by the Addons XPI Provider Utils // (Requires AddonManager.jsm) -let logger = Log.repository.getLogger(LOGGER_ID); +var logger = Log.repository.getLogger(LOGGER_ID); const KEY_PROFILEDIR = "ProfD"; const FILE_DATABASE = "extensions.sqlite"; -- cgit v1.2.3 From b702c9adcae7234c3806a9c1fd3414ff8ecef066 Mon Sep 17 00:00:00 2001 From: JustOff Date: Tue, 17 Apr 2018 23:16:20 +0300 Subject: Use asyncOpen2 instead of asyncOpen everywhere in Pale Moon --- .../mozapps/extensions/internal/XPIProvider.jsm | 24 ++++++++-------------- 1 file changed, 9 insertions(+), 15 deletions(-) (limited to 'toolkit/mozapps/extensions') diff --git a/toolkit/mozapps/extensions/internal/XPIProvider.jsm b/toolkit/mozapps/extensions/internal/XPIProvider.jsm index 2c5e3dfa7..72a460e4a 100644 --- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm +++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm @@ -1931,12 +1931,10 @@ this.XPIProvider = { let chan; try { - chan = Services.io.newChannelFromURI2(aURI, - null, // aLoadingNode - Services.scriptSecurityManager.getSystemPrincipal(), - null, // aTriggeringPrincipal - Ci.nsILoadInfo.SEC_NORMAL, - Ci.nsIContentPolicy.TYPE_OTHER); + chan = NetUtil.newChannel({ + uri: aURI, + loadUsingSystemPrincipal: true + }); } catch (ex) { return null; @@ -5456,21 +5454,17 @@ AddonInstall.prototype = { let requireBuiltIn = Preferences.get(PREF_INSTALL_REQUIREBUILTINCERTS, true); this.badCertHandler = new BadCertHandler(!requireBuiltIn); - this.channel = NetUtil.newChannel2(this.sourceURI, - null, - null, - null, // aLoadingNode - Services.scriptSecurityManager.getSystemPrincipal(), - null, // aTriggeringPrincipal - Ci.nsILoadInfo.SEC_NORMAL, - Ci.nsIContentPolicy.TYPE_OTHER); + this.channel = NetUtil.newChannel({ + uri: this.sourceURI, + loadUsingSystemPrincipal: true + }); this.channel.notificationCallbacks = this; if (this.channel instanceof Ci.nsIHttpChannel) { this.channel.setRequestHeader("Moz-XPI-Update", "1", true); if (this.channel instanceof Ci.nsIHttpChannelInternal) this.channel.forceAllowThirdPartyCookie = true; } - this.channel.asyncOpen(listener, null); + this.channel.asyncOpen2(listener); Services.obs.addObserver(this, "network:offline-about-to-go-offline", false); } -- cgit v1.2.3 From c30ebdac27c93b57e368c69e9c13055a17229992 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Sun, 22 Apr 2018 11:16:08 -0400 Subject: Fix for loops in AddonRepository_SQLiteMigrator.jsm (SyntaxError: missing ] after element list) --- .../mozapps/extensions/internal/AddonRepository_SQLiteMigrator.jsm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'toolkit/mozapps/extensions') diff --git a/toolkit/mozapps/extensions/internal/AddonRepository_SQLiteMigrator.jsm b/toolkit/mozapps/extensions/internal/AddonRepository_SQLiteMigrator.jsm index 11944ddf5..66147b9aa 100644 --- a/toolkit/mozapps/extensions/internal/AddonRepository_SQLiteMigrator.jsm +++ b/toolkit/mozapps/extensions/internal/AddonRepository_SQLiteMigrator.jsm @@ -60,7 +60,11 @@ this.AddonRepository_SQLiteMigrator = { this._retrieveStoredData((results) => { this._closeConnection(); - let resultArray = [addon for ([,addon] of Iterator(results))]; + // Tycho: let resultArray = [addon for ([,addon] of Iterator(results))]; + let resultArray = []; + for (let [,addon] of Iterator(results)) { + resultArray.push(addon); + } logger.debug(resultArray.length + " addons imported.") aCallback(resultArray); }); -- cgit v1.2.3 From be2b3635ad7f21582a5cfd5a25fc4ec41653c1c7 Mon Sep 17 00:00:00 2001 From: JustOff Date: Mon, 23 Apr 2018 14:52:50 +0300 Subject: Fix accessing the bootstrap methods when they are declared in the new lexical scope --- .../mozapps/extensions/internal/XPIProvider.jsm | 17 ++++++++++++--- .../test/addons/test_bootstrap_const/bootstrap.js | 5 +++++ .../test/addons/test_bootstrap_const/install.rdf | 24 ++++++++++++++++++++++ .../test/xpcshell/test_bootstrap_const.js | 17 +++++++++++++++ .../extensions/test/xpcshell/xpcshell-shared.ini | 1 + 5 files changed, 61 insertions(+), 3 deletions(-) create mode 100644 toolkit/mozapps/extensions/test/addons/test_bootstrap_const/bootstrap.js create mode 100644 toolkit/mozapps/extensions/test/addons/test_bootstrap_const/install.rdf create mode 100644 toolkit/mozapps/extensions/test/xpcshell/test_bootstrap_const.js (limited to 'toolkit/mozapps/extensions') diff --git a/toolkit/mozapps/extensions/internal/XPIProvider.jsm b/toolkit/mozapps/extensions/internal/XPIProvider.jsm index 72a460e4a..c43811ba8 100644 --- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm +++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm @@ -4436,7 +4436,18 @@ this.XPIProvider = { if (aAddon.type == "locale") return; - if (!(aMethod in this.bootstrapScopes[aAddon.id])) { + let method = undefined; + try { + method = Components.utils.evalInSandbox(`${aMethod};`, + this.bootstrapScopes[aAddon.id], + "ECMAv5"); + } + catch (e) { + // An exception will be caught if the expected method is not defined. + // That will be logged below. + } + + if (!method) { logger.warn("Add-on " + aAddon.id + " is missing bootstrap method " + aMethod); return; } @@ -4455,9 +4466,9 @@ this.XPIProvider = { } logger.debug("Calling bootstrap method " + aMethod + " on " + aAddon.id + " version " + - aAddon.version); + aAddon.version); try { - this.bootstrapScopes[aAddon.id][aMethod](params, aReason); + method(params, aReason); } catch (e) { logger.warn("Exception running bootstrap method " + aMethod + " on " + aAddon.id, e); diff --git a/toolkit/mozapps/extensions/test/addons/test_bootstrap_const/bootstrap.js b/toolkit/mozapps/extensions/test/addons/test_bootstrap_const/bootstrap.js new file mode 100644 index 000000000..498b76526 --- /dev/null +++ b/toolkit/mozapps/extensions/test/addons/test_bootstrap_const/bootstrap.js @@ -0,0 +1,5 @@ +Components.utils.import("resource://gre/modules/Services.jsm"); + +const install = function() { + Services.obs.notifyObservers(null, "addon-install", ""); +} \ No newline at end of file diff --git a/toolkit/mozapps/extensions/test/addons/test_bootstrap_const/install.rdf b/toolkit/mozapps/extensions/test/addons/test_bootstrap_const/install.rdf new file mode 100644 index 000000000..af3a749ce --- /dev/null +++ b/toolkit/mozapps/extensions/test/addons/test_bootstrap_const/install.rdf @@ -0,0 +1,24 @@ + + + + + + bootstrap@tests.mozilla.org + 1.0 + true + + + Test Bootstrap + Test Description + + + + xpcshell@tests.mozilla.org + 1 + 1 + + + + + \ No newline at end of file diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bootstrap_const.js b/toolkit/mozapps/extensions/test/xpcshell/test_bootstrap_const.js new file mode 100644 index 000000000..fb02b59be --- /dev/null +++ b/toolkit/mozapps/extensions/test/xpcshell/test_bootstrap_const.js @@ -0,0 +1,17 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ + */ + +createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1"); +startupManager(); + +add_task(function*() { + let sawInstall = false; + Services.obs.addObserver(function() { + sawInstall = true; + }, "addon-install", false); + + yield promiseInstallAllFiles([do_get_addon("test_bootstrap_const")]); + + ok(sawInstall); +}); \ No newline at end of file diff --git a/toolkit/mozapps/extensions/test/xpcshell/xpcshell-shared.ini b/toolkit/mozapps/extensions/test/xpcshell/xpcshell-shared.ini index bab072e83..2a12f147a 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell-shared.ini +++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell-shared.ini @@ -29,6 +29,7 @@ skip-if = os == "android" [test_bootstrap.js] # Bug 676992: test consistently hangs on Android skip-if = os == "android" +[test_bootstrap_const.js] [test_bootstrap_resource.js] [test_bug299716.js] # Bug 676992: test consistently hangs on Android -- cgit v1.2.3 From b8145b3d592cf0290cc17a6223816b817e3e3b77 Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Sat, 28 Apr 2018 12:46:29 +0200 Subject: Bug 1263935 - Expose native version of mapURIToAddonId via amIAddonPathService Issue #102 --- toolkit/mozapps/extensions/AddonPathService.cpp | 10 ++++++++++ toolkit/mozapps/extensions/amIAddonPathService.idl | 8 ++++++++ 2 files changed, 18 insertions(+) (limited to 'toolkit/mozapps/extensions') diff --git a/toolkit/mozapps/extensions/AddonPathService.cpp b/toolkit/mozapps/extensions/AddonPathService.cpp index 006149100..ddfdbe817 100644 --- a/toolkit/mozapps/extensions/AddonPathService.cpp +++ b/toolkit/mozapps/extensions/AddonPathService.cpp @@ -128,6 +128,16 @@ AddonPathService::InsertPath(const nsAString& path, const nsAString& addonIdStri return NS_OK; } +NS_IMETHODIMP +AddonPathService::MapURIToAddonId(nsIURI* aURI, nsAString& addonIdString) +{ + if (JSAddonId* id = MapURIToAddonID(aURI)) { + JSFlatString* flat = JS_ASSERT_STRING_IS_FLAT(JS::StringOfAddonId(id)); + AssignJSFlatString(addonIdString, flat); + } + return NS_OK; +} + static nsresult ResolveURI(nsIURI* aURI, nsAString& out) { diff --git a/toolkit/mozapps/extensions/amIAddonPathService.idl b/toolkit/mozapps/extensions/amIAddonPathService.idl index 863689858..9c9197a61 100644 --- a/toolkit/mozapps/extensions/amIAddonPathService.idl +++ b/toolkit/mozapps/extensions/amIAddonPathService.idl @@ -5,6 +5,8 @@ #include "nsISupports.idl" +interface nsIURI; + /** * This service maps file system paths where add-ons reside to the ID * of the add-on. Paths are added by the add-on manager. They can @@ -26,4 +28,10 @@ interface amIAddonPathService : nsISupports * associated with the given add-on ID. */ void insertPath(in AString path, in AString addonId); + + /** + * Given a URI to a file, return the ID of the add-on that the file belongs + * to. Returns an empty string if there is no add-on there. + */ + AString mapURIToAddonId(in nsIURI aURI); }; -- cgit v1.2.3 From 77e7fcac500629602059ad573c4ff6a9ff4d93b7 Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Sat, 28 Apr 2018 12:47:07 +0200 Subject: Bug 1263935 - Forward AddonManager.mapURIToAddonId to AddonPathService.mapURIToAddonId Issue #102 --- toolkit/mozapps/extensions/internal/XPIProvider.jsm | 19 +++++++------------ .../extensions/test/xpcshell/test_mapURIToAddonID.js | 4 +++- 2 files changed, 10 insertions(+), 13 deletions(-) (limited to 'toolkit/mozapps/extensions') diff --git a/toolkit/mozapps/extensions/internal/XPIProvider.jsm b/toolkit/mozapps/extensions/internal/XPIProvider.jsm index c43811ba8..8b49c6600 100644 --- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm +++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm @@ -52,6 +52,10 @@ XPCOMUtils.defineLazyServiceGetter(this, "ResProtocolHandler", "@mozilla.org/network/protocol;1?name=resource", "nsIResProtocolHandler"); +XPCOMUtils.defineLazyServiceGetter(this, + "AddonPathService", + "@mozilla.org/addon-path-service;1", + "amIAddonPathService"); const nsIFile = Components.Constructor("@mozilla.org/file/local;1", "nsIFile", "initWithPath"); @@ -1887,8 +1891,7 @@ this.XPIProvider = { logger.info("Mapping " + aID + " to " + aFile.path); this._addonFileMap.set(aID, aFile.path); - let service = Cc["@mozilla.org/addon-path-service;1"].getService(Ci.amIAddonPathService); - service.insertPath(aFile.path, aID); + AddonPathService.insertPath(aFile.path, aID); }, /** @@ -3916,16 +3919,8 @@ this.XPIProvider = { * @see amIAddonManager.mapURIToAddonID */ mapURIToAddonID: function XPI_mapURIToAddonID(aURI) { - let resolved = this._resolveURIToFile(aURI); - if (!resolved || !(resolved instanceof Ci.nsIFileURL)) - return null; - - for (let [id, path] of this._addonFileMap) { - if (resolved.file.path.startsWith(path)) - return id; - } - - return null; + // Returns `null` instead of empty string if the URI can't be mapped. + return AddonPathService.mapURIToAddonId(aURI) || null; }, /** diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_mapURIToAddonID.js b/toolkit/mozapps/extensions/test/xpcshell/test_mapURIToAddonID.js index a6f9c8052..a153256dc 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_mapURIToAddonID.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_mapURIToAddonID.js @@ -95,8 +95,10 @@ function run_test_early() { "resource://gre/modules/addons/XPIProvider.jsm", {}); // Make the early API call. - do_check_null(s.XPIProvider.mapURIToAddonID(uri)); + // AddonManager still misses its provider and so doesn't work yet. do_check_null(AddonManager.mapURIToAddonID(uri)); + // But calling XPIProvider directly works immediately + do_check_eq(s.XPIProvider.mapURIToAddonID(uri), id); // Actually start up the manager. startupManager(false); -- cgit v1.2.3 From 11caf6ecb3cb8c84d2355a6c6e9580a290147e92 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Sat, 28 Apr 2018 18:19:42 -0400 Subject: [TychoAM] Fix gCertBlocklistService.addRevokedCert is not a function Mozilla renamed it to revokeCertByIssuerAndSerial --- toolkit/mozapps/extensions/nsBlocklistService.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'toolkit/mozapps/extensions') diff --git a/toolkit/mozapps/extensions/nsBlocklistService.js b/toolkit/mozapps/extensions/nsBlocklistService.js index 936c9d1b5..487dae8e5 100644 --- a/toolkit/mozapps/extensions/nsBlocklistService.js +++ b/toolkit/mozapps/extensions/nsBlocklistService.js @@ -910,7 +910,7 @@ Blocklist.prototype = { let issuer = blocklistElement.getAttribute("issuerName"); for (let snElement of blocklistElement.children) { try { - gCertBlocklistService.addRevokedCert(issuer, snElement.textContent); + gCertBlocklistService.revokeCertByIssuerAndSerial(issuer, snElement.textContent); } catch (e) { // we want to keep trying other elements since missing all items // is worse than missing one -- cgit v1.2.3 From d2bf1f169db9ba341636808b9902aee652727499 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Sun, 29 Apr 2018 22:35:29 -0400 Subject: [*AM] Expand the list for excluding internally used IDs from being sent to AUS --- toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'toolkit/mozapps/extensions') diff --git a/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm b/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm index 939e2e269..8d742ea42 100644 --- a/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm +++ b/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm @@ -766,8 +766,17 @@ this.AddonUpdateChecker = { * down in-progress update requests */ checkForUpdates: function AUC_checkForUpdates(aId, aUpdateKey, aUrl, aObserver) { - // Exclude default theme - if (aId != "{972ce4c6-7e08-4474-a285-3208198ce6fd}") + // Define an array of internally used IDs to NOT send to AUS such as the + // Default Theme. Please keep this list in sync with: + // toolkit/mozapps/webextensions/AddonUpdateChecker.jsm + let internalIDS = [ + '{972ce4c6-7e08-4474-a285-3208198ce6fd}', + 'modern@themes.mozilla.org' + ]; + + // If the ID is not in the array then go ahead and query AUS + if (internalIDS.indexOf(aId) == -1) { return new UpdateParser(aId, aUpdateKey, aUrl, aObserver); + } } }; -- cgit v1.2.3 From 61de1c80cdc6c04e71fde07cc5028af503438134 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Tue, 1 May 2018 12:26:01 -0400 Subject: Only set and show the dual-guid indicators when dual-guid has been built --- toolkit/mozapps/extensions/content/extensions.xml | 6 ++++++ toolkit/mozapps/extensions/internal/XPIProvider.jsm | 8 +++++--- toolkit/mozapps/extensions/internal/XPIProviderUtils.js | 6 +++++- 3 files changed, 16 insertions(+), 4 deletions(-) (limited to 'toolkit/mozapps/extensions') diff --git a/toolkit/mozapps/extensions/content/extensions.xml b/toolkit/mozapps/extensions/content/extensions.xml index fab340540..7fe17be2a 100644 --- a/toolkit/mozapps/extensions/content/extensions.xml +++ b/toolkit/mozapps/extensions/content/extensions.xml @@ -9,6 +9,8 @@ %extensionsDTD; %aboutDTD; + +%brandDTD; ]> +#ifdef MOZ_PHOENIX_EXTENSIONS +#endif @@ -1362,8 +1366,10 @@ [this.mAddon.name], 1); } else { this.removeAttribute("notification"); +#ifdef MOZ_PHOENIX_EXTENSIONS if (this.mAddon.type == "extension") this.setAttribute("native", this.mAddon.native); +#endif } } diff --git a/toolkit/mozapps/extensions/internal/XPIProvider.jsm b/toolkit/mozapps/extensions/internal/XPIProvider.jsm index 8b49c6600..e1883fb6a 100644 --- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm +++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm @@ -6442,21 +6442,23 @@ AddonInternal.prototype = { if (!aPlatformVersion) aPlatformVersion = Services.appinfo.platformVersion; +#ifdef MOZ_PHOENIX_EXTENSIONS this.native = false; - +#endif + let version; if (app.id == Services.appinfo.ID) { version = aAppVersion; +#ifdef MOZ_PHOENIX_EXTENSIONS this.native = true; } -#ifdef MOZ_PHOENIX_EXTENSIONS else if (app.id == FIREFOX_ID) { version = FIREFOX_APPCOMPATVERSION; if (this.type == "locale") //Never allow language packs in Firefox compatibility mode return false; - } #endif + } else if (app.id == TOOLKIT_ID) version = aPlatformVersion diff --git a/toolkit/mozapps/extensions/internal/XPIProviderUtils.js b/toolkit/mozapps/extensions/internal/XPIProviderUtils.js index d26029455..6b37ed640 100644 --- a/toolkit/mozapps/extensions/internal/XPIProviderUtils.js +++ b/toolkit/mozapps/extensions/internal/XPIProviderUtils.js @@ -70,7 +70,11 @@ const PROP_JSON_FIELDS = ["id", "syncGUID", "location", "version", "type", "skinnable", "size", "sourceURI", "releaseNotesURI", "softDisabled", "foreignInstall", "hasBinaryComponents", "strictCompatibility", "locales", "targetApplications", - "targetPlatforms", "multiprocessCompatible", "native"]; + "targetPlatforms", "multiprocessCompatible", +#ifdef MOZ_PHOENIX_EXTENSIONS + "native" +#endif + ]; // Time to wait before async save of XPI JSON database, in milliseconds const ASYNC_SAVE_DELAY_MS = 20; -- cgit v1.2.3 From ec1df1e8a21d83e393dbfb6f5cc03657b11af0fc Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Tue, 1 May 2018 16:14:17 -0400 Subject: [TychoAM] Make the Add-ons Manager conditionally devtools free --- toolkit/mozapps/extensions/content/extensions.js | 4 ++++ toolkit/mozapps/extensions/content/extensions.xml | 2 ++ toolkit/mozapps/extensions/content/extensions.xul | 6 ++++++ toolkit/mozapps/extensions/internal/XPIProvider.jsm | 15 +++++++++++++++ 4 files changed, 27 insertions(+) (limited to 'toolkit/mozapps/extensions') diff --git a/toolkit/mozapps/extensions/content/extensions.js b/toolkit/mozapps/extensions/content/extensions.js index 8d9c132e6..fc4392231 100644 --- a/toolkit/mozapps/extensions/content/extensions.js +++ b/toolkit/mozapps/extensions/content/extensions.js @@ -18,10 +18,12 @@ Cu.import("resource://gre/modules/addons/AddonRepository.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "PluralForm", "resource://gre/modules/PluralForm.jsm"); +#ifdef MOZ_DEVTOOLS XPCOMUtils.defineLazyGetter(this, "BrowserToolboxProcess", function () { return Cu.import("resource://devtools/client/framework/ToolboxProcess.jsm", {}). BrowserToolboxProcess; }); +#endif const PREF_DISCOVERURL = "extensions.webservice.discoverURL"; const PREF_DISCOVER_ENABLED = "extensions.getAddons.showPane"; @@ -1002,6 +1004,7 @@ var gViewController = { } }, +#ifdef MOZ_DEVTOOLS cmd_debugItem: { doCommand: function cmd_debugItem_doCommand(aAddon) { BrowserToolboxProcess.init({ addonID: aAddon.id }); @@ -1015,6 +1018,7 @@ var gViewController = { return aAddon && aAddon.isDebuggable && debuggerEnabled && remoteEnabled; } }, +#endif cmd_showItemPreferences: { isEnabled: function cmd_showItemPreferences_isEnabled(aAddon) { diff --git a/toolkit/mozapps/extensions/content/extensions.xml b/toolkit/mozapps/extensions/content/extensions.xml index 7fe17be2a..cbd05bfa9 100644 --- a/toolkit/mozapps/extensions/content/extensions.xml +++ b/toolkit/mozapps/extensions/content/extensions.xml @@ -1628,11 +1628,13 @@ ]]> +#ifdef MOZ_DEVTOOLS +#endif +#ifdef MOZ_DEVTOOLS +#endif +#ifdef MOZ_DEVTOOLS +#endif @@ -631,9 +635,11 @@ #endif command="cmd_showItemPreferences"/> +#ifdef MOZ_DEVTOOLS -

-

- - diff --git a/toolkit/mozapps/extensions/test/xpinstall/cookieRedirect.sjs b/toolkit/mozapps/extensions/test/xpinstall/cookieRedirect.sjs deleted file mode 100644 index 92bccd9ec..000000000 --- a/toolkit/mozapps/extensions/test/xpinstall/cookieRedirect.sjs +++ /dev/null @@ -1,24 +0,0 @@ -// Simple script redirects to the query part of the uri if the cookie "xpinstall" -// has the value "true", otherwise gives a 500 error. - -function handleRequest(request, response) -{ - let cookie = null; - if (request.hasHeader("Cookie")) { - let cookies = request.getHeader("Cookie").split(";"); - for (let i = 0; i < cookies.length; i++) { - if (cookies[i].substring(0, 10) == "xpinstall=") - cookie = cookies[i].substring(10); - } - } - - if (cookie == "true") { - response.setStatusLine(request.httpVersion, 302, "Found"); - response.setHeader("Location", request.queryString); - response.write("See " + request.queryString); - } - else { - response.setStatusLine(request.httpVersion, 500, "Internal Server Error"); - response.write("Invalid request"); - } -} diff --git a/toolkit/mozapps/extensions/test/xpinstall/corrupt.xpi b/toolkit/mozapps/extensions/test/xpinstall/corrupt.xpi deleted file mode 100644 index 35d7bd5e5..000000000 --- a/toolkit/mozapps/extensions/test/xpinstall/corrupt.xpi +++ /dev/null @@ -1 +0,0 @@ -This is a corrupt zip file diff --git a/toolkit/mozapps/extensions/test/xpinstall/empty.xpi b/toolkit/mozapps/extensions/test/xpinstall/empty.xpi deleted file mode 100644 index 74ed2b817..000000000 Binary files a/toolkit/mozapps/extensions/test/xpinstall/empty.xpi and /dev/null differ diff --git a/toolkit/mozapps/extensions/test/xpinstall/enabled.html b/toolkit/mozapps/extensions/test/xpinstall/enabled.html deleted file mode 100644 index ec8513edc..000000000 --- a/toolkit/mozapps/extensions/test/xpinstall/enabled.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - -InstallTrigger tests - - - -

InstallTrigger tests

-

- - diff --git a/toolkit/mozapps/extensions/test/xpinstall/hashRedirect.sjs b/toolkit/mozapps/extensions/test/xpinstall/hashRedirect.sjs deleted file mode 100644 index 324a092a3..000000000 --- a/toolkit/mozapps/extensions/test/xpinstall/hashRedirect.sjs +++ /dev/null @@ -1,15 +0,0 @@ -// Simple script redirects takes the query part of te request and splits it on -// the | character. Anything before is included as the X-Target-Digest header -// the latter part is used as the url to redirect to - -function handleRequest(request, response) -{ - let pos = request.queryString.indexOf("|"); - let header = request.queryString.substring(0, pos); - let url = request.queryString.substring(pos + 1); - - response.setStatusLine(request.httpVersion, 302, "Found"); - response.setHeader("X-Target-Digest", header); - response.setHeader("Location", url); - response.write("See " + url); -} diff --git a/toolkit/mozapps/extensions/test/xpinstall/head.js b/toolkit/mozapps/extensions/test/xpinstall/head.js deleted file mode 100644 index 90db29924..000000000 --- a/toolkit/mozapps/extensions/test/xpinstall/head.js +++ /dev/null @@ -1,424 +0,0 @@ -const RELATIVE_DIR = "toolkit/mozapps/extensions/test/xpinstall/"; - -const TESTROOT = "http://example.com/browser/" + RELATIVE_DIR; -const TESTROOT2 = "http://example.org/browser/" + RELATIVE_DIR; -const XPINSTALL_URL = "chrome://mozapps/content/xpinstall/xpinstallConfirm.xul"; -const PROMPT_URL = "chrome://global/content/commonDialog.xul"; -const ADDONS_URL = "chrome://mozapps/content/extensions/extensions.xul"; -const PREF_LOGGING_ENABLED = "extensions.logging.enabled"; -const PREF_INSTALL_REQUIREBUILTINCERTS = "extensions.install.requireBuiltInCerts"; -const PREF_INSTALL_REQUIRESECUREORIGIN = "extensions.install.requireSecureOrigin"; -const CHROME_NAME = "mochikit"; - -function getChromeRoot(path) { - if (path === undefined) { - return "chrome://" + CHROME_NAME + "/content/browser/" + RELATIVE_DIR - } - return getRootDirectory(path); -} - -function extractChromeRoot(path) { - var chromeRootPath = getChromeRoot(path); - var jar = getJar(chromeRootPath); - if (jar) { - var tmpdir = extractJarToTmp(jar); - return "file://" + tmpdir.path + "/"; - } - return chromeRootPath; -} - -/** - * This is a test harness designed to handle responding to UI during the process - * of installing an XPI. A test can set callbacks to hear about specific parts - * of the sequence. - * Before use setup must be called and finish must be called afterwards. - */ -var Harness = { - // If set then the callback is called when an install is attempted and - // software installation is disabled. - installDisabledCallback: null, - // If set then the callback is called when an install is attempted and - // then canceled. - installCancelledCallback: null, - // If set then the callback will be called when an install's origin is blocked. - installOriginBlockedCallback: null, - // If set then the callback will be called when an install is blocked by the - // whitelist. The callback should return true to continue with the install - // anyway. - installBlockedCallback: null, - // If set will be called in the event of authentication being needed to get - // the xpi. Should return a 2 element array of username and password, or - // null to not authenticate. - authenticationCallback: null, - // If set this will be called to allow checking the contents of the xpinstall - // confirmation dialog. The callback should return true to continue the install. - installConfirmCallback: null, - // If set will be called when downloading of an item has begun. - downloadStartedCallback: null, - // If set will be called during the download of an item. - downloadProgressCallback: null, - // If set will be called when an xpi fails to download. - downloadFailedCallback: null, - // If set will be called when an xpi download is cancelled. - downloadCancelledCallback: null, - // If set will be called when downloading of an item has ended. - downloadEndedCallback: null, - // If set will be called when installation by the extension manager of an xpi - // item starts - installStartedCallback: null, - // If set will be called when an xpi fails to install. - installFailedCallback: null, - // If set will be called when each xpi item to be installed completes - // installation. - installEndedCallback: null, - // If set will be called when all triggered items are installed or the install - // is canceled. - installsCompletedCallback: null, - // If set the harness will wait for this DOM event before calling - // installsCompletedCallback - finalContentEvent: null, - - waitingForEvent: false, - pendingCount: null, - installCount: null, - runningInstalls: null, - - waitingForFinish: false, - - // A unique value to return from the installConfirmCallback to indicate that - // the install UI shouldn't be closed automatically - leaveOpen: {}, - - // Setup and tear down functions - setup: function() { - if (!this.waitingForFinish) { - waitForExplicitFinish(); - this.waitingForFinish = true; - - Services.prefs.setBoolPref(PREF_INSTALL_REQUIRESECUREORIGIN, false); - - Services.prefs.setBoolPref(PREF_LOGGING_ENABLED, true); - Services.obs.addObserver(this, "addon-install-started", false); - Services.obs.addObserver(this, "addon-install-disabled", false); - Services.obs.addObserver(this, "addon-install-origin-blocked", false); - Services.obs.addObserver(this, "addon-install-blocked", false); - Services.obs.addObserver(this, "addon-install-failed", false); - Services.obs.addObserver(this, "addon-install-complete", false); - - AddonManager.addInstallListener(this); - - Services.wm.addListener(this); - - var self = this; - registerCleanupFunction(function() { - Services.prefs.clearUserPref(PREF_LOGGING_ENABLED); - Services.prefs.clearUserPref(PREF_INSTALL_REQUIRESECUREORIGIN); - Services.obs.removeObserver(self, "addon-install-started"); - Services.obs.removeObserver(self, "addon-install-disabled"); - Services.obs.removeObserver(self, "addon-install-origin-blocked"); - Services.obs.removeObserver(self, "addon-install-blocked"); - Services.obs.removeObserver(self, "addon-install-failed"); - Services.obs.removeObserver(self, "addon-install-complete"); - - AddonManager.removeInstallListener(self); - - Services.wm.removeListener(self); - - AddonManager.getAllInstalls(function(aInstalls) { - is(aInstalls.length, 0, "Should be no active installs at the end of the test"); - aInstalls.forEach(function(aInstall) { - info("Install for " + aInstall.sourceURI + " is in state " + aInstall.state); - aInstall.cancel(); - }); - }); - }); - } - - this.installCount = 0; - this.pendingCount = 0; - this.runningInstalls = []; - }, - - finish: function() { - finish(); - }, - - endTest: function() { - let callback = this.installsCompletedCallback; - let count = this.installCount; - - is(this.runningInstalls.length, 0, "Should be no running installs left"); - this.runningInstalls.forEach(function(aInstall) { - info("Install for " + aInstall.sourceURI + " is in state " + aInstall.state); - }); - - this.installOriginBlockedCallback = null; - this.installBlockedCallback = null; - this.authenticationCallback = null; - this.installConfirmCallback = null; - this.downloadStartedCallback = null; - this.downloadProgressCallback = null; - this.downloadCancelledCallback = null; - this.downloadFailedCallback = null; - this.downloadEndedCallback = null; - this.installStartedCallback = null; - this.installFailedCallback = null; - this.installEndedCallback = null; - this.installsCompletedCallback = null; - this.runningInstalls = null; - - if (callback) - callback(count); - }, - - // Window open handling - windowReady: function(window) { - if (window.document.location.href == XPINSTALL_URL) { - if (this.installBlockedCallback) - ok(false, "Should have been blocked by the whitelist"); - this.pendingCount = window.document.getElementById("itemList").childNodes.length; - - // If there is a confirm callback then its return status determines whether - // to install the items or not. If not the test is over. - let result = true; - if (this.installConfirmCallback) { - result = this.installConfirmCallback(window); - if (result === this.leaveOpen) - return; - } - - if (!result) { - window.document.documentElement.cancelDialog(); - } - else { - // Initially the accept button is disabled on a countdown timer - var button = window.document.documentElement.getButton("accept"); - button.disabled = false; - window.document.documentElement.acceptDialog(); - } - } - else if (window.document.location.href == PROMPT_URL) { - var promptType = window.args.promptType; - switch (promptType) { - case "alert": - case "alertCheck": - case "confirmCheck": - case "confirm": - case "confirmEx": - window.document.documentElement.acceptDialog(); - break; - case "promptUserAndPass": - // This is a login dialog, hopefully an authentication prompt - // for the xpi. - if (this.authenticationCallback) { - var auth = this.authenticationCallback(); - if (auth && auth.length == 2) { - window.document.getElementById("loginTextbox").value = auth[0]; - window.document.getElementById("password1Textbox").value = auth[1]; - window.document.documentElement.acceptDialog(); - } - else { - window.document.documentElement.cancelDialog(); - } - } - else { - window.document.documentElement.cancelDialog(); - } - break; - default: - ok(false, "prompt type " + promptType + " not handled in test."); - break; - } - } - }, - - // Install blocked handling - - installDisabled: function(installInfo) { - ok(!!this.installDisabledCallback, "Installation shouldn't have been disabled"); - if (this.installDisabledCallback) - this.installDisabledCallback(installInfo); - this.endTest(); - }, - - installCancelled: function(installInfo) { - if (this.expectingCancelled) - return; - - ok(!!this.installCancelledCallback, "Installation shouldn't have been cancelled"); - if (this.installCancelledCallback) - this.installCancelledCallback(installInfo); - this.endTest(); - }, - - installOriginBlocked: function(installInfo) { - ok(!!this.installOriginBlockedCallback, "Shouldn't have been blocked"); - if (this.installOriginBlockedCallback) - this.installOriginBlockedCallback(installInfo); - this.endTest(); - }, - - installBlocked: function(installInfo) { - ok(!!this.installBlockedCallback, "Shouldn't have been blocked by the whitelist"); - if (this.installBlockedCallback && this.installBlockedCallback(installInfo)) { - this.installBlockedCallback = null; - installInfo.install(); - } - else { - this.expectingCancelled = true; - installInfo.installs.forEach(function(install) { - install.cancel(); - }); - this.expectingCancelled = false; - this.endTest(); - } - }, - - // nsIWindowMediatorListener - - onWindowTitleChange: function(window, title) { - }, - - onOpenWindow: function(window) { - var domwindow = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor) - .getInterface(Components.interfaces.nsIDOMWindow); - var self = this; - waitForFocus(function() { - self.windowReady(domwindow); - }, domwindow); - }, - - onCloseWindow: function(window) { - }, - - // Addon Install Listener - - onNewInstall: function(install) { - this.runningInstalls.push(install); - - if (this.finalContentEvent && !this.waitingForEvent) { - this.waitingForEvent = true; - info("Waiting for " + this.finalContentEvent); - let win = gBrowser.contentWindow; - let listener = () => { - info("Saw " + this.finalContentEvent); - win.removeEventListener(this.finalContentEvent, listener, false); - this.waitingForEvent = false; - if (this.pendingCount == 0) - this.endTest(); - } - win.addEventListener(this.finalContentEvent, listener, false); - } - }, - - onDownloadStarted: function(install) { - this.pendingCount++; - if (this.downloadStartedCallback) - this.downloadStartedCallback(install); - }, - - onDownloadProgress: function(install) { - if (this.downloadProgressCallback) - this.downloadProgressCallback(install); - }, - - onDownloadEnded: function(install) { - if (this.downloadEndedCallback) - this.downloadEndedCallback(install); - }, - - onDownloadCancelled: function(install) { - isnot(this.runningInstalls.indexOf(install), -1, - "Should only see cancelations for started installs"); - this.runningInstalls.splice(this.runningInstalls.indexOf(install), 1); - - if (this.downloadCancelledCallback) - this.downloadCancelledCallback(install); - this.checkTestEnded(); - }, - - onDownloadFailed: function(install) { - if (this.downloadFailedCallback) - this.downloadFailedCallback(install); - this.checkTestEnded(); - }, - - onInstallStarted: function(install) { - if (this.installStartedCallback) - this.installStartedCallback(install); - }, - - onInstallEnded: function(install, addon) { - if (this.installEndedCallback) - this.installEndedCallback(install, addon); - this.installCount++; - this.checkTestEnded(); - }, - - onInstallFailed: function(install) { - if (this.installFailedCallback) - this.installFailedCallback(install); - this.checkTestEnded(); - }, - - checkTestEnded: function() { - if (--this.pendingCount == 0 && !this.waitingForEvent) - this.endTest(); - }, - - // nsIObserver - - observe: function(subject, topic, data) { - var installInfo = subject.QueryInterface(Components.interfaces.amIWebInstallInfo); - switch (topic) { - case "addon-install-started": - is(this.runningInstalls.length, installInfo.installs.length, - "Should have seen the expected number of installs started"); - break; - case "addon-install-disabled": - this.installDisabled(installInfo); - break; - case "addon-install-cancelled": - this.installCancelled(installInfo); - break; - case "addon-install-origin-blocked": - this.installOriginBlocked(installInfo); - break; - case "addon-install-blocked": - this.installBlocked(installInfo); - break; - case "addon-install-failed": - installInfo.installs.forEach(function(aInstall) { - isnot(this.runningInstalls.indexOf(aInstall), -1, - "Should only see failures for started installs"); - - ok(aInstall.error != 0 || aInstall.addon.appDisabled, - "Failed installs should have an error or be appDisabled"); - - this.runningInstalls.splice(this.runningInstalls.indexOf(aInstall), 1); - }, this); - break; - case "addon-install-complete": - installInfo.installs.forEach(function(aInstall) { - isnot(this.runningInstalls.indexOf(aInstall), -1, - "Should only see completed events for started installs"); - - is(aInstall.error, 0, "Completed installs should have no error"); - ok(!aInstall.appDisabled, "Completed installs should not be appDisabled"); - - // Complete installs are either in the INSTALLED or CANCELLED state - // since the test may cancel installs the moment they complete. - ok(aInstall.state == AddonManager.STATE_INSTALLED || - aInstall.state == AddonManager.STATE_CANCELLED, - "Completed installs should be in the right state"); - - this.runningInstalls.splice(this.runningInstalls.indexOf(aInstall), 1); - }, this); - break; - } - }, - - QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, - Ci.nsIWindowMediatorListener, - Ci.nsISupports]) -} diff --git a/toolkit/mozapps/extensions/test/xpinstall/incompatible.xpi b/toolkit/mozapps/extensions/test/xpinstall/incompatible.xpi deleted file mode 100644 index cc40f43c9..000000000 Binary files a/toolkit/mozapps/extensions/test/xpinstall/incompatible.xpi and /dev/null differ diff --git a/toolkit/mozapps/extensions/test/xpinstall/installchrome.html b/toolkit/mozapps/extensions/test/xpinstall/installchrome.html deleted file mode 100644 index 71c072d3a..000000000 --- a/toolkit/mozapps/extensions/test/xpinstall/installchrome.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - -InstallTrigger tests - - - -

InstallTrigger tests

- - diff --git a/toolkit/mozapps/extensions/test/xpinstall/installtrigger.html b/toolkit/mozapps/extensions/test/xpinstall/installtrigger.html deleted file mode 100644 index cd7618cc5..000000000 --- a/toolkit/mozapps/extensions/test/xpinstall/installtrigger.html +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - -InstallTrigger tests - - - -

InstallTrigger tests

-

-

- - diff --git a/toolkit/mozapps/extensions/test/xpinstall/installtrigger_frame.html b/toolkit/mozapps/extensions/test/xpinstall/installtrigger_frame.html deleted file mode 100644 index 2b302642e..000000000 --- a/toolkit/mozapps/extensions/test/xpinstall/installtrigger_frame.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - -InstallTrigger frame tests - - - - - - -

InstallTrigger tests

-

-

- - diff --git a/toolkit/mozapps/extensions/test/xpinstall/multipackage.xpi b/toolkit/mozapps/extensions/test/xpinstall/multipackage.xpi deleted file mode 100644 index 11fbe1861..000000000 Binary files a/toolkit/mozapps/extensions/test/xpinstall/multipackage.xpi and /dev/null differ diff --git a/toolkit/mozapps/extensions/test/xpinstall/navigate.html b/toolkit/mozapps/extensions/test/xpinstall/navigate.html deleted file mode 100644 index 5a6903eb9..000000000 --- a/toolkit/mozapps/extensions/test/xpinstall/navigate.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - -Navigation tests - - - - -

Test Link

- - diff --git a/toolkit/mozapps/extensions/test/xpinstall/redirect.sjs b/toolkit/mozapps/extensions/test/xpinstall/redirect.sjs deleted file mode 100644 index d248bfbc7..000000000 --- a/toolkit/mozapps/extensions/test/xpinstall/redirect.sjs +++ /dev/null @@ -1,45 +0,0 @@ -// Script has two modes based on the query string. If the mode is "setup" then -// parameters from the query string configure the redirection. If the mode is -// "redirect" then a redirect is returned - -function handleRequest(request, response) -{ - let parts = request.queryString.split("&"); - let settings = {}; - - parts.forEach(function(aString) { - let [k, v] = aString.split("="); - settings[k] = decodeURIComponent(v); - }) - - if (settings.mode == "setup") { - delete settings.mode; - - // Object states must be an nsISupports - var state = { - settings: settings, - QueryInterface: function(aIid) { - if (aIid.equals(Components.interfaces.nsISupports)) - return settings; - throw Components.results.NS_ERROR_NO_INTERFACE; - } - } - state.wrappedJSObject = state; - - setObjectState("xpinstall-redirect-settings", state); - response.setStatusLine(request.httpVersion, 200, "Ok"); - response.setHeader("Content-Type", "text/plain"); - response.write("Setup complete"); - } - else if (settings.mode == "redirect") { - getObjectState("xpinstall-redirect-settings", function(aObject) { - settings = aObject.wrappedJSObject.settings; - }); - - response.setStatusLine(request.httpVersion, 302, "Found"); - for (var name in settings) { - response.setHeader(name, settings[name]); - } - response.write("Done"); - } -} diff --git a/toolkit/mozapps/extensions/test/xpinstall/restartless.xpi b/toolkit/mozapps/extensions/test/xpinstall/restartless.xpi deleted file mode 100644 index 973bc00cb..000000000 Binary files a/toolkit/mozapps/extensions/test/xpinstall/restartless.xpi and /dev/null differ diff --git a/toolkit/mozapps/extensions/test/xpinstall/signed-no-cn.xpi b/toolkit/mozapps/extensions/test/xpinstall/signed-no-cn.xpi deleted file mode 100644 index 90d3a3ce6..000000000 Binary files a/toolkit/mozapps/extensions/test/xpinstall/signed-no-cn.xpi and /dev/null differ diff --git a/toolkit/mozapps/extensions/test/xpinstall/signed-no-o.xpi b/toolkit/mozapps/extensions/test/xpinstall/signed-no-o.xpi deleted file mode 100644 index 19b754038..000000000 Binary files a/toolkit/mozapps/extensions/test/xpinstall/signed-no-o.xpi and /dev/null differ diff --git a/toolkit/mozapps/extensions/test/xpinstall/signed-tampered.xpi b/toolkit/mozapps/extensions/test/xpinstall/signed-tampered.xpi deleted file mode 100644 index 8c951881e..000000000 Binary files a/toolkit/mozapps/extensions/test/xpinstall/signed-tampered.xpi and /dev/null differ diff --git a/toolkit/mozapps/extensions/test/xpinstall/signed-untrusted.xpi b/toolkit/mozapps/extensions/test/xpinstall/signed-untrusted.xpi deleted file mode 100644 index 09789d189..000000000 Binary files a/toolkit/mozapps/extensions/test/xpinstall/signed-untrusted.xpi and /dev/null differ diff --git a/toolkit/mozapps/extensions/test/xpinstall/signed.xpi b/toolkit/mozapps/extensions/test/xpinstall/signed.xpi deleted file mode 100644 index bd7f78b7c..000000000 Binary files a/toolkit/mozapps/extensions/test/xpinstall/signed.xpi and /dev/null differ diff --git a/toolkit/mozapps/extensions/test/xpinstall/signed2.xpi b/toolkit/mozapps/extensions/test/xpinstall/signed2.xpi deleted file mode 100644 index 085efbbf7..000000000 Binary files a/toolkit/mozapps/extensions/test/xpinstall/signed2.xpi and /dev/null differ diff --git a/toolkit/mozapps/extensions/test/xpinstall/slowinstall.sjs b/toolkit/mozapps/extensions/test/xpinstall/slowinstall.sjs deleted file mode 100644 index 5f767a8f4..000000000 --- a/toolkit/mozapps/extensions/test/xpinstall/slowinstall.sjs +++ /dev/null @@ -1,101 +0,0 @@ -const { classes: Cc, interfaces: Ci, utils: Cu } = Components; - -Cu.import("resource://gre/modules/Services.jsm"); -Cu.import("resource://gre/modules/osfile.jsm"); -Cu.import("resource://gre/modules/NetUtil.jsm"); - -const RELATIVE_PATH = "browser/toolkit/mozapps/extensions/test/xpinstall" -const NOTIFICATION_TOPIC = "slowinstall-complete"; - -/** - * Helper function to create a JS object representing the url parameters from - * the request's queryString. - * - * @param aQueryString - * The request's query string. - * @return A JS object representing the url parameters from the request's - * queryString. - */ -function parseQueryString(aQueryString) { - var paramArray = aQueryString.split("&"); - var regex = /^([^=]+)=(.*)$/; - var params = {}; - for (var i = 0, sz = paramArray.length; i < sz; i++) { - var match = regex.exec(paramArray[i]); - if (!match) - throw "Bad parameter in queryString! '" + paramArray[i] + "'"; - params[decodeURIComponent(match[1])] = decodeURIComponent(match[2]); - } - - return params; -} - -function handleRequest(aRequest, aResponse) { - let id = +getState("ID"); - setState("ID", "" + (id + 1)); - - function LOG(str) { - dump("slowinstall.sjs[" + id + "]: " + str + "\n"); - } - - aResponse.setStatusLine(aRequest.httpVersion, 200, "OK"); - - var params = { }; - if (aRequest.queryString) - params = parseQueryString(aRequest.queryString); - - if (params.file) { - let xpiFile = ""; - - function complete_download() { - LOG("Completing download"); - downloadPaused = false; - - try { - // Doesn't seem to be a sane way to read using OS.File and write to an - // nsIOutputStream so here we are. - let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile); - file.initWithPath(xpiFile); - let stream = Cc["@mozilla.org/network/file-input-stream;1"]. - createInstance(Ci.nsIFileInputStream); - stream.init(file, -1, -1, stream.DEFER_OPEN + stream.CLOSE_ON_EOF); - - NetUtil.asyncCopy(stream, aResponse.bodyOutputStream, () => { - LOG("Download complete"); - aResponse.finish(); - }); - } - catch (e) { - LOG("Exception " + e); - } - } - - let waitForComplete = new Promise(resolve => { - function complete() { - Services.obs.removeObserver(complete, NOTIFICATION_TOPIC); - resolve(); - } - - Services.obs.addObserver(complete, NOTIFICATION_TOPIC, false); - }); - - aResponse.processAsync(); - - OS.File.getCurrentDirectory().then(dir => { - xpiFile = OS.Path.join(dir, ...RELATIVE_PATH.split("/"), params.file); - LOG("Starting slow download of " + xpiFile); - - OS.File.stat(xpiFile).then(info => { - aResponse.setHeader("Content-Type", "binary/octet-stream"); - aResponse.setHeader("Content-Length", info.size.toString()); - - LOG("Download paused"); - waitForComplete.then(complete_download); - }); - }); - } - else if (params.continue) { - dump("slowinstall.sjs: Received signal to complete all current downloads.\n"); - Services.obs.notifyObservers(null, NOTIFICATION_TOPIC, null); - } -} diff --git a/toolkit/mozapps/extensions/test/xpinstall/startsoftwareupdate.html b/toolkit/mozapps/extensions/test/xpinstall/startsoftwareupdate.html deleted file mode 100644 index 4845a504a..000000000 --- a/toolkit/mozapps/extensions/test/xpinstall/startsoftwareupdate.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - -InstallTrigger tests - - - -

InstallTrigger tests

- - diff --git a/toolkit/mozapps/extensions/test/xpinstall/theme.xpi b/toolkit/mozapps/extensions/test/xpinstall/theme.xpi deleted file mode 100644 index 0c94a280b..000000000 Binary files a/toolkit/mozapps/extensions/test/xpinstall/theme.xpi and /dev/null differ diff --git a/toolkit/mozapps/extensions/test/xpinstall/triggerredirect.html b/toolkit/mozapps/extensions/test/xpinstall/triggerredirect.html deleted file mode 100644 index 49fda7dc8..000000000 --- a/toolkit/mozapps/extensions/test/xpinstall/triggerredirect.html +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - -InstallTrigger tests - - - -

InstallTrigger tests

-

-

- - diff --git a/toolkit/mozapps/extensions/test/xpinstall/unsigned.xpi b/toolkit/mozapps/extensions/test/xpinstall/unsigned.xpi deleted file mode 100644 index 51b00475a..000000000 Binary files a/toolkit/mozapps/extensions/test/xpinstall/unsigned.xpi and /dev/null differ -- cgit v1.2.3 From ee5da989be3216486359498b61c68ff1f8b1633e Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Tue, 3 Jul 2018 11:08:58 +0200 Subject: [TychoAM] Make resilient to missing pref lightweightThemes.animation.enabled --- .../extensions/internal/LightweightThemeImageOptimizer.jsm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'toolkit/mozapps/extensions') diff --git a/toolkit/mozapps/extensions/internal/LightweightThemeImageOptimizer.jsm b/toolkit/mozapps/extensions/internal/LightweightThemeImageOptimizer.jsm index a5bc23ccd..a9201c3da 100644 --- a/toolkit/mozapps/extensions/internal/LightweightThemeImageOptimizer.jsm +++ b/toolkit/mozapps/extensions/internal/LightweightThemeImageOptimizer.jsm @@ -59,10 +59,14 @@ var ImageCropper = { return aImageURL; } - if (Services.prefs.getBoolPref("lightweightThemes.animation.enabled")) { - //Don't crop if animated - return aImageURL; - } + try { + if (Services.prefs.getBoolPref("lightweightThemes.animation.enabled")) { + //Don't crop if animated + return aImageURL; + } + } catch(e) { + // Continue of pref doesn't exist. + } // Generate the cropped image's file name using its // base name and the current screen size. -- cgit v1.2.3