Backed out changeset 1209711b3866 (bug 1541577) for browser-chrome failures at browser/components/preferences/in-content/tests/browser_browser_languages_subdialog.js on a CLOSED TREE

This commit is contained in:
Coroiu Cristina 2019-04-11 04:47:58 +03:00
Родитель 9db4a23f54
Коммит d57bd2e86b
3 изменённых файлов: 19 добавлений и 94 удалений

Просмотреть файл

@ -1117,21 +1117,6 @@ class AddonInstall {
XPIInstall.installs.add(this);
}
/**
* Called when we are finished with this install and are ready to remove
* any external references to it.
*/
_cleanup() {
XPIInstall.installs.delete(this);
if (this.addon && this.addon._install) {
if (this.addon._install === this) {
this.addon._install = null;
} else {
Cu.reportError(new Error("AddonInstall mismatch"));
}
}
}
/**
* Starts installation of this add-on from whatever state it is currently at
* if possible.
@ -1193,7 +1178,7 @@ class AddonInstall {
case AddonManager.STATE_DOWNLOADED:
logger.debug("Cancelling download of " + this.sourceURI.spec);
this.state = AddonManager.STATE_CANCELLED;
this._cleanup();
XPIInstall.installs.delete(this);
this._callInstallListeners("onDownloadCancelled");
this.removeTemporaryFile();
break;
@ -1203,7 +1188,7 @@ class AddonInstall {
flushJarCache(xpi);
this.location.installer.cleanStagingDir([`${this.addon.id}.xpi`]);
this.state = AddonManager.STATE_CANCELLED;
this._cleanup();
XPIInstall.installs.delete(this);
if (this.existingAddon) {
delete this.existingAddon.pendingUpgrade;
@ -1217,7 +1202,7 @@ class AddonInstall {
case AddonManager.STATE_POSTPONED:
logger.debug(`Cancelling postponed install of ${this.addon.id}`);
this.state = AddonManager.STATE_CANCELLED;
this._cleanup();
XPIInstall.installs.delete(this);
this._callInstallListeners("onInstallCancelled");
this.removeTemporaryFile();
@ -1415,7 +1400,7 @@ class AddonInstall {
} catch (err) {
logger.info(`Install of ${this.addon.id} cancelled by user`);
this.state = AddonManager.STATE_CANCELLED;
this._cleanup();
XPIInstall.installs.delete(this);
this._callInstallListeners("onInstallCancelled");
return;
}
@ -1460,7 +1445,7 @@ class AddonInstall {
if (!this._callInstallListeners("onInstallStarted")) {
this.state = AddonManager.STATE_DOWNLOADED;
this.removeTemporaryFile();
this._cleanup();
XPIInstall.installs.delete(this);
this._callInstallListeners("onInstallCancelled");
return;
}
@ -1509,7 +1494,8 @@ class AddonInstall {
await this.stageInstall(false, stagedAddon, isUpgrade);
this._cleanup();
// The install is completed so it should be removed from the active list
XPIInstall.installs.delete(this);
let install = async () => {
if (this.existingAddon && this.existingAddon.active && !isUpgrade) {
@ -1581,6 +1567,7 @@ class AddonInstall {
recursiveRemove(stagedAddon);
this.state = AddonManager.STATE_INSTALL_FAILED;
this.error = AddonManager.ERROR_FILE_ACCESS;
XPIInstall.installs.delete(this);
AddonManagerPrivate.callAddonListeners("onOperationCancelled",
this.addon.wrapper);
this._callInstallListeners("onInstallFailed");
@ -1715,7 +1702,7 @@ var LocalAddonInstall = class extends AddonInstall {
logger.warn("XPI file " + this.file.path + " does not exist");
this.state = AddonManager.STATE_DOWNLOAD_FAILED;
this.error = AddonManager.ERROR_NETWORK_FAILURE;
this._cleanup();
XPIInstall.installs.delete(this);
return;
}
@ -1731,7 +1718,7 @@ var LocalAddonInstall = class extends AddonInstall {
logger.warn("Unknown hash algorithm '" + this.hash.algorithm + "' for addon " + this.sourceURI.spec, e);
this.state = AddonManager.STATE_DOWNLOAD_FAILED;
this.error = AddonManager.ERROR_INCORRECT_HASH;
this._cleanup();
XPIInstall.installs.delete(this);
return;
}
@ -1743,7 +1730,7 @@ var LocalAddonInstall = class extends AddonInstall {
this.hash.data + ")");
this.state = AddonManager.STATE_DOWNLOAD_FAILED;
this.error = AddonManager.ERROR_INCORRECT_HASH;
this._cleanup();
XPIInstall.installs.delete(this);
return;
}
}
@ -1754,7 +1741,7 @@ var LocalAddonInstall = class extends AddonInstall {
logger.warn("Invalid XPI", message);
this.state = AddonManager.STATE_DOWNLOAD_FAILED;
this.error = error;
this._cleanup();
XPIInstall.installs.delete(this);
this._callInstallListeners("onNewInstall");
flushJarCache(this.file);
return;
@ -1900,7 +1887,7 @@ var DownloadAddonInstall = class extends AddonInstall {
if (!this._callInstallListeners("onDownloadStarted")) {
logger.debug("onDownloadStarted listeners cancelled installation of addon " + this.sourceURI.spec);
this.state = AddonManager.STATE_CANCELLED;
this._cleanup();
XPIInstall.installs.delete(this);
this._callInstallListeners("onDownloadCancelled");
return;
}
@ -1934,7 +1921,7 @@ var DownloadAddonInstall = class extends AddonInstall {
logger.warn("Failed to start download for addon " + this.sourceURI.spec, e);
this.state = AddonManager.STATE_DOWNLOAD_FAILED;
this.error = AddonManager.ERROR_FILE_ACCESS;
this._cleanup();
XPIInstall.installs.delete(this);
this._callInstallListeners("onDownloadFailed");
return;
}
@ -1966,7 +1953,7 @@ var DownloadAddonInstall = class extends AddonInstall {
logger.warn("Failed to start download for addon " + this.sourceURI.spec, e);
this.state = AddonManager.STATE_DOWNLOAD_FAILED;
this.error = AddonManager.ERROR_NETWORK_FAILURE;
this._cleanup();
XPIInstall.installs.delete(this);
this._callInstallListeners("onDownloadFailed");
}
}
@ -2027,7 +2014,7 @@ var DownloadAddonInstall = class extends AddonInstall {
logger.warn("Unknown hash algorithm '" + this.hash.algorithm + "' for addon " + this.sourceURI.spec, e);
this.state = AddonManager.STATE_DOWNLOAD_FAILED;
this.error = AddonManager.ERROR_INCORRECT_HASH;
this._cleanup();
XPIInstall.installs.delete(this);
this._callInstallListeners("onDownloadFailed");
aRequest.cancel(Cr.NS_BINDING_ABORTED);
return;
@ -2065,7 +2052,7 @@ var DownloadAddonInstall = class extends AddonInstall {
if (this.state == AddonManager.STATE_DOWNLOADING) {
logger.debug("Cancelled download of " + this.sourceURI.spec);
this.state = AddonManager.STATE_CANCELLED;
this._cleanup();
XPIInstall.installs.delete(this);
this._callInstallListeners("onDownloadCancelled");
// If a listener restarted the download then there is no need to
// remove the temporary file
@ -2141,7 +2128,7 @@ var DownloadAddonInstall = class extends AddonInstall {
logger.warn("Download of " + this.sourceURI.spec + " failed", aError);
this.state = AddonManager.STATE_DOWNLOAD_FAILED;
this.error = aReason;
this._cleanup();
XPIInstall.installs.delete(this);
this._callInstallListeners("onDownloadFailed");
// If the listener hasn't restarted the download then remove any temporary
@ -2567,6 +2554,7 @@ function createLocalInstall(file, location, telemetryInfo) {
return install.init().then(() => install);
} catch (e) {
logger.error("Error creating install", e);
XPIInstall.installs.delete(this);
return Promise.resolve(null);
}
}

Просмотреть файл

@ -66,8 +66,6 @@ skip-if = true # Bug 1449788
[browser_localfile2.js]
[browser_localfile3.js]
[browser_localfile4.js]
[browser_newwindow.js]
skip-if = !debug # This is a test for leaks, see comment in the test.
[browser_offline.js]
[browser_privatebrowsing.js]
skip-if = debug # Bug 1541577 - leaks on debug

Просмотреть файл

@ -1,61 +0,0 @@
// This functionality covered in this test is also covered in other tests.
// The purpose of this test is to catch window leaks. It should fail in
// debug builds if a window reference is held onto after an install finishes.
// See bug 1541577 for further details.
let win;
const exampleURI = Services.io.newURI("http://example.com");
async function test() {
waitForExplicitFinish(); // have to call this ourselves because we're async.
Harness.installConfirmCallback = confirm_install;
Harness.installEndedCallback = install => { install.cancel(); };
Harness.installsCompletedCallback = finish_test;
Harness.finalContentEvent = "InstallComplete";
win = await BrowserTestUtils.openNewBrowserWindow();
Harness.setup(win);
const pm = Services.perms;
pm.add(exampleURI, "install", pm.ALLOW_ACTION);
const triggers = encodeURIComponent(JSON.stringify({
"Unsigned XPI": {
URL: TESTROOT + "amosigned.xpi",
IconURL: TESTROOT + "icon.png",
},
}));
const url = `${TESTROOT}installtrigger.html?${triggers}`;
BrowserTestUtils.openNewForegroundTab(win.gBrowser, url);
}
function confirm_install(panel) {
is(panel.getAttribute("name"), "XPI Test", "Should have seen the name");
return true;
}
async function finish_test(count) {
is(count, 1, "1 Add-on should have been successfully installed");
Services.perms.remove(exampleURI, "install");
const results = await ContentTask.spawn(win.gBrowser.selectedBrowser, null, () => {
return {
return: content.document.getElementById("return").textContent,
status: content.document.getElementById("status").textContent,
};
});
is(results.return, "true", "installTrigger should have claimed success");
is(results.status, "0", "Callback should have seen a success");
// Explicitly click the "OK" button to avoid the panel reopening in the other window once this
// window closes (see also bug 1535069):
await BrowserTestUtils.waitForEvent(win.PanelUI.notificationPanel, "popupshown");
win.PanelUI.notificationPanel.querySelector("popupnotification[popupid=addon-installed]").button.click();
// Now finish the test:
await BrowserTestUtils.closeWindow(win);
Harness.finish(win);
win = null;
}