Closed Bug 1509315 Opened 6 years ago Closed 6 years ago

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

Categories

(DevTools :: Framework, enhancement, P2)

enhancement

Tracking

(firefox65 fixed)

RESOLVED FIXED
Firefox 65
Tracking Status
firefox65 --- fixed

People

(Reporter: ochameau, Assigned: ochameau)

References

Details

(Whiteboard: dt-fission)

Attachments

(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 apoirot@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/ce2018b0349d
Pass the full target form to all BrowsingContextTargetFront instances. r=yulia
https://hg.mozilla.org/integration/autoland/rev/18f76c415505
Use TargetFactory.forTab for creating targets in tests. r=yulia
https://hg.mozilla.org/integration/autoland/rev/322f2dd20299
Remove leftover from debugger head.js file. r=yulia
https://hg.mozilla.org/integration/autoland/rev/3eadd3d05800
Remove unecessary calls to listTabs. r=yulia
https://hg.mozilla.org/integration/autoland/rev/30bc5b0c60eb
Refactor console attachConsole test helpers to async. r=yulia
https://hg.mozilla.org/integration/autoland/rev/5e887c4ebd79
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.

Attachment

General

Created:
Updated:
Size: