Bug 1460841 - Console clean up: rename internal modules; r=nchevobbe

MozReview-Commit-ID: 7rDoXy8ROAe

--HG--
rename : devtools/client/webconsole/new-webconsole.js => devtools/client/webconsole/webconsole-frame.js
rename : devtools/client/webconsole/new-console-output-wrapper.js => devtools/client/webconsole/webconsole-output-wrapper.js
extra : rebase_source : e55bb6af8d6ca3079ab1e3f672ab28efe1b592eb
This commit is contained in:
Jan Odvarko 2018-05-24 18:11:14 +02:00
Родитель 540b917e81
Коммит d7570891ba
25 изменённых файлов: 73 добавлений и 73 удалений

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

@ -1904,7 +1904,7 @@ Toolbox.prototype = {
pending.push("message_count");
// Cold webconsole event message_count is handled in
// devtools/client/webconsole/new-console-output-wrapper.js
// devtools/client/webconsole/webconsole-output-wrapper.js
if (!cold) {
this.telemetry.addEventProperty(
"devtools.main", "enter", "webconsole", null, "message_count", 0);

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

@ -87,7 +87,7 @@ JSTerm.prototype = {
response.message);
return;
}
this.hud.newConsoleOutput.dispatchMessageAdd(response, true).then(resolve);
this.hud.consoleOutput.dispatchMessageAdd(response, true).then(resolve);
};
let options = {

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

@ -113,7 +113,7 @@ into actual modules used by the WebConsole and other Devtools.
The WebConsole UI is built using [React](http://docs.firefox-dev.tools/frontend/react.html)
components (in `components/`).
The React application is rendered from `new-console-output-wrapper.js`.
The React application is rendered from `webconsole-output-wrapper.js`.
It contains 3 top components:
* **ConsoleOutput** (in `ConsoleOutput.js`) is the component where messages are rendered.
* **FilterBar** (in `FilterBar.js`) is the component for the filter bars (filter input and toggle buttons).

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

@ -324,19 +324,19 @@ class JSTerm extends Component {
return;
}
if (this.hud.newConsoleOutput) {
this.hud.newConsoleOutput.dispatchMessageAdd(response, true).then(callback);
if (this.hud.consoleOutput) {
this.hud.consoleOutput.dispatchMessageAdd(response, true).then(callback);
}
}
inspectObjectActor(objectActor) {
this.hud.newConsoleOutput.dispatchMessageAdd({
this.hud.consoleOutput.dispatchMessageAdd({
helperResult: {
type: "inspectObject",
object: objectActor
}
}, true);
return this.hud.newConsoleOutput;
return this.hud.consoleOutput;
}
/**
@ -501,8 +501,8 @@ class JSTerm extends Component {
* this Web Console.
*/
clearOutput(clearStorage) {
if (this.hud && this.hud.newConsoleOutput) {
this.hud.newConsoleOutput.dispatchMessagesClear();
if (this.hud && this.hud.consoleOutput) {
this.hud.consoleOutput.dispatchMessagesClear();
}
this.webConsoleClient.clearNetworkRequests();
@ -519,8 +519,8 @@ class JSTerm extends Component {
* This method emits the "private-messages-cleared" notification.
*/
clearPrivateMessages() {
if (this.hud && this.hud.newConsoleOutput) {
this.hud.newConsoleOutput.dispatchPrivateMessagesClear();
if (this.hud && this.hud.consoleOutput) {
this.hud.consoleOutput.dispatchPrivateMessagesClear();
this.emit("private-messages-cleared");
}
}

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

@ -10,7 +10,7 @@ loader.lazyRequireGetter(this, "extend", "devtools/shared/extend", true);
loader.lazyRequireGetter(this, "TargetFactory", "devtools/client/framework/target", true);
loader.lazyRequireGetter(this, "Tools", "devtools/client/definitions", true);
loader.lazyRequireGetter(this, "Telemetry", "devtools/client/shared/telemetry");
loader.lazyRequireGetter(this, "NewWebConsoleFrame", "devtools/client/webconsole/new-webconsole", true);
loader.lazyRequireGetter(this, "WebConsoleFrame", "devtools/client/webconsole/webconsole-frame", true);
loader.lazyRequireGetter(this, "gDevTools", "devtools/client/framework/devtools", true);
loader.lazyRequireGetter(this, "DebuggerServer", "devtools/server/main", true);
loader.lazyRequireGetter(this, "DebuggerClient", "devtools/shared/client/debugger-client", true);
@ -272,7 +272,7 @@ function WebConsole(target, iframeWindow, chromeWindow) {
if (element.getAttribute("windowtype") != gDevTools.chromeWindowType) {
this.browserWindow = HUDService.currentContext();
}
this.ui = new NewWebConsoleFrame(this);
this.ui = new WebConsoleFrame(this);
}
WebConsole.prototype = {
iframeWindow: null,

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

@ -40,8 +40,8 @@ pref("devtools.webconsole.timestampMessages", false);
pref("devtools.webconsole.autoMultiline", true);
pref("devtools.webconsole.sidebarToggle", true);
const NewConsoleOutputWrapper = require("../new-console-output-wrapper");
const NewWebConsoleFrame = require("../new-webconsole").NewWebConsoleFrame;
const WebConsoleOutputWrapper = require("../webconsole-output-wrapper");
const WebConsoleFrame = require("../webconsole-frame").WebConsoleFrame;
// Copied from netmonitor/index.js:
window.addEventListener("DOMContentLoaded", () => {
@ -81,18 +81,18 @@ function onConnect(connection) {
getInspectorSelection: () => { },
target: connection.tabConnection.tabTarget,
_browserConsole: false,
NewConsoleOutputWrapper,
WebConsoleOutputWrapper,
};
consoleFrame = new NewWebConsoleFrame(owner);
consoleFrame = new WebConsoleFrame(owner);
consoleFrame.init().then(function() {
console.log("NewWebConsoleFrame initialized");
console.log("WebConsoleFrame initialized");
});
}
// This is just a hack until the local dev environment includes jsterm
window.evaluateJS = function(input) {
consoleFrame.webConsoleClient.evaluateJSAsync(`${input}`, function(r) {
consoleFrame.newConsoleOutput.dispatchMessageAdd(r);
consoleFrame.consoleOutput.dispatchMessageAdd(r);
}, {});
};

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

@ -8,15 +8,15 @@
const { BrowserLoader } = ChromeUtils.import("resource://devtools/client/shared/browser-loader.js", {});
this.NewConsoleOutput = function(parentNode, jsterm, toolbox, owner, serviceContainer) {
this.WebConsoleOutput = function(parentNode, jsterm, toolbox, owner, serviceContainer) {
// Initialize module loader and load all modules of the new inline
// preview feature. The entire code-base doesn't need any extra
// privileges and runs entirely in content scope.
let NewConsoleOutputWrapper = BrowserLoader({
let WebConsoleOutputWrapper = BrowserLoader({
baseURI: "resource://devtools/client/webconsole/",
window
}).require("./new-console-output-wrapper");
}).require("./webconsole-output-wrapper");
return new NewConsoleOutputWrapper(
return new WebConsoleOutputWrapper(
parentNode, jsterm, toolbox, owner, serviceContainer);
};

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

@ -17,14 +17,14 @@ DevToolsModules(
'constants.js',
'hudservice.js',
'main.js',
'new-console-output-wrapper.js',
'new-webconsole.js',
'panel.js',
'store.js',
'types.js',
'utils.js',
'webconsole-connection-proxy.js',
'webconsole-frame.js',
'webconsole-l10n.js',
'webconsole-output-wrapper.js',
)
with Files('**'):
BUG_COMPONENT = ('Firefox', 'Developer Tools: Console')

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

@ -81,7 +81,7 @@ WebConsolePanel.prototype = {
})
.then((webConsole) => {
this.hud = webConsole;
// Pipe 'reloaded' event from NewWebConsoleFrame to WebConsolePanel.
// Pipe 'reloaded' event from WebConsoleFrame to WebConsolePanel.
// These events are listened by the Toolbox.
this.hud.ui.on("reloaded", () => {
this.emit("reloaded");

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

@ -230,7 +230,7 @@ function enableNetProvider(hud) {
// /!\ This is terrible, but it allows ResponsePanel to be able to call
// `dataProvider.requestData` to fetch response content lazily.
// `proxy.networkDataProvider` is put by NewConsoleOutputWrapper on
// `proxy.networkDataProvider` is put by WebConsoleOutputWrapper on
// `serviceContainer` which allow NetworkEventMessage to expose requestData on
// the fake `connector` object it hands over to ResponsePanel.
proxy.networkDataProvider = dataProvider;
@ -260,7 +260,7 @@ function enableNetProvider(hud) {
// Process all incoming HTTP details packets. Note that
// Network event update packets are sent in batches from:
// `NewConsoleOutputWrapper.dispatchMessageUpdate` using
// `WebConsoleOutputWrapper.dispatchMessageUpdate` using
// NETWORK_MESSAGE_UPDATE action.
// Make sure to call `dataProvider.onNetworkEventUpdate`
// to fetch data from the backend.

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

@ -24,8 +24,8 @@ const NUM_STREAMING = 100;
ChromeUtils.import("resource://gre/modules/FileUtils.jsm");
const Services = browserRequire("Services");
Services.prefs.setIntPref("devtools.hud.loglimit", NUM_MESSAGES);
const NewConsoleOutputWrapper = browserRequire(
"devtools/client/webconsole/new-console-output-wrapper");
const WebConsoleOutputWrapper = browserRequire(
"devtools/client/webconsole/webconsole-output-wrapper");
const actions =
browserRequire("devtools/client/webconsole/actions/index");
const EventEmitter = browserRequire("devtools/shared/event-emitter");
@ -170,7 +170,7 @@ window.onload = async function() {
// It doesn't run in automation
SimpleTest.requestLongerTimeout(3);
const wrapper = new NewConsoleOutputWrapper(
const wrapper = new WebConsoleOutputWrapper(
document.getElementById("output"),
{hud: EventEmitter.decorate({proxy: {}}), focus: () => {}},
{},

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

@ -15,12 +15,12 @@ const {
getPrivatePacket,
} = require("devtools/client/webconsole/test/helpers");
const NewConsoleOutputWrapper =
require("devtools/client/webconsole/new-console-output-wrapper");
const WebConsoleOutputWrapper =
require("devtools/client/webconsole/webconsole-output-wrapper");
const { messagesAdd } =
require("devtools/client/webconsole/actions/messages");
function getNewConsoleOutputWrapper() {
function getWebConsoleOutputWrapper() {
const hud = {
proxy: {
releaseActor: () => {},
@ -31,12 +31,12 @@ function getNewConsoleOutputWrapper() {
},
},
};
return new NewConsoleOutputWrapper(null, hud);
return new WebConsoleOutputWrapper(null, hud);
}
describe("NewConsoleOutputWrapper", () => {
describe("WebConsoleOutputWrapper", () => {
it("clears queues when dispatchMessagesClear is called", () => {
const ncow = getNewConsoleOutputWrapper();
const ncow = getWebConsoleOutputWrapper();
ncow.queuedMessageAdds.push({fakePacket: "message"});
ncow.queuedMessageUpdates.push({fakePacket: "message-update"});
ncow.queuedRequestUpdates.push({fakePacket: "request-update"});
@ -49,7 +49,7 @@ describe("NewConsoleOutputWrapper", () => {
});
it("removes private packets from message queue on dispatchPrivateMessagesClear", () => {
const ncow = getNewConsoleOutputWrapper();
const ncow = getWebConsoleOutputWrapper();
const publicLog = stubPackets.get("console.log('mymap')");
ncow.queuedMessageAdds.push(
@ -65,7 +65,7 @@ describe("NewConsoleOutputWrapper", () => {
it("removes private packets from network update queue on dispatchPrivateMessagesClear",
() => {
const ncow = getNewConsoleOutputWrapper();
const ncow = getWebConsoleOutputWrapper();
const postId = Symbol();
const getId = Symbol();
@ -98,7 +98,7 @@ describe("NewConsoleOutputWrapper", () => {
it("removes private packets from network request queue on dispatchPrivateMessagesClear",
() => {
const ncow = getNewConsoleOutputWrapper();
const ncow = getWebConsoleOutputWrapper();
ncow.getStore().dispatch(messagesAdd([
stubPackets.get("GET request"),

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

@ -304,7 +304,7 @@ async function generateConsoleApiStubs() {
const hud = toolbox.getCurrentPanel().hud;
let {ui} = hud;
ok(ui.jsterm, "jsterm exists");
ok(ui.newConsoleOutput, "newConsoleOutput exists");
ok(ui.consoleOutput, "consoleOutput exists");
for (let [key, {keys, code}] of consoleApi) {
let received = new Promise(resolve => {

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

@ -15,7 +15,7 @@ const { INDENT_WIDTH } =
add_task(async function() {
const hud = await openNewTabAndConsole(TEST_URI);
const store = hud.ui.newConsoleOutput.getStore();
const store = hud.ui.consoleOutput.getStore();
logAllStoreChanges(hud);
const onMessagesLogged = waitForMessage(hud, "log-6");

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

@ -14,7 +14,7 @@ add_task(async function() {
let {ui} = hud;
ok(ui.jsterm, "jsterm exists");
ok(ui.newConsoleOutput, "newConsoleOutput exists");
ok(ui.consoleOutput, "consoleOutput exists");
let receievedMessages = waitForMessages({
hud,

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

@ -11,7 +11,7 @@ const TEST_URI = "data:text/html;charset=utf-8,<p>test logErrorInPage";
add_task(async function() {
const hud = await openNewTabAndConsole(TEST_URI);
const toolbox = hud.ui.newConsoleOutput.toolbox;
const toolbox = hud.ui.consoleOutput.toolbox;
toolbox.target.logErrorInPage("beware the octopus", "content javascript");

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

@ -11,7 +11,7 @@ const TEST_URI = "data:text/html;charset=utf-8,<p>test logErrorInPage";
add_task(async function() {
const hud = await openNewTabAndConsole(TEST_URI);
const toolbox = hud.ui.newConsoleOutput.toolbox;
const toolbox = hud.ui.consoleOutput.toolbox;
toolbox.target.logWarningInPage("beware the octopus", "content javascript");

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

@ -122,7 +122,7 @@ async function openRequestBeforeUpdates(target, hud, tab) {
let payload = waitForPayloadReady(toolbox);
// Set the default panel.
const state = hud.ui.newConsoleOutput.getStore().getState();
const state = hud.ui.consoleOutput.getStore().getState();
state.ui.networkMessageActiveTabId = tab.id;
// Expand network log

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

@ -59,7 +59,7 @@ add_task(async function task() {
let onConsoleMenuOpened = [
rightClickMouseEvent,
rightClickCtrlOrCmdKeyMouseEvent
].includes(clickEvent) ? hud.ui.newConsoleOutput.once("menu-open") : null;
].includes(clickEvent) ? hud.ui.consoleOutput.once("menu-open") : null;
let { link, where } = await simulateLinkClick(statusCodeNode, testCase.clickEvent);
is(link, testCase.link, `Clicking the provided link opens ${link}`);

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

@ -31,7 +31,7 @@ add_task(async function() {
await pushPref("devtools.source-map.client-service.enabled", true);
const hud = await openNewTabAndConsole(PAGE_URL);
const toolbox = hud.ui.newConsoleOutput.toolbox;
const toolbox = hud.ui.consoleOutput.toolbox;
info("Finding \"here\" message and waiting for source map to be applied");
await waitFor(() => {

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

@ -41,7 +41,7 @@ add_task(async function() {
await waitFor(() => (document.visibilityState == "hidden"));
const onAllMessagesInStore = new Promise(done => {
const store = hud.ui.newConsoleOutput.getStore();
const store = hud.ui.consoleOutput.getStore();
store.subscribe(() => {
const messages = store.getState().messages.messagesById.size;
// Also consider the "in-console log" message

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

@ -84,7 +84,7 @@ async function openNewTabAndConsole(url, clearJstermHistory = true) {
* @param object hud
*/
function logAllStoreChanges(hud) {
const store = hud.ui.newConsoleOutput.getStore();
const store = hud.ui.consoleOutput.getStore();
// Adding logging each time the store is modified in order to check
// the store state in case of failure.
store.subscribe(() => {
@ -240,10 +240,10 @@ function findMessages(hud, text, selector = ".message") {
* @return promise
*/
async function openContextMenu(hud, element) {
let onConsoleMenuOpened = hud.ui.newConsoleOutput.once("menu-open");
let onConsoleMenuOpened = hud.ui.consoleOutput.once("menu-open");
synthesizeContextMenuEvent(element);
await onConsoleMenuOpened;
const doc = hud.ui.newConsoleOutput.owner.chromeWindow.document;
const doc = hud.ui.consoleOutput.owner.chromeWindow.document;
return doc.getElementById("webconsole-menu");
}
@ -256,7 +256,7 @@ async function openContextMenu(hud, element) {
* @return promise
*/
function hideContextMenu(hud) {
const doc = hud.ui.newConsoleOutput.owner.chromeWindow.document;
const doc = hud.ui.consoleOutput.owner.chromeWindow.document;
let popup = doc.getElementById("webconsole-menu");
if (!popup) {
return Promise.resolve();
@ -747,6 +747,6 @@ async function setFilterBarVisible(hud, state) {
async function resetFilters(hud) {
info("Resetting filters to their default state");
const store = hud.ui.newConsoleOutput.getStore();
const store = hud.ui.consoleOutput.getStore();
store.dispatch(wcActions.filtersClear());
}

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

@ -228,25 +228,25 @@ WebConsoleConnectionProxy.prototype = {
* Dispatch a message add on the new frontend and emit an event for tests.
*/
dispatchMessageAdd: function(packet) {
this.webConsoleFrame.newConsoleOutput.dispatchMessageAdd(packet);
this.webConsoleFrame.consoleOutput.dispatchMessageAdd(packet);
},
/**
* Batched dispatch of messages.
*/
dispatchMessagesAdd: function(packets) {
this.webConsoleFrame.newConsoleOutput.dispatchMessagesAdd(packets);
this.webConsoleFrame.consoleOutput.dispatchMessagesAdd(packets);
},
/**
* Dispatch a message event on the new frontend and emit an event for tests.
*/
dispatchMessageUpdate: function(networkInfo, response) {
this.webConsoleFrame.newConsoleOutput.dispatchMessageUpdate(networkInfo, response);
this.webConsoleFrame.consoleOutput.dispatchMessageUpdate(networkInfo, response);
},
dispatchRequestUpdate: function(id, data) {
this.webConsoleFrame.newConsoleOutput.dispatchRequestUpdate(id, data);
this.webConsoleFrame.consoleOutput.dispatchRequestUpdate(id, data);
},
/**

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

@ -40,7 +40,7 @@ const PREF_SIDEBAR_ENABLED = "devtools.webconsole.sidebarToggle";
* @param object webConsoleOwner
* The WebConsole owner object.
*/
function NewWebConsoleFrame(webConsoleOwner) {
function WebConsoleFrame(webConsoleOwner) {
this.owner = webConsoleOwner;
this.hudId = this.owner.hudId;
this.isBrowserConsole = this.owner._browserConsole;
@ -52,7 +52,7 @@ function NewWebConsoleFrame(webConsoleOwner) {
EventEmitter.decorate(this);
}
NewWebConsoleFrame.prototype = {
WebConsoleFrame.prototype = {
/**
* Getter for the debugger WebConsoleClient.
* @type object
@ -82,7 +82,7 @@ NewWebConsoleFrame.prototype = {
async init() {
this._initUI();
await this._initConnection();
await this.newConsoleOutput.init();
await this.consoleOutput.init();
let id = WebConsoleUtils.supportsString(this.hudId);
if (Services.obs) {
@ -108,7 +108,7 @@ NewWebConsoleFrame.prototype = {
toolbox.off("select", this._onChangeSplitConsoleState);
}
this.window = this.owner = this.newConsoleOutput = null;
this.window = this.owner = this.consoleOutput = null;
let onDestroy = () => {
this._destroyer.resolve(null);
@ -204,8 +204,8 @@ NewWebConsoleFrame.prototype = {
let toolbox = gDevTools.getToolbox(this.owner.target);
// Handle both launchpad and toolbox loading
let Wrapper = this.owner.NewConsoleOutputWrapper || this.window.NewConsoleOutput;
this.newConsoleOutput =
let Wrapper = this.owner.WebConsoleOutputWrapper || this.window.WebConsoleOutput;
this.consoleOutput =
new Wrapper(this.outputNode, this, toolbox, this.owner, this.document);
// Toggle the timestamp on preference change
Services.prefs.addObserver(PREF_MESSAGE_TIMESTAMP, this._onToolboxPrefChanged);
@ -253,7 +253,7 @@ NewWebConsoleFrame.prototype = {
} else if (Services.prefs.getBoolPref(PREF_SIDEBAR_ENABLED)) {
shortcuts.on("Esc", event => {
if (!this.jsterm.autocompletePopup || !this.jsterm.autocompletePopup.isOpen) {
this.newConsoleOutput.dispatchSidebarClose();
this.consoleOutput.dispatchSidebarClose();
this.jsterm.focus();
}
});
@ -293,7 +293,7 @@ NewWebConsoleFrame.prototype = {
*/
_onToolboxPrefChanged: function() {
let newValue = Services.prefs.getBoolPref(PREF_MESSAGE_TIMESTAMP);
this.newConsoleOutput.dispatchTimestampsToggle(newValue);
this.consoleOutput.dispatchTimestampsToggle(newValue);
},
/**
@ -306,7 +306,7 @@ NewWebConsoleFrame.prototype = {
},
_onChangeSplitConsoleState: function() {
this.newConsoleOutput.dispatchSplitConsoleCloseButtonToggle();
this.consoleOutput.dispatchSplitConsoleCloseButtonToggle();
},
/**
@ -328,7 +328,7 @@ NewWebConsoleFrame.prototype = {
// Wait for completion of any async dispatch before notifying that the console
// is fully updated after a page reload
await this.newConsoleOutput.waitAsyncDispatches();
await this.consoleOutput.waitAsyncDispatches();
this.emit("reloaded");
},
@ -336,7 +336,7 @@ NewWebConsoleFrame.prototype = {
if (this.persistLog) {
// Add a _type to hit convertCachedPacket.
packet._type = true;
this.newConsoleOutput.dispatchMessageAdd(packet);
this.consoleOutput.dispatchMessageAdd(packet);
} else {
this.jsterm.clearOutput(false);
}
@ -360,4 +360,4 @@ function quickRestart() {
Services.startup.quit(Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestart);
}
exports.NewWebConsoleFrame = NewWebConsoleFrame;
exports.WebConsoleFrame = WebConsoleFrame;

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

@ -19,7 +19,7 @@ const App = createFactory(require("devtools/client/webconsole/components/App"));
let store = null;
function NewConsoleOutputWrapper(parentNode, hud, toolbox, owner, document) {
function WebConsoleOutputWrapper(parentNode, hud, toolbox, owner, document) {
EventEmitter.decorate(this);
this.parentNode = parentNode;
@ -40,7 +40,7 @@ function NewConsoleOutputWrapper(parentNode, hud, toolbox, owner, document) {
store = configureStore(this.hud);
}
NewConsoleOutputWrapper.prototype = {
WebConsoleOutputWrapper.prototype = {
init: function() {
return new Promise((resolve) => {
const attachRefToHud = (id, node) => {
@ -432,4 +432,4 @@ NewConsoleOutputWrapper.prototype = {
};
// Exports from this module
module.exports = NewConsoleOutputWrapper;
module.exports = WebConsoleOutputWrapper;