зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 159d0cb3c2c3 (bug 1246030) for timeouts in browser_addons_debugging_initial_state.js
This commit is contained in:
Родитель
7b817e43c0
Коммит
053055083c
|
@ -25,19 +25,6 @@ module.exports = createClass({
|
|||
BrowserToolboxProcess.init({ addonID: target.addonID });
|
||||
},
|
||||
|
||||
reload() {
|
||||
let { client, target } = this.props;
|
||||
// This function sometimes returns a partial promise that only
|
||||
// implements then().
|
||||
client.request({
|
||||
to: target.addonActor,
|
||||
type: "reload"
|
||||
}).then(() => {}, error => {
|
||||
throw new Error(
|
||||
"Error reloading addon " + target.addonID + ": " + error);
|
||||
});
|
||||
},
|
||||
|
||||
render() {
|
||||
let { target, debugDisabled } = this.props;
|
||||
|
||||
|
@ -54,11 +41,7 @@ module.exports = createClass({
|
|||
className: "debug-button",
|
||||
onClick: this.debug,
|
||||
disabled: debugDisabled,
|
||||
}, Strings.GetStringFromName("debug")),
|
||||
dom.button({
|
||||
className: "reload-button",
|
||||
onClick: this.reload
|
||||
}, Strings.GetStringFromName("reload"))
|
||||
}, Strings.GetStringFromName("debug"))
|
||||
);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -60,21 +60,17 @@ module.exports = createClass({
|
|||
},
|
||||
|
||||
updateAddonsList() {
|
||||
this.props.client.listAddons()
|
||||
.then(({addons}) => {
|
||||
let extensions = addons.filter(addon => addon.debuggable).map(addon => {
|
||||
return {
|
||||
name: addon.name,
|
||||
icon: addon.iconURL || ExtensionIcon,
|
||||
addonID: addon.id,
|
||||
addonActor: addon.actor
|
||||
};
|
||||
});
|
||||
|
||||
this.setState({ extensions });
|
||||
}, error => {
|
||||
throw new Error("Client error while listing addons: " + error);
|
||||
AddonManager.getAllAddons(addons => {
|
||||
let extensions = addons.filter(addon => addon.isDebuggable).map(addon => {
|
||||
return {
|
||||
name: addon.name,
|
||||
icon: addon.iconURL || ExtensionIcon,
|
||||
addonID: addon.id
|
||||
};
|
||||
});
|
||||
|
||||
this.setState({ extensions });
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -14,7 +14,6 @@ support-files =
|
|||
[browser_addons_debug_bootstrapped.js]
|
||||
[browser_addons_debugging_initial_state.js]
|
||||
[browser_addons_install.js]
|
||||
[browser_addons_reload.js]
|
||||
[browser_addons_toggle_debug.js]
|
||||
[browser_service_workers.js]
|
||||
[browser_service_workers_push.js]
|
||||
|
|
|
@ -22,7 +22,6 @@ add_task(function* () {
|
|||
});
|
||||
|
||||
let { tab, document } = yield openAboutDebugging("addons");
|
||||
yield waitForInitialAddonList(document);
|
||||
yield installAddon(document, "addons/unpacked/install.rdf", ADDON_NAME,
|
||||
"test-devtools");
|
||||
|
||||
|
|
|
@ -47,7 +47,6 @@ function* testCheckboxState(testData) {
|
|||
});
|
||||
|
||||
let { tab, document } = yield openAboutDebugging("addons");
|
||||
yield waitForInitialAddonList(document);
|
||||
|
||||
info("Install a test addon.");
|
||||
yield installAddon(document, "addons/unpacked/install.rdf", ADDON_NAME,
|
||||
|
|
|
@ -7,7 +7,6 @@ const ADDON_NAME = "test-devtools";
|
|||
|
||||
add_task(function* () {
|
||||
let { tab, document } = yield openAboutDebugging("addons");
|
||||
yield waitForInitialAddonList(document);
|
||||
|
||||
// Install this add-on, and verify that it appears in the about:debugging UI
|
||||
yield installAddon(document, "addons/unpacked/install.rdf", ADDON_NAME,
|
||||
|
@ -21,7 +20,6 @@ add_task(function* () {
|
|||
|
||||
add_task(function* () {
|
||||
let { tab, document } = yield openAboutDebugging("addons");
|
||||
yield waitForInitialAddonList(document);
|
||||
|
||||
// Start an observer that looks for the install error before
|
||||
// actually doing the install
|
||||
|
|
|
@ -1,65 +0,0 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
"use strict";
|
||||
|
||||
const ADDON_ID = "test-devtools@mozilla.org";
|
||||
const ADDON_NAME = "test-devtools";
|
||||
|
||||
/**
|
||||
* Returns a promise that resolves when the given add-on event is fired. The
|
||||
* resolved value is an array of arguments passed for the event.
|
||||
*/
|
||||
function promiseAddonEvent(event) {
|
||||
return new Promise(resolve => {
|
||||
let listener = {
|
||||
[event]: function(...args) {
|
||||
AddonManager.removeAddonListener(listener);
|
||||
resolve(args);
|
||||
}
|
||||
};
|
||||
|
||||
AddonManager.addAddonListener(listener);
|
||||
});
|
||||
}
|
||||
|
||||
add_task(function* () {
|
||||
const { tab, document } = yield openAboutDebugging("addons");
|
||||
yield waitForInitialAddonList(document);
|
||||
yield installAddon(document, "addons/unpacked/install.rdf",
|
||||
ADDON_NAME, ADDON_NAME);
|
||||
|
||||
// Retrieve the Reload button.
|
||||
const names = [...document.querySelectorAll("#addons .target-name")];
|
||||
const name = names.filter(element => element.textContent === ADDON_NAME)[0];
|
||||
ok(name, "Found " + ADDON_NAME + " add-on in the list");
|
||||
const targetElement = name.parentNode.parentNode;
|
||||
const reloadButton = targetElement.querySelector(".reload-button");
|
||||
ok(reloadButton, "Found its reload button");
|
||||
|
||||
const onDisabled = promiseAddonEvent("onDisabled");
|
||||
const onEnabled = promiseAddonEvent("onEnabled");
|
||||
|
||||
const onBootstrapInstallCalled = new Promise(done => {
|
||||
Services.obs.addObserver(function listener() {
|
||||
Services.obs.removeObserver(listener, ADDON_NAME, false);
|
||||
ok(true, "Add-on was installed: " + ADDON_NAME);
|
||||
done();
|
||||
}, ADDON_NAME, false);
|
||||
});
|
||||
|
||||
reloadButton.click();
|
||||
|
||||
const [disabledAddon] = yield onDisabled;
|
||||
ok(disabledAddon.name === ADDON_NAME,
|
||||
"Add-on was disabled: " + disabledAddon.name);
|
||||
|
||||
const [enabledAddon] = yield onEnabled;
|
||||
ok(enabledAddon.name === ADDON_NAME,
|
||||
"Add-on was re-enabled: " + enabledAddon.name);
|
||||
|
||||
yield onBootstrapInstallCalled;
|
||||
|
||||
info("Uninstall addon installed earlier.");
|
||||
yield uninstallAddon(document, ADDON_ID, ADDON_NAME);
|
||||
yield closeAboutDebugging(tab);
|
||||
});
|
|
@ -20,7 +20,6 @@ add_task(function* () {
|
|||
});
|
||||
|
||||
let { tab, document } = yield openAboutDebugging("addons");
|
||||
yield waitForInitialAddonList(document);
|
||||
|
||||
info("Install a test addon.");
|
||||
yield installAddon(document, "addons/unpacked/install.rdf", ADDON_NAME,
|
||||
|
|
|
@ -5,8 +5,7 @@
|
|||
/* eslint-disable mozilla/no-cpows-in-tests */
|
||||
/* exported openAboutDebugging, closeAboutDebugging, installAddon,
|
||||
uninstallAddon, waitForMutation, assertHasTarget,
|
||||
waitForInitialAddonList, waitForServiceWorkerRegistered,
|
||||
unregisterServiceWorker */
|
||||
waitForServiceWorkerRegistered, unregisterServiceWorker */
|
||||
/* global sendAsyncMessage */
|
||||
|
||||
"use strict";
|
||||
|
@ -156,18 +155,6 @@ function* uninstallAddon(document, addonId, addonName) {
|
|||
+ names);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a promise that will resolve when the add-on list has been updated.
|
||||
*
|
||||
* @param {Node} document
|
||||
* @return {Promise}
|
||||
*/
|
||||
function waitForInitialAddonList(document) {
|
||||
// Wait for actor to load initial list of add-ons.
|
||||
return waitForMutation(document.querySelector("#addons .targets"),
|
||||
{ childList: true });
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a promise that will resolve after receiving a mutation matching the
|
||||
* provided mutation options on the provided target.
|
||||
|
|
|
@ -16,7 +16,6 @@ addonDebugging.moreInfo = more info
|
|||
loadTemporaryAddon = Load Temporary Add-on
|
||||
extensions = Extensions
|
||||
selectAddonFromFile2 = Select Manifest File or Package (.xpi)
|
||||
reload = Reload
|
||||
|
||||
workers = Workers
|
||||
serviceWorkers = Service Workers
|
||||
|
|
|
@ -83,7 +83,6 @@ BrowserAddonActor.prototype = {
|
|||
id: this.id,
|
||||
name: this._addon.name,
|
||||
url: this.url,
|
||||
iconURL: this._addon.iconURL,
|
||||
debuggable: this._addon.isDebuggable,
|
||||
consoleActor: this._consoleActor.actorID,
|
||||
|
||||
|
@ -156,13 +155,6 @@ BrowserAddonActor.prototype = {
|
|||
return { type: "detached" };
|
||||
},
|
||||
|
||||
onReload: function BAA_onReload() {
|
||||
return this._addon.reload()
|
||||
.then(() => {
|
||||
return {}; // send an empty response
|
||||
});
|
||||
},
|
||||
|
||||
preNest: function() {
|
||||
let e = Services.wm.getEnumerator(null);
|
||||
while (e.hasMoreElements()) {
|
||||
|
@ -257,8 +249,7 @@ BrowserAddonActor.prototype = {
|
|||
|
||||
BrowserAddonActor.prototype.requestTypes = {
|
||||
"attach": BrowserAddonActor.prototype.onAttach,
|
||||
"detach": BrowserAddonActor.prototype.onDetach,
|
||||
"reload": BrowserAddonActor.prototype.onReload
|
||||
"detach": BrowserAddonActor.prototype.onDetach
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче