зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1382581 - Adapt extension code to the EventEmitter change in devtools/client/framework; r=rpl.
MozReview-Commit-ID: 3I7kmXiPOqd --HG-- extra : rebase_source : 033f3aef38cf90a6ea495f2ab86de1900ae2c4e3
This commit is contained in:
Родитель
5789c8f4fa
Коммит
7f4f2e28cf
|
@ -15,7 +15,7 @@ this.devtools_network = class extends ExtensionAPI {
|
|||
devtools: {
|
||||
network: {
|
||||
onNavigated: new EventManager(context, "devtools.onNavigated", fire => {
|
||||
let listener = (event, data) => {
|
||||
let listener = data => {
|
||||
fire.async(data.url);
|
||||
};
|
||||
|
||||
|
|
|
@ -169,7 +169,7 @@ class ParentDevToolsPanel {
|
|||
}
|
||||
}
|
||||
|
||||
async onToolboxPanelSelect(what, id) {
|
||||
async onToolboxPanelSelect(id) {
|
||||
if (!this.waitTopLevelContext || !this.panelAdded) {
|
||||
return;
|
||||
}
|
||||
|
@ -350,7 +350,7 @@ class DevToolsSelectionObserver extends EventEmitter {
|
|||
this.destroyed = true;
|
||||
}
|
||||
|
||||
onSelected(event) {
|
||||
onSelected() {
|
||||
this.emit("selectionChanged");
|
||||
}
|
||||
}
|
||||
|
@ -423,7 +423,7 @@ class ParentDevToolsInspectorSidebar {
|
|||
this.destroyed = true;
|
||||
}
|
||||
|
||||
onSidebarCreated(evt, sidebar) {
|
||||
onSidebarCreated(sidebar) {
|
||||
this.extensionSidebar = sidebar;
|
||||
|
||||
const {_lazySidebarInit} = this;
|
||||
|
@ -434,7 +434,7 @@ class ParentDevToolsInspectorSidebar {
|
|||
}
|
||||
}
|
||||
|
||||
onSidebarSelect(what, id) {
|
||||
onSidebarSelect(id) {
|
||||
if (!this.extensionSidebar) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -237,7 +237,7 @@ class DevToolsPageDefinition {
|
|||
this.devtoolsPageForTarget = new Map();
|
||||
}
|
||||
|
||||
onThemeChanged(evt, themeName) {
|
||||
onThemeChanged(themeName) {
|
||||
Services.ppmm.broadcastAsyncMessage("Extension:DevToolsThemeChanged", {themeName});
|
||||
}
|
||||
|
||||
|
@ -304,7 +304,7 @@ initDevTools = function() {
|
|||
/* eslint-disable mozilla/balanced-listeners */
|
||||
// Create a devtools page context for a new opened toolbox,
|
||||
// based on the registered devtools_page definitions.
|
||||
DevToolsShim.on("toolbox-created", (evt, toolbox) => {
|
||||
DevToolsShim.on("toolbox-created", toolbox => {
|
||||
if (!toolbox.target.isLocalTab) {
|
||||
// Only local tabs are currently supported (See Bug 1304378 for additional details
|
||||
// related to remote targets support).
|
||||
|
@ -325,7 +325,7 @@ initDevTools = function() {
|
|||
|
||||
// Destroy a devtools page context for a destroyed toolbox,
|
||||
// based on the registered devtools_page definitions.
|
||||
DevToolsShim.on("toolbox-destroy", (evt, target) => {
|
||||
DevToolsShim.on("toolbox-destroy", target => {
|
||||
if (!target.isLocalTab) {
|
||||
// Only local tabs are currently supported (See Bug 1304378 for additional details
|
||||
// related to remote targets support).
|
||||
|
|
|
@ -93,9 +93,7 @@ add_task(async function test_devtools_inspectedWindow_eval_bindings() {
|
|||
info("Toolbox switched back to the styleeditor panel");
|
||||
|
||||
const inspectorPanelSelectedPromise = (async () => {
|
||||
const toolId = await new Promise(resolve => {
|
||||
toolbox.once("select", (evt, toolId) => resolve(toolId));
|
||||
});
|
||||
const toolId = await toolbox.once("select");
|
||||
|
||||
if (toolId === "inspector") {
|
||||
const selectedNodeName = toolbox.selection.nodeFront &&
|
||||
|
|
|
@ -20,10 +20,10 @@ const DEVTOOLS_THEME_PREF = "devtools.theme";
|
|||
* - devtools.panels.create is able to create a devtools panel.
|
||||
*/
|
||||
|
||||
async function switchTheme(theme) {
|
||||
const waitforThemeChanged = new Promise(resolve => gDevTools.once("theme-changed", resolve));
|
||||
function switchTheme(theme) {
|
||||
const waitforThemeChanged = gDevTools.once("theme-changed");
|
||||
Preferences.set(DEVTOOLS_THEME_PREF, theme);
|
||||
await waitforThemeChanged;
|
||||
return waitforThemeChanged;
|
||||
}
|
||||
|
||||
async function testThemeSwitching(extension, locations = ["page"]) {
|
||||
|
@ -276,9 +276,7 @@ add_task(async function test_devtools_page_panels_create() {
|
|||
is(secondCycleResults.panelHidden, 2, "panel.onHidden listener has been called twice");
|
||||
|
||||
// Turn off the addon devtools panel using the visibilityswitch.
|
||||
const waitToolVisibilityOff = new Promise(resolve => {
|
||||
toolbox.once("tool-unregistered", resolve);
|
||||
});
|
||||
const waitToolVisibilityOff = toolbox.once("tool-unregistered");
|
||||
|
||||
Services.prefs.setBoolPref(`devtools.webext-${panelId}.enabled`, false);
|
||||
gDevTools.emit("tool-unregistered", panelId);
|
||||
|
@ -292,9 +290,7 @@ add_task(async function test_devtools_page_panels_create() {
|
|||
"The tool is not visible on visibilityswitch set to false");
|
||||
|
||||
// Turn on the addon devtools panel using the visibilityswitch.
|
||||
const waitToolVisibilityOn = new Promise(resolve => {
|
||||
toolbox.once("tool-registered", resolve);
|
||||
});
|
||||
const waitToolVisibilityOn = toolbox.once("tool-registered");
|
||||
|
||||
Services.prefs.setBoolPref(`devtools.webext-${panelId}.enabled`, true);
|
||||
gDevTools.emit("tool-registered", panelId);
|
||||
|
|
|
@ -97,7 +97,7 @@ add_task(async function testWebExtensionsToolboxSwitchToPopup() {
|
|||
dump(`Clicked the noautohide button\n`);
|
||||
|
||||
popupFramePromise = new Promise(resolve => {
|
||||
let listener = (event, data) => {
|
||||
let listener = data => {
|
||||
if (data.frames.some(({url}) => url && url.endsWith("popup.html"))) {
|
||||
toolbox.target.off("frame-update", listener);
|
||||
resolve();
|
||||
|
|
Загрузка…
Ссылка в новой задаче