forked from mirrors/gecko-dev
Backed out changeset 0d0223fcdc02 (bug 1812141) for xpcshelll failures on test_ClientEnvironment.js. CLOSED TREE
This commit is contained in:
parent
bb430b7130
commit
f44882d7b1
20 changed files with 72 additions and 73 deletions
|
|
@ -1,23 +1,31 @@
|
|||
/* 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";
|
||||
|
||||
var EXPORTED_SYMBOLS = ["AttributionCode", "AttributionIOUtils"];
|
||||
|
||||
/**
|
||||
* This is a policy object used to override behavior for testing.
|
||||
*/
|
||||
export const AttributionIOUtils = {
|
||||
const AttributionIOUtils = {
|
||||
write: async (path, bytes) => IOUtils.write(path, bytes),
|
||||
read: async path => IOUtils.read(path),
|
||||
exists: async path => IOUtils.exists(path),
|
||||
};
|
||||
|
||||
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
|
||||
import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
|
||||
|
||||
const { XPCOMUtils } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/XPCOMUtils.sys.mjs"
|
||||
);
|
||||
const { AppConstants } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/AppConstants.sys.mjs"
|
||||
);
|
||||
const lazy = {};
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
MacAttribution: "resource:///modules/MacAttribution.sys.mjs",
|
||||
});
|
||||
ChromeUtils.defineModuleGetter(
|
||||
lazy,
|
||||
"MacAttribution",
|
||||
"resource:///modules/MacAttribution.jsm"
|
||||
);
|
||||
XPCOMUtils.defineLazyGetter(lazy, "log", () => {
|
||||
let { ConsoleAPI } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/Console.sys.mjs"
|
||||
|
|
@ -58,7 +66,7 @@ const ATTR_CODE_KEYS = [
|
|||
|
||||
let gCachedAttrData = null;
|
||||
|
||||
export var AttributionCode = {
|
||||
var AttributionCode = {
|
||||
/**
|
||||
* Wrapper to pull campaign IDs from MSIX builds.
|
||||
* This function solely exists to make it easy to mock out for tests.
|
||||
|
|
@ -1,9 +1,13 @@
|
|||
/* 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";
|
||||
|
||||
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
|
||||
var EXPORTED_SYMBOLS = ["MacAttribution"];
|
||||
|
||||
const { XPCOMUtils } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/XPCOMUtils.sys.mjs"
|
||||
);
|
||||
const lazy = {};
|
||||
XPCOMUtils.defineLazyGetter(lazy, "log", () => {
|
||||
let { ConsoleAPI } = ChromeUtils.importESModule(
|
||||
|
|
@ -125,7 +129,7 @@ async function queryQuarantineDatabase(
|
|||
return parts[1].trim();
|
||||
}
|
||||
|
||||
export var MacAttribution = {
|
||||
var MacAttribution = {
|
||||
/**
|
||||
* The file path to the `.app` directory.
|
||||
*/
|
||||
|
|
@ -12,7 +12,7 @@ XPCSHELL_TESTS_MANIFESTS += ["test/xpcshell/xpcshell.ini"]
|
|||
BROWSER_CHROME_MANIFESTS += ["test/browser/browser.ini"]
|
||||
|
||||
EXTRA_JS_MODULES += [
|
||||
"AttributionCode.sys.mjs",
|
||||
"AttributionCode.jsm",
|
||||
]
|
||||
|
||||
SPHINX_TREES["docs"] = "docs"
|
||||
|
|
@ -35,5 +35,5 @@ if CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa":
|
|||
FINAL_LIBRARY = "browsercomps"
|
||||
|
||||
EXTRA_JS_MODULES += [
|
||||
"MacAttribution.sys.mjs",
|
||||
"MacAttribution.jsm",
|
||||
]
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
ChromeUtils.defineESModuleGetters(this, {
|
||||
TelemetryTestUtils: "resource://testing-common/TelemetryTestUtils.sys.mjs",
|
||||
});
|
||||
const { MacAttribution } = ChromeUtils.importESModule(
|
||||
"resource:///modules/MacAttribution.sys.mjs"
|
||||
const { MacAttribution } = ChromeUtils.import(
|
||||
"resource:///modules/MacAttribution.jsm"
|
||||
);
|
||||
const { AttributionIOUtils } = ChromeUtils.importESModule(
|
||||
"resource:///modules/AttributionCode.sys.mjs"
|
||||
const { AttributionIOUtils } = ChromeUtils.import(
|
||||
"resource:///modules/AttributionCode.jsm"
|
||||
);
|
||||
const { sinon } = ChromeUtils.import("resource://testing-common/Sinon.jsm");
|
||||
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
ChromeUtils.defineESModuleGetters(this, {
|
||||
TelemetryTestUtils: "resource://testing-common/TelemetryTestUtils.sys.mjs",
|
||||
});
|
||||
const { AttributionIOUtils } = ChromeUtils.importESModule(
|
||||
"resource:///modules/AttributionCode.sys.mjs"
|
||||
const { AttributionIOUtils } = ChromeUtils.import(
|
||||
"resource:///modules/AttributionCode.jsm"
|
||||
);
|
||||
|
||||
add_task(async function test_parse_error() {
|
||||
if (AppConstants.platform == "macosx") {
|
||||
// On macOS, the underlying data is the OS-level quarantine
|
||||
// database. We need to start from nothing to isolate the cache.
|
||||
const { MacAttribution } = ChromeUtils.importESModule(
|
||||
"resource:///modules/MacAttribution.sys.mjs"
|
||||
const { MacAttribution } = ChromeUtils.import(
|
||||
"resource:///modules/MacAttribution.jsm"
|
||||
);
|
||||
let attributionSvc = Cc["@mozilla.org/mac-attribution;1"].getService(
|
||||
Ci.nsIMacAttributionService
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
*/
|
||||
"use strict";
|
||||
|
||||
const { AttributionCode } = ChromeUtils.importESModule(
|
||||
"resource:///modules/AttributionCode.sys.mjs"
|
||||
const { AttributionCode } = ChromeUtils.import(
|
||||
"resource:///modules/AttributionCode.jsm"
|
||||
);
|
||||
|
||||
// Keep in sync with `BROWSER_ATTRIBUTION_ERRORS` in Histograms.json.
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
*/
|
||||
"use strict";
|
||||
|
||||
const { AttributionCode } = ChromeUtils.importESModule(
|
||||
"resource:///modules/AttributionCode.sys.mjs"
|
||||
const { AttributionCode } = ChromeUtils.import(
|
||||
"resource:///modules/AttributionCode.jsm"
|
||||
);
|
||||
|
||||
let validAttrCodes = [
|
||||
|
|
@ -115,8 +115,8 @@ async function setupStubs() {
|
|||
|
||||
if (AppConstants.platform == "macosx") {
|
||||
// We're implicitly using the fact that modules are shared between importers here.
|
||||
const { MacAttribution } = ChromeUtils.importESModule(
|
||||
"resource:///modules/MacAttribution.sys.mjs"
|
||||
const { MacAttribution } = ChromeUtils.import(
|
||||
"resource:///modules/MacAttribution.jsm"
|
||||
);
|
||||
sinon
|
||||
.stub(MacAttribution, "applicationPath")
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { MacAttribution } = ChromeUtils.importESModule(
|
||||
"resource:///modules/MacAttribution.sys.mjs"
|
||||
const { MacAttribution } = ChromeUtils.import(
|
||||
"resource:///modules/MacAttribution.jsm"
|
||||
);
|
||||
|
||||
add_task(async () => {
|
||||
|
|
|
|||
|
|
@ -16,11 +16,11 @@ const lazy = {};
|
|||
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
BrowserUtils: "resource://gre/modules/BrowserUtils.sys.mjs",
|
||||
AttributionCode: "resource:///modules/AttributionCode.sys.mjs",
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetters(lazy, {
|
||||
AddonRepository: "resource://gre/modules/addons/AddonRepository.jsm",
|
||||
AttributionCode: "resource:///modules/AttributionCode.jsm",
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyPreferenceGetter(
|
||||
|
|
|
|||
|
|
@ -11,13 +11,13 @@ const { XPCOMUtils } = ChromeUtils.importESModule(
|
|||
const lazy = {};
|
||||
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
AttributionCode: "resource:///modules/AttributionCode.sys.mjs",
|
||||
ClientID: "resource://gre/modules/ClientID.sys.mjs",
|
||||
TelemetrySession: "resource://gre/modules/TelemetrySession.sys.mjs",
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetters(lazy, {
|
||||
PingCentre: "resource:///modules/PingCentre.jsm",
|
||||
AttributionCode: "resource:///modules/AttributionCode.jsm",
|
||||
});
|
||||
XPCOMUtils.defineLazyPreferenceGetter(
|
||||
lazy,
|
||||
|
|
|
|||
|
|
@ -38,9 +38,7 @@ XPCOMUtils.defineLazyModuleGetters(lazy, {
|
|||
"resource://messaging-system/lib/SpecialMessageActions.jsm",
|
||||
TargetingContext: "resource://messaging-system/targeting/Targeting.jsm",
|
||||
Utils: "resource://services-settings/Utils.jsm",
|
||||
});
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
MacAttribution: "resource:///modules/MacAttribution.sys.mjs",
|
||||
MacAttribution: "resource:///modules/MacAttribution.jsm",
|
||||
});
|
||||
XPCOMUtils.defineLazyServiceGetters(lazy, {
|
||||
BrowserHandler: ["@mozilla.org/browser/clh;1", "nsIBrowserHandler"],
|
||||
|
|
@ -61,8 +59,8 @@ const { RemoteSettings } = ChromeUtils.import(
|
|||
const { CFRPageActions } = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/CFRPageActions.jsm"
|
||||
);
|
||||
const { AttributionCode } = ChromeUtils.importESModule(
|
||||
"resource:///modules/AttributionCode.sys.mjs"
|
||||
const { AttributionCode } = ChromeUtils.import(
|
||||
"resource:///modules/AttributionCode.jsm"
|
||||
);
|
||||
|
||||
// List of hosts for endpoints that serve router messages.
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ const { ShellService } = ChromeUtils.import(
|
|||
const lazy = {};
|
||||
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
AttributionCode: "resource:///modules/AttributionCode.sys.mjs",
|
||||
BuiltInThemes: "resource:///modules/BuiltInThemes.sys.mjs",
|
||||
ProfileAge: "resource://gre/modules/ProfileAge.sys.mjs",
|
||||
Region: "resource://gre/modules/Region.sys.mjs",
|
||||
|
|
@ -34,6 +33,7 @@ XPCOMUtils.defineLazyModuleGetters(lazy, {
|
|||
ASRouterPreferences: "resource://activity-stream/lib/ASRouterPreferences.jsm",
|
||||
AddonManager: "resource://gre/modules/AddonManager.jsm",
|
||||
ClientEnvironment: "resource://normandy/lib/ClientEnvironment.jsm",
|
||||
AttributionCode: "resource:///modules/AttributionCode.jsm",
|
||||
TargetingContext: "resource://messaging-system/targeting/Targeting.jsm",
|
||||
HomePage: "resource:///modules/HomePage.jsm",
|
||||
AboutNewTab: "resource:///modules/AboutNewTab.jsm",
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
const { ASRouter } = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/ASRouter.jsm"
|
||||
);
|
||||
const { AttributionCode } = ChromeUtils.importESModule(
|
||||
"resource:///modules/AttributionCode.sys.mjs"
|
||||
const { AttributionCode } = ChromeUtils.import(
|
||||
"resource:///modules/AttributionCode.jsm"
|
||||
);
|
||||
const { AddonRepository } = ChromeUtils.import(
|
||||
"resource://gre/modules/addons/AddonRepository.jsm"
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
|||
AddonManager: "resource://gre/modules/AddonManager.jsm",
|
||||
AddonTestUtils: "resource://testing-common/AddonTestUtils.jsm",
|
||||
ASRouterTargeting: "resource://activity-stream/lib/ASRouterTargeting.jsm",
|
||||
AttributionCode: "resource:///modules/AttributionCode.jsm",
|
||||
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
|
||||
CFRMessageProvider: "resource://activity-stream/lib/CFRMessageProvider.jsm",
|
||||
ExperimentAPI: "resource://nimbus/ExperimentAPI.jsm",
|
||||
|
|
@ -16,7 +17,6 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
|||
});
|
||||
ChromeUtils.defineESModuleGetters(this, {
|
||||
AppConstants: "resource://gre/modules/AppConstants.sys.mjs",
|
||||
AttributionCode: "resource:///modules/AttributionCode.sys.mjs",
|
||||
BuiltInThemes: "resource:///modules/BuiltInThemes.sys.mjs",
|
||||
NewTabUtils: "resource://gre/modules/NewTabUtils.sys.mjs",
|
||||
PlacesTestUtils: "resource://testing-common/PlacesTestUtils.sys.mjs",
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { AttributionCode } = ChromeUtils.importESModule(
|
||||
"resource:///modules/AttributionCode.sys.mjs"
|
||||
const { AttributionCode } = ChromeUtils.import(
|
||||
"resource:///modules/AttributionCode.jsm"
|
||||
);
|
||||
const { ASRouterTargeting } = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/ASRouterTargeting.jsm"
|
||||
);
|
||||
const { MacAttribution } = ChromeUtils.importESModule(
|
||||
"resource:///modules/MacAttribution.sys.mjs"
|
||||
const { MacAttribution } = ChromeUtils.import(
|
||||
"resource:///modules/MacAttribution.jsm"
|
||||
);
|
||||
const { EnterprisePolicyTesting } = ChromeUtils.importESModule(
|
||||
"resource://testing-common/EnterprisePolicyTesting.sys.mjs"
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ const { AboutWelcomeDefaults } = ChromeUtils.import(
|
|||
"resource://activity-stream/aboutwelcome/lib/AboutWelcomeDefaults.jsm"
|
||||
);
|
||||
const { sinon } = ChromeUtils.import("resource://testing-common/Sinon.jsm");
|
||||
const { AttributionCode } = ChromeUtils.importESModule(
|
||||
"resource:///modules/AttributionCode.sys.mjs"
|
||||
const { AttributionCode } = ChromeUtils.import(
|
||||
"resource:///modules/AttributionCode.jsm"
|
||||
);
|
||||
const { AddonRepository } = ChromeUtils.import(
|
||||
"resource://gre/modules/addons/AddonRepository.jsm"
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@
|
|||
const { AboutWelcomeTelemetry } = ChromeUtils.import(
|
||||
"resource://activity-stream/aboutwelcome/lib/AboutWelcomeTelemetry.jsm"
|
||||
);
|
||||
const { AttributionCode } = ChromeUtils.importESModule(
|
||||
"resource:///modules/AttributionCode.sys.mjs"
|
||||
const { AttributionCode } = ChromeUtils.import(
|
||||
"resource:///modules/AttributionCode.jsm"
|
||||
);
|
||||
const { sinon } = ChromeUtils.import("resource://testing-common/Sinon.jsm");
|
||||
const TELEMETRY_PREF = "browser.newtabpage.activity-stream.telemetry";
|
||||
|
|
|
|||
|
|
@ -20,8 +20,12 @@ const { AddonManager, AddonManagerPrivate } = ChromeUtils.import(
|
|||
|
||||
const lazy = {};
|
||||
|
||||
ChromeUtils.defineModuleGetter(
|
||||
lazy,
|
||||
"AttributionCode",
|
||||
"resource:///modules/AttributionCode.jsm"
|
||||
);
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
AttributionCode: "resource:///modules/AttributionCode.sys.mjs",
|
||||
ProfileAge: "resource://gre/modules/ProfileAge.sys.mjs",
|
||||
WindowsRegistry: "resource://gre/modules/WindowsRegistry.sys.mjs",
|
||||
});
|
||||
|
|
@ -1676,7 +1680,7 @@ EnvironmentCache.prototype = {
|
|||
try {
|
||||
await lazy.AttributionCode.getAttrDataAsync();
|
||||
} catch (e) {
|
||||
// The AttributionCode.sys.mjs module might not be always available
|
||||
// The AttributionCode.jsm module might not be always available
|
||||
// (e.g. tests). Gracefully handle this.
|
||||
return;
|
||||
}
|
||||
|
|
@ -1691,7 +1695,7 @@ EnvironmentCache.prototype = {
|
|||
try {
|
||||
data = lazy.AttributionCode.getCachedAttributionData();
|
||||
} catch (e) {
|
||||
// The AttributionCode.sys.mjs module might not be always available
|
||||
// The AttributionCode.jsm module might not be always available
|
||||
// (e.g. tests). Gracefully handle this.
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,13 +9,14 @@ const lazy = {};
|
|||
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
Assert: "resource://testing-common/Assert.sys.mjs",
|
||||
// AttributionCode is only needed for Firefox
|
||||
AttributionCode: "resource:///modules/AttributionCode.sys.mjs",
|
||||
MockRegistrar: "resource://testing-common/MockRegistrar.sys.mjs",
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetters(lazy, {
|
||||
AddonManager: "resource://gre/modules/AddonManager.jsm",
|
||||
|
||||
// AttributionCode is only needed for Firefox
|
||||
AttributionCode: "resource:///modules/AttributionCode.jsm",
|
||||
});
|
||||
|
||||
const gIsWindows = AppConstants.platform == "win";
|
||||
|
|
|
|||
|
|
@ -11,32 +11,16 @@ const { AppConstants } = ChromeUtils.importESModule(
|
|||
const lazy = {};
|
||||
|
||||
/* eslint-disable prettier/prettier */
|
||||
ChromeUtils.defineModuleGetter(
|
||||
lazy,
|
||||
"ShellService",
|
||||
"resource:///modules/ShellService.jsm"
|
||||
);
|
||||
ChromeUtils.defineModuleGetter(
|
||||
lazy,
|
||||
"AddonManager",
|
||||
"resource://gre/modules/AddonManager.jsm"
|
||||
);
|
||||
ChromeUtils.defineModuleGetter(
|
||||
lazy,
|
||||
"WindowsVersionInfo",
|
||||
"resource://gre/modules/components-utils/WindowsVersionInfo.jsm"
|
||||
);
|
||||
ChromeUtils.defineModuleGetter(
|
||||
lazy,
|
||||
"NormandyUtils",
|
||||
"resource://normandy/lib/NormandyUtils.jsm"
|
||||
);
|
||||
ChromeUtils.defineModuleGetter(lazy, "ShellService", "resource:///modules/ShellService.jsm");
|
||||
ChromeUtils.defineModuleGetter(lazy, "AddonManager", "resource://gre/modules/AddonManager.jsm");
|
||||
ChromeUtils.defineModuleGetter(lazy, "AttributionCode", "resource:///modules/AttributionCode.jsm");
|
||||
ChromeUtils.defineModuleGetter(lazy, "WindowsVersionInfo", "resource://gre/modules/components-utils/WindowsVersionInfo.jsm");
|
||||
ChromeUtils.defineModuleGetter(lazy, "NormandyUtils", "resource://normandy/lib/NormandyUtils.jsm");
|
||||
/* eslint-enable prettier/prettier */
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
TelemetryArchive: "resource://gre/modules/TelemetryArchive.sys.mjs",
|
||||
TelemetryController: "resource://gre/modules/TelemetryController.sys.mjs",
|
||||
UpdateUtils: "resource://gre/modules/UpdateUtils.sys.mjs",
|
||||
AttributionCode: "resource:///modules/AttributionCode.sys.mjs",
|
||||
});
|
||||
|
||||
var EXPORTED_SYMBOLS = ["ClientEnvironmentBase"];
|
||||
|
|
|
|||
Loading…
Reference in a new issue