Closed Bug 1509315 Opened 4 years ago Closed 4 years ago

Refactor all tests involving a real tab to use TargetFactory.forTab to create a target front


(DevTools :: Framework, enhancement, P2)



(firefox65 fixed)

Firefox 65
Tracking Status
firefox65 --- fixed


(Reporter: ochameau, Assigned: ochameau)



(Whiteboard: dt-fission)


(6 files)

For now, most of the tests are using TargetFactory.forTab for accessing to the target front, but there is still a couple manually creating only the front and not a Target by create its own DebuggerClient, querying listTabs manually and calling DebuggerClient.attachTarget by itself.

In order to ease the refactoring coming in bug 1506548, it would be great to reduce the number of usages of listTabs. Such cleanup would reduce quite significantly the number of callsites.
Blocks: 1508285
No longer blocks: 1506548
Severity: normal → enhancement
Priority: -- → P2
Whiteboard: dt-fission
For now, we only pass { actor } for all tab target fronts created via DebuggerClient.attachTarget,
whereas parent process target fronts were passing the full form from RootFront.getProcess.

MozReview-Commit-ID: 1H2NxFv8glY
There is 4 patterns here:
* Tests using attachThreadActorForUrl like event-listeners ones. I augmented this helper method to call TargetFactory.
* Tests using attachTargetActorForUrl like debugger-statement, dbg-navigation and target-scoped-actor. Uses TargetFactory directly.
* Tests using connectDebuggerClient like navigateEvents and spaw_actor_in_parent. Uses TargetFactory directly.
* All the others, where creating DebuggerClient on their own, and calling listTabs+attachTarget. They now use TargetFactory directly.

A note about webconsole-helpers, only consoleClient attribute was used from tests using this helper.
Also, in various tests I remove the call to client.destroy, that's because shared-head will
close all the tabs/toolboxes and it should lead to target/client destruction.
Finally, debugger-statement now request the thread actor via the client instead of manual request,
it should help the refactoring to a front!

MozReview-Commit-ID: 2ah4UmSjuoi

Depends on D12730
I also removed the get root form leftover.

MozReview-Commit-ID: DxPwG9a5YAG

Depends on D12731
These tests are calling listTabs, but that is no longer necessary thanks to rootForm
being automatically managed within RootFront.

MozReview-Commit-ID: AmC6dTIJjiY

Depends on D12732
MozReview-Commit-ID: 2jIm73AiIPN

Depends on D12733
Ideally, it would use TargetFactory. But as that's mochitest chrome,
we don't have natural access to gBrowser/firefox tab.

MozReview-Commit-ID: 4nrfFZu6jAU

Depends on D12734
Pushed by
Pass the full target form to all BrowsingContextTargetFront instances. r=yulia
Use TargetFactory.forTab for creating targets in tests. r=yulia
Remove leftover from debugger head.js file. r=yulia
Remove unecessary calls to listTabs. r=yulia
Refactor console attachConsole test helpers to async. r=yulia
Make the console test helper use getTab instead of listTabs. r=yulia
You need to log in before you can comment on or make changes to this bug.