зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1740292 - [devtools] Stop calling target front attach method. r=nchevobbe
Previous patches made attach method become a no-op, so all these callsites can be removed. Differential Revision: https://phabricator.services.mozilla.com/D130913
This commit is contained in:
Родитель
5aea7b3306
Коммит
487d9677f3
|
@ -14,7 +14,6 @@ add_task(async function() {
|
||||||
|
|
||||||
const descriptorFront = await client.mainRoot.getMainProcess();
|
const descriptorFront = await client.mainRoot.getMainProcess();
|
||||||
const front = await descriptorFront.getTarget();
|
const front = await descriptorFront.getTarget();
|
||||||
await front.attach();
|
|
||||||
const threadFront = await front.attachThread();
|
const threadFront = await front.attachThread();
|
||||||
|
|
||||||
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, "about:mozilla");
|
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, "about:mozilla");
|
||||||
|
|
|
@ -106,7 +106,6 @@ async function testMainProcess() {
|
||||||
|
|
||||||
const targetDescriptor = await client.mainRoot.getMainProcess();
|
const targetDescriptor = await client.mainRoot.getMainProcess();
|
||||||
const target = await targetDescriptor.getTarget();
|
const target = await targetDescriptor.getTarget();
|
||||||
await target.attach();
|
|
||||||
|
|
||||||
const threadFront = await target.attachThread();
|
const threadFront = await target.attachThread();
|
||||||
const { sources } = await threadFront.getSources();
|
const { sources } = await threadFront.getSources();
|
||||||
|
|
|
@ -4,8 +4,6 @@
|
||||||
// Test support methods on Target, such as `hasActor` and `getTrait`.
|
// Test support methods on Target, such as `hasActor` and `getTrait`.
|
||||||
|
|
||||||
async function testTarget(client, target) {
|
async function testTarget(client, target) {
|
||||||
await target.attach();
|
|
||||||
|
|
||||||
is(
|
is(
|
||||||
target.hasActor("inspector"),
|
target.hasActor("inspector"),
|
||||||
true,
|
true,
|
||||||
|
|
|
@ -86,7 +86,6 @@ async function checkGetTabFailures(client) {
|
||||||
|
|
||||||
async function checkSelectedTargetActor(targetFront2) {
|
async function checkSelectedTargetActor(targetFront2) {
|
||||||
// Send a naive request to the second target actor to check if it works
|
// Send a naive request to the second target actor to check if it works
|
||||||
await targetFront2.attach();
|
|
||||||
const consoleFront = await targetFront2.getFront("console");
|
const consoleFront = await targetFront2.getFront("console");
|
||||||
const response = await consoleFront.startListeners([]);
|
const response = await consoleFront.startListeners([]);
|
||||||
ok(
|
ok(
|
||||||
|
@ -97,7 +96,6 @@ async function checkSelectedTargetActor(targetFront2) {
|
||||||
|
|
||||||
async function checkFirstTargetActor(targetFront1) {
|
async function checkFirstTargetActor(targetFront1) {
|
||||||
// then send a request to the first target actor to check if it still works
|
// then send a request to the first target actor to check if it still works
|
||||||
await targetFront1.attach();
|
|
||||||
const consoleFront = await targetFront1.getFront("console");
|
const consoleFront = await targetFront1.getFront("console");
|
||||||
const response = await consoleFront.startListeners([]);
|
const response = await consoleFront.startListeners([]);
|
||||||
ok(
|
ok(
|
||||||
|
|
|
@ -107,7 +107,6 @@ class ProcessDescriptorFront extends DescriptorMixin(
|
||||||
try {
|
try {
|
||||||
const targetForm = await super.getTarget();
|
const targetForm = await super.getTarget();
|
||||||
targetFront = await this._createProcessTargetFront(targetForm);
|
targetFront = await this._createProcessTargetFront(targetForm);
|
||||||
await targetFront.attach();
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// This is likely to happen if we get a lot of events which drop previous
|
// This is likely to happen if we get a lot of events which drop previous
|
||||||
// processes.
|
// processes.
|
||||||
|
|
|
@ -280,7 +280,6 @@ class TabDescriptorFront extends DescriptorMixin(
|
||||||
try {
|
try {
|
||||||
const targetForm = await super.getTarget();
|
const targetForm = await super.getTarget();
|
||||||
newTargetFront = this._createTabTarget(targetForm);
|
newTargetFront = this._createTabTarget(targetForm);
|
||||||
await newTargetFront.attach();
|
|
||||||
this.setTarget(newTargetFront);
|
this.setTarget(newTargetFront);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(
|
console.log(
|
||||||
|
|
|
@ -145,7 +145,6 @@ class WebExtensionDescriptorFront extends DescriptorMixin(
|
||||||
try {
|
try {
|
||||||
const targetForm = await super.getTarget();
|
const targetForm = await super.getTarget();
|
||||||
targetFront = this._createWebExtensionTarget(targetForm);
|
targetFront = this._createWebExtensionTarget(targetForm);
|
||||||
await targetFront.attach();
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(
|
console.log(
|
||||||
`Request to connect to WebExtensionDescriptor "${this.id}" failed: ${e}`
|
`Request to connect to WebExtensionDescriptor "${this.id}" failed: ${e}`
|
||||||
|
|
|
@ -755,9 +755,6 @@ class ResponsiveUI {
|
||||||
// enterResponsiveMode whenever there is a target switch.
|
// enterResponsiveMode whenever there is a target switch.
|
||||||
this.tab.linkedBrowser.enterResponsiveMode();
|
this.tab.linkedBrowser.enterResponsiveMode();
|
||||||
|
|
||||||
// Attach current target to the selected browser tab.
|
|
||||||
await this.currentTarget.attach();
|
|
||||||
|
|
||||||
// If the target follows the window global lifecycle, the configuration was already
|
// If the target follows the window global lifecycle, the configuration was already
|
||||||
// restored from the server during target switch, so we can stop here.
|
// restored from the server during target switch, so we can stop here.
|
||||||
// This function is still called at startup to restore potential state from previous
|
// This function is still called at startup to restore potential state from previous
|
||||||
|
|
|
@ -875,7 +875,6 @@ async function createAndAttachTargetForTab(tab) {
|
||||||
await commands.targetCommand.startListening();
|
await commands.targetCommand.startListening();
|
||||||
|
|
||||||
const target = commands.targetCommand.targetFront;
|
const target = commands.targetCommand.targetFront;
|
||||||
await target.attach();
|
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,13 +77,8 @@ function attachToTab() {
|
||||||
// Find the active tab.
|
// Find the active tab.
|
||||||
let targetFront = tabs.find(tab => tab.selected);
|
let targetFront = tabs.find(tab => tab.selected);
|
||||||
|
|
||||||
// Attach to the tab.
|
// Attach listeners for client events.
|
||||||
targetFront.attach().then(() => {
|
targetFront.on("tabNavigated", onTab);
|
||||||
// Now the targetFront is ready and can be used.
|
|
||||||
|
|
||||||
// Attach listeners for client events.
|
|
||||||
targetFront.on("tabNavigated", onTab);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
@ -169,8 +164,6 @@ async function debugTab() {
|
||||||
const tabs = await client.mainRoot.listTabs();
|
const tabs = await client.mainRoot.listTabs();
|
||||||
// Find the active tab.
|
// Find the active tab.
|
||||||
let targetFront = tabs.find(tab => tab.selected);
|
let targetFront = tabs.find(tab => tab.selected);
|
||||||
// Attach to the tab.
|
|
||||||
await targetFront.attach();
|
|
||||||
// Attach to the thread (context).
|
// Attach to the thread (context).
|
||||||
const threadFront = await targetFront.attachThread();
|
const threadFront = await targetFront.attachThread();
|
||||||
// Attach listeners for thread events.
|
// Attach listeners for thread events.
|
||||||
|
|
|
@ -811,7 +811,6 @@ async function setupTestFromUrl(url) {
|
||||||
const tabs = await listTabs(devToolsClient);
|
const tabs = await listTabs(devToolsClient);
|
||||||
const descriptorFront = findTab(tabs, "test");
|
const descriptorFront = findTab(tabs, "test");
|
||||||
const targetFront = await descriptorFront.getTarget();
|
const targetFront = await descriptorFront.getTarget();
|
||||||
await targetFront.attach();
|
|
||||||
|
|
||||||
const threadFront = await attachThread(targetFront);
|
const threadFront = await attachThread(targetFront);
|
||||||
|
|
||||||
|
|
|
@ -158,8 +158,8 @@ exports.CommandsFactory = {
|
||||||
// Hack something in order to help TargetMixinFront to distinguish the BrowserConsole
|
// Hack something in order to help TargetMixinFront to distinguish the BrowserConsole
|
||||||
descriptor.createdForBrowserConsole = true;
|
descriptor.createdForBrowserConsole = true;
|
||||||
|
|
||||||
const target = await descriptor.getTarget();
|
// Force fetching the first top level target right away.
|
||||||
await target.attach();
|
await descriptor.getTarget();
|
||||||
|
|
||||||
const commands = await createCommandsDictionary(descriptor);
|
const commands = await createCommandsDictionary(descriptor);
|
||||||
return commands;
|
return commands;
|
||||||
|
|
|
@ -43,10 +43,6 @@ async function checkBreakpointBeforeWatchResources() {
|
||||||
tab
|
tab
|
||||||
);
|
);
|
||||||
|
|
||||||
// Attach the thread actor before running the debugger statement,
|
|
||||||
// so that it is correctly catched by the thread actor.
|
|
||||||
info("Attach the top level target");
|
|
||||||
await targetCommand.targetFront.attach();
|
|
||||||
// Init the Thread actor via attachAndInitThread in order to ensure
|
// Init the Thread actor via attachAndInitThread in order to ensure
|
||||||
// memoizing the thread front and avoid attaching it twice
|
// memoizing the thread front and avoid attaching it twice
|
||||||
info("Attach the top level thread actor");
|
info("Attach the top level thread actor");
|
||||||
|
@ -348,9 +344,6 @@ async function checkSetBeforeWatch() {
|
||||||
tab
|
tab
|
||||||
);
|
);
|
||||||
|
|
||||||
// Attach the target in order to create the thread actor
|
|
||||||
info("Attach the top level target");
|
|
||||||
await targetCommand.targetFront.attach();
|
|
||||||
// Instantiate the thread front in order to be able to set a breakpoint before watching for thread state
|
// Instantiate the thread front in order to be able to set a breakpoint before watching for thread state
|
||||||
info("Attach the top level thread actor");
|
info("Attach the top level thread actor");
|
||||||
await targetCommand.targetFront.attachAndInitThread(targetCommand);
|
await targetCommand.targetFront.attachAndInitThread(targetCommand);
|
||||||
|
|
|
@ -75,8 +75,6 @@ var _attachConsole = async function(listeners, attachToTab, attachToWorker) {
|
||||||
worker = new Worker(workerName);
|
worker = new Worker(workerName);
|
||||||
await waitForMessage(worker);
|
await waitForMessage(worker);
|
||||||
|
|
||||||
// listWorkers only works if the browsing context target actor is attached
|
|
||||||
await target.attach();
|
|
||||||
const { workers } = await target.listWorkers();
|
const { workers } = await target.listWorkers();
|
||||||
target = workers.filter(w => w.url == workerName)[0];
|
target = workers.filter(w => w.url == workerName)[0];
|
||||||
if (!target) {
|
if (!target) {
|
||||||
|
@ -85,11 +83,13 @@ var _attachConsole = async function(listeners, attachToTab, attachToWorker) {
|
||||||
);
|
);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
// This is still important to attach workers as target is still a descriptor front
|
||||||
|
// which "becomes" a target when calling its attach method.
|
||||||
|
await target.attach();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attach the Target and the target thread in order to instantiate the console client.
|
// Attach the Target and the target thread in order to instantiate the console client.
|
||||||
await target.attach();
|
|
||||||
await target.attachThread();
|
await target.attachThread();
|
||||||
|
|
||||||
const webConsoleFront = await target.getFront("console");
|
const webConsoleFront = await target.getFront("console");
|
||||||
|
|
Загрузка…
Ссылка в новой задаче