From 41edb0dc48a8b57539d6b8b4591a92a60ec188fd Mon Sep 17 00:00:00 2001 From: Nicolas Chevobbe Date: Thu, 29 Mar 2018 16:06:24 +0200 Subject: [PATCH] Bug 1449931 - Remove old-event-emitter usage from devtools/shared/webconsole; r=bgrins. MozReview-Commit-ID: HkbUm0XkeJs --HG-- extra : rebase_source : 6b75408de3370cc2f0047996532dceaab4403a34 --- devtools/client/framework/target.js | 2 +- .../client/netmonitor/src/connector/firefox-connector.js | 6 +++--- .../netmonitor/src/connector/firefox-data-provider.js | 6 ++---- devtools/client/webconsole/new-console-output/store.js | 6 +++--- .../test/fixtures/stub-generators/head.js | 2 +- devtools/client/webconsole/webconsole-connection-proxy.js | 8 ++------ devtools/shared/webconsole/client.js | 2 +- 7 files changed, 13 insertions(+), 19 deletions(-) diff --git a/devtools/client/framework/target.js b/devtools/client/framework/target.js index 31005820107d..56894f8014b9 100644 --- a/devtools/client/framework/target.js +++ b/devtools/client/framework/target.js @@ -457,7 +457,7 @@ TabTarget.prototype = { } this.activeConsole = consoleClient; - this._onInspectObject = (event, packet) => this.emit("inspect-object", packet); + this._onInspectObject = packet => this.emit("inspect-object", packet); this.activeConsole.on("inspectObject", this._onInspectObject); this._remote.resolve(null); diff --git a/devtools/client/netmonitor/src/connector/firefox-connector.js b/devtools/client/netmonitor/src/connector/firefox-connector.js index f82ea666e72c..e7b450e59755 100644 --- a/devtools/client/netmonitor/src/connector/firefox-connector.js +++ b/devtools/client/netmonitor/src/connector/firefox-connector.js @@ -178,10 +178,10 @@ class FirefoxConnector { displayCachedEvents() { for (let networkInfo of this.webConsoleClient.getNetworkEvents()) { // First add the request to the timeline. - this.dataProvider.onNetworkEvent("networkEvent", networkInfo); + this.dataProvider.onNetworkEvent(networkInfo); // Then replay any updates already received. for (let updateType of networkInfo.updates) { - this.dataProvider.onNetworkEventUpdate("networkEventUpdate", { + this.dataProvider.onNetworkEventUpdate({ packet: { updateType }, networkInfo, }); @@ -215,7 +215,7 @@ class FirefoxConnector { * * @param {object} marker */ - onDocEvent(type, event) { + onDocEvent(event) { this.actions.addTimingMarker(event); window.emit(EVENTS.TIMELINE_EVENT, event); } diff --git a/devtools/client/netmonitor/src/connector/firefox-data-provider.js b/devtools/client/netmonitor/src/connector/firefox-data-provider.js index b33ba15b0e40..99885d84644c 100644 --- a/devtools/client/netmonitor/src/connector/firefox-data-provider.js +++ b/devtools/client/netmonitor/src/connector/firefox-data-provider.js @@ -288,10 +288,9 @@ class FirefoxDataProvider { /** * The "networkEvent" message type handler. * - * @param {string} type message type * @param {object} networkInfo network request information */ - async onNetworkEvent(type, networkInfo) { + async onNetworkEvent(networkInfo) { let { actor, cause, @@ -321,11 +320,10 @@ class FirefoxDataProvider { /** * The "networkEventUpdate" message type handler. * - * @param {string} type message type * @param {object} packet the message received from the server. * @param {object} networkInfo the network request information. */ - onNetworkEventUpdate(type, data) { + onNetworkEventUpdate(data) { let { packet, networkInfo } = data; let { actor } = networkInfo; let { updateType } = packet; diff --git a/devtools/client/webconsole/new-console-output/store.js b/devtools/client/webconsole/new-console-output/store.js index ef5a98d483b4..a7f5a969a633 100644 --- a/devtools/client/webconsole/new-console-output/store.js +++ b/devtools/client/webconsole/new-console-output/store.js @@ -216,9 +216,9 @@ function enableNetProvider(hud) { let updates = getAllNetworkMessagesUpdateById(newState); let message = updates[action.id]; if (message && !message.openedOnce && message.source == "network") { - dataProvider.onNetworkEvent(null, message); + dataProvider.onNetworkEvent(message); message.updates.forEach(updateType => { - dataProvider.onNetworkEventUpdate(null, { + dataProvider.onNetworkEventUpdate({ packet: { updateType: updateType }, networkInfo: message, }); @@ -238,7 +238,7 @@ function enableNetProvider(hud) { if (open) { let message = getMessage(state, actor); message.updates.forEach(updateType => { - dataProvider.onNetworkEventUpdate(null, { + dataProvider.onNetworkEventUpdate({ packet: { updateType }, networkInfo: message, }); diff --git a/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/head.js b/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/head.js index 9cc3a0e3bb27..32a6d5dcbed8 100644 --- a/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/head.js +++ b/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/head.js @@ -425,7 +425,7 @@ async function generateNetworkEventStubs() { for (let [key, {keys, code}] of networkEvent) { let onNetwork = new Promise(resolve => { let i = 0; - toolbox.target.activeConsole.on("networkEvent", function onNetworkEvent(type, res) { + toolbox.target.activeConsole.on("networkEvent", function onNetworkEvent(res) { stubs.packets.push(formatPacket(keys[i], res)); stubs.preparedMessages.push(formatNetworkEventStub(keys[i], res)); if (++i === keys.length) { diff --git a/devtools/client/webconsole/webconsole-connection-proxy.js b/devtools/client/webconsole/webconsole-connection-proxy.js index 91c0cfb5ac51..a507748f3177 100644 --- a/devtools/client/webconsole/webconsole-connection-proxy.js +++ b/devtools/client/webconsole/webconsole-connection-proxy.js @@ -354,12 +354,10 @@ WebConsoleConnectionProxy.prototype = { * the UI for displaying. * * @private - * @param string type - * Message type. * @param object networkInfo * The network request information. */ - _onNetworkEvent: function(type, networkInfo) { + _onNetworkEvent: function(networkInfo) { if (!this.webConsoleFrame) { return; } @@ -374,12 +372,10 @@ WebConsoleConnectionProxy.prototype = { * the UI for displaying. * * @private - * @param string type - * Message type. * @param object response * The update response received from the server. */ - _onNetworkEventUpdate: function(type, response) { + _onNetworkEventUpdate: function(response) { if (!this.webConsoleFrame) { return; } diff --git a/devtools/shared/webconsole/client.js b/devtools/shared/webconsole/client.js index 6802e5fba2ac..9463c9d26203 100644 --- a/devtools/shared/webconsole/client.js +++ b/devtools/shared/webconsole/client.js @@ -7,7 +7,7 @@ "use strict"; const DevToolsUtils = require("devtools/shared/DevToolsUtils"); -const EventEmitter = require("devtools/shared/old-event-emitter"); +const EventEmitter = require("devtools/shared/event-emitter"); const LongStringClient = require("devtools/shared/client/long-string-client"); /**