Bug 1570242 - Fetch toolbox from WebConsole class rather than gDevTools. r=nchevobbe

Differential Revision: https://phabricator.services.mozilla.com/D41797

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Alexandre Poirot 2019-08-21 09:47:51 +00:00
Родитель 23fda7ab4b
Коммит 77ad7c4faa
15 изменённых файлов: 22 добавлений и 23 удалений

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

@ -17,7 +17,7 @@ add_task(async function() {
ok(bcHud, "browser console opened");
// Cause an exception in a script loaded with the DevTools loader.
const toolbox = gDevTools.getToolbox(wcHud.target);
const toolbox = wcHud.toolbox;
const oldPanels = toolbox._toolPanels;
// non-iterable
toolbox._toolPanels = {};

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

@ -38,7 +38,7 @@ add_task(async function() {
info("Click on the jump to definition button.");
jumpIcon.click();
const toolbox = gDevTools.getToolbox(hud.target);
const toolbox = hud.toolbox;
const dbg = createDebuggerContext(toolbox);
await waitForSelectedSource(dbg, TEST_SCRIPT_URI);

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

@ -30,7 +30,7 @@ add_task(async function() {
info("Open the debugger and then select the console again");
await openDebugger();
const toolbox = gDevTools.getToolbox(hud.target);
const toolbox = hud.toolbox;
const dbg = createDebuggerContext(toolbox);
await openConsole();

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

@ -18,7 +18,7 @@ add_task(async function() {
info("open the debugger");
await openDebugger();
const toolbox = gDevTools.getToolbox(hud.target);
const toolbox = hud.toolbox;
const dbg = createDebuggerContext(toolbox);
// firstCall calls secondCall, which has a debugger statement, so we'll be paused.

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

@ -25,7 +25,7 @@ add_task(async function() {
info("Open the Debugger panel");
await openDebugger();
const toolbox = gDevTools.getToolbox(hud.target);
const toolbox = hud.toolbox;
const dbg = createDebuggerContext(toolbox);
await selectSource(dbg, "test-location-debugger-link-logpoint-1.js");
@ -111,7 +111,7 @@ add_task(async function() {
info("Open the Debugger panel");
await openDebugger();
const toolbox = gDevTools.getToolbox(hud.target);
const toolbox = hud.toolbox;
const dbg = createDebuggerContext(toolbox);
info("Add a logpoint to the first file");

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

@ -29,7 +29,7 @@ Services.scriptloader.loadSubScript(
add_task(async function() {
const hud = await openNewTabAndConsole(TEST_URI);
const toolbox = gDevTools.getToolbox(hud.target);
const toolbox = hud.toolbox;
await registerTestActor(toolbox.target.client);
const testActor = await getTestActor(toolbox);

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

@ -23,7 +23,7 @@ const TEST_URI = "data:text/html;charset=utf-8," + encodeURI(HTML);
add_task(async function() {
const hud = await openNewTabAndConsole(TEST_URI);
const toolbox = gDevTools.getToolbox(hud.target);
const toolbox = hud.toolbox;
// Loading the inspector panel at first, to make it possible to listen for
// new node selections

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

@ -16,7 +16,7 @@ add_task(async function() {
const hud = await openNewTabAndConsole(TEST_URI);
await openDebugger();
const toolbox = gDevTools.getToolbox(hud.target);
const toolbox = hud.toolbox;
const dbg = createDebuggerContext(toolbox);
await selectSource(dbg, "test-closure-optimized-out.html");

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

@ -31,7 +31,7 @@ add_task(async function() {
info("Open the settings panel");
const observer = new PrefObserver("");
const toolbox = gDevTools.getToolbox(hud.target);
const toolbox = hud.toolbox;
const { panelDoc, panelWin } = await toolbox.selectTool("options");
info("Change Timestamp preference");

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

@ -25,7 +25,7 @@ const MESSAGES_COUNT = 10;
add_task(async function() {
const hud = await openNewTabAndConsole(TEST_URI);
const toolbox = gDevTools.getToolbox(hud.target);
const toolbox = hud.toolbox;
info("Log one message in the console");
ContentTask.spawn(gBrowser.selectedBrowser, null, () => {
@ -85,7 +85,7 @@ add_task(async function() {
// Here, the messages should still be logged.
add_task(async function() {
const hud = await openNewTabAndConsole(TEST_URI);
const toolbox = gDevTools.getToolbox(hud.target);
const toolbox = hud.toolbox;
info("Log one message in the console");
ContentTask.spawn(gBrowser.selectedBrowser, null, () => {

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

@ -278,7 +278,7 @@ async function toggleWarningGroupPreference(hud, fromUI = true) {
info("Open the settings panel");
const observer = new PrefObserver("");
const toolbox = gDevTools.getToolbox(hud.target);
const toolbox = hud.toolbox;
const { panelDoc, panelWin } = await toolbox.selectTool("options");
info("Change warning preference");

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

@ -14,7 +14,7 @@ add_task(async function() {
const hud = await openNewTabAndConsole(TEST_URI);
await openDebugger();
const toolbox = gDevTools.getToolbox(hud.target);
const toolbox = hud.toolbox;
const dbg = createDebuggerContext(toolbox);
execute(hud, "pauseInWorker(42)");

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

@ -350,7 +350,7 @@ function hideContextMenu(hud) {
}
function _getContextMenu(hud) {
const toolbox = gDevTools.getToolbox(hud.target);
const toolbox = hud.toolbox;
const doc = toolbox ? toolbox.topWindow.document : hud.chromeWindow.document;
return doc.getElementById("webconsole-menu");
}

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

@ -7,7 +7,6 @@
const { Utils: WebConsoleUtils } = require("devtools/client/webconsole/utils");
const EventEmitter = require("devtools/shared/event-emitter");
const Services = require("Services");
const { gDevTools } = require("devtools/client/framework/devtools");
const {
WebConsoleConnectionProxy,
} = require("devtools/client/webconsole/webconsole-connection-proxy");
@ -143,7 +142,7 @@ class WebConsoleUI {
this.wrapper.destroy();
}
const toolbox = gDevTools.getToolbox(this.hud.target);
const toolbox = this.hud.toolbox;
if (toolbox) {
toolbox.off("webconsole-selected", this._onPanelSelected);
toolbox.off("split-console", this._onChangeSplitConsoleState);
@ -301,7 +300,7 @@ class WebConsoleUI {
this.outputNode = this.document.getElementById("app-wrapper");
const toolbox = gDevTools.getToolbox(this.hud.target);
const toolbox = this.hud.toolbox;
// Initialize module loader and load all the WebConsoleWrapper. The entire code-base
// doesn't need any extra privileges and runs entirely in content scope.

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

@ -197,7 +197,7 @@ class WebConsole {
* The line number which you want to place the caret.
*/
viewSourceInStyleEditor(sourceURL, sourceLine) {
const toolbox = gDevTools.getToolbox(this.target);
const toolbox = this.toolbox;
if (!toolbox) {
this.viewSource(sourceURL, sourceLine);
return;
@ -220,7 +220,7 @@ class WebConsole {
* The column number which you want to place the caret.
*/
viewSourceInDebugger(sourceURL, sourceLine, sourceColumn) {
const toolbox = gDevTools.getToolbox(this.target);
const toolbox = this.toolbox;
if (!toolbox) {
this.viewSource(sourceURL, sourceLine, sourceColumn);
return;
@ -257,7 +257,7 @@ class WebConsole {
* returned.
*/
getDebuggerFrames() {
const toolbox = gDevTools.getToolbox(this.target);
const toolbox = this.toolbox;
if (!toolbox) {
return null;
}
@ -286,7 +286,7 @@ class WebConsole {
* `originalExpression`.
*/
getMappedExpression(expression) {
const toolbox = gDevTools.getToolbox(this.target);
const toolbox = this.toolbox;
// We need to check if the debugger is open, since it may perform a variable name
// substitution for sourcemapped script (i.e. evaluated `myVar.trim()` might need to
@ -341,7 +341,7 @@ class WebConsole {
* then |null| is returned.
*/
getInspectorSelection() {
const toolbox = gDevTools.getToolbox(this.target);
const toolbox = this.toolbox;
if (!toolbox) {
return null;
}