# HG changeset patch # User Nicolas Chevobbe # Date 1520243155 -3600 # Node ID 4cc7620edb4f1e4090b9b6307ef1c788355dd83c # Parent d2947a8d1390c2fd27930a30b4548911d95b119e Bug 1382604 - Remove old-event-emitter usage from scratchpad; r=jryans. Usage was removed from devtools/client/framework/sidebar as well since it emits events with the parent component. MozReview-Commit-ID: 24LLmnSZ89I diff --git a/devtools/client/framework/sidebar.js b/devtools/client/framework/sidebar.js --- a/devtools/client/framework/sidebar.js +++ b/devtools/client/framework/sidebar.js @@ -1,17 +1,17 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ "use strict"; var Services = require("Services"); var {Task} = require("devtools/shared/task"); -var EventEmitter = require("devtools/shared/old-event-emitter"); +var EventEmitter = require("devtools/shared/event-emitter"); var Telemetry = require("devtools/client/shared/telemetry"); const {LocalizationHelper} = require("devtools/shared/l10n"); const L10N = new LocalizationHelper("devtools/client/locales/toolbox.properties"); const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; /** diff --git a/devtools/client/framework/test/browser_toolbox_sidebar.js b/devtools/client/framework/test/browser_toolbox_sidebar.js --- a/devtools/client/framework/test/browser_toolbox_sidebar.js +++ b/devtools/client/framework/test/browser_toolbox_sidebar.js @@ -43,40 +43,40 @@ function test() { gDevTools.showToolbox(target, toolDefinition.id).then(function (toolbox) { let panel = toolbox.getPanel(toolDefinition.id); panel.toolbox = toolbox; ok(true, "Tool open"); let tabbox = panel.panelDoc.getElementById("sidebar"); panel.sidebar = new ToolSidebar(tabbox, panel, "testbug865688", true); - panel.sidebar.on("new-tab-registered", function (event, id) { + panel.sidebar.on("new-tab-registered", function (id) { registeredTabs[id] = true; }); - panel.sidebar.once("tab1-ready", function (event) { - info(event); + panel.sidebar.once("tab1-ready", function () { + info("tab1-ready"); readyTabs.tab1 = true; allTabsReady(panel); }); - panel.sidebar.once("tab2-ready", function (event) { - info(event); + panel.sidebar.once("tab2-ready", function () { + info("tab2-ready"); readyTabs.tab2 = true; allTabsReady(panel); }); - panel.sidebar.once("tab3-ready", function (event) { - info(event); + panel.sidebar.once("tab3-ready", function () { + info("tab3-ready"); readyTabs.tab3 = true; allTabsReady(panel); }); - panel.sidebar.once("tab1-selected", function (event) { - info(event); + panel.sidebar.once("tab1-selected", function () { + info("tab1-selected"); tab1Selected = true; allTabsReady(panel); }); panel.sidebar.addTab("tab1", tab1URL, {selected: true}); panel.sidebar.addTab("tab2", tab2URL); panel.sidebar.addTab("tab3", tab3URL); @@ -122,18 +122,18 @@ function test() { testRemoval(panel); }); }); panel.sidebar.select("tab2"); } function testRemoval(panel) { - panel.sidebar.once("tab-unregistered", function (event, id) { - info(event); + panel.sidebar.once("tab-unregistered", function (id) { + info("tab-unregistered"); registeredTabs[id] = false; is(id, "tab3", "The right tab must be removed"); let tabs = panel.sidebar._tabbox.querySelectorAll("tab"); let panels = panel.sidebar._tabbox.querySelectorAll("tabpanel"); is(tabs.length, 2, "There is the right number of tabs"); diff --git a/devtools/client/framework/test/browser_toolbox_sidebar_events.js b/devtools/client/framework/test/browser_toolbox_sidebar_events.js --- a/devtools/client/framework/test/browser_toolbox_sidebar_events.js +++ b/devtools/client/framework/test/browser_toolbox_sidebar_events.js @@ -34,33 +34,33 @@ function test() { gDevTools.registerTool(toolDefinition); addTab("about:blank").then(function (aTab) { let target = TargetFactory.forTab(aTab); gDevTools.showToolbox(target, toolDefinition.id).then(function (toolbox) { let panel = toolbox.getPanel(toolDefinition.id); ok(true, "Tool open"); - panel.once("sidebar-created", function (event, id) { - collectedEvents.push(event); + panel.once("sidebar-created", function () { + collectedEvents.push("sidebar-created"); }); - panel.once("sidebar-destroyed", function (event, id) { - collectedEvents.push(event); + panel.once("sidebar-destroyed", function () { + collectedEvents.push("sidebar-destroyed"); }); let tabbox = panel.panelDoc.getElementById("sidebar"); panel.sidebar = new ToolSidebar(tabbox, panel, "testbug1072208", true); - panel.sidebar.once("show", function (event, id) { - collectedEvents.push(event); + panel.sidebar.once("show", function () { + collectedEvents.push("show"); }); - panel.sidebar.once("hide", function (event, id) { - collectedEvents.push(event); + panel.sidebar.once("hide", function () { + collectedEvents.push("hide"); }); panel.sidebar.once("tab1-selected", () => finishUp(panel)); panel.sidebar.addTab("tab1", tab1URL, {selected: true}); panel.sidebar.show(); }).catch(console.error); }); diff --git a/devtools/client/scratchpad/scratchpad-panel.js b/devtools/client/scratchpad/scratchpad-panel.js --- a/devtools/client/scratchpad/scratchpad-panel.js +++ b/devtools/client/scratchpad/scratchpad-panel.js @@ -1,17 +1,17 @@ /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ /* vim: set ft=javascript ts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ "use strict"; const {Cu} = require("chrome"); -const EventEmitter = require("devtools/shared/old-event-emitter"); +const EventEmitter = require("devtools/shared/event-emitter"); const promise = require("promise"); const defer = require("devtools/shared/defer"); function ScratchpadPanel(iframeWindow, toolbox) { let { Scratchpad } = iframeWindow; this._toolbox = toolbox; this.panelWin = iframeWindow; diff --git a/devtools/client/scratchpad/scratchpad.js b/devtools/client/scratchpad/scratchpad.js --- a/devtools/client/scratchpad/scratchpad.js +++ b/devtools/client/scratchpad/scratchpad.js @@ -38,17 +38,17 @@ const TAB_SIZE = "devtools.editor.tabsiz const FALLBACK_CHARSET_LIST = "intl.fallbackCharsetList.ISO-8859-1"; const VARIABLES_VIEW_URL = "chrome://devtools/content/shared/widgets/VariablesView.xul"; const {require, loader} = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {}); const Editor = require("devtools/client/sourceeditor/editor"); const TargetFactory = require("devtools/client/framework/target").TargetFactory; -const EventEmitter = require("devtools/shared/old-event-emitter"); +const EventEmitter = require("devtools/shared/event-emitter"); const {DevToolsWorker} = require("devtools/shared/worker/worker"); const DevToolsUtils = require("devtools/shared/DevToolsUtils"); const flags = require("devtools/shared/flags"); const promise = require("promise"); const defer = require("devtools/shared/defer"); const Services = require("Services"); const {gDevTools} = require("devtools/client/framework/devtools"); const { extend } = require("devtools/shared/extend");