Bug 1382606 - Switch webconsole to new event-emitter; r=Honza.

MozReview-Commit-ID: HBogPeOI7WM

--HG--
extra : rebase_source : 4ad1fb922ffc818d175ae3c09820ce31ba416487
This commit is contained in:
Nicolas Chevobbe 2018-02-23 09:10:36 +01:00
Родитель 71f42f588a
Коммит 8ea55ce28a
28 изменённых файлов: 37 добавлений и 36 удалений

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

@ -126,7 +126,7 @@ add_task(async function test_devtools_inspectedWindow_eval_bindings() {
if (jsterm.hud.NEW_CONSOLE_OUTPUT_ENABLED === true) {
// Wait for the message to appear on the console.
const messageNode = await new Promise(resolve => {
jsterm.hud.on("new-messages", function onThisMessage(e, messages) {
jsterm.hud.on("new-messages", function onThisMessage(messages) {
for (let m of messages) {
resolve(m.node);
jsterm.hud.off("new-messages", onThisMessage);
@ -166,7 +166,7 @@ add_task(async function test_devtools_inspectedWindow_eval_bindings() {
is(nodes.length, 3, "The object preview has the expected number of nodes");
} else {
const options = await new Promise(resolve => {
jsterm.once("variablesview-open", (evt, view, options) => resolve(options));
jsterm.once("variablesview-open", (view, options) => resolve(options));
});
const objectType = options.objectActor.type;

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

@ -49,7 +49,7 @@ function test()
function testFocus(sw, hud) {
let sp = sw.Scratchpad;
function onMessage(event, messages) {
function onMessage(messages) {
let msg = [...messages][0];
let node = msg.node;

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

@ -16,7 +16,7 @@ const {KeyCodes} = require("devtools/client/shared/keycodes");
loader.lazyServiceGetter(this, "clipboardHelper",
"@mozilla.org/widget/clipboardhelper;1",
"nsIClipboardHelper");
loader.lazyRequireGetter(this, "EventEmitter", "devtools/shared/old-event-emitter");
loader.lazyRequireGetter(this, "EventEmitter", "devtools/shared/event-emitter");
loader.lazyRequireGetter(this, "AutocompletePopup", "devtools/client/shared/autocomplete-popup");
loader.lazyRequireGetter(this, "ToolSidebar", "devtools/client/framework/sidebar", true);
loader.lazyRequireGetter(this, "Messages", "devtools/client/webconsole/console-output", true);
@ -639,7 +639,7 @@ JSTerm.prototype = {
window.focus();
}
this.emit("variablesview-open", view, options);
this.emit("variablesview-open", {view, options});
return view;
};

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

@ -12,7 +12,7 @@ const actions = require("devtools/client/webconsole/new-console-output/actions/i
const { createContextMenu } = require("devtools/client/webconsole/new-console-output/utils/context-menu");
const { configureStore } = require("devtools/client/webconsole/new-console-output/store");
const EventEmitter = require("devtools/shared/old-event-emitter");
const EventEmitter = require("devtools/shared/event-emitter");
const ConsoleOutput = createFactory(require("devtools/client/webconsole/new-console-output/components/ConsoleOutput"));
const FilterBar = createFactory(require("devtools/client/webconsole/new-console-output/components/FilterBar"));
const SideBar = createFactory(require("devtools/client/webconsole/new-console-output/components/SideBar"));
@ -241,7 +241,7 @@ NewConsoleOutputWrapper.prototype = {
promise = new Promise(resolve => {
let jsterm = this.jsterm;
jsterm.hud.on("new-messages", function onThisMessage(e, messages) {
jsterm.hud.on("new-messages", function onThisMessage(messages) {
for (let m of messages) {
if (m.timeStamp === timeStampToMatch) {
resolve(m.node);

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

@ -28,7 +28,7 @@ const NewConsoleOutputWrapper = browserRequire(
"devtools/client/webconsole/new-console-output/new-console-output-wrapper");
const actions =
browserRequire("devtools/client/webconsole/new-console-output/actions/index");
const EventEmitter = browserRequire("devtools/shared/old-event-emitter");
const EventEmitter = browserRequire("devtools/shared/event-emitter");
const testPackets = Array.from({length: NUM_MESSAGES}).map((el, id) => ({
"from": "server1.conn4.child1/consoleActor2",
"type": "consoleAPICall",

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

@ -437,7 +437,7 @@ function* generateNetworkEventStubs() {
let onNetworkUpdate = new Promise(resolve => {
let i = 0;
ui.jsterm.hud.on("network-message-updated", function onNetworkUpdated(event, res) {
ui.jsterm.hud.on("network-message-updated", function onNetworkUpdated(res) {
let updateKey = `${keys[i++]} update`;
// We cannot ensure the form of the network update packet, some properties
// might be in another order than in the original packet.

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

@ -7,7 +7,7 @@
"use strict";
function onNewMessage(aEvent, aNewMessages) {
function onNewMessage(aNewMessages) {
for (let msg of aNewMessages) {
// Messages that shouldn't be output contain the substring FAIL_TEST
if (msg.node.textContent.includes("FAIL_TEST")) {
@ -119,7 +119,7 @@ add_task(function* () {
let deferred = defer();
let onFetch = (aEvent, aVar) => {
let onFetch = (aVar) => {
// Skip the notification from console.dir variablesview-fetched.
if (aVar._variablesView != hud.jsterm._variablesView) {
return;

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

@ -81,7 +81,7 @@ function onExecuteGetName(results) {
});
}
function onGetNameFetch(evt, view) {
function onGetNameFetch(view) {
gVariablesView = view._variablesView;
ok(gVariablesView, "variables view object");

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

@ -108,7 +108,7 @@ function waitForMessages({ hud, messages }) {
return new Promise(resolve => {
const matchedMessages = [];
hud.ui.on("new-messages",
function messagesReceived(e, newMessages) {
function messagesReceived(newMessages) {
for (let message of messages) {
if (message.matched) {
continue;

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

@ -7,7 +7,7 @@
"use strict";
const {Utils: WebConsoleUtils} = require("devtools/client/webconsole/utils");
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");
const Services = require("Services");

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

@ -10,7 +10,7 @@ const promise = require("promise");
const defer = require("devtools/shared/defer");
loader.lazyRequireGetter(this, "HUDService", "devtools/client/webconsole/hudservice", true);
loader.lazyGetter(this, "EventEmitter", () => require("devtools/shared/old-event-emitter"));
loader.lazyGetter(this, "EventEmitter", () => require("devtools/shared/event-emitter"));
/**
* A DevToolPanel that controls the Web Console.

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

@ -7,7 +7,7 @@
"use strict";
function onNewMessage(aEvent, aNewMessages) {
function onNewMessage(aNewMessages) {
for (let msg of aNewMessages) {
// Messages that shouldn't be output contain the substring FAIL_TEST
if (msg.node.textContent.includes("FAIL_TEST")) {
@ -119,7 +119,7 @@ add_task(function* () {
let deferred = defer();
let onFetch = (aEvent, aVar) => {
let onFetch = (aVar) => {
// Skip the notification from console.dir variablesview-fetched.
if (aVar._variablesView != hud.jsterm._variablesView) {
return;

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

@ -28,7 +28,7 @@ function testObjectInspectorPropertiesAreNotSet(variablesView) {
}
function* getVariablesView(hud) {
function openVariablesView(event, vview) {
function openVariablesView(vview) {
deferred.resolve(vview._variablesView);
}

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

@ -37,7 +37,7 @@ function test() {
const jsterm = hud.jsterm;
let deferred = defer();
jsterm.once("variablesview-fetched", (_, val) => deferred.resolve(val));
jsterm.once("variablesview-fetched", (val) => deferred.resolve(val));
jsterm.execute("inspect(document.querySelectorAll('div'))");
let variableScope = yield deferred.promise;

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

@ -84,7 +84,7 @@ function test() {
function* testNotSorted(aObject) {
info("Testing " + aObject);
let deferred = defer();
jsterm.once("variablesview-fetched", (_, aVar) => deferred.resolve(aVar));
jsterm.once("variablesview-fetched", (aVar) => deferred.resolve(aVar));
jsterm.execute("inspect(" + aObject + ")");
let variableScope = yield deferred.promise;
@ -110,7 +110,7 @@ function test() {
function* testSorted(aObject) {
info("Testing " + aObject);
let deferred = defer();
jsterm.once("variablesview-fetched", (_, aVar) => deferred.resolve(aVar));
jsterm.once("variablesview-fetched", (aVar) => deferred.resolve(aVar));
jsterm.execute("inspect(" + aObject + ")");
let variableScope = yield deferred.promise;

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

@ -40,7 +40,7 @@ function onQSAexecuted(msg) {
);
}
function onNodeListViewFetched(event, variable) {
function onNodeListViewFetched(variable) {
gVariablesView = variable._variablesView;
ok(gVariablesView, "variables view object");

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

@ -54,7 +54,7 @@ function* testVariablesView(hud) {
info("Waiting for variable view to appear");
let variable = yield new Promise(resolve => {
jsterm.once("variablesview-fetched", (e, variable) => {
jsterm.once("variablesview-fetched", (variable) => {
resolve(variable);
});
executeSoon(() => EventUtils.synthesizeMouse(anchor, 2, 2, {},

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

@ -57,7 +57,7 @@ function* testVariablesView(hud) {
info("Waiting for variable view to appear");
let variable = yield new Promise(resolve => {
jsterm.once("variablesview-fetched", (e, variable) => {
jsterm.once("variablesview-fetched", (variable) => {
resolve(variable);
});
executeSoon(() => EventUtils.synthesizeMouse(anchor, 2, 2, {},

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

@ -25,7 +25,7 @@ function consoleOpened(hud) {
hud.jsterm.once("variablesview-fetched", onOpen);
}
function onViewOpened(hud, event, view) {
function onViewOpened(hud, view) {
let doc = gBrowser.contentWindowAsCPOW.wrappedJSObject.document;
findVariableViewProperties(view, [

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

@ -57,7 +57,7 @@ function consoleOpened(HUD) {
});
}
function testVariablesView(aWebconsole, aEvent, aView) {
function testVariablesView(aWebconsole, aView) {
findVariableViewProperties(aView, [
{ name: "gen1", isGenerator: true },
{ name: "gen2", isGenerator: true },

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

@ -85,7 +85,7 @@ function testPropertyPanel() {
let jsterm = gHUD.jsterm;
jsterm.clearOutput();
jsterm.execute("document", (msg) => {
jsterm.once("variablesview-fetched", (evt, view) => {
jsterm.once("variablesview-fetched", (view) => {
deferred.resolve(view);
});
let anchor = msg.querySelector(".message-body a");

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

@ -81,7 +81,7 @@ function onExecuteGetName(results) {
});
}
function onGetNameFetch(evt, view) {
function onGetNameFetch(view) {
gVariablesView = view._variablesView;
ok(gVariablesView, "variables view object");

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

@ -116,7 +116,7 @@
}
function clickMessageAndShowVariablesView() {
let result = jsterm.once("variablesview-fetched", (event, vview) => {
let result = jsterm.once("variablesview-fetched", (vview) => {
variablesView = vview;
});

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

@ -1249,7 +1249,7 @@ function waitForMessages(options) {
return rule.matched.size == count;
}
function onMessagesAdded(event, newMessages) {
function onMessagesAdded(newMessages) {
for (let msg of newMessages) {
let elem = msg.node;
let location = getRenderedSource(elem);
@ -1332,7 +1332,7 @@ function waitForMessages(options) {
});
}
onMessagesAdded("new-messages", messages);
onMessagesAdded(messages);
if (!allRulesMatched()) {
listenerAdded = true;
@ -1529,7 +1529,7 @@ function checkOutputForInputs(hud, inputTests) {
yield promise.resolve(null);
}
function onVariablesViewOpen(entry, {resolve, reject}, event, view, options) {
function onVariablesViewOpen(entry, {resolve, reject}, {view, options}) {
info("Variables view opened");
let label = entry.variablesViewLabel || entry.output;
if (typeof label == "string" && options.label != label) {

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

@ -25,7 +25,7 @@ const {PrefObserver} = require("devtools/client/shared/prefs");
loader.lazyServiceGetter(this, "clipboardHelper",
"@mozilla.org/widget/clipboardhelper;1",
"nsIClipboardHelper");
loader.lazyRequireGetter(this, "EventEmitter", "devtools/shared/old-event-emitter");
loader.lazyRequireGetter(this, "EventEmitter", "devtools/shared/event-emitter");
loader.lazyRequireGetter(this, "ConsoleOutput", "devtools/client/webconsole/console-output", true);
loader.lazyRequireGetter(this, "Messages", "devtools/client/webconsole/console-output", true);
loader.lazyRequireGetter(this, "EnvironmentClient", "devtools/shared/client/environment-client");

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

@ -97,6 +97,7 @@ webpackConfig.resolve = {
"devtools/shared/fronts/timeline": path.join(__dirname, "../../client/shared/webpack/shims/fronts-timeline-shim"),
"devtools/shared/old-event-emitter": "devtools-modules/src/utils/event-emitter",
"devtools/shared/event-emitter": "devtools-modules/src/utils/event-emitter",
"devtools/shared/client/debugger-client": path.join(__dirname, "new-console-output/test/fixtures/DebuggerClient"),
"devtools/shared/platform/clipboard": path.join(__dirname, "../../client/shared/webpack/shims/platform-clipboard-stub"),
"devtools/shared/platform/stack": path.join(__dirname, "../../client/shared/webpack/shims/platform-stack-stub"),

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

@ -16,7 +16,7 @@ var webconsole = null;
var messages_seen = 0;
var expected_messages = 50;
function on_new_message(event, new_messages) {
function on_new_message(new_messages) {
for (let message of new_messages) {
let elem = message.node;
let text = elem.textContent;

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

@ -352,7 +352,7 @@ Damp.prototype = {
// Resolve once the last message has been received.
let allMessagesReceived = new Promise(resolve => {
function receiveMessages(e, messages) {
function receiveMessages(messages) {
for (let m of messages) {
if (m.node.textContent.includes("damp " + TOTAL_MESSAGES)) {
webconsole.hud.ui.off("new-messages", receiveMessages);
@ -444,7 +444,7 @@ Damp.prototype = {
// Resolve once the first message is received.
let onMessageReceived = new Promise(resolve => {
function receiveMessages(e, messages) {
function receiveMessages(messages) {
for (let m of messages) {
resolve(m);
}