Closed Bug 1508287 Opened 3 years ago Closed 3 years ago

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


(DevTools :: Debugger, enhancement, P2)



(firefox65 fixed)

Firefox 65
Tracking Status
firefox65 --- fixed


(Reporter: ochameau, Assigned: ochameau)


(Blocks 1 open bug)


(Whiteboard: dt-fission)


(4 files)

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:

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, ...
Blocks: 1508289
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
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
MozReview-Commit-ID: 3a9IB4XFjff

Depends on D12310
MozReview-Commit-ID: 4qGo1ZF7ITC

Depends on D12311
Pushed by
Ensure exposing `console` to modules loaded for worker server. r=yulia
Refactor most debugger server test using run_test_with_server to share more code. r=yulia
Refactor xpcshell tests using custom principal. r=yulia
Refactor server xpcshell tests that do not pass in worker context. r=yulia
Regressions: 1570279
You need to log in before you can comment on or make changes to this bug.