Refactor xpcshell thread client tests running against multiple servers to share a test helper

RESOLVED FIXED in Firefox 65

Status

enhancement
P2
normal
RESOLVED FIXED
6 months ago
3 days ago

People

(Reporter: ochameau, Assigned: ochameau)

Tracking

(Blocks 1 bug)

unspecified
Firefox 65
Dependency tree / graph

Firefox Tracking Flags

(firefox65 fixed)

Details

(Whiteboard: dt-fission)

Attachments

(4 attachments)

Assignee

Description

6 months ago
Many xpcshell tests against the thread client are copy paste a lot of setup code.
Especially the one that require to run the tests against two server: the regular DebuggerServer and the worker one, run in a special context, where there is no chrome privileges. No access to require("chrome")/ChromeUtils/Components.*.

These are the tests using run_test_with_server function, which is copy pasted between all of them:
https://searchfox.org/mozilla-central/search?q=run_test_with_server&case=false&regexp=false&path=

I'm cleaning this up to help the refactoring necessary for fission, where we will have to refactor how to instantiate a target, a thread client, ...
Assignee

Updated

6 months ago
Blocks: 1508289
Assignee

Comment 1

6 months ago
Without this devtools/server/tests/unit/test_breakpoint-22.js fails in protocol.js
writeError function when trying to use console object.

MozReview-Commit-ID: JFhFboHugUh
Assignee

Comment 2

6 months ago
There is a lot of code being copy paste in all these tests
and as I'm most likely going to change things around them in the near future
regarding fission, it would be better if we start sharing more code.

After this there is still a couple of copy paste code (but way less!):
* breakpoints: wait a paused event and eval a custom script in a sandbox
* object grips: set the security.allow_eval_with_system_principal pref, eval stopMe and wait for paused
* stepping: use executeOnNextTickAndWaitForPause to eval a custom script and wait for pause while doing this only on next tick

There is most likely more to share, but at least this isn't framework code, but now only code specific to the debugger.

MozReview-Commit-ID: JgD389cas2j

Depends on D12309
Assignee

Comment 3

6 months ago
MozReview-Commit-ID: 3a9IB4XFjff

Depends on D12310
Assignee

Comment 4

6 months ago
MozReview-Commit-ID: 4qGo1ZF7ITC

Depends on D12311

Comment 5

6 months ago
Pushed by apoirot@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/fc10fcd15066
Ensure exposing `console` to modules loaded for worker server. r=yulia
https://hg.mozilla.org/integration/autoland/rev/c56b523e11e6
Refactor most debugger server test using run_test_with_server to share more code. r=yulia
https://hg.mozilla.org/integration/autoland/rev/fc126a74993d
Refactor xpcshell tests using custom principal. r=yulia
https://hg.mozilla.org/integration/autoland/rev/14c07af09b66
Refactor server xpcshell tests that do not pass in worker context. r=yulia
You need to log in before you can comment on or make changes to this bug.