diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
commit | d8bbc7858622b6d9c278469aab701ca0b609cddf (patch) | |
tree | eff41dc61d9f714852212739e6b3738b82a2af87 /toolkit/modules | |
parent | Releasing progress-linux version 125.0.3-1~progress7.99u1. (diff) | |
download | firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip |
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/modules')
42 files changed, 314 insertions, 196 deletions
diff --git a/toolkit/modules/ActorManagerParent.sys.mjs b/toolkit/modules/ActorManagerParent.sys.mjs index 5b31421ec6..46d6951475 100644 --- a/toolkit/modules/ActorManagerParent.sys.mjs +++ b/toolkit/modules/ActorManagerParent.sys.mjs @@ -127,8 +127,8 @@ let JSWINDOWACTORS = { esModuleURI: "resource://gre/actors/AutoCompleteParent.sys.mjs", // These two messages are also used, but are currently synchronous calls // through the per-process message manager. - // "FormAutoComplete:GetSelectedIndex", - // "FormAutoComplete:SelectBy" + // "AutoComplete:GetSelectedIndex", + // "AutoComplete:SelectBy" }, child: { diff --git a/toolkit/modules/AppMenuNotifications.sys.mjs b/toolkit/modules/AppMenuNotifications.sys.mjs index 77487437ac..3e148f6e21 100644 --- a/toolkit/modules/AppMenuNotifications.sys.mjs +++ b/toolkit/modules/AppMenuNotifications.sys.mjs @@ -30,7 +30,7 @@ export var AppMenuNotifications = { Services.obs.removeObserver(this, "appMenu-notifications-request"); }, - observe(subject, topic, status) { + observe(subject, topic) { switch (topic) { case "xpcom-shutdown": this.uninit(); diff --git a/toolkit/modules/AsanReporter.sys.mjs b/toolkit/modules/AsanReporter.sys.mjs index 172e24ca4b..50929fbad9 100644 --- a/toolkit/modules/AsanReporter.sys.mjs +++ b/toolkit/modules/AsanReporter.sys.mjs @@ -56,7 +56,7 @@ export const AsanReporter = { processDirectory(); }, - observe(aSubject, aTopic, aData) { + observe(aSubject, aTopic) { if (aTopic == "ipc:content-shutdown") { aSubject.QueryInterface(Ci.nsIPropertyBag2); if (!aSubject.get("abnormal")) { @@ -135,7 +135,7 @@ function submitToServer(data) { tool: "asan-nightly-program", }; - var xhr = new XMLHttpRequest(); + var xhr = new XMLHttpRequest({ mozAnon: !auth_token }); xhr.open("POST", api_url, true); xhr.setRequestHeader("Content-Type", "application/json"); diff --git a/toolkit/modules/AsyncPrefs.sys.mjs b/toolkit/modules/AsyncPrefs.sys.mjs index 5fa0ea6d6f..07f08c119e 100644 --- a/toolkit/modules/AsyncPrefs.sys.mjs +++ b/toolkit/modules/AsyncPrefs.sys.mjs @@ -31,6 +31,11 @@ const kAllowedPrefs = new Set([ "reader.color_scheme", "reader.content_width", "reader.line_height", + "reader.custom_colors.foreground", + "reader.custom_colors.background", + "reader.custom_colors.unvisited-links", + "reader.custom_colors.visited-links", + "reader.custom_colors.selection-highlight", "security.tls.version.enable-deprecated", "security.xfocsp.errorReporting.automatic", @@ -103,7 +108,7 @@ export var AsyncPrefs = { return AsyncPrefsParent.set(pref, value); }, - reset(pref, value) { + reset(pref) { if (kInChildProcess) { return ChromeUtils.domProcessChild.getActor("AsyncPrefs").reset(pref); } diff --git a/toolkit/modules/BrowserTelemetryUtils.sys.mjs b/toolkit/modules/BrowserTelemetryUtils.sys.mjs index c3035974e8..39b1267642 100644 --- a/toolkit/modules/BrowserTelemetryUtils.sys.mjs +++ b/toolkit/modules/BrowserTelemetryUtils.sys.mjs @@ -64,7 +64,7 @@ export var BrowserTelemetryUtils = { } else if (currentTime >= this._lastRecordSiteOrigin + this.min_interval) { this._lastRecordSiteOrigin = currentTime; - Glean.geckoview.documentSiteOrigins.accumulateSamples([originCount]); + Glean.geckoview.documentSiteOrigins.accumulateSingleSample(originCount); } }, }; diff --git a/toolkit/modules/E10SUtils.sys.mjs b/toolkit/modules/E10SUtils.sys.mjs index 34da17fc50..c91bb2a80d 100644 --- a/toolkit/modules/E10SUtils.sys.mjs +++ b/toolkit/modules/E10SUtils.sys.mjs @@ -133,6 +133,7 @@ function validatedWebRemoteType( ) { // To load into the Privileged Mozilla Content Process you must be https, // and be an exact match or a subdomain of an allowlisted domain. + // This code is duplicated in ProcessIolation.cpp, please update both. if ( lazy.separatePrivilegedMozillaWebContentProcess && aTargetUri.asciiHost && diff --git a/toolkit/modules/FindBarContent.sys.mjs b/toolkit/modules/FindBarContent.sys.mjs index ef3a197d50..cdeead2a6e 100644 --- a/toolkit/modules/FindBarContent.sys.mjs +++ b/toolkit/modules/FindBarContent.sys.mjs @@ -20,7 +20,7 @@ export class FindBarContent { this.addedEventListener = false; } - start(event) { + start() { this.inPassThrough = true; } @@ -100,7 +100,7 @@ export class FindBarContent { this.actor.sendAsyncMessage("Findbar:Keypress", fakeEvent); } - onMouseup(event) { + onMouseup() { if (this.findMode != FIND_NORMAL) { this.actor.sendAsyncMessage("Findbar:Mouseup", {}); } diff --git a/toolkit/modules/Finder.sys.mjs b/toolkit/modules/Finder.sys.mjs index 0b54b2caad..f5d0452e39 100644 --- a/toolkit/modules/Finder.sys.mjs +++ b/toolkit/modules/Finder.sys.mjs @@ -100,7 +100,7 @@ Finder.prototype = { this._listeners = this._listeners.filter(l => l != aListener); }, - _setResults(options, mode) { + _setResults(options) { if (typeof options.storeResult != "boolean") { options.storeResult = true; } diff --git a/toolkit/modules/FinderHighlighter.sys.mjs b/toolkit/modules/FinderHighlighter.sys.mjs index 2ebf718bd0..655792e498 100644 --- a/toolkit/modules/FinderHighlighter.sys.mjs +++ b/toolkit/modules/FinderHighlighter.sys.mjs @@ -146,7 +146,7 @@ function mockAnonymousContentNode(domNode) { duration ); }, - setCutoutRectsForElement(id, rects) { + setCutoutRectsForElement() { // no-op for now. }, }; @@ -217,7 +217,7 @@ FinderHighlighter.prototype = { * @param {nsIDOMWindow} window * @return {Object} */ - getForWindow(window, propName = null) { + getForWindow(window) { if (!gWindows.has(window)) { gWindows.set(window, { detectedGeometryChange: false, @@ -661,7 +661,7 @@ FinderHighlighter.prototype = { this.setScrollMarks(window, Array.from(marks), onHorizontalScrollbar); if (!this._marksListener) { - this._marksListener = event => { + this._marksListener = () => { this.updateScrollMarks(); }; @@ -1966,7 +1966,7 @@ FinderHighlighter.prototype = { // Start of nsIEditActionListener implementations - WillDeleteText(textNode, offset, length) { + WillDeleteText(textNode, offset) { let editor = this._getEditableNode(textNode).editor; let controller = editor.selectionController; let fSelection = controller.getSelection( @@ -2131,7 +2131,7 @@ FinderHighlighter.prototype = { }, // Unimplemented - notifyDocumentStateChanged(aDirty) {}, + notifyDocumentStateChanged() {}, }; }, }; diff --git a/toolkit/modules/FinderParent.sys.mjs b/toolkit/modules/FinderParent.sys.mjs index 8c8437f5e9..1f66ec95b0 100644 --- a/toolkit/modules/FinderParent.sys.mjs +++ b/toolkit/modules/FinderParent.sys.mjs @@ -143,7 +143,7 @@ FinderParent.prototype = { let actor = windowGlobal.getActor("Finder"); return actor.sendQuery(aMessageName, aArgs).then( result => result, - r => {} + () => {} ); } diff --git a/toolkit/modules/GMPInstallManager.sys.mjs b/toolkit/modules/GMPInstallManager.sys.mjs index 41f57b9a63..c187215096 100644 --- a/toolkit/modules/GMPInstallManager.sys.mjs +++ b/toolkit/modules/GMPInstallManager.sys.mjs @@ -49,13 +49,23 @@ const LOCAL_GMP_SOURCES = [ }, ]; +function getLocalSources() { + if (GMPPrefs.getBool(GMPPrefs.KEY_ALLOW_LOCAL_SOURCES, true)) { + return LOCAL_GMP_SOURCES; + } + + let log = getScopedLogger("GMPInstallManager.checkForAddons"); + log.info("ignoring local sources"); + return []; +} + function downloadJSON(uri) { let log = getScopedLogger("GMPInstallManager.checkForAddons"); log.info("fetching config from: " + uri); return new Promise((resolve, reject) => { let xmlHttp = new lazy.ServiceRequest({ mozAnon: true }); - xmlHttp.onload = function (aResponse) { + xmlHttp.onload = function () { resolve(JSON.parse(this.responseText)); }; @@ -152,6 +162,36 @@ GMPInstallManager.prototype = { }, /** + * Determines the root to use for verifying content signatures. + * @param url + * The Balrog URL, i.e. the return value of _getURL(). + */ + _getContentSignatureRootForURL(url) { + // The prod and stage URLs of Balrog are documented at: + // https://mozilla-balrog.readthedocs.io/en/latest/infrastructure.html + // Note: we are matching by prefix without the full domain nor slash, to + // enable us to move to a different host name in the future if desired. + if (url.startsWith("https://aus")) { + return Ci.nsIContentSignatureVerifier.ContentSignatureProdRoot; + } + if (url.startsWith("https://stage.")) { + return Ci.nsIContentSignatureVerifier.ContentSignatureStageRoot; + } + if (Services.env.exists("XPCSHELL_TEST_PROFILE_DIR")) { + return Ci.nsIX509CertDB.AppXPCShellRoot; + } + // When content signature verification for GMP was added (bug 1714621), a + // pref existed to configure an arbitrary root, which enabled local testing. + // This pref was removed later in bug 1769669, and replaced with hard-coded + // roots (prod and tests only). Support for testing against the stage server + // was restored in bug 1771992. + // Note: other verifiers ultimately fall back to ContentSignatureLocalRoot, + // to support local development. Here we use ContentSignatureProdRoot to + // minimize risk (and the unclear demand for "local" development). + return Ci.nsIContentSignatureVerifier.ContentSignatureProdRoot; + }, + + /** * Records telemetry results on if fetching update.xml from Balrog succeeded * when content signature was used to verify the response from Balrog. * @param didGetAddonList @@ -325,9 +365,10 @@ GMPInstallManager.prototype = { } let url = await this._getURL(); + let trustedContentSignatureRoot = this._getContentSignatureRootForURL(url); log.info( - `Fetching product addon list url=${url}, allowNonBuiltIn=${allowNonBuiltIn}, certs=${certs}, checkContentSignature=${checkContentSignature}` + `Fetching product addon list url=${url}, allowNonBuiltIn=${allowNonBuiltIn}, certs=${certs}, checkContentSignature=${checkContentSignature}, trustedContentSignatureRoot=${trustedContentSignatureRoot}` ); let success = true; @@ -337,7 +378,8 @@ GMPInstallManager.prototype = { url, allowNonBuiltIn, certs, - checkContentSignature + checkContentSignature, + trustedContentSignatureRoot ); if (checkContentSignature) { @@ -354,10 +396,12 @@ GMPInstallManager.prototype = { } } + let localSources = getLocalSources(); + try { if (!success) { log.info("Falling back to local config"); - let fallbackSources = LOCAL_GMP_SOURCES.filter(function (gmpSource) { + let fallbackSources = localSources.filter(function (gmpSource) { return gmpSource.installByDefault; }); res = await downloadLocalConfig(fallbackSources); @@ -379,7 +423,7 @@ GMPInstallManager.prototype = { // the user has requested be forced installed regardless of our update // server configuration. try { - let forcedSources = LOCAL_GMP_SOURCES.filter(function (gmpSource) { + let forcedSources = localSources.filter(function (gmpSource) { return GMPPrefs.getBool( GMPPrefs.KEY_PLUGIN_FORCE_INSTALL, false, diff --git a/toolkit/modules/GMPUtils.sys.mjs b/toolkit/modules/GMPUtils.sys.mjs index 211c30a45f..e2fee781e1 100644 --- a/toolkit/modules/GMPUtils.sys.mjs +++ b/toolkit/modules/GMPUtils.sys.mjs @@ -134,6 +134,7 @@ export var GMPPrefs = { KEY_PLUGIN_FORCE_SUPPORTED: "media.{0}.forceSupported", KEY_PLUGIN_FORCE_INSTALL: "media.{0}.forceInstall", KEY_PLUGIN_ALLOW_X64_ON_ARM64: "media.{0}.allow-x64-plugin-on-arm64", + KEY_ALLOW_LOCAL_SOURCES: "media.gmp-manager.allowLocalSources", KEY_URL: "media.gmp-manager.url", KEY_URL_OVERRIDE: "media.gmp-manager.url.override", KEY_CERT_CHECKATTRS: "media.gmp-manager.cert.checkAttributes", diff --git a/toolkit/modules/HiddenFrame.sys.mjs b/toolkit/modules/HiddenFrame.sys.mjs index 23ad57c0d3..74fe755796 100644 --- a/toolkit/modules/HiddenFrame.sys.mjs +++ b/toolkit/modules/HiddenFrame.sys.mjs @@ -89,7 +89,7 @@ HiddenFrame.prototype = { "nsISupportsWeakReference", ]), }; - this._listener.onStateChange = (wbp, request, stateFlags, status) => { + this._listener.onStateChange = (wbp, request, stateFlags) => { if (!request) { return; } diff --git a/toolkit/modules/LightweightThemeConsumer.sys.mjs b/toolkit/modules/LightweightThemeConsumer.sys.mjs index 0d3993370b..c2ad888c22 100644 --- a/toolkit/modules/LightweightThemeConsumer.sys.mjs +++ b/toolkit/modules/LightweightThemeConsumer.sys.mjs @@ -30,7 +30,7 @@ const toolkitVariableMap = [ "--lwt-accent-color", { lwtProperty: "accentcolor", - processColor(rgbaChannels, element) { + processColor(rgbaChannels) { if (!rgbaChannels || rgbaChannels.a == 0) { return "white"; } @@ -44,7 +44,7 @@ const toolkitVariableMap = [ "--lwt-text-color", { lwtProperty: "textcolor", - processColor(rgbaChannels, element) { + processColor(rgbaChannels) { if (!rgbaChannels) { rgbaChannels = { r: 0, g: 0, b: 0 }; } @@ -147,7 +147,7 @@ const toolkitVariableMap = [ "--lwt-toolbar-field-highlight", { lwtProperty: "toolbar_field_highlight", - processColor(rgbaChannels, element) { + processColor(rgbaChannels) { if (!rgbaChannels) { return null; } @@ -226,7 +226,7 @@ export function LightweightThemeConsumer(aDocument) { LightweightThemeConsumer.prototype = { _lastData: null, - observe(aSubject, aTopic, aData) { + observe(aSubject, aTopic) { if (aTopic != "lightweight-theme-styling-update") { return; } @@ -311,29 +311,25 @@ LightweightThemeConsumer.prototype = { if (!theme) { theme = { id: DEFAULT_THEME_ID }; } - - let active = (this._active = Object.keys(theme).length); + let hasTheme = theme.id != DEFAULT_THEME_ID || useDarkTheme; let root = this._doc.documentElement; - - if (active && theme.headerURL) { + if (hasTheme && theme.headerURL) { root.setAttribute("lwtheme-image", "true"); } else { root.removeAttribute("lwtheme-image"); } - let hasTheme = theme.id != DEFAULT_THEME_ID || useDarkTheme; - - this._setExperiment(active, themeData.experiment, theme.experimental); - _setImage(this._win, root, active, "--lwt-header-image", theme.headerURL); + this._setExperiment(hasTheme, themeData.experiment, theme.experimental); + _setImage(this._win, root, hasTheme, "--lwt-header-image", theme.headerURL); _setImage( this._win, root, - active, + hasTheme, "--lwt-additional-images", theme.additionalBackgrounds ); - _setProperties(root, active, theme, hasTheme); + _setProperties(root, hasTheme, theme); if (hasTheme) { if (updateGlobalThemeData) { @@ -352,7 +348,7 @@ LightweightThemeConsumer.prototype = { _setDarkModeAttributes(this._doc, root, theme._processedColors, hasTheme); - let contentThemeData = _getContentProperties(this._doc, active, theme); + let contentThemeData = _getContentProperties(this._doc, hasTheme, theme); Services.ppmm.sharedData.set(`theme/${this._winId}`, contentThemeData); // We flush sharedData because contentThemeData can be responsible for // painting large background surfaces. If this data isn't delivered to the @@ -363,7 +359,7 @@ LightweightThemeConsumer.prototype = { this._win.dispatchEvent(new CustomEvent("windowlwthemeupdate")); }, - _setExperiment(active, experiment, properties) { + _setExperiment(hasTheme, experiment, properties) { const root = this._doc.documentElement; if (this._lastExperimentData) { const { stylesheet, usedVariables } = this._lastExperimentData; @@ -379,7 +375,7 @@ LightweightThemeConsumer.prototype = { this._lastExperimentData = {}; - if (!active || !experiment) { + if (!hasTheme || !experiment) { return; } @@ -427,11 +423,11 @@ LightweightThemeConsumer.prototype = { }, }; -function _getContentProperties(doc, active, data) { - if (!active) { - return {}; +function _getContentProperties(doc, hasTheme, data) { + let properties = { hasTheme }; + if (!hasTheme) { + return properties; } - let properties = {}; for (let property in data) { if (lazy.ThemeContentPropertyList.includes(property)) { properties[property] = _cssColorToRGBA(doc, data[property]); @@ -472,8 +468,8 @@ function _setImage(aWin, aRoot, aActive, aVariableName, aURLs) { ); } -function _setProperty(elem, active, variableName, value) { - if (active && value) { +function _setProperty(elem, hasTheme, variableName, value) { + if (hasTheme && value) { elem.style.setProperty(variableName, value); } else { elem.style.removeProperty(variableName); @@ -664,7 +660,7 @@ function _determineIfColorPairIsDark( return !_isColorDark(color.r, color.g, color.b); } -function _setProperties(root, active, themeData, hasTheme) { +function _setProperties(root, hasTheme, themeData) { let propertyOverrides = new Map(); let doc = root.ownerDocument; @@ -706,7 +702,7 @@ function _setProperties(root, active, themeData, hasTheme) { // Add processed color to themeData. themeData._processedColors[lwtProperty] = val; - _setProperty(elem, active, cssVarName, val); + _setProperty(elem, hasTheme, cssVarName, val); } } } diff --git a/toolkit/modules/NewTabUtils.sys.mjs b/toolkit/modules/NewTabUtils.sys.mjs index 00067ada12..4fb4c7f912 100644 --- a/toolkit/modules/NewTabUtils.sys.mjs +++ b/toolkit/modules/NewTabUtils.sys.mjs @@ -602,12 +602,12 @@ var PlacesProvider = { } }, - handleError(aError) { + handleError() { // Should we somehow handle this error? aCallback([]); }, - handleCompletion(aReason) { + handleCompletion() { // The Places query breaks ties in frecency by place ID descending, but // that's different from how Links.compareLinks breaks ties, because // compareLinks doesn't have access to place IDs. It's very important @@ -2101,7 +2101,7 @@ var Links = { * Implements the nsIObserver interface to get notified about browser history * sanitization. */ - observe: function Links_observe(aSubject, aTopic, aData) { + observe: function Links_observe() { // Make sure to update open about:newtab instances. If there are no opened // pages we can just wait for the next new tab to populate the cache again. if (AllPages.length && AllPages.enabled) { @@ -2182,7 +2182,7 @@ var Telemetry = { /** * Listens for gather telemetry topic. */ - observe: function Telemetry_observe(aSubject, aTopic, aData) { + observe: function Telemetry_observe() { this._collect(); }, }; diff --git a/toolkit/modules/PopupNotifications.sys.mjs b/toolkit/modules/PopupNotifications.sys.mjs index 2f4893a2f6..bb53e0a5f6 100644 --- a/toolkit/modules/PopupNotifications.sys.mjs +++ b/toolkit/modules/PopupNotifications.sys.mjs @@ -689,7 +689,7 @@ PopupNotifications.prototype = { */ suppressWhileOpen(panel) { this._hidePanel().catch(console.error); - panel.addEventListener("popuphidden", aEvent => { + panel.addEventListener("popuphidden", () => { this._update(); }); }, @@ -1369,7 +1369,7 @@ PopupNotifications.prototype = { true ); } - this._popupshownListener = function (e) { + this._popupshownListener = function () { target.removeEventListener( "popupshown", this._popupshownListener, @@ -1939,10 +1939,14 @@ PopupNotifications.prototype = { } if (type == "buttoncommand" || type == "secondarybuttoncommand") { - if (Services.focus.activeWindow != this.window) { + // TODO: Bug 1892756. + if ( + Services.focus.activeWindow != this.window || + notificationEl.matches(":-moz-window-inactive") + ) { Services.console.logStringMessage( "PopupNotifications._onButtonEvent: " + - "Button click happened before the window was focused" + "Button click happened before the window was focused / active" ); this.window.focus(); return; diff --git a/toolkit/modules/ProcessType.sys.mjs b/toolkit/modules/ProcessType.sys.mjs index f8dcfb6fae..4e1ef25552 100644 --- a/toolkit/modules/ProcessType.sys.mjs +++ b/toolkit/modules/ProcessType.sys.mjs @@ -14,6 +14,7 @@ export const ProcessType = Object.freeze({ rdd: "process-type-rdd", socket: "process-type-socket", utility: "process-type-utility", + forkServer: "process-type-forkserver", // Utility with actor names utility_audioDecoder_Generic: diff --git a/toolkit/modules/Region.sys.mjs b/toolkit/modules/Region.sys.mjs index a07e73f378..559273461f 100644 --- a/toolkit/modules/Region.sys.mjs +++ b/toolkit/modules/Region.sys.mjs @@ -843,7 +843,7 @@ class RegionDetector { } } - observe(aSubject, aTopic, aData) { + observe(aSubject, aTopic) { log.info(`Observed ${aTopic}`); switch (aTopic) { case GEOLOCATION_TOPIC: diff --git a/toolkit/modules/ShortcutUtils.sys.mjs b/toolkit/modules/ShortcutUtils.sys.mjs index e45855602b..3632c52e69 100644 --- a/toolkit/modules/ShortcutUtils.sys.mjs +++ b/toolkit/modules/ShortcutUtils.sys.mjs @@ -56,9 +56,12 @@ export var ShortcutUtils = { }, getModifierString(elemMod) { + if (!elemMod) { + return ""; + } + let elemString = ""; let haveCloverLeaf = false; - if (elemMod.match("accel")) { if (Services.appinfo.OS == "Darwin") { haveCloverLeaf = true; diff --git a/toolkit/modules/SubDialog.sys.mjs b/toolkit/modules/SubDialog.sys.mjs index 6cb8d3127e..07659e0a6b 100644 --- a/toolkit/modules/SubDialog.sys.mjs +++ b/toolkit/modules/SubDialog.sys.mjs @@ -229,7 +229,7 @@ SubDialog.prototype = { bubbles: true, detail: { dialog: this, abort: true }, }); - this._frame.contentWindow.close(); + this._frame.contentWindow?.close(); // It's possible that we're aborting this dialog before we've had a // chance to set up the contentWindow.close function override in // _onContentLoaded. If so, call this.close() directly to clean things @@ -419,6 +419,11 @@ SubDialog.prototype = { ); }; + // Defining resizeDialog on the contentWindow object to resize dialogs when prompted + this._frame.contentWindow.resizeDialog = () => { + return this.resizeDialog(); + }; + // Make window.close calls work like dialog closing. let oldClose = this._frame.contentWindow.close; this._frame.contentWindow.close = () => { @@ -484,6 +489,33 @@ SubDialog.prototype = { }, async resizeDialog() { + this.resizeHorizontally(); + this.resizeVertically(); + + this._overlay.dispatchEvent( + new CustomEvent("dialogopen", { + bubbles: true, + detail: { dialog: this }, + }) + ); + this._overlay.style.visibility = "inherit"; + this._overlay.style.opacity = ""; // XXX: focus hack continued from _onContentLoaded + + if (this._box.getAttribute("resizable") == "true") { + this._onResize = this._onResize.bind(this); + this._resizeObserver = new this._window.MutationObserver(this._onResize); + this._resizeObserver.observe(this._box, { attributes: true }); + } + + this._trapFocus(); + + this._resizeCallback?.({ + title: this._titleElement, + frame: this._frame, + }); + }, + + resizeHorizontally() { // Do this on load to wait for the CSS to load and apply before calculating the size. let docEl = this._frame.contentDocument.documentElement; @@ -529,30 +561,6 @@ SubDialog.prototype = { boxMinWidth = `min(80vw, ${boxMinWidth})`; } this._box.style.minWidth = boxMinWidth; - - this.resizeVertically(); - - this._overlay.dispatchEvent( - new CustomEvent("dialogopen", { - bubbles: true, - detail: { dialog: this }, - }) - ); - this._overlay.style.visibility = "inherit"; - this._overlay.style.opacity = ""; // XXX: focus hack continued from _onContentLoaded - - if (this._box.getAttribute("resizable") == "true") { - this._onResize = this._onResize.bind(this); - this._resizeObserver = new this._window.MutationObserver(this._onResize); - this._resizeObserver.observe(this._box, { attributes: true }); - } - - this._trapFocus(); - - this._resizeCallback?.({ - title: this._titleElement, - frame: this._frame, - }); }, resizeVertically() { diff --git a/toolkit/modules/Troubleshoot.sys.mjs b/toolkit/modules/Troubleshoot.sys.mjs index 43b8c1ca51..c716f1d941 100644 --- a/toolkit/modules/Troubleshoot.sys.mjs +++ b/toolkit/modules/Troubleshoot.sys.mjs @@ -22,6 +22,7 @@ const PREFS_FOR_DISPLAY = [ "apz.", "browser.cache.", "browser.contentblocking.category", + "browser.contentanalysis.", "browser.display.", "browser.download.always_ask_before_handling_new_types", "browser.download.enable_spam_prevention", @@ -999,6 +1000,24 @@ var dataProviders = { }); }, + contentAnalysis: async function contentAnalysis(done) { + const contentAnalysis = Cc["@mozilla.org/contentanalysis;1"].getService( + Ci.nsIContentAnalysis + ); + if (!contentAnalysis.isActive) { + done({ active: false }); + return; + } + let info = await contentAnalysis.getDiagnosticInfo(); + done({ + active: true, + connected: info.connectedToAgent, + agentPath: info.agentPath, + failedSignatureVerification: info.failedSignatureVerification, + requestCount: info.requestCount, + }); + }, + async normandy(done) { if (!AppConstants.MOZ_NORMANDY) { done(); diff --git a/toolkit/modules/UpdateUtils.sys.mjs b/toolkit/modules/UpdateUtils.sys.mjs index 01149dbae3..be9ce9d540 100644 --- a/toolkit/modules/UpdateUtils.sys.mjs +++ b/toolkit/modules/UpdateUtils.sys.mjs @@ -269,7 +269,7 @@ export var UpdateUtils = { initialConfig[prefName] = initialValue; } catch (e) {} - Services.prefs.addObserver(prefName, async (subject, topic, data) => { + Services.prefs.addObserver(prefName, async () => { let config = { ...gUpdateConfigCache }; config[prefName] = await UpdateUtils.readUpdateConfigSetting( prefName diff --git a/toolkit/modules/moz.build b/toolkit/modules/moz.build index 07924cedba..ab7dcb284b 100644 --- a/toolkit/modules/moz.build +++ b/toolkit/modules/moz.build @@ -227,7 +227,6 @@ EXTRA_JS_MODULES.sessionstore += [ "sessionstore/PrivacyFilter.sys.mjs", "sessionstore/PrivacyLevel.sys.mjs", "sessionstore/SessionHistory.sys.mjs", - "sessionstore/Utils.sys.mjs", ] EXTRA_JS_MODULES.third_party.fathom += ["third_party/fathom/fathom.mjs"] diff --git a/toolkit/modules/sessionstore/Utils.sys.mjs b/toolkit/modules/sessionstore/Utils.sys.mjs deleted file mode 100644 index 627cd22686..0000000000 --- a/toolkit/modules/sessionstore/Utils.sys.mjs +++ /dev/null @@ -1,29 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -export var Utils = Object.freeze({ - /** - * Restores frame tree |data|, starting at the given root |frame|. As the - * function recurses into descendant frames it will call cb(frame, data) for - * each frame it encounters, starting with the given root. - */ - restoreFrameTreeData(frame, data, cb) { - // Restore data for the root frame. - // The callback can abort by returning false. - if (cb(frame, data) === false) { - return; - } - - if (!data.hasOwnProperty("children")) { - return; - } - - // Recurse into child frames. - SessionStoreUtils.forEachNonDynamicChildFrame(frame, (subframe, index) => { - if (data.children[index]) { - this.restoreFrameTreeData(subframe, data.children[index], cb); - } - }); - }, -}); diff --git a/toolkit/modules/tests/browser/browser_Finder.js b/toolkit/modules/tests/browser/browser_Finder.js index 7bcf7e8a00..03724d2548 100644 --- a/toolkit/modules/tests/browser/browser_Finder.js +++ b/toolkit/modules/tests/browser/browser_Finder.js @@ -44,7 +44,7 @@ add_task(async function () { findResult = await promiseFind; is(findResult.result, Ci.nsITypeAheadFind.FIND_FOUND, "should find link"); - await SpecialPowers.spawn(tab.linkedBrowser, [], async function (arg) { + await SpecialPowers.spawn(tab.linkedBrowser, [], async function () { Assert.ok( !!content.document.getElementsByTagName("a")[0].style.outline, "outline set" @@ -61,7 +61,7 @@ add_task(async function () { "should find link again" ); - await SpecialPowers.spawn(tab.linkedBrowser, [], async function (arg) { + await SpecialPowers.spawn(tab.linkedBrowser, [], async function () { Assert.ok( !content.document.getElementsByTagName("a")[0].style.outline, "outline not set" diff --git a/toolkit/modules/tests/browser/browser_FinderHighlighter.js b/toolkit/modules/tests/browser/browser_FinderHighlighter.js index 7e377e47d1..be4f0fefef 100644 --- a/toolkit/modules/tests/browser/browser_FinderHighlighter.js +++ b/toolkit/modules/tests/browser/browser_FinderHighlighter.js @@ -33,7 +33,7 @@ add_task(async function testModalResults() { insertCalls: [5, 6], removeCalls: [4, 5], // eslint-disable-next-line object-shorthand - extraTest: function (maskNode, outlineNode, rects) { + extraTest: function (maskNode, outlineNode) { Assert.equal( outlineNode.getElementsByTagName("div").length, 2, diff --git a/toolkit/modules/tests/browser/browser_Troubleshoot.js b/toolkit/modules/tests/browser/browser_Troubleshoot.js index d627f175e4..dbfbe69909 100644 --- a/toolkit/modules/tests/browser/browser_Troubleshoot.js +++ b/toolkit/modules/tests/browser/browser_Troubleshoot.js @@ -1288,6 +1288,27 @@ const SNAPSHOT_SCHEMA = { }, }, }, + contentAnalysis: { + type: "object", + properties: { + active: { + required: true, + type: "boolean", + }, + connected: { + type: "boolean", + }, + agentPath: { + type: "string", + }, + failedSignatureVerification: { + type: "boolean", + }, + requestCount: { + type: "number", + }, + }, + }, }, }; @@ -1346,9 +1367,9 @@ function validateObject_array(array, schema) { array.forEach(elt => validateObject(elt, schema.items)); } -function validateObject_string(str, schema) {} -function validateObject_boolean(bool, schema) {} -function validateObject_number(num, schema) {} +function validateObject_string() {} +function validateObject_boolean() {} +function validateObject_number() {} function validationErr(msg, obj, schema) { return new Error( diff --git a/toolkit/modules/tests/browser/browser_web_channel.js b/toolkit/modules/tests/browser/browser_web_channel.js index 9dfa59485b..289e4d1d14 100644 --- a/toolkit/modules/tests/browser/browser_web_channel.js +++ b/toolkit/modules/tests/browser/browser_web_channel.js @@ -23,10 +23,10 @@ var gTests = [ { desc: "WebChannel generic message", run() { - return new Promise(function (resolve, reject) { + return new Promise(function (resolve) { let tab; let channel = new WebChannel("generic", Services.io.newURI(HTTP_PATH)); - channel.listen(function (id, message, target) { + channel.listen(function (id, message) { is(id, "generic"); is(message.something.nested, "hello"); channel.stopListening(); @@ -44,9 +44,9 @@ var gTests = [ { desc: "WebChannel generic message in a private window.", async run() { - let promiseTestDone = new Promise(function (resolve, reject) { + let promiseTestDone = new Promise(function (resolve) { let channel = new WebChannel("generic", Services.io.newURI(HTTP_PATH)); - channel.listen(function (id, message, target) { + channel.listen(function (id, message) { is(id, "generic"); is(message.something.nested, "hello"); channel.stopListening(); @@ -66,7 +66,7 @@ var gTests = [ { desc: "WebChannel two way communication", run() { - return new Promise(function (resolve, reject) { + return new Promise(function (resolve) { let tab; let channel = new WebChannel("twoway", Services.io.newURI(HTTP_PATH)); @@ -102,7 +102,7 @@ var gTests = [ Services.io.newURI(HTTP_IFRAME_PATH) ); let promiseTestDone = new Promise(function (resolve, reject) { - parentChannel.listen(function (id, message, sender) { + parentChannel.listen(function () { reject(new Error("WebChannel message incorrectly sent to parent")); }); @@ -218,14 +218,14 @@ var gTests = [ { desc: "WebChannel multichannel", run() { - return new Promise(function (resolve, reject) { + return new Promise(function (resolve) { let tab; let channel = new WebChannel( "multichannel", Services.io.newURI(HTTP_PATH) ); - channel.listen(function (id, message, sender) { + channel.listen(function (id) { is(id, "multichannel"); gBrowser.removeTab(tab); resolve(); @@ -246,8 +246,8 @@ var gTests = [ // an unsolicted message is sent from Chrome->Content which is then // echoed back. If the echo is received here, then the content // received the message. - let messagePromise = new Promise(function (resolve, reject) { - channel.listen(function (id, message, sender) { + let messagePromise = new Promise(function (resolve) { + channel.listen(function (id, message) { is(id, "echo"); is(message.command, "unsolicited"); @@ -283,8 +283,8 @@ var gTests = [ // an unsolicted message is sent from Chrome->Content which is then // echoed back. If the echo is received here, then the content // received the message. - let messagePromise = new Promise(function (resolve, reject) { - channel.listen(function (id, message, sender) { + let messagePromise = new Promise(function (resolve) { + channel.listen(function (id, message) { is(id, "echo"); is(message.command, "unsolicited"); @@ -326,7 +326,7 @@ var gTests = [ // and should not be echoed back. The second, `done`, is sent to the // correct principal and should be echoed back. let messagePromise = new Promise(function (resolve, reject) { - channel.listen(function (id, message, sender) { + channel.listen(function (id, message) { is(id, "echo"); if (message.command === "done") { @@ -435,8 +435,8 @@ var gTests = [ * message. */ let channel = new WebChannel("objects", Services.io.newURI(HTTP_PATH)); - let testDonePromise = new Promise((resolve, reject) => { - channel.listen((id, message, sender) => { + let testDonePromise = new Promise(resolve => { + channel.listen((id, message) => { is(id, "objects"); is(message.type, "string"); resolve(); @@ -466,7 +466,7 @@ var gTests = [ let testDonePromise = new Promise((resolve, reject) => { let sawObject = false; let sawString = false; - channel.listen((id, message, sender) => { + channel.listen((id, message) => { is(id, "objects"); if (message.type === "object") { ok(!sawObject); @@ -509,9 +509,9 @@ var gTests = [ // The channel where we see the response when the content sees the error let echoChannel = new WebChannel("echo", Services.io.newURI(HTTP_PATH)); - let testDonePromise = new Promise((resolve, reject) => { + let testDonePromise = new Promise(resolve => { // listen for the confirmation that content saw the error. - echoChannel.listen((id, message, sender) => { + echoChannel.listen((id, message) => { is(id, "echo"); is(message.error, "oh no"); is(message.errno, ERRNO_UNKNOWN_ERROR); @@ -519,7 +519,7 @@ var gTests = [ }); // listen for a message telling us to simulate an error. - channel.listen((id, message, sender) => { + channel.listen((id, message) => { is(id, "error"); is(message.command, "oops"); throw new Error("oh no"); @@ -545,9 +545,9 @@ var gTests = [ // The channel where we see the response when the content sees the error let echoChannel = new WebChannel("echo", Services.io.newURI(HTTP_PATH)); - let testDonePromise = new Promise((resolve, reject) => { + let testDonePromise = new Promise(resolve => { // listen for the confirmation that content saw the error. - echoChannel.listen((id, message, sender) => { + echoChannel.listen((id, message) => { is(id, "echo"); is(message.error, "No Such Channel"); is(message.errno, ERRNO_NO_SUCH_CHANNEL); diff --git a/toolkit/modules/tests/browser/head.js b/toolkit/modules/tests/browser/head.js index 7c3f75b106..84bfad9328 100644 --- a/toolkit/modules/tests/browser/head.js +++ b/toolkit/modules/tests/browser/head.js @@ -87,7 +87,7 @@ function promiseTestHighlighterOutput( browser, [{ word, expectedResult, extraTest: extraTest.toSource() }], async function ({ word, expectedResult, extraTest }) { - return new Promise((resolve, reject) => { + return new Promise(resolve => { let stubbed = {}; let callCounts = { insertCalls: [], diff --git a/toolkit/modules/tests/modules/MockDocument.sys.mjs b/toolkit/modules/tests/modules/MockDocument.sys.mjs index 163beb8450..d4c2b07205 100644 --- a/toolkit/modules/tests/modules/MockDocument.sys.mjs +++ b/toolkit/modules/tests/modules/MockDocument.sys.mjs @@ -40,7 +40,7 @@ export const MockDocument = { // Mock the document.location object so we can unit test without a frame. We use a proxy // instead of just assigning to the property since it's not configurable or writable. let document = new Proxy(aDoc, { - get(target, property, receiver) { + get(target, property) { // document.location is normally null when a document is outside of a "browsing context". // See https://html.spec.whatwg.org/#the-location-interface if (property == "location") { diff --git a/toolkit/modules/tests/modules/PromiseTestUtils.sys.mjs b/toolkit/modules/tests/modules/PromiseTestUtils.sys.mjs index 2286ac03da..ffdb8c37d6 100644 --- a/toolkit/modules/tests/modules/PromiseTestUtils.sys.mjs +++ b/toolkit/modules/tests/modules/PromiseTestUtils.sys.mjs @@ -11,8 +11,8 @@ import { Assert } from "resource://testing-common/Assert.sys.mjs"; export var PromiseTestUtils = { /** * Array of objects containing the details of the Promise rejections that are - * currently left uncaught. This includes DOM Promise and Promise.jsm. When - * rejections in DOM Promises are consumed, they are removed from this list. + * currently left uncaught. When rejections in DOM Promises are consumed, they + * are removed from this list. * * The objects contain at least the following properties: * { diff --git a/toolkit/modules/tests/xpcshell/test_DeferredTask.js b/toolkit/modules/tests/xpcshell/test_DeferredTask.js index e6c58e03db..cb1cc2d600 100644 --- a/toolkit/modules/tests/xpcshell/test_DeferredTask.js +++ b/toolkit/modules/tests/xpcshell/test_DeferredTask.js @@ -389,7 +389,7 @@ add_test(function test_finalize() { let finalized = false; // Let idleDispatch take longer. - replaceIdleDispatch((callback, timeout) => { + replaceIdleDispatch(callback => { Assert.ok(!idleStarted); idleStarted = true; do_timeout(T, callback); diff --git a/toolkit/modules/tests/xpcshell/test_FinderIterator.js b/toolkit/modules/tests/xpcshell/test_FinderIterator.js index fcbe97ba5f..5125740c55 100644 --- a/toolkit/modules/tests/xpcshell/test_FinderIterator.js +++ b/toolkit/modules/tests/xpcshell/test_FinderIterator.js @@ -7,7 +7,7 @@ let finderIterator = new FinderIterator(); var gFindResults = []; // Stub the method that instantiates nsIFind and does all the interaction with // the docShell to be searched through. -finderIterator._iterateDocument = function* (word, window, finder) { +finderIterator._iterateDocument = function* () { for (let range of gFindResults) { yield range; } @@ -117,7 +117,7 @@ add_task(async function test_valid_arguments() { entireWord: false, finder: gMockFinder, listener: { - onIteratorRangeFound(range) { + onIteratorRangeFound() { ++count; }, }, @@ -136,7 +136,7 @@ add_task(async function test_valid_arguments() { finderIterator.start({ entireWord: false, listener: { - onIteratorRangeFound(range) { + onIteratorRangeFound() { ++count; }, }, @@ -154,7 +154,7 @@ add_task(async function test_valid_arguments() { caseSensitive: false, entireWord: false, listener: { - onIteratorRangeFound(range) { + onIteratorRangeFound() { ++count; }, }, @@ -170,7 +170,7 @@ add_task(async function test_valid_arguments() { finderIterator.start({ caseSensitive: false, listener: { - onIteratorRangeFound(range) { + onIteratorRangeFound() { ++count; }, }, @@ -188,7 +188,7 @@ add_task(async function test_valid_arguments() { caseSensitive: false, entireWord: false, listener: { - onIteratorRangeFound(range) { + onIteratorRangeFound() { ++count; }, }, @@ -221,7 +221,7 @@ add_task(async function test_valid_arguments() { entireWord: true, finder: gMockFinder, listener: { - onIteratorRangeFound(range) { + onIteratorRangeFound() { ++count; }, }, @@ -246,7 +246,7 @@ add_task(async function test_stop() { entireWord: false, finder: gMockFinder, listener: { - onIteratorRangeFound(range) { + onIteratorRangeFound() { ++count; }, }, @@ -274,7 +274,7 @@ add_task(async function test_reset() { entireWord: false, finder: gMockFinder, listener: { - onIteratorRangeFound(range) { + onIteratorRangeFound() { ++count; }, }, @@ -317,7 +317,7 @@ add_task(async function test_parallel_starts() { entireWord: false, finder: gMockFinder, listener: { - onIteratorRangeFound(range) { + onIteratorRangeFound() { ++count; }, }, @@ -334,7 +334,7 @@ add_task(async function test_parallel_starts() { entireWord: false, finder: gMockFinder, listener: { - onIteratorRangeFound(range) { + onIteratorRangeFound() { ++count2; }, }, @@ -385,7 +385,7 @@ add_task(async function test_allowDistance() { entireWord: false, finder: gMockFinder, listener: { - onIteratorRangeFound(range) { + onIteratorRangeFound() { ++count; }, }, @@ -399,7 +399,7 @@ add_task(async function test_allowDistance() { entireWord: false, finder: gMockFinder, listener: { - onIteratorRangeFound(range) { + onIteratorRangeFound() { ++count2; }, }, @@ -414,7 +414,7 @@ add_task(async function test_allowDistance() { entireWord: false, finder: gMockFinder, listener: { - onIteratorRangeFound(range) { + onIteratorRangeFound() { ++count3; }, }, diff --git a/toolkit/modules/tests/xpcshell/test_GMPInstallManager.js b/toolkit/modules/tests/xpcshell/test_GMPInstallManager.js index a0d12b8a6a..be1be93968 100644 --- a/toolkit/modules/tests/xpcshell/test_GMPInstallManager.js +++ b/toolkit/modules/tests/xpcshell/test_GMPInstallManager.js @@ -837,6 +837,60 @@ add_task(async function test_checkForAddons_contentSignatureFailure() { }); /** + * Tests that the signature verification URL is as expected. + */ +add_task(async function test_checkForAddons_get_verifier_url() { + const previousUrlOverride = setupContentSigTestPrefs(); + + let installManager = new GMPInstallManager(); + // checkForAddons() calls _getContentSignatureRootForURL() with the return + // value of _getURL(), which is effectively KEY_URL_OVERRIDE or KEY_URL + // followed by some normalization. + const rootForUrl = async () => { + const url = await installManager._getURL(); + return installManager._getContentSignatureRootForURL(url); + }; + + Assert.equal( + await rootForUrl(), + Ci.nsIX509CertDB.AppXPCShellRoot, + "XPCShell root used by default in xpcshell test" + ); + + const defaultPrefs = Services.prefs.getDefaultBranch(""); + const defaultUrl = defaultPrefs.getStringPref(GMPPrefs.KEY_URL); + Preferences.set(GMPPrefs.KEY_URL_OVERRIDE, defaultUrl); + Assert.equal( + await rootForUrl(), + Ci.nsIContentSignatureVerifier.ContentSignatureProdRoot, + "Production cert should be used for the default Balrog URL: " + defaultUrl + ); + + // The current Balrog endpoint is at aus5.mozilla.org. Confirm that the prod + // cert is used even if we bump the version (e.g. aus6): + const potentialProdUrl = "https://aus1337.mozilla.org/potential/prod/URL"; + Preferences.set(GMPPrefs.KEY_URL_OVERRIDE, potentialProdUrl); + Assert.equal( + await rootForUrl(), + Ci.nsIContentSignatureVerifier.ContentSignatureProdRoot, + "Production cert should be used for: " + potentialProdUrl + ); + + // Stage URL documented at https://mozilla-balrog.readthedocs.io/en/latest/infrastructure.html + const stageUrl = "https://stage.balrog.nonprod.cloudops.mozgcp.net/etc."; + Preferences.set(GMPPrefs.KEY_URL_OVERRIDE, stageUrl); + Assert.equal( + await rootForUrl(), + Ci.nsIContentSignatureVerifier.ContentSignatureStageRoot, + "Stage cert should be used with the stage URL: " + stageUrl + ); + + installManager.uninit(); + + revertContentSigTestPrefs(previousUrlOverride); +}); + +/** * Tests that checkForAddons() works as expected when certificate pinning * checking is enabled. We plan to move away from cert pinning in favor of * content signature checks, but part of doing this is comparing the telemetry @@ -1175,7 +1229,7 @@ add_test(function test_installAddon_noServer() { GMPInstallManager.overrideLeaveDownloadedZip = true; let installPromise = installManager.installAddon(gmpAddon); installPromise.then( - extractedPaths => { + () => { do_throw("No server for install should reject"); }, err => { @@ -1324,8 +1378,8 @@ function mockRequest(inputStatus, inputResponse, options) { this._options = options || {}; } mockRequest.prototype = { - overrideMimeType(aMimetype) {}, - setRequestHeader(aHeader, aValue) {}, + overrideMimeType() {}, + setRequestHeader() {}, status: null, channel: { set notificationCallbacks(aVal) {} }, open(aMethod, aUrl) { @@ -1339,7 +1393,7 @@ mockRequest.prototype = { }, responseXML: null, responseText: null, - send(aBody) { + send() { executeSoon(() => { try { if (this._options.dropRequest) { @@ -1427,9 +1481,8 @@ mockRequest.prototype = { } } }, - addEventListener(aEvent, aValue, aCapturing) { - // eslint-disable-next-line no-eval - eval("this._on" + aEvent + " = aValue"); + addEventListener(aEvent, aValue) { + this[`_on${aEvent}`] = aValue; }, get wrappedJSObject() { return this; diff --git a/toolkit/modules/tests/xpcshell/test_Integration.js b/toolkit/modules/tests/xpcshell/test_Integration.js index 8213e32592..d0f53cc22a 100644 --- a/toolkit/modules/tests/xpcshell/test_Integration.js +++ b/toolkit/modules/tests/xpcshell/test_Integration.js @@ -170,7 +170,7 @@ add_task(async function test_override_super_multiple() { * ensures that this does not block other functions from being registered. */ add_task(async function test_override_error() { - let errorOverrideFn = base => { + let errorOverrideFn = () => { throw new Error("Expected error."); }; diff --git a/toolkit/modules/tests/xpcshell/test_Log.js b/toolkit/modules/tests/xpcshell/test_Log.js index c9fc367dc3..5989dbb78f 100644 --- a/toolkit/modules/tests/xpcshell/test_Log.js +++ b/toolkit/modules/tests/xpcshell/test_Log.js @@ -362,7 +362,6 @@ add_task(async function log_template_literal_message() { /* * Check that we format JS Errors reasonably. - * This needs to stay a generator to exercise Task.jsm's stack rewriting. */ add_task(async function format_errors() { let pFormat = new Log.ParameterFormatter(); @@ -386,8 +385,6 @@ add_task(async function format_errors() { // lineNumber:columnNumber. Assert.ok(str.includes(":1:12)")); // Make sure that we use human-readable stack traces - // Check that the error doesn't contain any reference to "Task.jsm" - Assert.ok(!str.includes("Task.jsm")); Assert.ok(str.includes("format_errors")); } }); diff --git a/toolkit/modules/tests/xpcshell/test_PermissionsUtils.js b/toolkit/modules/tests/xpcshell/test_PermissionsUtils.js index a712044359..80154a0c67 100644 --- a/toolkit/modules/tests/xpcshell/test_PermissionsUtils.js +++ b/toolkit/modules/tests/xpcshell/test_PermissionsUtils.js @@ -2,7 +2,7 @@ * http://creativecommons.org/publicdomain/zero/1.0/ */ -// Tests that PerrmissionsUtils.jsm works as expected, including: +// Tests that PerrmissionsUtils.sys.mjs works as expected, including: // * PermissionsUtils.importfromPrefs() // <ROOT>.[whitelist|blacklist].add preferences are emptied when // converted into permissions on startup. diff --git a/toolkit/modules/tests/xpcshell/test_UpdateUtils_updatechannel.js b/toolkit/modules/tests/xpcshell/test_UpdateUtils_updatechannel.js index 81db867ba4..2dc4654492 100644 --- a/toolkit/modules/tests/xpcshell/test_UpdateUtils_updatechannel.js +++ b/toolkit/modules/tests/xpcshell/test_UpdateUtils_updatechannel.js @@ -25,6 +25,7 @@ add_task(async function test_updatechannel() { Assert.equal(UpdateUtils.getUpdateChannel(true), currentChannel); Assert.equal(UpdateUtils.getUpdateChannel(false), currentChannel); + defaultPrefs.unlock(PREF_APP_UPDATE_CHANNEL); defaultPrefs.set(PREF_APP_UPDATE_CHANNEL, TEST_CHANNEL); Assert.equal(UpdateUtils.UpdateChannel, TEST_CHANNEL); Assert.equal(UpdateUtils.getUpdateChannel(true), TEST_CHANNEL); diff --git a/toolkit/modules/tests/xpcshell/test_UpdateUtils_url.js b/toolkit/modules/tests/xpcshell/test_UpdateUtils_url.js index 00176a5f3a..b8618291f8 100644 --- a/toolkit/modules/tests/xpcshell/test_UpdateUtils_url.js +++ b/toolkit/modules/tests/xpcshell/test_UpdateUtils_url.js @@ -34,6 +34,7 @@ const gAppInfo = getAppInfo(); const gDefaultPrefBranch = Services.prefs.getDefaultBranch(null); function setUpdateChannel(aChannel) { + gDefaultPrefBranch.unlockPref(PREF_APP_UPDATE_CHANNEL); gDefaultPrefBranch.setCharPref(PREF_APP_UPDATE_CHANNEL, aChannel); } diff --git a/toolkit/modules/tests/xpcshell/test_sqlite.js b/toolkit/modules/tests/xpcshell/test_sqlite.js index e0a79e137d..bea349ded4 100644 --- a/toolkit/modules/tests/xpcshell/test_sqlite.js +++ b/toolkit/modules/tests/xpcshell/test_sqlite.js @@ -334,12 +334,9 @@ add_task(async function test_execute_invalid_statement() { await new Promise(resolve => { Assert.equal(c._connectionData._anonymousStatements.size, 0); - c.execute("SELECT invalid FROM unknown").then( - do_throw, - function onError(error) { - resolve(); - } - ); + c.execute("SELECT invalid FROM unknown").then(do_throw, function onError() { + resolve(); + }); }); // Ensure we don't leak the statement instance. @@ -366,15 +363,11 @@ add_task(async function test_on_row_exception_ignored() { } let i = 0; - let hasResult = await c.execute( - "SELECT * FROM DIRS", - null, - function onRow(row) { - i++; + let hasResult = await c.execute("SELECT * FROM DIRS", null, function onRow() { + i++; - throw new Error("Some silly error."); - } - ); + throw new Error("Some silly error."); + }); Assert.equal(hasResult, true); Assert.equal(i, 10); @@ -418,7 +411,7 @@ add_task(async function test_on_row_stop_iteration() { let hasResult = await c.execute( `SELECT * FROM dirs WHERE path="nonexistent"`, null, - function onRow(row) { + function onRow() { i++; } ); @@ -473,7 +466,7 @@ add_task(async function test_execute_transaction_rollback() { // We should never get here. do_throw(); - }).then(do_throw, function onError(error) { + }).then(do_throw, function onError() { deferred.resolve(); }); @@ -490,7 +483,7 @@ add_task(async function test_close_during_transaction() { await c.execute("INSERT INTO dirs (path) VALUES ('foo')"); - let promise = c.executeTransaction(async function transaction(conn) { + let promise = c.executeTransaction(async function transaction() { await c.execute("INSERT INTO dirs (path) VALUES ('bar')"); }); await c.close(); @@ -801,7 +794,7 @@ add_task(async function test_discard_while_active() { let discarded = -1; let first = true; let sql = "SELECT * FROM dirs"; - await c.executeCached(sql, null, function onRow(row) { + await c.executeCached(sql, null, function onRow() { if (!first) { return; } @@ -1010,7 +1003,7 @@ add_task(async function test_direct() { let deferred = Promise.withResolvers(); begin.executeAsync({ - handleCompletion(reason) { + handleCompletion() { deferred.resolve(); }, }); @@ -1021,7 +1014,7 @@ add_task(async function test_direct() { deferred = Promise.withResolvers(); print("Executing async."); statement.executeAsync({ - handleResult(resultSet) {}, + handleResult() {}, handleError(error) { print( @@ -1031,7 +1024,7 @@ add_task(async function test_direct() { deferred.reject(); }, - handleCompletion(reason) { + handleCompletion() { print("Completed."); deferred.resolve(); }, @@ -1041,7 +1034,7 @@ add_task(async function test_direct() { deferred = Promise.withResolvers(); end.executeAsync({ - handleCompletion(reason) { + handleCompletion() { deferred.resolve(); }, }); diff --git a/toolkit/modules/tests/xpcshell/test_web_channel.js b/toolkit/modules/tests/xpcshell/test_web_channel.js index 6d62762e97..a45f52efde 100644 --- a/toolkit/modules/tests/xpcshell/test_web_channel.js +++ b/toolkit/modules/tests/xpcshell/test_web_channel.js @@ -37,7 +37,7 @@ var MockWebChannelBroker = { * Test channel listening with originOrPermission being an nsIURI. */ add_task(function test_web_channel_listen() { - return new Promise((resolve, reject) => { + return new Promise(resolve => { let channel = new WebChannel( VALID_WEB_CHANNEL_ID, VALID_WEB_CHANNEL_ORIGIN, @@ -94,7 +94,7 @@ add_task(function test_web_channel_listen() { * Test channel listening with originOrPermission being a permission string. */ add_task(function test_web_channel_listen_permission() { - return new Promise((resolve, reject) => { + return new Promise(resolve => { // add a new permission PermissionTestUtils.add( VALID_WEB_CHANNEL_ORIGIN, diff --git a/toolkit/modules/tests/xpcshell/test_web_channel_broker.js b/toolkit/modules/tests/xpcshell/test_web_channel_broker.js index 232e02e935..3e3d4efc0e 100644 --- a/toolkit/modules/tests/xpcshell/test_web_channel_broker.js +++ b/toolkit/modules/tests/xpcshell/test_web_channel_broker.js @@ -44,7 +44,7 @@ add_test(function test_web_channel_broker_channel_map() { * Test WebChannelBroker _listener test */ add_task(function test_web_channel_broker_listener() { - return new Promise((resolve, reject) => { + return new Promise(resolve => { var channel = { id: VALID_WEB_CHANNEL_ID, _originCheckCallback: requestPrincipal => { |