Bug 1570242 - Rename target to currentTarget in WebConsole codebase. r=nchevobbe,yulia

Do that to better highlight that the target can change over time.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Alexandre Poirot 2019-08-21 09:47:53 +00:00
parent 77ad7c4faa
commit 763683b0a2
7 changed files with 19 additions and 30 deletions

View File

@ -46,7 +46,7 @@ class BrowserConsole extends WebConsole {
this._bcDestroyer = null;
}
get target() {
get currentTarget() {
return this._browserConsoleTarget;
}
@ -101,7 +101,7 @@ class BrowserConsole extends WebConsole {
this._telemetry.toolClosed("browserconsole", -1, this);
await super.destroy();
await this.target.destroy();
await this.currentTarget.destroy();
this.chromeWindow.close();
})();

View File

@ -89,7 +89,7 @@ WebConsolePanel.prototype = {
return this;
},
get target() {
get currentTarget() {
return this._toolbox.target;
},

View File

@ -15,7 +15,7 @@ add_task(async function() {
const hud = await openNewTabAndConsole(TEST_URI);
info("Reload the content window");
const onNavigate = hud.target.once("navigate");
const onNavigate = hud.currentTarget.once("navigate");
ContentTask.spawn(gBrowser.selectedBrowser, null, () => {
content.wrappedJSObject.location.reload();
});

View 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.target.tab.linkedBrowser;
const browser = hud.currentTarget.tab.linkedBrowser;
const message = "message for tab " + tabs.indexOf(tab);
// Log a message in the newly opened console.

View File

@ -222,7 +222,7 @@ class WebConsoleUI {
}
logWarningAboutReplacedAPI() {
return this.hud.target.logWarningInPage(
return this.hud.currentTarget.logWarningInPage(
l10n.getStr("ConsoleAPIDisabled"),
"ConsoleAPIDisabled"
);
@ -257,14 +257,11 @@ class WebConsoleUI {
* A promise object that is resolved/reject based on the proxies connections.
*/
async _initConnection() {
this.proxy = new WebConsoleConnectionProxy(this, this.hud.target);
this.proxy = new WebConsoleConnectionProxy(this, this.hud.currentTarget);
if (
this.fissionSupport &&
this.hud.target.chrome &&
!this.hud.target.isAddon
) {
const { mainRoot } = this.hud.target.client;
const target = this.hud.currentTarget;
if (this.fissionSupport && target.chrome && !target.isAddon) {
const { mainRoot } = target.client;
const { processes } = await mainRoot.listProcesses();
this.additionalProxies = [];
@ -273,7 +270,7 @@ class WebConsoleUI {
// Don't create a proxy for the "main" target,
// as we already created it in this.proxy.
if (targetFront === this.hud.target) {
if (targetFront === target) {
continue;
}

View File

@ -84,9 +84,9 @@ class WebConsoleWrapper {
this.webConsoleUI[id] = node;
};
const { webConsoleUI } = this;
const debuggerClient = this.hud.target.client;
const debuggerClient = this.hud.currentTarget.client;
const webConsoleClient = await this.hud.target.getFront("console");
const webConsoleClient = await this.hud.currentTarget.getFront("console");
this.networkDataProvider = new DataProvider({
actions: {
updateRequest: (id, data) => {
@ -114,23 +114,15 @@ class WebConsoleWrapper {
webConsoleUI.hud.openLink(url, e);
},
canRewind: () => {
if (
!(
webConsoleUI.hud &&
webConsoleUI.hud.target &&
webConsoleUI.hud.target.traits
)
) {
return false;
}
return webConsoleUI.hud.target.traits.canRewind;
const target = webConsoleUI.hud && webConsoleUI.hud.currentTarget;
const traits = target && target.traits;
return traits && traits.canRewind;
},
createElement: nodename => {
return this.document.createElement(nodename);
},
fetchObjectProperties: async (grip, ignoreNonIndexedProperties) => {
const client = new ObjectClient(this.hud.target.client, grip);
const client = new ObjectClient(this.hud.currentTarget.client, grip);
const { iterator } = await client.enumProperties({
ignoreNonIndexedProperties,
});
@ -138,7 +130,7 @@ class WebConsoleWrapper {
return ownProperties;
},
fetchObjectEntries: async grip => {
const client = new ObjectClient(this.hud.target.client, grip);
const client = new ObjectClient(this.hud.currentTarget.client, grip);
const { iterator } = await client.enumEntries();
const { ownProperties } = await iterator.slice(0, iterator.count);
return ownProperties;

View File

@ -86,7 +86,7 @@ class WebConsole {
EventEmitter.decorate(this);
}
get target() {
get currentTarget() {
return this.toolbox.target;
}