mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 00:32:11 +00:00
Bug 1461145: Follow-up: Fix more racy tests. r=bustage CLOSED TREE
MozReview-Commit-ID: 7uep5FCvVwC --HG-- extra : rebase_source : 22e6c32288fe6dfd72625eabdebb1bb5c4637069
This commit is contained in:
parent
61aeafad6a
commit
f72f5fc596
@ -640,11 +640,9 @@ SpecialPowersObserverAPI.prototype = {
|
||||
let id = aMessage.data.id;
|
||||
let extension = this._extensions.get(id);
|
||||
this._extensions.delete(id);
|
||||
let {setTimeout} = ChromeUtils.import("resource://gre/modules/Timer.jsm", null);
|
||||
let done = () => {
|
||||
setTimeout(() => {
|
||||
this._sendReply(aMessage, "SPExtensionMessage", {id, type: "extensionUnloaded", args: []});
|
||||
}, 0);
|
||||
let done = async () => {
|
||||
await extension._uninstallPromise;
|
||||
this._sendReply(aMessage, "SPExtensionMessage", {id, type: "extensionUnloaded", args: []});
|
||||
};
|
||||
extension.shutdown().then(done, done);
|
||||
return undefined;
|
||||
|
@ -1155,7 +1155,9 @@ class BootstrapScope {
|
||||
uninstall(data, reason) {
|
||||
AsyncShutdown.profileChangeTeardown.addBlocker(
|
||||
`Uninstalling add-on: ${data.id}`,
|
||||
Management.emit("uninstall", {id: data.id}));
|
||||
Management.emit("uninstall", {id: data.id}).then(() => {
|
||||
Management.emit("uninstall-complete", {id: data.id});
|
||||
}));
|
||||
}
|
||||
|
||||
update(data, reason) {
|
||||
|
@ -56,9 +56,10 @@ XPCOMUtils.defineLazyGetter(this, "console", ExtensionUtils.getConsole);
|
||||
* @param {nsIFile} file
|
||||
* @param {nsIURI} rootURI
|
||||
* @param {string} installType
|
||||
* @param {boolean} [embedded = false]
|
||||
*/
|
||||
class MockExtension {
|
||||
constructor(file, rootURI, installType) {
|
||||
constructor(file, rootURI, installType, embedded) {
|
||||
this.id = null;
|
||||
this.file = file;
|
||||
this.rootURI = rootURI;
|
||||
@ -84,6 +85,9 @@ class MockExtension {
|
||||
this._extension = null;
|
||||
this._extensionPromise = promiseEvent("startup");
|
||||
this._readyPromise = promiseEvent("ready");
|
||||
if (!embedded) {
|
||||
this._uninstallPromise = promiseEvent("uninstall-complete");
|
||||
}
|
||||
}
|
||||
|
||||
maybeSetID(uri, id) {
|
||||
@ -374,7 +378,7 @@ var ExtensionTestCommon = class ExtensionTestCommon {
|
||||
|
||||
// This may be "temporary" or "permanent".
|
||||
if (data.useAddonManager) {
|
||||
return new MockExtension(file, jarURI, data.useAddonManager);
|
||||
return new MockExtension(file, jarURI, data.useAddonManager, data.embedded);
|
||||
}
|
||||
|
||||
let id;
|
||||
|
Loading…
Reference in New Issue
Block a user