Bug 1449931 - Remove old-event-emitter usage from devtools/shared/webconsole; r=bgrins.

MozReview-Commit-ID: HkbUm0XkeJs

--HG--
extra : rebase_source : 6b75408de3370cc2f0047996532dceaab4403a34
This commit is contained in:
Nicolas Chevobbe 2018-03-29 16:06:24 +02:00
Родитель ffe252e467
Коммит 41edb0dc48
7 изменённых файлов: 13 добавлений и 19 удалений

Просмотреть файл

@ -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);

Просмотреть файл

@ -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);
}

Просмотреть файл

@ -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;

Просмотреть файл

@ -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,
});

Просмотреть файл

@ -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) {

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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");
/**