зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 3 changesets (bug 1570242) for devtools failure in /webconsole/test/node/components/webconsole-wrapper.test.js. CLOSED TREE
Backed out changeset 854e62f7f1ae (bug 1570242) Backed out changeset 304366165980 (bug 1570242) Backed out changeset a213b28dd40f (bug 1570242)
This commit is contained in:
Родитель
ae8445aebc
Коммит
4a1c5b0a2a
|
@ -38,18 +38,13 @@ class BrowserConsole extends WebConsole {
|
|||
* @param Boolean fissionSupport
|
||||
*/
|
||||
constructor(target, iframeWindow, chromeWindow, fissionSupport = false) {
|
||||
super(null, iframeWindow, chromeWindow, true, fissionSupport);
|
||||
super(target, iframeWindow, chromeWindow, true, fissionSupport);
|
||||
|
||||
this._browserConsoleTarget = target;
|
||||
this._telemetry = new Telemetry();
|
||||
this._bcInitializer = null;
|
||||
this._bcDestroyer = null;
|
||||
}
|
||||
|
||||
get currentTarget() {
|
||||
return this._browserConsoleTarget;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the Browser Console instance.
|
||||
*
|
||||
|
@ -101,7 +96,7 @@ class BrowserConsole extends WebConsole {
|
|||
this._telemetry.toolClosed("browserconsole", -1, this);
|
||||
|
||||
await super.destroy();
|
||||
await this.currentTarget.destroy();
|
||||
await this.target.destroy();
|
||||
this.chromeWindow.close();
|
||||
})();
|
||||
|
||||
|
|
|
@ -65,11 +65,7 @@ WebConsolePanel.prototype = {
|
|||
const chromeWindow = iframe.ownerDocument.defaultView;
|
||||
|
||||
// Open the Web Console.
|
||||
this.hud = new WebConsole(
|
||||
this._toolbox,
|
||||
webConsoleUIWindow,
|
||||
chromeWindow
|
||||
);
|
||||
this.hud = new WebConsole(this.target, webConsoleUIWindow, chromeWindow);
|
||||
await this.hud.init();
|
||||
|
||||
// Pipe 'reloaded' event from WebConsoleUI to WebConsolePanel.
|
||||
|
@ -89,7 +85,7 @@ WebConsolePanel.prototype = {
|
|||
return this;
|
||||
},
|
||||
|
||||
get currentTarget() {
|
||||
get target() {
|
||||
return this._toolbox.target;
|
||||
},
|
||||
|
||||
|
|
|
@ -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 = wcHud.toolbox;
|
||||
const toolbox = gDevTools.getToolbox(wcHud.target);
|
||||
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 = hud.toolbox;
|
||||
const toolbox = gDevTools.getToolbox(hud.target);
|
||||
const dbg = createDebuggerContext(toolbox);
|
||||
await waitForSelectedSource(dbg, TEST_SCRIPT_URI);
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ add_task(async function() {
|
|||
const hud = await openNewTabAndConsole(TEST_URI);
|
||||
|
||||
info("Reload the content window");
|
||||
const onNavigate = hud.currentTarget.once("navigate");
|
||||
const onNavigate = hud.target.once("navigate");
|
||||
ContentTask.spawn(gBrowser.selectedBrowser, null, () => {
|
||||
content.wrappedJSObject.location.reload();
|
||||
});
|
||||
|
|
|
@ -30,7 +30,7 @@ add_task(async function() {
|
|||
|
||||
info("Open the debugger and then select the console again");
|
||||
await openDebugger();
|
||||
const toolbox = hud.toolbox;
|
||||
const toolbox = gDevTools.getToolbox(hud.target);
|
||||
const dbg = createDebuggerContext(toolbox);
|
||||
|
||||
await openConsole();
|
||||
|
|
|
@ -18,7 +18,7 @@ add_task(async function() {
|
|||
info("open the debugger");
|
||||
await openDebugger();
|
||||
|
||||
const toolbox = hud.toolbox;
|
||||
const toolbox = gDevTools.getToolbox(hud.target);
|
||||
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 = hud.toolbox;
|
||||
const toolbox = gDevTools.getToolbox(hud.target);
|
||||
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 = hud.toolbox;
|
||||
const toolbox = gDevTools.getToolbox(hud.target);
|
||||
const dbg = createDebuggerContext(toolbox);
|
||||
|
||||
info("Add a logpoint to the first file");
|
||||
|
|
|
@ -37,7 +37,7 @@ add_task(async function() {
|
|||
for (const tab of tabs) {
|
||||
// Open the console in tab${i}.
|
||||
const hud = await openConsole(tab);
|
||||
const browser = hud.currentTarget.tab.linkedBrowser;
|
||||
const browser = hud.target.tab.linkedBrowser;
|
||||
const message = "message for tab " + tabs.indexOf(tab);
|
||||
|
||||
// Log a message in the newly opened console.
|
||||
|
|
|
@ -29,7 +29,7 @@ Services.scriptloader.loadSubScript(
|
|||
|
||||
add_task(async function() {
|
||||
const hud = await openNewTabAndConsole(TEST_URI);
|
||||
const toolbox = hud.toolbox;
|
||||
const toolbox = gDevTools.getToolbox(hud.target);
|
||||
|
||||
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 = hud.toolbox;
|
||||
const toolbox = gDevTools.getToolbox(hud.target);
|
||||
|
||||
// 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 = hud.toolbox;
|
||||
const toolbox = gDevTools.getToolbox(hud.target);
|
||||
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 = hud.toolbox;
|
||||
const toolbox = gDevTools.getToolbox(hud.target);
|
||||
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 = hud.toolbox;
|
||||
const toolbox = gDevTools.getToolbox(hud.target);
|
||||
|
||||
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 = hud.toolbox;
|
||||
const toolbox = gDevTools.getToolbox(hud.target);
|
||||
|
||||
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 = hud.toolbox;
|
||||
const toolbox = gDevTools.getToolbox(hud.target);
|
||||
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 = hud.toolbox;
|
||||
const toolbox = gDevTools.getToolbox(hud.target);
|
||||
const dbg = createDebuggerContext(toolbox);
|
||||
|
||||
execute(hud, "pauseInWorker(42)");
|
||||
|
|
|
@ -350,7 +350,7 @@ function hideContextMenu(hud) {
|
|||
}
|
||||
|
||||
function _getContextMenu(hud) {
|
||||
const toolbox = hud.toolbox;
|
||||
const toolbox = gDevTools.getToolbox(hud.target);
|
||||
const doc = toolbox ? toolbox.topWindow.document : hud.chromeWindow.document;
|
||||
return doc.getElementById("webconsole-menu");
|
||||
}
|
||||
|
|
|
@ -23,10 +23,19 @@ class WebConsoleConnectionProxy {
|
|||
* @param RemoteTarget target
|
||||
* The target that the console will connect to.
|
||||
*/
|
||||
constructor(webConsoleUI, target) {
|
||||
constructor(webConsoleUI, target, isBrowserConsole, fissionSupport) {
|
||||
this.webConsoleUI = webConsoleUI;
|
||||
this.target = target;
|
||||
this.fissionSupport = this.webConsoleUI.fissionSupport;
|
||||
this.isBrowserConsole = isBrowserConsole;
|
||||
this.fissionSupport = fissionSupport;
|
||||
|
||||
/**
|
||||
* The DebuggerClient object.
|
||||
*
|
||||
* @see DebuggerClient
|
||||
* @type object
|
||||
*/
|
||||
this.client = target.client;
|
||||
|
||||
this._connecter = null;
|
||||
|
||||
|
@ -59,7 +68,6 @@ class WebConsoleConnectionProxy {
|
|||
this.target.on("navigate", this._onTabNavigated);
|
||||
|
||||
const connection = (async () => {
|
||||
this.client = this.target.client;
|
||||
this.webConsoleClient = await this.target.getFront("console");
|
||||
this._addWebConsoleClientEventListeners();
|
||||
await this._attachConsole();
|
||||
|
@ -376,6 +384,7 @@ class WebConsoleConnectionProxy {
|
|||
|
||||
this.client = null;
|
||||
this.webConsoleClient = null;
|
||||
this.target = null;
|
||||
this.webConsoleUI = null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
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");
|
||||
|
@ -142,21 +143,20 @@ class WebConsoleUI {
|
|||
this.wrapper.destroy();
|
||||
}
|
||||
|
||||
const toolbox = this.hud.toolbox;
|
||||
const toolbox = gDevTools.getToolbox(this.hud.target);
|
||||
if (toolbox) {
|
||||
toolbox.off("webconsole-selected", this._onPanelSelected);
|
||||
toolbox.off("split-console", this._onChangeSplitConsoleState);
|
||||
toolbox.off("select", this._onChangeSplitConsoleState);
|
||||
}
|
||||
|
||||
this.window = this.hud = this.wrapper = null;
|
||||
|
||||
for (const proxy of this.getAllProxies()) {
|
||||
proxy.disconnect();
|
||||
}
|
||||
this.proxy = null;
|
||||
this.additionalProxies = null;
|
||||
|
||||
// Nullify `hud` last as it nullify also target which is used on destroy
|
||||
this.window = this.hud = this.wrapper = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -222,7 +222,7 @@ class WebConsoleUI {
|
|||
}
|
||||
|
||||
logWarningAboutReplacedAPI() {
|
||||
return this.hud.currentTarget.logWarningInPage(
|
||||
return this.hud.target.logWarningInPage(
|
||||
l10n.getStr("ConsoleAPIDisabled"),
|
||||
"ConsoleAPIDisabled"
|
||||
);
|
||||
|
@ -257,11 +257,19 @@ class WebConsoleUI {
|
|||
* A promise object that is resolved/reject based on the proxies connections.
|
||||
*/
|
||||
async _initConnection() {
|
||||
this.proxy = new WebConsoleConnectionProxy(this, this.hud.currentTarget);
|
||||
this.proxy = new WebConsoleConnectionProxy(
|
||||
this,
|
||||
this.hud.target,
|
||||
this.isBrowserConsole,
|
||||
this.fissionSupport
|
||||
);
|
||||
|
||||
const target = this.hud.currentTarget;
|
||||
if (this.fissionSupport && target.chrome && !target.isAddon) {
|
||||
const { mainRoot } = target.client;
|
||||
if (
|
||||
this.fissionSupport &&
|
||||
this.hud.target.chrome &&
|
||||
!this.hud.target.isAddon
|
||||
) {
|
||||
const { mainRoot } = this.hud.target.client;
|
||||
const { processes } = await mainRoot.listProcesses();
|
||||
|
||||
this.additionalProxies = [];
|
||||
|
@ -270,7 +278,7 @@ class WebConsoleUI {
|
|||
|
||||
// Don't create a proxy for the "main" target,
|
||||
// as we already created it in this.proxy.
|
||||
if (targetFront === target) {
|
||||
if (targetFront === this.hud.target) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -283,7 +291,12 @@ class WebConsoleUI {
|
|||
}
|
||||
|
||||
this.additionalProxies.push(
|
||||
new WebConsoleConnectionProxy(this, targetFront)
|
||||
new WebConsoleConnectionProxy(
|
||||
this,
|
||||
targetFront,
|
||||
this.isBrowserConsole,
|
||||
this.fissionSupport
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -297,7 +310,7 @@ class WebConsoleUI {
|
|||
|
||||
this.outputNode = this.document.getElementById("app-wrapper");
|
||||
|
||||
const toolbox = this.hud.toolbox;
|
||||
const toolbox = gDevTools.getToolbox(this.hud.target);
|
||||
|
||||
// Initialize module loader and load all the WebConsoleWrapper. The entire code-base
|
||||
// doesn't need any extra privileges and runs entirely in content scope.
|
||||
|
|
|
@ -84,9 +84,9 @@ class WebConsoleWrapper {
|
|||
this.webConsoleUI[id] = node;
|
||||
};
|
||||
const { webConsoleUI } = this;
|
||||
const debuggerClient = this.hud.currentTarget.client;
|
||||
const debuggerClient = this.hud.target.client;
|
||||
|
||||
const webConsoleClient = await this.hud.currentTarget.getFront("console");
|
||||
const webConsoleClient = await this.hud.target.getFront("console");
|
||||
this.networkDataProvider = new DataProvider({
|
||||
actions: {
|
||||
updateRequest: (id, data) => {
|
||||
|
@ -114,15 +114,23 @@ class WebConsoleWrapper {
|
|||
webConsoleUI.hud.openLink(url, e);
|
||||
},
|
||||
canRewind: () => {
|
||||
const target = webConsoleUI.hud && webConsoleUI.hud.currentTarget;
|
||||
const traits = target && target.traits;
|
||||
return traits && traits.canRewind;
|
||||
if (
|
||||
!(
|
||||
webConsoleUI.hud &&
|
||||
webConsoleUI.hud.target &&
|
||||
webConsoleUI.hud.target.traits
|
||||
)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return webConsoleUI.hud.target.traits.canRewind;
|
||||
},
|
||||
createElement: nodename => {
|
||||
return this.document.createElement(nodename);
|
||||
},
|
||||
fetchObjectProperties: async (grip, ignoreNonIndexedProperties) => {
|
||||
const client = new ObjectClient(this.hud.currentTarget.client, grip);
|
||||
const client = new ObjectClient(this.hud.target.client, grip);
|
||||
const { iterator } = await client.enumProperties({
|
||||
ignoreNonIndexedProperties,
|
||||
});
|
||||
|
@ -130,7 +138,7 @@ class WebConsoleWrapper {
|
|||
return ownProperties;
|
||||
},
|
||||
fetchObjectEntries: async grip => {
|
||||
const client = new ObjectClient(this.hud.currentTarget.client, grip);
|
||||
const client = new ObjectClient(this.hud.target.client, grip);
|
||||
const { iterator } = await client.enumEntries();
|
||||
const { ownProperties } = await iterator.slice(0, iterator.count);
|
||||
return ownProperties;
|
||||
|
|
|
@ -51,8 +51,8 @@ const isMacOS = Services.appinfo.OS === "Darwin";
|
|||
class WebConsole {
|
||||
/*
|
||||
* @constructor
|
||||
* @param object toolbox
|
||||
* The toolbox where the web console is displayed.
|
||||
* @param object target
|
||||
* The target that the web console will connect to.
|
||||
* @param nsIDOMWindow iframeWindow
|
||||
* The window where the web console UI is already loaded.
|
||||
* @param nsIDOMWindow chromeWindow
|
||||
|
@ -60,16 +60,16 @@ class WebConsole {
|
|||
* @param bool isBrowserConsole
|
||||
*/
|
||||
constructor(
|
||||
toolbox,
|
||||
target,
|
||||
iframeWindow,
|
||||
chromeWindow,
|
||||
isBrowserConsole = false,
|
||||
fissionSupport = false
|
||||
) {
|
||||
this.toolbox = toolbox;
|
||||
this.iframeWindow = iframeWindow;
|
||||
this.chromeWindow = chromeWindow;
|
||||
this.hudId = "hud_" + ++gHudId;
|
||||
this.target = target;
|
||||
this.browserWindow = this.chromeWindow.top;
|
||||
this.isBrowserConsole = isBrowserConsole;
|
||||
this.fissionSupport = fissionSupport;
|
||||
|
@ -86,10 +86,6 @@ class WebConsole {
|
|||
EventEmitter.decorate(this);
|
||||
}
|
||||
|
||||
get currentTarget() {
|
||||
return this.toolbox.target;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for the window that can provide various utilities that the web
|
||||
* console makes use of, like opening links, managing popups, etc. In
|
||||
|
@ -197,7 +193,7 @@ class WebConsole {
|
|||
* The line number which you want to place the caret.
|
||||
*/
|
||||
viewSourceInStyleEditor(sourceURL, sourceLine) {
|
||||
const toolbox = this.toolbox;
|
||||
const toolbox = gDevTools.getToolbox(this.target);
|
||||
if (!toolbox) {
|
||||
this.viewSource(sourceURL, sourceLine);
|
||||
return;
|
||||
|
@ -220,7 +216,7 @@ class WebConsole {
|
|||
* The column number which you want to place the caret.
|
||||
*/
|
||||
viewSourceInDebugger(sourceURL, sourceLine, sourceColumn) {
|
||||
const toolbox = this.toolbox;
|
||||
const toolbox = gDevTools.getToolbox(this.target);
|
||||
if (!toolbox) {
|
||||
this.viewSource(sourceURL, sourceLine, sourceColumn);
|
||||
return;
|
||||
|
@ -257,7 +253,7 @@ class WebConsole {
|
|||
* returned.
|
||||
*/
|
||||
getDebuggerFrames() {
|
||||
const toolbox = this.toolbox;
|
||||
const toolbox = gDevTools.getToolbox(this.target);
|
||||
if (!toolbox) {
|
||||
return null;
|
||||
}
|
||||
|
@ -286,7 +282,7 @@ class WebConsole {
|
|||
* `originalExpression`.
|
||||
*/
|
||||
getMappedExpression(expression) {
|
||||
const toolbox = this.toolbox;
|
||||
const toolbox = gDevTools.getToolbox(this.target);
|
||||
|
||||
// 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 +337,7 @@ class WebConsole {
|
|||
* then |null| is returned.
|
||||
*/
|
||||
getInspectorSelection() {
|
||||
const toolbox = this.toolbox;
|
||||
const toolbox = gDevTools.getToolbox(this.target);
|
||||
if (!toolbox) {
|
||||
return null;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче