Bug 1382604 - Remove old-event-emitter usage from scratchpad; r=jryans.
authorNicolas Chevobbe <nchevobbe@mozilla.com>
Mon, 05 Mar 2018 10:45:55 +0100
changeset 406578 4cc7620edb4f1e4090b9b6307ef1c788355dd83c
parent 406577 fd805c59ae56d8707d6c6469bdbdf6ffa22ebb84
child 406579 b7bb0ef4ddaa6e385db3094619963a2b6015220f
push id60604
push usernchevobbe@mozilla.com
push dateMon, 05 Mar 2018 16:17:49 +0000
treeherderautoland@4cc7620edb4f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjryans
bugs1382604
milestone60.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
devtools/client/framework/sidebar.js
devtools/client/framework/test/browser_toolbox_sidebar.js
devtools/client/framework/test/browser_toolbox_sidebar_events.js
devtools/client/scratchpad/scratchpad-panel.js
devtools/client/scratchpad/scratchpad.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";
 
 /**
--- 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");
--- 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);
   });
 
--- 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;
--- 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");