forked from mirrors/gecko-dev
Bug 1864821 - Replace PromiseUtils.defer() with Promise.withResolvers() in browser window scopes. r=Gijs,extension-reviewers,application-update-reviewers,rpl,nalexander
Differential Revision: https://phabricator.services.mozilla.com/D197486
This commit is contained in:
parent
070a3d3ad1
commit
7a4d095f30
26 changed files with 45 additions and 47 deletions
|
|
@ -88,7 +88,7 @@ var SidebarUI = {
|
||||||
*/
|
*/
|
||||||
_observer: null,
|
_observer: null,
|
||||||
|
|
||||||
_initDeferred: PromiseUtils.defer(),
|
_initDeferred: Promise.withResolvers(),
|
||||||
|
|
||||||
get promiseInitialized() {
|
get promiseInitialized() {
|
||||||
return this._initDeferred.promise;
|
return this._initDeferred.promise;
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,6 @@ ChromeUtils.defineESModuleGetters(this, {
|
||||||
Pocket: "chrome://pocket/content/Pocket.sys.mjs",
|
Pocket: "chrome://pocket/content/Pocket.sys.mjs",
|
||||||
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs",
|
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs",
|
||||||
ProcessHangMonitor: "resource:///modules/ProcessHangMonitor.sys.mjs",
|
ProcessHangMonitor: "resource:///modules/ProcessHangMonitor.sys.mjs",
|
||||||
PromiseUtils: "resource://gre/modules/PromiseUtils.sys.mjs",
|
|
||||||
PromptUtils: "resource://gre/modules/PromptUtils.sys.mjs",
|
PromptUtils: "resource://gre/modules/PromptUtils.sys.mjs",
|
||||||
ReaderMode: "resource://gre/modules/ReaderMode.sys.mjs",
|
ReaderMode: "resource://gre/modules/ReaderMode.sys.mjs",
|
||||||
ResetPBMPanel: "resource:///modules/ResetPBMPanel.sys.mjs",
|
ResetPBMPanel: "resource:///modules/ResetPBMPanel.sys.mjs",
|
||||||
|
|
@ -2580,7 +2579,7 @@ var gBrowserInit = {
|
||||||
ChromeUtils.defineLazyGetter(
|
ChromeUtils.defineLazyGetter(
|
||||||
gBrowserInit,
|
gBrowserInit,
|
||||||
"_firstContentWindowPaintDeferred",
|
"_firstContentWindowPaintDeferred",
|
||||||
() => PromiseUtils.defer()
|
() => Promise.withResolvers()
|
||||||
);
|
);
|
||||||
|
|
||||||
gBrowserInit.idleTasksFinishedPromise = new Promise(resolve => {
|
gBrowserInit.idleTasksFinishedPromise = new Promise(resolve => {
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ add_task(async () => {
|
||||||
|
|
||||||
let tab = await preparePendingTab();
|
let tab = await preparePendingTab();
|
||||||
|
|
||||||
let deferredTab = PromiseUtils.defer();
|
let deferredTab = Promise.withResolvers();
|
||||||
|
|
||||||
let win = gBrowser.replaceTabWithWindow(tab);
|
let win = gBrowser.replaceTabWithWindow(tab);
|
||||||
win.addEventListener(
|
win.addEventListener(
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ function promiseNextTick() {
|
||||||
* @return {Promise} Resolved when the notification is displayed.
|
* @return {Promise} Resolved when the notification is displayed.
|
||||||
*/
|
*/
|
||||||
function promiseWaitForAlertActive(aNotificationBox) {
|
function promiseWaitForAlertActive(aNotificationBox) {
|
||||||
let deferred = PromiseUtils.defer();
|
let deferred = Promise.withResolvers();
|
||||||
aNotificationBox.stack.addEventListener(
|
aNotificationBox.stack.addEventListener(
|
||||||
"AlertActive",
|
"AlertActive",
|
||||||
function () {
|
function () {
|
||||||
|
|
@ -71,7 +71,7 @@ function promiseWaitForAlertActive(aNotificationBox) {
|
||||||
* @return {Promise} Resolved when the notification is closed.
|
* @return {Promise} Resolved when the notification is closed.
|
||||||
*/
|
*/
|
||||||
function promiseWaitForNotificationClose(aNotification) {
|
function promiseWaitForNotificationClose(aNotification) {
|
||||||
let deferred = PromiseUtils.defer();
|
let deferred = Promise.withResolvers();
|
||||||
waitForNotificationClose(aNotification, deferred.resolve);
|
waitForNotificationClose(aNotification, deferred.resolve);
|
||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,7 @@ async function promiseAnimationFrame(win = window) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function promisePopupNotShown(id, win = window) {
|
async function promisePopupNotShown(id, win = window) {
|
||||||
let deferred = PromiseUtils.defer();
|
let deferred = Promise.withResolvers();
|
||||||
function listener(e) {
|
function listener(e) {
|
||||||
deferred.reject("Unexpected popupshown");
|
deferred.reject("Unexpected popupshown");
|
||||||
}
|
}
|
||||||
|
|
@ -145,7 +145,7 @@ async function promisePopupNotShown(id, win = window) {
|
||||||
// TODO (Bug 1700780): Why is this necessary? Without this trick the test
|
// TODO (Bug 1700780): Why is this necessary? Without this trick the test
|
||||||
// fails intermittently on Ubuntu.
|
// fails intermittently on Ubuntu.
|
||||||
function promiseStableResize(expectedWidth, win = window) {
|
function promiseStableResize(expectedWidth, win = window) {
|
||||||
let deferred = PromiseUtils.defer();
|
let deferred = Promise.withResolvers();
|
||||||
let id;
|
let id;
|
||||||
function listener() {
|
function listener() {
|
||||||
win.clearTimeout(id);
|
win.clearTimeout(id);
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ const TEST_DATA_SHORT = "This test string is downloaded.";
|
||||||
/**
|
/**
|
||||||
* This is an internal reference that should not be used directly by tests.
|
* This is an internal reference that should not be used directly by tests.
|
||||||
*/
|
*/
|
||||||
var _gDeferResponses = PromiseUtils.defer();
|
var _gDeferResponses = Promise.withResolvers();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ensures that all the interruptible requests started after this function is
|
* Ensures that all the interruptible requests started after this function is
|
||||||
|
|
@ -79,7 +79,7 @@ function mustInterruptResponses() {
|
||||||
_gDeferResponses.resolve();
|
_gDeferResponses.resolve();
|
||||||
|
|
||||||
info("Interruptible responses will be blocked midway.");
|
info("Interruptible responses will be blocked midway.");
|
||||||
_gDeferResponses = PromiseUtils.defer();
|
_gDeferResponses = Promise.withResolvers();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -211,7 +211,7 @@ async function withWindowOverflowed(
|
||||||
// added.
|
// added.
|
||||||
let listener = {
|
let listener = {
|
||||||
_remainingBrowserActions: NUM_EXTENSIONS,
|
_remainingBrowserActions: NUM_EXTENSIONS,
|
||||||
_deferred: PromiseUtils.defer(),
|
_deferred: Promise.withResolvers(),
|
||||||
|
|
||||||
get promise() {
|
get promise() {
|
||||||
return this._deferred.promise;
|
return this._deferred.promise;
|
||||||
|
|
@ -257,7 +257,7 @@ async function withWindowOverflowed(
|
||||||
let widgetOverflowListener = {
|
let widgetOverflowListener = {
|
||||||
_remainingOverflowables:
|
_remainingOverflowables:
|
||||||
browserActionsInNavBar.length + DEFAULT_WIDGET_IDS.length,
|
browserActionsInNavBar.length + DEFAULT_WIDGET_IDS.length,
|
||||||
_deferred: PromiseUtils.defer(),
|
_deferred: Promise.withResolvers(),
|
||||||
|
|
||||||
get promise() {
|
get promise() {
|
||||||
return this._deferred.promise;
|
return this._deferred.promise;
|
||||||
|
|
|
||||||
|
|
@ -1482,7 +1482,7 @@ class PlacesToolbar extends PlacesViewBase {
|
||||||
// Container is the toolbar itself.
|
// Container is the toolbar itself.
|
||||||
let instance = (this._rebuildingInstance = {});
|
let instance = (this._rebuildingInstance = {});
|
||||||
if (!this._rebuilding) {
|
if (!this._rebuilding) {
|
||||||
this._rebuilding = PromiseUtils.defer();
|
this._rebuilding = Promise.withResolvers();
|
||||||
}
|
}
|
||||||
this._rebuild()
|
this._rebuild()
|
||||||
.catch(console.error)
|
.catch(console.error)
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@ ChromeUtils.defineESModuleGetters(this, {
|
||||||
PlacesTransactions: "resource://gre/modules/PlacesTransactions.sys.mjs",
|
PlacesTransactions: "resource://gre/modules/PlacesTransactions.sys.mjs",
|
||||||
PlacesUIUtils: "resource:///modules/PlacesUIUtils.sys.mjs",
|
PlacesUIUtils: "resource:///modules/PlacesUIUtils.sys.mjs",
|
||||||
PlacesUtils: "resource://gre/modules/PlacesUtils.sys.mjs",
|
PlacesUtils: "resource://gre/modules/PlacesUtils.sys.mjs",
|
||||||
PromiseUtils: "resource://gre/modules/PromiseUtils.sys.mjs",
|
|
||||||
});
|
});
|
||||||
|
|
||||||
var gEditItemOverlay = {
|
var gEditItemOverlay = {
|
||||||
|
|
@ -257,7 +256,7 @@ var gEditItemOverlay = {
|
||||||
* "title", "location", "keyword", "folderPicker".
|
* "title", "location", "keyword", "folderPicker".
|
||||||
*/
|
*/
|
||||||
async initPanel(aInfo) {
|
async initPanel(aInfo) {
|
||||||
const deferred = (this._initPanelDeferred = PromiseUtils.defer());
|
const deferred = (this._initPanelDeferred = Promise.withResolvers());
|
||||||
try {
|
try {
|
||||||
if (typeof aInfo != "object" || aInfo === null) {
|
if (typeof aInfo != "object" || aInfo === null) {
|
||||||
throw new Error("aInfo must be an object.");
|
throw new Error("aInfo must be an object.");
|
||||||
|
|
@ -697,7 +696,7 @@ var gEditItemOverlay = {
|
||||||
* Handle tag list updates from the input field or selector box.
|
* Handle tag list updates from the input field or selector box.
|
||||||
*/
|
*/
|
||||||
async _updateTags() {
|
async _updateTags() {
|
||||||
const deferred = (this._updateTagsDeferred = PromiseUtils.defer());
|
const deferred = (this._updateTagsDeferred = Promise.withResolvers());
|
||||||
try {
|
try {
|
||||||
const inputTags = this._getTagsArrayFromTagsInputField();
|
const inputTags = this._getTagsArrayFromTagsInputField();
|
||||||
const isLibraryWindow =
|
const isLibraryWindow =
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@ const RIGHT_URL = BASE_URL + "/frameRight.html";
|
||||||
|
|
||||||
add_task(async function test() {
|
add_task(async function test() {
|
||||||
// We must wait for both frames to be loaded and the visits to be registered.
|
// We must wait for both frames to be loaded and the visits to be registered.
|
||||||
let deferredLeftFrameVisit = PromiseUtils.defer();
|
let deferredLeftFrameVisit = Promise.withResolvers();
|
||||||
let deferredRightFrameVisit = PromiseUtils.defer();
|
let deferredRightFrameVisit = Promise.withResolvers();
|
||||||
|
|
||||||
Services.obs.addObserver(function observe(subject) {
|
Services.obs.addObserver(function observe(subject) {
|
||||||
(async function () {
|
(async function () {
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ add_task(async function test() {
|
||||||
));
|
));
|
||||||
await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
|
await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
|
||||||
|
|
||||||
let promiseFinished = PromiseUtils.defer();
|
let promiseFinished = Promise.withResolvers();
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
let notificationBox = aWindow.gBrowser.getNotificationBox();
|
let notificationBox = aWindow.gBrowser.getNotificationBox();
|
||||||
let notification =
|
let notification =
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ var tests = [
|
||||||
|
|
||||||
let highlight = document.getElementById("UITourHighlight");
|
let highlight = document.getElementById("UITourHighlight");
|
||||||
|
|
||||||
let browserStartupDeferred = PromiseUtils.defer();
|
let browserStartupDeferred = Promise.withResolvers();
|
||||||
Services.obs.addObserver(function onBrowserDelayedStartup(aWindow) {
|
Services.obs.addObserver(function onBrowserDelayedStartup(aWindow) {
|
||||||
Services.obs.removeObserver(
|
Services.obs.removeObserver(
|
||||||
onBrowserDelayedStartup,
|
onBrowserDelayedStartup,
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ add_setup(async function () {
|
||||||
class NoResponseTestProvider extends UrlbarTestUtils.TestProvider {
|
class NoResponseTestProvider extends UrlbarTestUtils.TestProvider {
|
||||||
constructor() {
|
constructor() {
|
||||||
super({ name: "TestProviderNoResponse ", results: [] });
|
super({ name: "TestProviderNoResponse ", results: [] });
|
||||||
this.#deferred = PromiseUtils.defer();
|
this.#deferred = Promise.withResolvers();
|
||||||
}
|
}
|
||||||
|
|
||||||
get type() {
|
get type() {
|
||||||
|
|
@ -45,7 +45,7 @@ const noResponseProvider = new NoResponseTestProvider();
|
||||||
class AnotherHeuristicProvider extends UrlbarTestUtils.TestProvider {
|
class AnotherHeuristicProvider extends UrlbarTestUtils.TestProvider {
|
||||||
constructor({ results }) {
|
constructor({ results }) {
|
||||||
super({ name: "TestProviderAnotherHeuristic ", results });
|
super({ name: "TestProviderAnotherHeuristic ", results });
|
||||||
this.#deferred = PromiseUtils.defer();
|
this.#deferred = Promise.withResolvers();
|
||||||
}
|
}
|
||||||
|
|
||||||
get type() {
|
get type() {
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@ add_task(async function () {
|
||||||
// Override the browser's `prepareToChangeRemoteness` so that we can delay
|
// Override the browser's `prepareToChangeRemoteness` so that we can delay
|
||||||
// the process switch for an indefinite amount of time. This will allow us
|
// the process switch for an indefinite amount of time. This will allow us
|
||||||
// to control the timing of the resolve call to trigger the bug.
|
// to control the timing of the resolve call to trigger the bug.
|
||||||
let prepareToChangeCalled = PromiseUtils.defer();
|
let prepareToChangeCalled = Promise.withResolvers();
|
||||||
let finishSwitch = PromiseUtils.defer();
|
let finishSwitch = Promise.withResolvers();
|
||||||
let oldPrepare = browser.prepareToChangeRemoteness;
|
let oldPrepare = browser.prepareToChangeRemoteness;
|
||||||
browser.prepareToChangeRemoteness = async () => {
|
browser.prepareToChangeRemoteness = async () => {
|
||||||
prepareToChangeCalled.resolve();
|
prepareToChangeCalled.resolve();
|
||||||
|
|
@ -34,7 +34,7 @@ add_task(async function () {
|
||||||
// finishes.
|
// finishes.
|
||||||
info("Creating new tab loaded in file URI process");
|
info("Creating new tab loaded in file URI process");
|
||||||
let fileProcess;
|
let fileProcess;
|
||||||
let browserParentDestroyed = PromiseUtils.defer();
|
let browserParentDestroyed = Promise.withResolvers();
|
||||||
await BrowserTestUtils.withNewTab(
|
await BrowserTestUtils.withNewTab(
|
||||||
uriString,
|
uriString,
|
||||||
async function (otherBrowser) {
|
async function (otherBrowser) {
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ async function createAndShutdownContentProcess(url) {
|
||||||
|
|
||||||
// Launch a new process and load url. Sets up a promise that will resolve
|
// Launch a new process and load url. Sets up a promise that will resolve
|
||||||
// on shutdown.
|
// on shutdown.
|
||||||
let browserDestroyed = PromiseUtils.defer();
|
let browserDestroyed = Promise.withResolvers();
|
||||||
await BrowserTestUtils.withNewTab(
|
await BrowserTestUtils.withNewTab(
|
||||||
{
|
{
|
||||||
gBrowser,
|
gBrowser,
|
||||||
|
|
|
||||||
|
|
@ -141,7 +141,7 @@ decorate_task(
|
||||||
withStub(Normandy, "finishInit"),
|
withStub(Normandy, "finishInit"),
|
||||||
async function testStartupDelayed({ finishInitStub }) {
|
async function testStartupDelayed({ finishInitStub }) {
|
||||||
let originalDeferred = Normandy.uiAvailableNotificationObserved;
|
let originalDeferred = Normandy.uiAvailableNotificationObserved;
|
||||||
let mockUiAvailableDeferred = PromiseUtils.defer();
|
let mockUiAvailableDeferred = Promise.withResolvers();
|
||||||
Normandy.uiAvailableNotificationObserved = mockUiAvailableDeferred;
|
Normandy.uiAvailableNotificationObserved = mockUiAvailableDeferred;
|
||||||
|
|
||||||
let initPromise = Normandy.init();
|
let initPromise = Normandy.init();
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ const { NormandyAddonManager } = ChromeUtils.importESModule(
|
||||||
);
|
);
|
||||||
|
|
||||||
decorate_task(ensureAddonCleanup(), async function download_and_install() {
|
decorate_task(ensureAddonCleanup(), async function download_and_install() {
|
||||||
const applyDeferred = PromiseUtils.defer();
|
const applyDeferred = Promise.withResolvers();
|
||||||
|
|
||||||
const [addonId, addonVersion] = await NormandyAddonManager.downloadAndInstall(
|
const [addonId, addonVersion] = await NormandyAddonManager.downloadAndInstall(
|
||||||
{
|
{
|
||||||
|
|
@ -37,8 +37,8 @@ decorate_task(ensureAddonCleanup(), async function download_and_install() {
|
||||||
});
|
});
|
||||||
|
|
||||||
decorate_task(ensureAddonCleanup(), async function id_mismatch() {
|
decorate_task(ensureAddonCleanup(), async function id_mismatch() {
|
||||||
const applyDeferred = PromiseUtils.defer();
|
const applyDeferred = Promise.withResolvers();
|
||||||
const undoDeferred = PromiseUtils.defer();
|
const undoDeferred = Promise.withResolvers();
|
||||||
|
|
||||||
let error;
|
let error;
|
||||||
|
|
||||||
|
|
@ -87,8 +87,8 @@ decorate_task(ensureAddonCleanup(), async function id_mismatch() {
|
||||||
});
|
});
|
||||||
|
|
||||||
decorate_task(ensureAddonCleanup(), async function version_mismatch() {
|
decorate_task(ensureAddonCleanup(), async function version_mismatch() {
|
||||||
const applyDeferred = PromiseUtils.defer();
|
const applyDeferred = Promise.withResolvers();
|
||||||
const undoDeferred = PromiseUtils.defer();
|
const undoDeferred = Promise.withResolvers();
|
||||||
|
|
||||||
let error;
|
let error;
|
||||||
|
|
||||||
|
|
@ -137,8 +137,8 @@ decorate_task(ensureAddonCleanup(), async function version_mismatch() {
|
||||||
});
|
});
|
||||||
|
|
||||||
decorate_task(ensureAddonCleanup(), async function download_failure() {
|
decorate_task(ensureAddonCleanup(), async function download_failure() {
|
||||||
const applyDeferred = PromiseUtils.defer();
|
const applyDeferred = Promise.withResolvers();
|
||||||
const undoDeferred = PromiseUtils.defer();
|
const undoDeferred = Promise.withResolvers();
|
||||||
|
|
||||||
let error;
|
let error;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -823,7 +823,7 @@ decorate_task(
|
||||||
Services.obs.addObserver(observer, "recipe-runner:start");
|
Services.obs.addObserver(observer, "recipe-runner:start");
|
||||||
|
|
||||||
const originalPrefsApplied = Normandy.defaultPrefsHaveBeenApplied;
|
const originalPrefsApplied = Normandy.defaultPrefsHaveBeenApplied;
|
||||||
Normandy.defaultPrefsHaveBeenApplied = PromiseUtils.defer();
|
Normandy.defaultPrefsHaveBeenApplied = Promise.withResolvers();
|
||||||
|
|
||||||
const recipeRunnerPromise = RecipeRunner.run();
|
const recipeRunnerPromise = RecipeRunner.run();
|
||||||
await Promise.resolve();
|
await Promise.resolve();
|
||||||
|
|
|
||||||
|
|
@ -745,7 +745,7 @@ add_task(async function test_nimbus_about_studies_rollout() {
|
||||||
});
|
});
|
||||||
|
|
||||||
add_task(async function test_getStudiesEnabled() {
|
add_task(async function test_getStudiesEnabled() {
|
||||||
RecipeRunner.initializedPromise = PromiseUtils.defer();
|
RecipeRunner.initializedPromise = Promise.withResolvers();
|
||||||
let promise = AboutPages.aboutStudies.getStudiesEnabled();
|
let promise = AboutPages.aboutStudies.getStudiesEnabled();
|
||||||
|
|
||||||
RecipeRunner.initializedPromise.resolve();
|
RecipeRunner.initializedPromise.resolve();
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@ const DIALOG_DELAY =
|
||||||
Services.prefs.getIntPref("security.dialog_enable_delay") + 200;
|
Services.prefs.getIntPref("security.dialog_enable_delay") + 200;
|
||||||
|
|
||||||
let UCTObserver = {
|
let UCTObserver = {
|
||||||
opened: PromiseUtils.defer(),
|
opened: Promise.withResolvers(),
|
||||||
closed: PromiseUtils.defer(),
|
closed: Promise.withResolvers(),
|
||||||
|
|
||||||
observe(aSubject, aTopic, aData) {
|
observe(aSubject, aTopic, aData) {
|
||||||
let win = aSubject;
|
let win = aSubject;
|
||||||
|
|
|
||||||
|
|
@ -35,8 +35,8 @@ add_task(async function test_unknownContentType_dialog_layout() {
|
||||||
|
|
||||||
for (let test of tests) {
|
for (let test of tests) {
|
||||||
let UCTObserver = {
|
let UCTObserver = {
|
||||||
opened: PromiseUtils.defer(),
|
opened: Promise.withResolvers(),
|
||||||
closed: PromiseUtils.defer(),
|
closed: Promise.withResolvers(),
|
||||||
|
|
||||||
observe(aSubject, aTopic, aData) {
|
observe(aSubject, aTopic, aData) {
|
||||||
let win = aSubject;
|
let win = aSubject;
|
||||||
|
|
|
||||||
|
|
@ -331,7 +331,7 @@ add_task(async function testUpdateButton() {
|
||||||
let item = getAddonCard(win, addon.id);
|
let item = getAddonCard(win, addon.id);
|
||||||
|
|
||||||
gInstalledAddonId = "";
|
gInstalledAddonId = "";
|
||||||
gInstallDeferred = PromiseUtils.defer();
|
gInstallDeferred = Promise.withResolvers();
|
||||||
|
|
||||||
let loaded = waitForViewLoad(win);
|
let loaded = waitForViewLoad(win);
|
||||||
item.querySelector("[action=expand]").click();
|
item.querySelector("[action=expand]").click();
|
||||||
|
|
|
||||||
|
|
@ -148,9 +148,9 @@ function mockLangpackInstall() {
|
||||||
XPIInstall.stageLangpacksForAppUpdate = original;
|
XPIInstall.stageLangpacksForAppUpdate = original;
|
||||||
});
|
});
|
||||||
|
|
||||||
let stagingCall = PromiseUtils.defer();
|
let stagingCall = Promise.withResolvers();
|
||||||
XPIInstall.stageLangpacksForAppUpdate = (appVersion, platformVersion) => {
|
XPIInstall.stageLangpacksForAppUpdate = (appVersion, platformVersion) => {
|
||||||
let result = PromiseUtils.defer();
|
let result = Promise.withResolvers();
|
||||||
stagingCall.resolve({
|
stagingCall.resolve({
|
||||||
appVersion,
|
appVersion,
|
||||||
platformVersion,
|
platformVersion,
|
||||||
|
|
|
||||||
|
|
@ -143,7 +143,7 @@ async function createDownloadTest(
|
||||||
let oldLaunchFile = DownloadIntegration.launchFile;
|
let oldLaunchFile = DownloadIntegration.launchFile;
|
||||||
let fileLaunched = null;
|
let fileLaunched = null;
|
||||||
if (expectLaunch) {
|
if (expectLaunch) {
|
||||||
fileLaunched = PromiseUtils.defer();
|
fileLaunched = Promise.withResolvers();
|
||||||
DownloadIntegration.launchFile = () => {
|
DownloadIntegration.launchFile = () => {
|
||||||
ok(
|
ok(
|
||||||
expectLaunch,
|
expectLaunch,
|
||||||
|
|
|
||||||
|
|
@ -46,14 +46,14 @@ add_task(async function test_check_filename_urlescape() {
|
||||||
);
|
);
|
||||||
|
|
||||||
pendingTest = "save browser";
|
pendingTest = "save browser";
|
||||||
pendingPromise = PromiseUtils.defer();
|
pendingPromise = Promise.withResolvers();
|
||||||
// First try to save the browser
|
// First try to save the browser
|
||||||
saveBrowser(browser);
|
saveBrowser(browser);
|
||||||
await pendingPromise.promise;
|
await pendingPromise.promise;
|
||||||
|
|
||||||
// Next, try the context menu:
|
// Next, try the context menu:
|
||||||
pendingTest = "save from context menu";
|
pendingTest = "save from context menu";
|
||||||
pendingPromise = PromiseUtils.defer();
|
pendingPromise = Promise.withResolvers();
|
||||||
let menu = document.getElementById("contentAreaContextMenu");
|
let menu = document.getElementById("contentAreaContextMenu");
|
||||||
let menuShown = BrowserTestUtils.waitForEvent(menu, "popupshown");
|
let menuShown = BrowserTestUtils.waitForEvent(menu, "popupshown");
|
||||||
BrowserTestUtils.synthesizeMouse(
|
BrowserTestUtils.synthesizeMouse(
|
||||||
|
|
|
||||||
|
|
@ -178,7 +178,7 @@ add_task(
|
||||||
const { expectTab, expectLaunch, description, expectUCT } = testCase;
|
const { expectTab, expectLaunch, description, expectUCT } = testCase;
|
||||||
|
|
||||||
let oldLaunchFile = DownloadIntegration.launchFile;
|
let oldLaunchFile = DownloadIntegration.launchFile;
|
||||||
let fileLaunched = PromiseUtils.defer();
|
let fileLaunched = Promise.withResolvers();
|
||||||
DownloadIntegration.launchFile = () => {
|
DownloadIntegration.launchFile = () => {
|
||||||
ok(
|
ok(
|
||||||
expectLaunch,
|
expectLaunch,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue