diff --git a/.gitignore b/.gitignore index 59633ed9528..7ed2266af56 100644 --- a/.gitignore +++ b/.gitignore @@ -54,6 +54,16 @@ parser/html/java/javaparser/ .cproject .settings/ +# Ignore the files and directory that JetBrains IDEs create. +/.idea/ +*.iml + +# Gradle cache. +/.gradle/ + +# Local Gradle configuration properties. +/local.properties + # Python virtualenv artifacts. python/psutil/**/*.so python/psutil/**/*.pyd diff --git a/browser/tools/mozscreenshots/browser.ini b/browser/tools/mozscreenshots/browser.ini index b0227f3f932..0ca5820bdba 100644 --- a/browser/tools/mozscreenshots/browser.ini +++ b/browser/tools/mozscreenshots/browser.ini @@ -4,4 +4,3 @@ support-files = head.js [browser_screenshots.js] -tags = screenshots diff --git a/browser/tools/mozscreenshots/browser_screenshots.js b/browser/tools/mozscreenshots/browser_screenshots.js index f40c0867808..502f90fec2c 100644 --- a/browser/tools/mozscreenshots/browser_screenshots.js +++ b/browser/tools/mozscreenshots/browser_screenshots.js @@ -5,15 +5,12 @@ "use strict"; add_task(function* capture() { - if (!shouldCapture()) { + let setsEnv = env.get("MOZSCREENSHOTS_SETS"); + if (!setsEnv) { + ok(true, "MOZSCREENSHOTS_SETS wasn't specified so there's nothing to capture"); return; } - let { TestRunner } = Cu.import("chrome://mozscreenshots/content/TestRunner.jsm", {}); - let sets = ["TabsInTitlebar", "Tabs", "WindowSize", "Toolbars", "LightweightThemes"]; - let setsEnv = env.get("MOZSCREENSHOTS_SETS"); - if (setsEnv) { - sets = setsEnv.trim().split(","); - } + let sets = setsEnv.trim().split(","); yield TestRunner.start(sets); }); diff --git a/browser/tools/mozscreenshots/devtools/browser.ini b/browser/tools/mozscreenshots/devtools/browser.ini new file mode 100644 index 00000000000..e4fa0a988a9 --- /dev/null +++ b/browser/tools/mozscreenshots/devtools/browser.ini @@ -0,0 +1,6 @@ +[DEFAULT] +subsuite = screenshots +support-files = + ../head.js + +[browser_devtools.js] diff --git a/browser/tools/mozscreenshots/devtools/browser_devtools.js b/browser/tools/mozscreenshots/devtools/browser_devtools.js new file mode 100644 index 00000000000..07d3ef548b2 --- /dev/null +++ b/browser/tools/mozscreenshots/devtools/browser_devtools.js @@ -0,0 +1,14 @@ +/* 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"; + +add_task(function* capture() { + if (!shouldCapture()) { + return; + } + let sets = ["DevTools"]; + + yield TestRunner.start(sets); +}); diff --git a/browser/tools/mozscreenshots/head.js b/browser/tools/mozscreenshots/head.js index 940b8268726..122c9d4a974 100644 --- a/browser/tools/mozscreenshots/head.js +++ b/browser/tools/mozscreenshots/head.js @@ -6,6 +6,7 @@ const {AddonWatcher} = Cu.import("resource://gre/modules/AddonWatcher.jsm", {}); const env = Cc["@mozilla.org/process/environment;1"].getService(Ci.nsIEnvironment); +let TestRunner; function setup() { requestLongerTimeout(20); @@ -15,18 +16,25 @@ function setup() { AddonManager.getAddonByID("mozscreenshots@mozilla.org", function(aAddon) { isnot(aAddon, null, "The mozscreenshots extension should be installed"); AddonWatcher.ignoreAddonPermanently(aAddon.id); + TestRunner = Cu.import("chrome://mozscreenshots/content/TestRunner.jsm", {}).TestRunner; resolve(); }); }); } function shouldCapture() { + // Try pushes only capture in browser_screenshots.js with MOZSCREENSHOTS_SETS. + if (env.get("MOZSCREENSHOTS_SETS")) { + ok(true, "MOZSCREENSHOTS_SETS was specified so only capture what was " + + "requested (in browser_screenshots.js)"); + return false; + } + // Automation isn't able to schedule test jobs to only run on nightlies so we handle it here - // (see also: bug 1116275). Try pushes and local builds should also capture. + // (see also: bug 1116275). let capture = AppConstants.MOZ_UPDATE_CHANNEL == "nightly" || - (AppConstants.SOURCE_REVISION_URL.includes("/try/rev/") && - env.get("MOZSCREENSHOTS_SETS")) || - AppConstants.SOURCE_REVISION_URL == ""; + AppConstants.SOURCE_REVISION_URL == "" || + AppConstants.SOURCE_REVISION_URL == "1"; // bug 1248027 if (!capture) { ok(true, "Capturing is disabled for this MOZ_UPDATE_CHANNEL or REPO"); } diff --git a/browser/tools/mozscreenshots/moz.build b/browser/tools/mozscreenshots/moz.build index 2c0347bbc8f..65b107c1091 100644 --- a/browser/tools/mozscreenshots/moz.build +++ b/browser/tools/mozscreenshots/moz.build @@ -4,7 +4,14 @@ # 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/. -BROWSER_CHROME_MANIFESTS += ['browser.ini'] +BROWSER_CHROME_MANIFESTS += [ + # Each test is in it's own directory so it gets run in a clean profile with + # run-by-dir. + 'browser.ini', + 'devtools/browser.ini', + 'preferences/browser.ini', + 'primaryUI/browser.ini', +] TEST_DIRS += [ 'mozscreenshots/extension', diff --git a/browser/tools/mozscreenshots/mozscreenshots/extension/TestRunner.jsm b/browser/tools/mozscreenshots/mozscreenshots/extension/TestRunner.jsm index 5a9bf7fd881..991109ed2d6 100644 --- a/browser/tools/mozscreenshots/mozscreenshots/extension/TestRunner.jsm +++ b/browser/tools/mozscreenshots/mozscreenshots/extension/TestRunner.jsm @@ -11,7 +11,6 @@ const defaultSetNames = ["TabsInTitlebar", "Tabs", "WindowSize", "Toolbars", "Li const env = Cc["@mozilla.org/process/environment;1"].getService(Ci.nsIEnvironment); const HOME_PAGE = "chrome://mozscreenshots/content/lib/mozscreenshots.html"; -Cu.import("resource://testing-common/BrowserTestUtils.jsm"); Cu.import("resource://gre/modules/FileUtils.jsm"); Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/Task.jsm"); @@ -19,6 +18,9 @@ Cu.import("resource://gre/modules/Timer.jsm"); Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/osfile.jsm"); +XPCOMUtils.defineLazyModuleGetter(this, "BrowserTestUtils", + "resource://testing-common/BrowserTestUtils.jsm"); + Cu.import("chrome://mozscreenshots/content/Screenshot.jsm"); // Create a new instance of the ConsoleAPI so we can control the maxLogLevel with a pref. @@ -42,6 +44,7 @@ this.TestRunner = { _libDir: null, init(extensionPath) { + log.info("init"); this._extensionPath = extensionPath; }, diff --git a/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/Preferences.jsm b/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/Preferences.jsm index c0f18787e64..add345168c9 100644 --- a/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/Preferences.jsm +++ b/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/Preferences.jsm @@ -9,7 +9,9 @@ this.EXPORTED_SYMBOLS = ["Preferences"]; const {classes: Cc, interfaces: Ci, utils: Cu} = Components; Cu.import("resource://gre/modules/Services.jsm"); +Cu.import("resource://gre/modules/Task.jsm"); Cu.import("resource://gre/modules/Timer.jsm"); +Cu.import("resource://testing-common/TestUtils.jsm"); this.Preferences = { @@ -31,7 +33,7 @@ this.Preferences = { ["paneAdvanced", "encryptionTab"], ]; for (let [primary, advanced] of panes) { - let configName = primary + ("-" + advanced || ""); + let configName = primary.replace(/^pane/, "prefs") + (advanced ? "-" + advanced : ""); this.configurations[configName] = {}; this.configurations[configName].applyConfig = prefHelper.bind(null, primary, advanced); } @@ -40,14 +42,27 @@ this.Preferences = { configurations: {}, }; -function prefHelper(primary, advanced) { - return new Promise((resolve) => { - let browserWindow = Services.wm.getMostRecentWindow("navigator:browser"); - if (primary == "paneAdvanced") { - browserWindow.openAdvancedPreferences(advanced); - } else { - browserWindow.openPreferences(primary); - } - setTimeout(resolve, 50); - }); -} +let prefHelper = Task.async(function*(primary, advanced) { + let browserWindow = Services.wm.getMostRecentWindow("navigator:browser"); + let selectedBrowser = browserWindow.gBrowser; + let readyPromise = null; + if (selectedBrowser.currentURI.specIgnoringRef == "about:preferences") { + readyPromise = new Promise((resolve) => { + browserWindow.addEventListener("MozAfterPaint", function paneSwitch() { + browserWindow.removeEventListener("MozAfterPaint", paneSwitch); + resolve(); + }); + }); + + } else { + readyPromise = TestUtils.topicObserved("advanced-pane-loaded"); + } + + if (primary == "paneAdvanced") { + browserWindow.openAdvancedPreferences(advanced); + } else { + browserWindow.openPreferences(primary); + } + + yield readyPromise; +}); diff --git a/browser/tools/mozscreenshots/preferences/browser.ini b/browser/tools/mozscreenshots/preferences/browser.ini new file mode 100644 index 00000000000..975d9168150 --- /dev/null +++ b/browser/tools/mozscreenshots/preferences/browser.ini @@ -0,0 +1,6 @@ +[DEFAULT] +subsuite = screenshots +support-files = + ../head.js + +[browser_preferences.js] diff --git a/browser/tools/mozscreenshots/preferences/browser_preferences.js b/browser/tools/mozscreenshots/preferences/browser_preferences.js new file mode 100644 index 00000000000..c4e1b19f3d4 --- /dev/null +++ b/browser/tools/mozscreenshots/preferences/browser_preferences.js @@ -0,0 +1,14 @@ +/* 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"; + +add_task(function* capture() { + if (!shouldCapture()) { + return; + } + let sets = ["Preferences"]; + + yield TestRunner.start(sets); +}); diff --git a/browser/tools/mozscreenshots/primaryUI/browser.ini b/browser/tools/mozscreenshots/primaryUI/browser.ini new file mode 100644 index 00000000000..628520b23f5 --- /dev/null +++ b/browser/tools/mozscreenshots/primaryUI/browser.ini @@ -0,0 +1,6 @@ +[DEFAULT] +subsuite = screenshots +support-files = + ../head.js + +[browser_primaryUI.js] diff --git a/browser/tools/mozscreenshots/primaryUI/browser_primaryUI.js b/browser/tools/mozscreenshots/primaryUI/browser_primaryUI.js new file mode 100644 index 00000000000..b48c0139dc5 --- /dev/null +++ b/browser/tools/mozscreenshots/primaryUI/browser_primaryUI.js @@ -0,0 +1,14 @@ +/* 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"; + +add_task(function* capture() { + if (!shouldCapture()) { + return; + } + let sets = ["TabsInTitlebar", "Tabs", "WindowSize", "Toolbars", "LightweightThemes"]; + + yield TestRunner.start(sets); +}); diff --git a/mobile/android/base/java/org/mozilla/gecko/home/BrowserSearch.java b/mobile/android/base/java/org/mozilla/gecko/home/BrowserSearch.java index 045f4ddb7db..3d09dbe3b24 100644 --- a/mobile/android/base/java/org/mozilla/gecko/home/BrowserSearch.java +++ b/mobile/android/base/java/org/mozilla/gecko/home/BrowserSearch.java @@ -818,6 +818,8 @@ public class BrowserSearch extends HomeFragment // Pref observer in gecko will also set prompted = true PrefsHelper.setPref("browser.search.suggest.enabled", enabled); + Telemetry.sendUIEvent(TelemetryContract.Event.ACTION, TelemetryContract.Method.BUTTON, (enabled ? "suggestions_optin_yes" : "suggestions_optin_no")); + TranslateAnimation slideAnimation = new TranslateAnimation(0, mSuggestionsOptInPrompt.getWidth(), 0, 0); slideAnimation.setDuration(ANIMATION_DURATION); slideAnimation.setInterpolator(new AccelerateInterpolator()); diff --git a/toolkit/components/telemetry/TelemetryEnvironment.jsm b/toolkit/components/telemetry/TelemetryEnvironment.jsm index b32f0eea8e3..4451e396942 100644 --- a/toolkit/components/telemetry/TelemetryEnvironment.jsm +++ b/toolkit/components/telemetry/TelemetryEnvironment.jsm @@ -540,6 +540,7 @@ EnvironmentAddonBuilder.prototype = { installDay: Utils.millisecondsToDays(installDate.getTime()), updateDay: Utils.millisecondsToDays(updateDate.getTime()), signedState: addon.signedState, + isSystem: addon.isSystem, }; if (addon.signedState !== undefined) diff --git a/toolkit/components/telemetry/docs/environment.rst b/toolkit/components/telemetry/docs/environment.rst index 441e68b2ab4..e5c7b4a45f6 100644 --- a/toolkit/components/telemetry/docs/environment.rst +++ b/toolkit/components/telemetry/docs/environment.rst @@ -195,6 +195,7 @@ Structure:: installDay: , // days since UNIX epoch, 0 on failure updateDay: , // days since UNIX epoch, 0 on failure signedState: , // whether the add-on is signed by AMO, only present for extensions + isSystem: , // true if this is a System Add-on }, ... }, diff --git a/toolkit/components/telemetry/tests/addons/system/install.rdf b/toolkit/components/telemetry/tests/addons/system/install.rdf new file mode 100644 index 00000000000..12cb143a7df --- /dev/null +++ b/toolkit/components/telemetry/tests/addons/system/install.rdf @@ -0,0 +1,24 @@ + + + + + + tel-system-xpi@tests.mozilla.org + 1.0 + + + + toolkit@mozilla.org + 0 + * + + + + + XPI Telemetry System Add-on Test + A system addon which is shipped with Firefox. + true + + + diff --git a/toolkit/components/telemetry/tests/unit/head.js b/toolkit/components/telemetry/tests/unit/head.js index 58dfdfe4457..87586527f09 100644 --- a/toolkit/components/telemetry/tests/unit/head.js +++ b/toolkit/components/telemetry/tests/unit/head.js @@ -166,6 +166,10 @@ function loadAddonManager(id, name, version, platformVersion) { let uri = ns.Services.io.newFileURI(file); ns.Services.scriptloader.loadSubScript(uri.spec, gGlobalScope); createAppInfo(id, name, version, platformVersion); + // As we're not running in application, we need to setup the features directory + // used by system add-ons. + const distroDir = FileUtils.getDir("ProfD", ["sysfeatures", "app0"], true); + registerDirectory("XREAppFeat", distroDir); startupManager(); } diff --git a/toolkit/components/telemetry/tests/unit/test_TelemetryEnvironment.js b/toolkit/components/telemetry/tests/unit/test_TelemetryEnvironment.js index 33332d6f4f0..84ec2e6dcb0 100644 --- a/toolkit/components/telemetry/tests/unit/test_TelemetryEnvironment.js +++ b/toolkit/components/telemetry/tests/unit/test_TelemetryEnvironment.js @@ -9,6 +9,7 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm", this); Cu.import("resource://testing-common/AddonManagerTesting.jsm"); Cu.import("resource://testing-common/httpd.js"); Cu.import("resource://testing-common/MockRegistrar.jsm", this); +Cu.import("resource://gre/modules/FileUtils.jsm"); // Lazy load |LightweightThemeManager|, we won't be using it on Gonk. XPCOMUtils.defineLazyModuleGetter(this, "LightweightThemeManager", @@ -67,6 +68,9 @@ const PERSONA_DESCRIPTION = "A nice theme/persona description."; const PLUGIN_UPDATED_TOPIC = "plugins-list-updated"; +// system add-ons are enabled at startup, so record date when the test starts +const SYSTEM_ADDON_INSTALL_DATE = Date.now(); + /** * Used to mock plugin tags in our fake plugin host. */ @@ -571,6 +575,11 @@ function checkSystemSection(data) { } function checkActiveAddon(data){ + let signedState = mozinfo.addon_signing ? "number" : "undefined"; + // system add-ons have an undefined signState + if (data.isSystem) + signedState = "undefined"; + const EXPECTED_ADDON_FIELDS_TYPES = { blocklisted: "boolean", name: "string", @@ -583,7 +592,8 @@ function checkActiveAddon(data){ hasBinaryComponents: "boolean", installDay: "number", updateDay: "number", - signedState: mozinfo.addon_signing ? "number" : "undefined", + signedState: signedState, + isSystem: "boolean", }; for (let f in EXPECTED_ADDON_FIELDS_TYPES) { @@ -715,6 +725,13 @@ function run_test() { do_test_pending(); spoofGfxAdapter(); do_get_profile(); + + // The system add-on must be installed before AddonManager is started. + const distroDir = FileUtils.getDir("ProfD", ["sysfeatures", "app0"], true); + do_get_file("system.xpi").copyTo(distroDir, "tel-system-xpi@tests.mozilla.org.xpi"); + let system_addon = FileUtils.File(distroDir.path); + system_addon.append("tel-system-xpi@tests.mozilla.org.xpi"); + system_addon.lastModifiedTime = SYSTEM_ADDON_INSTALL_DATE; loadAddonManager(APP_ID, APP_NAME, APP_VERSION, PLATFORM_VERSION); // Spoof the persona ID, but not on Gonk. @@ -1016,6 +1033,24 @@ add_task(function* test_addonsAndPlugins() { installDay: ADDON_INSTALL_DATE, updateDay: ADDON_INSTALL_DATE, signedState: mozinfo.addon_signing ? AddonManager.SIGNEDSTATE_SIGNED : AddonManager.SIGNEDSTATE_NOT_REQUIRED, + isSystem: false, + }; + const SYSTEM_ADDON_ID = "tel-system-xpi@tests.mozilla.org"; + const EXPECTED_SYSTEM_ADDON_DATA = { + blocklisted: false, + description: "A system addon which is shipped with Firefox.", + name: "XPI Telemetry System Add-on Test", + userDisabled: false, + appDisabled: false, + version: "1.0", + scope: 1, + type: "extension", + foreignInstall: false, + hasBinaryComponents: false, + installDay: truncateToDays(SYSTEM_ADDON_INSTALL_DATE), + updateDay: truncateToDays(SYSTEM_ADDON_INSTALL_DATE), + signedState: undefined, + isSystem: true, }; const EXPECTED_PLUGIN_DATA = { @@ -1040,6 +1075,13 @@ add_task(function* test_addonsAndPlugins() { Assert.equal(targetAddon[f], EXPECTED_ADDON_DATA[f], f + " must have the correct value."); } + // Check system add-on data. + Assert.ok(SYSTEM_ADDON_ID in data.addons.activeAddons, "We must have one active system addon."); + let targetSystemAddon = data.addons.activeAddons[SYSTEM_ADDON_ID]; + for (let f in EXPECTED_SYSTEM_ADDON_DATA) { + Assert.equal(targetSystemAddon[f], EXPECTED_SYSTEM_ADDON_DATA[f], f + " must have the correct value."); + } + // Check theme data. let theme = data.addons.theme; Assert.equal(theme.id, (PERSONA_ID + PERSONA_ID_SUFFIX)); diff --git a/toolkit/components/telemetry/tests/unit/xpcshell.ini b/toolkit/components/telemetry/tests/unit/xpcshell.ini index 4c98da3eeed..1ad201ce695 100644 --- a/toolkit/components/telemetry/tests/unit/xpcshell.ini +++ b/toolkit/components/telemetry/tests/unit/xpcshell.ini @@ -12,6 +12,7 @@ support-files = experiment.xpi extension.xpi extension-2.xpi + system.xpi restartless.xpi theme.xpi generated-files = @@ -19,6 +20,7 @@ generated-files = experiment.xpi extension.xpi extension-2.xpi + system.xpi restartless.xpi theme.xpi diff --git a/toolkit/mozapps/extensions/internal/XPIProvider.jsm b/toolkit/mozapps/extensions/internal/XPIProvider.jsm index cf7cd7a9860..007bdb13b1e 100644 --- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm +++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm @@ -1,4 +1,4 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public + /* 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/. */ @@ -7137,6 +7137,12 @@ AddonWrapper.prototype = { addon._installLocation.name == KEY_APP_SYSTEM_ADDONS); }, + get isSystem() { + let addon = addonFor(this); + return (addon._installLocation.name == KEY_APP_SYSTEM_DEFAULTS || + addon._installLocation.name == KEY_APP_SYSTEM_ADDONS); + }, + isCompatibleWith: function(aAppVersion, aPlatformVersion) { return addonFor(this).isCompatibleWith(aAppVersion, aPlatformVersion); }, diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bootstrap.js b/toolkit/mozapps/extensions/test/xpcshell/test_bootstrap.js index 291c7a1083e..221681118e1 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_bootstrap.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_bootstrap.js @@ -185,6 +185,7 @@ function check_test_1(installSyncGUID) { do_check_false(b1.appDisabled); do_check_false(b1.userDisabled); do_check_true(b1.isActive); + do_check_false(b1.isSystem); BootstrapMonitor.checkAddonInstalled(ID1, "1.0"); BootstrapMonitor.checkAddonStarted(ID1, "1.0"); do_check_eq(getStartupReason(), ADDON_INSTALL); @@ -291,6 +292,7 @@ function run_test_4() { do_check_false(b1.appDisabled); do_check_false(b1.userDisabled); do_check_true(b1.isActive); + do_check_false(b1.isSystem); BootstrapMonitor.checkAddonInstalled(ID1, "1.0"); BootstrapMonitor.checkAddonStarted(ID1, "1.0"); do_check_eq(getStartupReason(), ADDON_ENABLE); @@ -333,6 +335,7 @@ function run_test_5() { do_check_false(b1.appDisabled); do_check_false(b1.userDisabled); do_check_true(b1.isActive); + do_check_false(b1.isSystem); do_check_false(isExtensionInAddonsList(profileDir, b1.id)); do_check_bootstrappedPref(run_test_6); @@ -376,6 +379,7 @@ function check_test_6() { do_check_false(b1.appDisabled); do_check_false(b1.userDisabled); do_check_true(b1.isActive); + do_check_false(b1.isSystem); BootstrapMonitor.checkAddonInstalled(ID1, "2.0"); BootstrapMonitor.checkAddonStarted(ID1, "2.0"); do_check_eq(getStartupReason(), ADDON_UPGRADE); @@ -446,6 +450,7 @@ function run_test_8() { do_check_false(b1.appDisabled); do_check_false(b1.userDisabled); do_check_true(b1.isActive); + do_check_false(b1.isSystem); BootstrapMonitor.checkAddonInstalled(ID1, "1.0"); BootstrapMonitor.checkAddonStarted(ID1, "1.0"); do_check_eq(getStartupReason(), ADDON_INSTALL); @@ -516,6 +521,7 @@ function check_test_10_pt1() { do_check_false(b1.appDisabled); do_check_false(b1.userDisabled); do_check_true(b1.isActive); + do_check_false(b1.isSystem); BootstrapMonitor.checkAddonInstalled(ID1, "2.0"); BootstrapMonitor.checkAddonStarted(ID1, "2.0"); do_check_eq(getStartupReason(), ADDON_INSTALL); @@ -560,6 +566,7 @@ function check_test_10_pt2() { do_check_false(b1.appDisabled); do_check_false(b1.userDisabled); do_check_true(b1.isActive); + do_check_false(b1.isSystem); BootstrapMonitor.checkAddonInstalled(ID1, "1.0"); BootstrapMonitor.checkAddonStarted(ID1, "1.0"); do_check_eq(getStartupReason(), ADDON_DOWNGRADE); @@ -626,6 +633,7 @@ function run_test_12() { do_check_false(b1.appDisabled); do_check_false(b1.userDisabled); do_check_true(b1.isActive); + do_check_false(b1.isSystem); BootstrapMonitor.checkAddonInstalled(ID1, "1.0"); BootstrapMonitor.checkAddonStarted(ID1, "1.0"); do_check_eq(getStartupReason(), ADDON_INSTALL); @@ -754,6 +762,7 @@ function run_test_15() { do_check_false(b1.appDisabled); do_check_false(b1.userDisabled); do_check_true(b1.isActive); + do_check_false(b1.isSystem); BootstrapMonitor.checkAddonInstalled(ID1, "1.0"); BootstrapMonitor.checkAddonStarted(ID1, "1.0"); @@ -826,6 +835,7 @@ function run_test_16() { BootstrapMonitor.checkAddonInstalled(ID1, "1.0"); BootstrapMonitor.checkAddonStarted(ID1, "1.0"); do_check_true(b1.isActive); + do_check_false(b1.isSystem); do_check_eq(b1.iconURL, "chrome://foo/skin/icon.png"); do_check_eq(b1.aboutURL, "chrome://foo/content/about.xul"); do_check_eq(b1.optionsURL, "chrome://foo/content/options.xul"); @@ -883,6 +893,7 @@ function run_test_17() { do_check_neq(b1, null); do_check_eq(b1.version, "1.0"); do_check_true(b1.isActive); + do_check_false(b1.isSystem); do_check_bootstrappedPref(run_test_18); }); @@ -899,6 +910,7 @@ function run_test_18() { do_check_neq(b1, null); do_check_eq(b1.version, "2.0"); do_check_true(b1.isActive); + do_check_false(b1.isSystem); do_check_eq(getShutdownReason(), ADDON_UPGRADE); do_check_eq(getUninstallReason(), ADDON_UPGRADE); @@ -941,6 +953,7 @@ function check_test_19() { do_check_neq(b1, null); do_check_eq(b1.version, "1.0"); do_check_true(b1.isActive); + do_check_false(b1.isSystem); // TODO these reasons really should be ADDON_DOWNGRADE (bug 607818) do_check_eq(getShutdownReason(), ADDON_UNINSTALL); @@ -974,6 +987,7 @@ function run_test_20() { do_check_neq(b1, null); do_check_eq(b1.version, "2.0"); do_check_true(b1.isActive); + do_check_false(b1.isSystem); do_check_eq(getShutdownReason(), APP_SHUTDOWN); do_check_eq(getUninstallReason(), ADDON_UPGRADE); @@ -1008,6 +1022,7 @@ function run_test_21() { do_check_neq(b1, null); do_check_eq(b1.version, "1.0"); do_check_true(b1.isActive); + do_check_false(b1.isSystem); // This won't be set as the bootstrap script was gone so we couldn't // uninstall it properly @@ -1051,6 +1066,7 @@ function run_test_22() { do_check_neq(b1, null); do_check_eq(b1.version, "1.0"); do_check_true(b1.isActive); + do_check_false(b1.isSystem); shutdownManager(); @@ -1071,6 +1087,7 @@ function run_test_22() { do_check_neq(b1, null); do_check_eq(b1.version, "2.0"); do_check_true(b1.isActive); + do_check_false(b1.isSystem); // This won't be set as the bootstrap script was gone so we couldn't // uninstall it properly @@ -1150,6 +1167,7 @@ function check_test_23() { do_check_false(b1.appDisabled); do_check_false(b1.userDisabled); do_check_true(b1.isActive); + do_check_false(b1.isSystem); BootstrapMonitor.checkAddonInstalled(ID1, "1.0"); BootstrapMonitor.checkAddonStarted(ID1, "1.0"); do_check_eq(getStartupReason(), ADDON_INSTALL); @@ -1238,6 +1256,7 @@ function run_test_25() { do_check_neq(b1, null); do_check_eq(b1.version, "1.0"); do_check_true(b1.isActive); + do_check_false(b1.isSystem); do_check_true(hasFlag(b1.pendingOperations, AddonManager.PENDING_UPGRADE)); restartManager(); @@ -1251,6 +1270,7 @@ function run_test_25() { do_check_neq(b1, null); do_check_eq(b1.version, "4.0"); do_check_true(b1.isActive); + do_check_false(b1.isSystem); do_check_eq(b1.pendingOperations, AddonManager.PENDING_NONE); do_check_bootstrappedPref(run_test_26); @@ -1275,6 +1295,7 @@ function run_test_26() { do_check_neq(b1, null); do_check_eq(b1.version, "4.0"); do_check_true(b1.isActive); + do_check_false(b1.isSystem); do_check_true(hasFlag(b1.pendingOperations, AddonManager.PENDING_UPGRADE)); restartManager(); @@ -1288,6 +1309,7 @@ function run_test_26() { do_check_neq(b1, null); do_check_eq(b1.version, "1.0"); do_check_true(b1.isActive); + do_check_false(b1.isSystem); do_check_eq(b1.pendingOperations, AddonManager.PENDING_NONE); do_check_bootstrappedPref(run_test_27); @@ -1368,6 +1390,7 @@ function run_test_28() { b1.userDisabled = false; do_check_eq(b1.version, "1.0"); do_check_true(b1.isActive); + do_check_false(b1.isSystem); do_check_eq(b1.pendingOperations, AddonManager.PENDING_NONE); BootstrapMonitor.checkAddonInstalled(ID1, "1.0"); BootstrapMonitor.checkAddonStarted(ID1, "1.0"); diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_system_reset.js b/toolkit/mozapps/extensions/test/xpcshell/test_system_reset.js index 139baca2b9a..e153227804d 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_system_reset.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_system_reset.js @@ -46,6 +46,7 @@ function* check_installed(inProfile, ...versions) { do_check_false(hasFlag(addon.permissions, AddonManager.PERM_CAN_UPGRADE)); do_check_false(hasFlag(addon.permissions, AddonManager.PERM_CAN_UNINSTALL)); do_check_true(addon.hidden); + do_check_true(addon.isSystem); // Verify the add-ons file is in the right place let file = expectedDir.clone(); diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_system_update.js b/toolkit/mozapps/extensions/test/xpcshell/test_system_update.js index 60b0a6cbcb7..90961a1c756 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_system_update.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_system_update.js @@ -162,6 +162,7 @@ function* check_installed(inProfile, ...versions) { do_check_true(addon.isActive); do_check_false(addon.foreignInstall); do_check_true(addon.hidden); + do_check_true(addon.isSystem); // Verify the add-ons file is in the right place let file = expectedDir.clone(); diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_webextension.js b/toolkit/mozapps/extensions/test/xpcshell/test_webextension.js index 7cadf835d08..8cb473fd620 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_webextension.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_webextension.js @@ -54,6 +54,7 @@ add_task(function*() { do_check_true(addon.isCompatible); do_check_false(addon.appDisabled); do_check_true(addon.isActive); + do_check_false(addon.isSystem); do_check_eq(addon.type, "extension"); do_check_eq(addon.signedState, mozinfo.addon_signing ? AddonManager.SIGNEDSTATE_SIGNED : AddonManager.SIGNEDSTATE_NOT_REQUIRED); @@ -81,6 +82,7 @@ add_task(function*() { do_check_true(addon.isCompatible); do_check_false(addon.appDisabled); do_check_true(addon.isActive); + do_check_false(addon.isSystem); do_check_eq(addon.type, "extension"); do_check_eq(addon.signedState, mozinfo.addon_signing ? AddonManager.SIGNEDSTATE_SIGNED : AddonManager.SIGNEDSTATE_NOT_REQUIRED); @@ -134,6 +136,7 @@ add_task(function*() { do_check_true(addon.isCompatible); do_check_false(addon.appDisabled); do_check_true(addon.isActive); + do_check_false(addon.isSystem); do_check_eq(addon.type, "extension"); do_check_eq(addon.signedState, mozinfo.addon_signing ? AddonManager.SIGNEDSTATE_SIGNED : AddonManager.SIGNEDSTATE_NOT_REQUIRED); @@ -252,6 +255,7 @@ add_task(function*() { do_check_neq(first_addon, null); do_check_false(first_addon.appDisabled); do_check_true(first_addon.isActive); + do_check_false(first_addon.isSystem); let manifestjson_id= "last-webextension2@tests.mozilla.org"; let last_addon = yield promiseAddonByID(manifestjson_id);