зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
540b917e81
Коммит
d7570891ba
|
@ -1904,7 +1904,7 @@ Toolbox.prototype = {
|
||||||
pending.push("message_count");
|
pending.push("message_count");
|
||||||
|
|
||||||
// Cold webconsole event message_count is handled in
|
// 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) {
|
if (!cold) {
|
||||||
this.telemetry.addEventProperty(
|
this.telemetry.addEventProperty(
|
||||||
"devtools.main", "enter", "webconsole", null, "message_count", 0);
|
"devtools.main", "enter", "webconsole", null, "message_count", 0);
|
||||||
|
|
|
@ -87,7 +87,7 @@ JSTerm.prototype = {
|
||||||
response.message);
|
response.message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.hud.newConsoleOutput.dispatchMessageAdd(response, true).then(resolve);
|
this.hud.consoleOutput.dispatchMessageAdd(response, true).then(resolve);
|
||||||
};
|
};
|
||||||
|
|
||||||
let options = {
|
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)
|
The WebConsole UI is built using [React](http://docs.firefox-dev.tools/frontend/react.html)
|
||||||
components (in `components/`).
|
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:
|
It contains 3 top components:
|
||||||
* **ConsoleOutput** (in `ConsoleOutput.js`) is the component where messages are rendered.
|
* **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).
|
* **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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.hud.newConsoleOutput) {
|
if (this.hud.consoleOutput) {
|
||||||
this.hud.newConsoleOutput.dispatchMessageAdd(response, true).then(callback);
|
this.hud.consoleOutput.dispatchMessageAdd(response, true).then(callback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inspectObjectActor(objectActor) {
|
inspectObjectActor(objectActor) {
|
||||||
this.hud.newConsoleOutput.dispatchMessageAdd({
|
this.hud.consoleOutput.dispatchMessageAdd({
|
||||||
helperResult: {
|
helperResult: {
|
||||||
type: "inspectObject",
|
type: "inspectObject",
|
||||||
object: objectActor
|
object: objectActor
|
||||||
}
|
}
|
||||||
}, true);
|
}, true);
|
||||||
return this.hud.newConsoleOutput;
|
return this.hud.consoleOutput;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -501,8 +501,8 @@ class JSTerm extends Component {
|
||||||
* this Web Console.
|
* this Web Console.
|
||||||
*/
|
*/
|
||||||
clearOutput(clearStorage) {
|
clearOutput(clearStorage) {
|
||||||
if (this.hud && this.hud.newConsoleOutput) {
|
if (this.hud && this.hud.consoleOutput) {
|
||||||
this.hud.newConsoleOutput.dispatchMessagesClear();
|
this.hud.consoleOutput.dispatchMessagesClear();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.webConsoleClient.clearNetworkRequests();
|
this.webConsoleClient.clearNetworkRequests();
|
||||||
|
@ -519,8 +519,8 @@ class JSTerm extends Component {
|
||||||
* This method emits the "private-messages-cleared" notification.
|
* This method emits the "private-messages-cleared" notification.
|
||||||
*/
|
*/
|
||||||
clearPrivateMessages() {
|
clearPrivateMessages() {
|
||||||
if (this.hud && this.hud.newConsoleOutput) {
|
if (this.hud && this.hud.consoleOutput) {
|
||||||
this.hud.newConsoleOutput.dispatchPrivateMessagesClear();
|
this.hud.consoleOutput.dispatchPrivateMessagesClear();
|
||||||
this.emit("private-messages-cleared");
|
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, "TargetFactory", "devtools/client/framework/target", true);
|
||||||
loader.lazyRequireGetter(this, "Tools", "devtools/client/definitions", true);
|
loader.lazyRequireGetter(this, "Tools", "devtools/client/definitions", true);
|
||||||
loader.lazyRequireGetter(this, "Telemetry", "devtools/client/shared/telemetry");
|
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, "gDevTools", "devtools/client/framework/devtools", true);
|
||||||
loader.lazyRequireGetter(this, "DebuggerServer", "devtools/server/main", true);
|
loader.lazyRequireGetter(this, "DebuggerServer", "devtools/server/main", true);
|
||||||
loader.lazyRequireGetter(this, "DebuggerClient", "devtools/shared/client/debugger-client", 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) {
|
if (element.getAttribute("windowtype") != gDevTools.chromeWindowType) {
|
||||||
this.browserWindow = HUDService.currentContext();
|
this.browserWindow = HUDService.currentContext();
|
||||||
}
|
}
|
||||||
this.ui = new NewWebConsoleFrame(this);
|
this.ui = new WebConsoleFrame(this);
|
||||||
}
|
}
|
||||||
WebConsole.prototype = {
|
WebConsole.prototype = {
|
||||||
iframeWindow: null,
|
iframeWindow: null,
|
||||||
|
|
|
@ -40,8 +40,8 @@ pref("devtools.webconsole.timestampMessages", false);
|
||||||
pref("devtools.webconsole.autoMultiline", true);
|
pref("devtools.webconsole.autoMultiline", true);
|
||||||
pref("devtools.webconsole.sidebarToggle", true);
|
pref("devtools.webconsole.sidebarToggle", true);
|
||||||
|
|
||||||
const NewConsoleOutputWrapper = require("../new-console-output-wrapper");
|
const WebConsoleOutputWrapper = require("../webconsole-output-wrapper");
|
||||||
const NewWebConsoleFrame = require("../new-webconsole").NewWebConsoleFrame;
|
const WebConsoleFrame = require("../webconsole-frame").WebConsoleFrame;
|
||||||
|
|
||||||
// Copied from netmonitor/index.js:
|
// Copied from netmonitor/index.js:
|
||||||
window.addEventListener("DOMContentLoaded", () => {
|
window.addEventListener("DOMContentLoaded", () => {
|
||||||
|
@ -81,18 +81,18 @@ function onConnect(connection) {
|
||||||
getInspectorSelection: () => { },
|
getInspectorSelection: () => { },
|
||||||
target: connection.tabConnection.tabTarget,
|
target: connection.tabConnection.tabTarget,
|
||||||
_browserConsole: false,
|
_browserConsole: false,
|
||||||
NewConsoleOutputWrapper,
|
WebConsoleOutputWrapper,
|
||||||
};
|
};
|
||||||
consoleFrame = new NewWebConsoleFrame(owner);
|
consoleFrame = new WebConsoleFrame(owner);
|
||||||
consoleFrame.init().then(function() {
|
consoleFrame.init().then(function() {
|
||||||
console.log("NewWebConsoleFrame initialized");
|
console.log("WebConsoleFrame initialized");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is just a hack until the local dev environment includes jsterm
|
// This is just a hack until the local dev environment includes jsterm
|
||||||
window.evaluateJS = function(input) {
|
window.evaluateJS = function(input) {
|
||||||
consoleFrame.webConsoleClient.evaluateJSAsync(`${input}`, function(r) {
|
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", {});
|
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
|
// Initialize module loader and load all modules of the new inline
|
||||||
// preview feature. The entire code-base doesn't need any extra
|
// preview feature. The entire code-base doesn't need any extra
|
||||||
// privileges and runs entirely in content scope.
|
// privileges and runs entirely in content scope.
|
||||||
let NewConsoleOutputWrapper = BrowserLoader({
|
let WebConsoleOutputWrapper = BrowserLoader({
|
||||||
baseURI: "resource://devtools/client/webconsole/",
|
baseURI: "resource://devtools/client/webconsole/",
|
||||||
window
|
window
|
||||||
}).require("./new-console-output-wrapper");
|
}).require("./webconsole-output-wrapper");
|
||||||
|
|
||||||
return new NewConsoleOutputWrapper(
|
return new WebConsoleOutputWrapper(
|
||||||
parentNode, jsterm, toolbox, owner, serviceContainer);
|
parentNode, jsterm, toolbox, owner, serviceContainer);
|
||||||
};
|
};
|
||||||
|
|
|
@ -17,14 +17,14 @@ DevToolsModules(
|
||||||
'constants.js',
|
'constants.js',
|
||||||
'hudservice.js',
|
'hudservice.js',
|
||||||
'main.js',
|
'main.js',
|
||||||
'new-console-output-wrapper.js',
|
|
||||||
'new-webconsole.js',
|
|
||||||
'panel.js',
|
'panel.js',
|
||||||
'store.js',
|
'store.js',
|
||||||
'types.js',
|
'types.js',
|
||||||
'utils.js',
|
'utils.js',
|
||||||
'webconsole-connection-proxy.js',
|
'webconsole-connection-proxy.js',
|
||||||
|
'webconsole-frame.js',
|
||||||
'webconsole-l10n.js',
|
'webconsole-l10n.js',
|
||||||
|
'webconsole-output-wrapper.js',
|
||||||
)
|
)
|
||||||
with Files('**'):
|
with Files('**'):
|
||||||
BUG_COMPONENT = ('Firefox', 'Developer Tools: Console')
|
BUG_COMPONENT = ('Firefox', 'Developer Tools: Console')
|
||||||
|
|
|
@ -81,7 +81,7 @@ WebConsolePanel.prototype = {
|
||||||
})
|
})
|
||||||
.then((webConsole) => {
|
.then((webConsole) => {
|
||||||
this.hud = 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.
|
// These events are listened by the Toolbox.
|
||||||
this.hud.ui.on("reloaded", () => {
|
this.hud.ui.on("reloaded", () => {
|
||||||
this.emit("reloaded");
|
this.emit("reloaded");
|
||||||
|
|
|
@ -230,7 +230,7 @@ function enableNetProvider(hud) {
|
||||||
|
|
||||||
// /!\ This is terrible, but it allows ResponsePanel to be able to call
|
// /!\ This is terrible, but it allows ResponsePanel to be able to call
|
||||||
// `dataProvider.requestData` to fetch response content lazily.
|
// `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
|
// `serviceContainer` which allow NetworkEventMessage to expose requestData on
|
||||||
// the fake `connector` object it hands over to ResponsePanel.
|
// the fake `connector` object it hands over to ResponsePanel.
|
||||||
proxy.networkDataProvider = dataProvider;
|
proxy.networkDataProvider = dataProvider;
|
||||||
|
@ -260,7 +260,7 @@ function enableNetProvider(hud) {
|
||||||
|
|
||||||
// Process all incoming HTTP details packets. Note that
|
// Process all incoming HTTP details packets. Note that
|
||||||
// Network event update packets are sent in batches from:
|
// Network event update packets are sent in batches from:
|
||||||
// `NewConsoleOutputWrapper.dispatchMessageUpdate` using
|
// `WebConsoleOutputWrapper.dispatchMessageUpdate` using
|
||||||
// NETWORK_MESSAGE_UPDATE action.
|
// NETWORK_MESSAGE_UPDATE action.
|
||||||
// Make sure to call `dataProvider.onNetworkEventUpdate`
|
// Make sure to call `dataProvider.onNetworkEventUpdate`
|
||||||
// to fetch data from the backend.
|
// to fetch data from the backend.
|
||||||
|
|
|
@ -24,8 +24,8 @@ const NUM_STREAMING = 100;
|
||||||
ChromeUtils.import("resource://gre/modules/FileUtils.jsm");
|
ChromeUtils.import("resource://gre/modules/FileUtils.jsm");
|
||||||
const Services = browserRequire("Services");
|
const Services = browserRequire("Services");
|
||||||
Services.prefs.setIntPref("devtools.hud.loglimit", NUM_MESSAGES);
|
Services.prefs.setIntPref("devtools.hud.loglimit", NUM_MESSAGES);
|
||||||
const NewConsoleOutputWrapper = browserRequire(
|
const WebConsoleOutputWrapper = browserRequire(
|
||||||
"devtools/client/webconsole/new-console-output-wrapper");
|
"devtools/client/webconsole/webconsole-output-wrapper");
|
||||||
const actions =
|
const actions =
|
||||||
browserRequire("devtools/client/webconsole/actions/index");
|
browserRequire("devtools/client/webconsole/actions/index");
|
||||||
const EventEmitter = browserRequire("devtools/shared/event-emitter");
|
const EventEmitter = browserRequire("devtools/shared/event-emitter");
|
||||||
|
@ -170,7 +170,7 @@ window.onload = async function() {
|
||||||
// It doesn't run in automation
|
// It doesn't run in automation
|
||||||
SimpleTest.requestLongerTimeout(3);
|
SimpleTest.requestLongerTimeout(3);
|
||||||
|
|
||||||
const wrapper = new NewConsoleOutputWrapper(
|
const wrapper = new WebConsoleOutputWrapper(
|
||||||
document.getElementById("output"),
|
document.getElementById("output"),
|
||||||
{hud: EventEmitter.decorate({proxy: {}}), focus: () => {}},
|
{hud: EventEmitter.decorate({proxy: {}}), focus: () => {}},
|
||||||
{},
|
{},
|
||||||
|
|
|
@ -15,12 +15,12 @@ const {
|
||||||
getPrivatePacket,
|
getPrivatePacket,
|
||||||
} = require("devtools/client/webconsole/test/helpers");
|
} = require("devtools/client/webconsole/test/helpers");
|
||||||
|
|
||||||
const NewConsoleOutputWrapper =
|
const WebConsoleOutputWrapper =
|
||||||
require("devtools/client/webconsole/new-console-output-wrapper");
|
require("devtools/client/webconsole/webconsole-output-wrapper");
|
||||||
const { messagesAdd } =
|
const { messagesAdd } =
|
||||||
require("devtools/client/webconsole/actions/messages");
|
require("devtools/client/webconsole/actions/messages");
|
||||||
|
|
||||||
function getNewConsoleOutputWrapper() {
|
function getWebConsoleOutputWrapper() {
|
||||||
const hud = {
|
const hud = {
|
||||||
proxy: {
|
proxy: {
|
||||||
releaseActor: () => {},
|
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", () => {
|
it("clears queues when dispatchMessagesClear is called", () => {
|
||||||
const ncow = getNewConsoleOutputWrapper();
|
const ncow = getWebConsoleOutputWrapper();
|
||||||
ncow.queuedMessageAdds.push({fakePacket: "message"});
|
ncow.queuedMessageAdds.push({fakePacket: "message"});
|
||||||
ncow.queuedMessageUpdates.push({fakePacket: "message-update"});
|
ncow.queuedMessageUpdates.push({fakePacket: "message-update"});
|
||||||
ncow.queuedRequestUpdates.push({fakePacket: "request-update"});
|
ncow.queuedRequestUpdates.push({fakePacket: "request-update"});
|
||||||
|
@ -49,7 +49,7 @@ describe("NewConsoleOutputWrapper", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("removes private packets from message queue on dispatchPrivateMessagesClear", () => {
|
it("removes private packets from message queue on dispatchPrivateMessagesClear", () => {
|
||||||
const ncow = getNewConsoleOutputWrapper();
|
const ncow = getWebConsoleOutputWrapper();
|
||||||
|
|
||||||
const publicLog = stubPackets.get("console.log('mymap')");
|
const publicLog = stubPackets.get("console.log('mymap')");
|
||||||
ncow.queuedMessageAdds.push(
|
ncow.queuedMessageAdds.push(
|
||||||
|
@ -65,7 +65,7 @@ describe("NewConsoleOutputWrapper", () => {
|
||||||
|
|
||||||
it("removes private packets from network update queue on dispatchPrivateMessagesClear",
|
it("removes private packets from network update queue on dispatchPrivateMessagesClear",
|
||||||
() => {
|
() => {
|
||||||
const ncow = getNewConsoleOutputWrapper();
|
const ncow = getWebConsoleOutputWrapper();
|
||||||
|
|
||||||
const postId = Symbol();
|
const postId = Symbol();
|
||||||
const getId = Symbol();
|
const getId = Symbol();
|
||||||
|
@ -98,7 +98,7 @@ describe("NewConsoleOutputWrapper", () => {
|
||||||
|
|
||||||
it("removes private packets from network request queue on dispatchPrivateMessagesClear",
|
it("removes private packets from network request queue on dispatchPrivateMessagesClear",
|
||||||
() => {
|
() => {
|
||||||
const ncow = getNewConsoleOutputWrapper();
|
const ncow = getWebConsoleOutputWrapper();
|
||||||
|
|
||||||
ncow.getStore().dispatch(messagesAdd([
|
ncow.getStore().dispatch(messagesAdd([
|
||||||
stubPackets.get("GET request"),
|
stubPackets.get("GET request"),
|
||||||
|
|
|
@ -304,7 +304,7 @@ async function generateConsoleApiStubs() {
|
||||||
const hud = toolbox.getCurrentPanel().hud;
|
const hud = toolbox.getCurrentPanel().hud;
|
||||||
let {ui} = hud;
|
let {ui} = hud;
|
||||||
ok(ui.jsterm, "jsterm exists");
|
ok(ui.jsterm, "jsterm exists");
|
||||||
ok(ui.newConsoleOutput, "newConsoleOutput exists");
|
ok(ui.consoleOutput, "consoleOutput exists");
|
||||||
|
|
||||||
for (let [key, {keys, code}] of consoleApi) {
|
for (let [key, {keys, code}] of consoleApi) {
|
||||||
let received = new Promise(resolve => {
|
let received = new Promise(resolve => {
|
||||||
|
|
|
@ -15,7 +15,7 @@ const { INDENT_WIDTH } =
|
||||||
|
|
||||||
add_task(async function() {
|
add_task(async function() {
|
||||||
const hud = await openNewTabAndConsole(TEST_URI);
|
const hud = await openNewTabAndConsole(TEST_URI);
|
||||||
const store = hud.ui.newConsoleOutput.getStore();
|
const store = hud.ui.consoleOutput.getStore();
|
||||||
logAllStoreChanges(hud);
|
logAllStoreChanges(hud);
|
||||||
|
|
||||||
const onMessagesLogged = waitForMessage(hud, "log-6");
|
const onMessagesLogged = waitForMessage(hud, "log-6");
|
||||||
|
|
|
@ -14,7 +14,7 @@ add_task(async function() {
|
||||||
let {ui} = hud;
|
let {ui} = hud;
|
||||||
|
|
||||||
ok(ui.jsterm, "jsterm exists");
|
ok(ui.jsterm, "jsterm exists");
|
||||||
ok(ui.newConsoleOutput, "newConsoleOutput exists");
|
ok(ui.consoleOutput, "consoleOutput exists");
|
||||||
|
|
||||||
let receievedMessages = waitForMessages({
|
let receievedMessages = waitForMessages({
|
||||||
hud,
|
hud,
|
||||||
|
|
|
@ -11,7 +11,7 @@ const TEST_URI = "data:text/html;charset=utf-8,<p>test logErrorInPage";
|
||||||
|
|
||||||
add_task(async function() {
|
add_task(async function() {
|
||||||
const hud = await openNewTabAndConsole(TEST_URI);
|
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");
|
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() {
|
add_task(async function() {
|
||||||
const hud = await openNewTabAndConsole(TEST_URI);
|
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");
|
toolbox.target.logWarningInPage("beware the octopus", "content javascript");
|
||||||
|
|
||||||
|
|
|
@ -122,7 +122,7 @@ async function openRequestBeforeUpdates(target, hud, tab) {
|
||||||
let payload = waitForPayloadReady(toolbox);
|
let payload = waitForPayloadReady(toolbox);
|
||||||
|
|
||||||
// Set the default panel.
|
// Set the default panel.
|
||||||
const state = hud.ui.newConsoleOutput.getStore().getState();
|
const state = hud.ui.consoleOutput.getStore().getState();
|
||||||
state.ui.networkMessageActiveTabId = tab.id;
|
state.ui.networkMessageActiveTabId = tab.id;
|
||||||
|
|
||||||
// Expand network log
|
// Expand network log
|
||||||
|
|
|
@ -59,7 +59,7 @@ add_task(async function task() {
|
||||||
let onConsoleMenuOpened = [
|
let onConsoleMenuOpened = [
|
||||||
rightClickMouseEvent,
|
rightClickMouseEvent,
|
||||||
rightClickCtrlOrCmdKeyMouseEvent
|
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);
|
let { link, where } = await simulateLinkClick(statusCodeNode, testCase.clickEvent);
|
||||||
is(link, testCase.link, `Clicking the provided link opens ${link}`);
|
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);
|
await pushPref("devtools.source-map.client-service.enabled", true);
|
||||||
|
|
||||||
const hud = await openNewTabAndConsole(PAGE_URL);
|
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");
|
info("Finding \"here\" message and waiting for source map to be applied");
|
||||||
await waitFor(() => {
|
await waitFor(() => {
|
||||||
|
|
|
@ -41,7 +41,7 @@ add_task(async function() {
|
||||||
await waitFor(() => (document.visibilityState == "hidden"));
|
await waitFor(() => (document.visibilityState == "hidden"));
|
||||||
|
|
||||||
const onAllMessagesInStore = new Promise(done => {
|
const onAllMessagesInStore = new Promise(done => {
|
||||||
const store = hud.ui.newConsoleOutput.getStore();
|
const store = hud.ui.consoleOutput.getStore();
|
||||||
store.subscribe(() => {
|
store.subscribe(() => {
|
||||||
const messages = store.getState().messages.messagesById.size;
|
const messages = store.getState().messages.messagesById.size;
|
||||||
// Also consider the "in-console log" message
|
// Also consider the "in-console log" message
|
||||||
|
|
|
@ -84,7 +84,7 @@ async function openNewTabAndConsole(url, clearJstermHistory = true) {
|
||||||
* @param object hud
|
* @param object hud
|
||||||
*/
|
*/
|
||||||
function logAllStoreChanges(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
|
// Adding logging each time the store is modified in order to check
|
||||||
// the store state in case of failure.
|
// the store state in case of failure.
|
||||||
store.subscribe(() => {
|
store.subscribe(() => {
|
||||||
|
@ -240,10 +240,10 @@ function findMessages(hud, text, selector = ".message") {
|
||||||
* @return promise
|
* @return promise
|
||||||
*/
|
*/
|
||||||
async function openContextMenu(hud, element) {
|
async function openContextMenu(hud, element) {
|
||||||
let onConsoleMenuOpened = hud.ui.newConsoleOutput.once("menu-open");
|
let onConsoleMenuOpened = hud.ui.consoleOutput.once("menu-open");
|
||||||
synthesizeContextMenuEvent(element);
|
synthesizeContextMenuEvent(element);
|
||||||
await onConsoleMenuOpened;
|
await onConsoleMenuOpened;
|
||||||
const doc = hud.ui.newConsoleOutput.owner.chromeWindow.document;
|
const doc = hud.ui.consoleOutput.owner.chromeWindow.document;
|
||||||
return doc.getElementById("webconsole-menu");
|
return doc.getElementById("webconsole-menu");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -256,7 +256,7 @@ async function openContextMenu(hud, element) {
|
||||||
* @return promise
|
* @return promise
|
||||||
*/
|
*/
|
||||||
function hideContextMenu(hud) {
|
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");
|
let popup = doc.getElementById("webconsole-menu");
|
||||||
if (!popup) {
|
if (!popup) {
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
|
@ -747,6 +747,6 @@ async function setFilterBarVisible(hud, state) {
|
||||||
async function resetFilters(hud) {
|
async function resetFilters(hud) {
|
||||||
info("Resetting filters to their default state");
|
info("Resetting filters to their default state");
|
||||||
|
|
||||||
const store = hud.ui.newConsoleOutput.getStore();
|
const store = hud.ui.consoleOutput.getStore();
|
||||||
store.dispatch(wcActions.filtersClear());
|
store.dispatch(wcActions.filtersClear());
|
||||||
}
|
}
|
||||||
|
|
|
@ -228,25 +228,25 @@ WebConsoleConnectionProxy.prototype = {
|
||||||
* Dispatch a message add on the new frontend and emit an event for tests.
|
* Dispatch a message add on the new frontend and emit an event for tests.
|
||||||
*/
|
*/
|
||||||
dispatchMessageAdd: function(packet) {
|
dispatchMessageAdd: function(packet) {
|
||||||
this.webConsoleFrame.newConsoleOutput.dispatchMessageAdd(packet);
|
this.webConsoleFrame.consoleOutput.dispatchMessageAdd(packet);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Batched dispatch of messages.
|
* Batched dispatch of messages.
|
||||||
*/
|
*/
|
||||||
dispatchMessagesAdd: function(packets) {
|
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.
|
* Dispatch a message event on the new frontend and emit an event for tests.
|
||||||
*/
|
*/
|
||||||
dispatchMessageUpdate: function(networkInfo, response) {
|
dispatchMessageUpdate: function(networkInfo, response) {
|
||||||
this.webConsoleFrame.newConsoleOutput.dispatchMessageUpdate(networkInfo, response);
|
this.webConsoleFrame.consoleOutput.dispatchMessageUpdate(networkInfo, response);
|
||||||
},
|
},
|
||||||
|
|
||||||
dispatchRequestUpdate: function(id, data) {
|
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
|
* @param object webConsoleOwner
|
||||||
* The WebConsole owner object.
|
* The WebConsole owner object.
|
||||||
*/
|
*/
|
||||||
function NewWebConsoleFrame(webConsoleOwner) {
|
function WebConsoleFrame(webConsoleOwner) {
|
||||||
this.owner = webConsoleOwner;
|
this.owner = webConsoleOwner;
|
||||||
this.hudId = this.owner.hudId;
|
this.hudId = this.owner.hudId;
|
||||||
this.isBrowserConsole = this.owner._browserConsole;
|
this.isBrowserConsole = this.owner._browserConsole;
|
||||||
|
@ -52,7 +52,7 @@ function NewWebConsoleFrame(webConsoleOwner) {
|
||||||
|
|
||||||
EventEmitter.decorate(this);
|
EventEmitter.decorate(this);
|
||||||
}
|
}
|
||||||
NewWebConsoleFrame.prototype = {
|
WebConsoleFrame.prototype = {
|
||||||
/**
|
/**
|
||||||
* Getter for the debugger WebConsoleClient.
|
* Getter for the debugger WebConsoleClient.
|
||||||
* @type object
|
* @type object
|
||||||
|
@ -82,7 +82,7 @@ NewWebConsoleFrame.prototype = {
|
||||||
async init() {
|
async init() {
|
||||||
this._initUI();
|
this._initUI();
|
||||||
await this._initConnection();
|
await this._initConnection();
|
||||||
await this.newConsoleOutput.init();
|
await this.consoleOutput.init();
|
||||||
|
|
||||||
let id = WebConsoleUtils.supportsString(this.hudId);
|
let id = WebConsoleUtils.supportsString(this.hudId);
|
||||||
if (Services.obs) {
|
if (Services.obs) {
|
||||||
|
@ -108,7 +108,7 @@ NewWebConsoleFrame.prototype = {
|
||||||
toolbox.off("select", this._onChangeSplitConsoleState);
|
toolbox.off("select", this._onChangeSplitConsoleState);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.window = this.owner = this.newConsoleOutput = null;
|
this.window = this.owner = this.consoleOutput = null;
|
||||||
|
|
||||||
let onDestroy = () => {
|
let onDestroy = () => {
|
||||||
this._destroyer.resolve(null);
|
this._destroyer.resolve(null);
|
||||||
|
@ -204,8 +204,8 @@ NewWebConsoleFrame.prototype = {
|
||||||
let toolbox = gDevTools.getToolbox(this.owner.target);
|
let toolbox = gDevTools.getToolbox(this.owner.target);
|
||||||
|
|
||||||
// Handle both launchpad and toolbox loading
|
// Handle both launchpad and toolbox loading
|
||||||
let Wrapper = this.owner.NewConsoleOutputWrapper || this.window.NewConsoleOutput;
|
let Wrapper = this.owner.WebConsoleOutputWrapper || this.window.WebConsoleOutput;
|
||||||
this.newConsoleOutput =
|
this.consoleOutput =
|
||||||
new Wrapper(this.outputNode, this, toolbox, this.owner, this.document);
|
new Wrapper(this.outputNode, this, toolbox, this.owner, this.document);
|
||||||
// Toggle the timestamp on preference change
|
// Toggle the timestamp on preference change
|
||||||
Services.prefs.addObserver(PREF_MESSAGE_TIMESTAMP, this._onToolboxPrefChanged);
|
Services.prefs.addObserver(PREF_MESSAGE_TIMESTAMP, this._onToolboxPrefChanged);
|
||||||
|
@ -253,7 +253,7 @@ NewWebConsoleFrame.prototype = {
|
||||||
} else if (Services.prefs.getBoolPref(PREF_SIDEBAR_ENABLED)) {
|
} else if (Services.prefs.getBoolPref(PREF_SIDEBAR_ENABLED)) {
|
||||||
shortcuts.on("Esc", event => {
|
shortcuts.on("Esc", event => {
|
||||||
if (!this.jsterm.autocompletePopup || !this.jsterm.autocompletePopup.isOpen) {
|
if (!this.jsterm.autocompletePopup || !this.jsterm.autocompletePopup.isOpen) {
|
||||||
this.newConsoleOutput.dispatchSidebarClose();
|
this.consoleOutput.dispatchSidebarClose();
|
||||||
this.jsterm.focus();
|
this.jsterm.focus();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -293,7 +293,7 @@ NewWebConsoleFrame.prototype = {
|
||||||
*/
|
*/
|
||||||
_onToolboxPrefChanged: function() {
|
_onToolboxPrefChanged: function() {
|
||||||
let newValue = Services.prefs.getBoolPref(PREF_MESSAGE_TIMESTAMP);
|
let newValue = Services.prefs.getBoolPref(PREF_MESSAGE_TIMESTAMP);
|
||||||
this.newConsoleOutput.dispatchTimestampsToggle(newValue);
|
this.consoleOutput.dispatchTimestampsToggle(newValue);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -306,7 +306,7 @@ NewWebConsoleFrame.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
_onChangeSplitConsoleState: function() {
|
_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
|
// Wait for completion of any async dispatch before notifying that the console
|
||||||
// is fully updated after a page reload
|
// is fully updated after a page reload
|
||||||
await this.newConsoleOutput.waitAsyncDispatches();
|
await this.consoleOutput.waitAsyncDispatches();
|
||||||
this.emit("reloaded");
|
this.emit("reloaded");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -336,7 +336,7 @@ NewWebConsoleFrame.prototype = {
|
||||||
if (this.persistLog) {
|
if (this.persistLog) {
|
||||||
// Add a _type to hit convertCachedPacket.
|
// Add a _type to hit convertCachedPacket.
|
||||||
packet._type = true;
|
packet._type = true;
|
||||||
this.newConsoleOutput.dispatchMessageAdd(packet);
|
this.consoleOutput.dispatchMessageAdd(packet);
|
||||||
} else {
|
} else {
|
||||||
this.jsterm.clearOutput(false);
|
this.jsterm.clearOutput(false);
|
||||||
}
|
}
|
||||||
|
@ -360,4 +360,4 @@ function quickRestart() {
|
||||||
Services.startup.quit(Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestart);
|
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;
|
let store = null;
|
||||||
|
|
||||||
function NewConsoleOutputWrapper(parentNode, hud, toolbox, owner, document) {
|
function WebConsoleOutputWrapper(parentNode, hud, toolbox, owner, document) {
|
||||||
EventEmitter.decorate(this);
|
EventEmitter.decorate(this);
|
||||||
|
|
||||||
this.parentNode = parentNode;
|
this.parentNode = parentNode;
|
||||||
|
@ -40,7 +40,7 @@ function NewConsoleOutputWrapper(parentNode, hud, toolbox, owner, document) {
|
||||||
store = configureStore(this.hud);
|
store = configureStore(this.hud);
|
||||||
}
|
}
|
||||||
|
|
||||||
NewConsoleOutputWrapper.prototype = {
|
WebConsoleOutputWrapper.prototype = {
|
||||||
init: function() {
|
init: function() {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
const attachRefToHud = (id, node) => {
|
const attachRefToHud = (id, node) => {
|
||||||
|
@ -432,4 +432,4 @@ NewConsoleOutputWrapper.prototype = {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Exports from this module
|
// Exports from this module
|
||||||
module.exports = NewConsoleOutputWrapper;
|
module.exports = WebConsoleOutputWrapper;
|
Загрузка…
Ссылка в новой задаче