Bulk replace most ContentTask.spawn calls with SpecialPowers.spawn calls
Categories
(Testing :: Mochitest, task, P2)
Tracking
(Fission Milestone:M4.1, firefox73 fixed)
Tracking | Status | |
---|---|---|
firefox73 | --- | fixed |
People
(Reporter: kmag, Assigned: kmag)
References
(Blocks 2 open bugs)
Details
Attachments
(18 files)
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review |
SpecialPowers.spawn has a more robust implementation than ContentTask.spawn, and is significantly more broadly available and Fission-compatible. Aside from making Fissionification easier, converting existing callers to use SpecialPowers.spawn should help alleviate some of the confusion of having two relatively-similar-but-slightly-different APIs, where it may not be obvious to everyone which one should be used, and when.
That said, there are still cases where have ContentTask.spawn calls which can't be converted to SpecialPowers.spawn. The main difference at this point is the lifetime of the task, where ContentTask.spawn is bound to the lifetime of a frameloader, and may persist across same-process navigations, and SpecialPowers.spawn is bound to the lifetime of a window global, and may not. In general, those kinds of tasks should be considered deprecated, and should be rewritten in such a way as to be agnostic to whether a navigation maintains the same docShell/process as the previous document. But that is a nontrivial amount of work.
Some other callers also depend on other esoterica of ContentTask, like the fact that it has different timing constraints than SpecialPowers.spawn (which always bounces tasks off of a parent actor before sending them to a child), which this bug doesn't intend to address immediately.
Assignee | ||
Comment 1•5 years ago
|
||
ContentTask.spawn supports some common global mochitest assertion methods as
aliases for corresponding Assert methods, along with espected-fail todo
variants, and the info
method for logging messages without triggering
assertions. The easiest way to mass-convert existing callers is to just add
support for these to SpecialPowers.spawn, which this patch does.
Assignee | ||
Comment 2•5 years ago
|
||
Some tests currently use an initial ContentTask.spawn
call to import certain
modules into the frame script global that subsequent tasks will run in. Since
each SpecialPowers.spawn
task runs in its own sandbox, this method doesn't
work for them.
This patch adds a helper, SpecialPowers.addTaskImport
, which allows similar
functionality by automatically importing the given module for any task spawned
by the SpecialPowers
instance it was called on.
Assignee | ||
Comment 3•5 years ago
|
||
A number of additional globals are available to ContentTask.spawn tasks
compared to SpecialPowers.spawn tasks. Most of these are available by
accident, as a side-effect of running in a shared frame script global, or
being evaled in the context of the content-task.js frame script, but several
of them are pretty broadly useful, or difficult to obtain from a Sandbox
environment without reaching into arbitrary nearby globals.
This patch adds some of the more useful ones to the default task environment.
Assignee | ||
Comment 4•5 years ago
|
||
This is somewhat unrelated, but I stumbled across it when writing part 1a, and
it annoyed me.
Assignee | ||
Comment 5•5 years ago
|
||
Assignee | ||
Comment 6•5 years ago
|
||
This patch updates the existing ContentTask.spawn rule to do similar things
for SpecialPowers.spawn calls, only with a slightly different set of globals.
Assignee | ||
Comment 7•5 years ago
|
||
This is generally pretty straightforward, and rewrites nearly all calls. It
skips the ones that it can detect using frame script globals like
sendAsyncMessage
, though.
Assignee | ||
Comment 8•5 years ago
|
||
Assignee | ||
Comment 9•5 years ago
|
||
Assignee | ||
Comment 10•5 years ago
|
||
Assignee | ||
Comment 11•5 years ago
|
||
Assignee | ||
Comment 12•5 years ago
|
||
Assignee | ||
Comment 13•5 years ago
|
||
Assignee | ||
Comment 14•5 years ago
|
||
Assignee | ||
Comment 15•5 years ago
|
||
Updated•5 years ago
|
Updated•5 years ago
|
Comment 16•5 years ago
|
||
Assignee | ||
Comment 17•5 years ago
|
||
Comment 18•5 years ago
|
||
Assignee | ||
Comment 19•5 years ago
|
||
Comment 20•5 years ago
|
||
Assignee | ||
Comment 21•5 years ago
|
||
Comment 22•5 years ago
|
||
Backed out 17 changesets (Bug 1596918) for multiple browser-chrome and dev-tools failures.
Failure logs:
https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=280087351&repo=autoland&lineNumber=3082
https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=280087408&repo=autoland&lineNumber=4247
https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=280087377&repo=autoland&lineNumber=3215
https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=280087419&repo=autoland&lineNumber=1845
https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=280087404&repo=autoland&lineNumber=12069
https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=280087394&repo=autoland&lineNumber=2569
https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=280087694&repo=autoland&lineNumber=4931
Comment 23•5 years ago
|
||
Comment 24•5 years ago
|
||
Comment 25•5 years ago
|
||
Backed out 9 changesets (Bug 1596918) for causing multiple browser-chrome failures
Failure logs: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=280141245&repo=autoland&lineNumber=1555
https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=280140721&repo=autoland&lineNumber=13094
https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=280140321&repo=autoland&lineNumber=9215
Backout: https://hg.mozilla.org/integration/autoland/rev/60951c2dc41ec463d0620c11b39c50352d23be13
Assignee | ||
Updated•5 years ago
|
Comment 26•5 years ago
|
||
Comment 27•5 years ago
|
||
Backed out 9 changesets (Bug 1596918) for causing mochitest permafailures in toolkit/content/tests/chrome/test_findbar_events.xhtml CLOSED TREE
https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=280594285&repo=autoland&lineNumber=6791
Comment 28•5 years ago
|
||
Comment 29•5 years ago
|
||
There are also ss failures:
https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=280602804&repo=autoland&lineNumber=2793
Assignee | ||
Updated•5 years ago
|
Comment 30•5 years ago
|
||
Comment 31•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/7d76a0d3d402
https://hg.mozilla.org/mozilla-central/rev/603e887cc955
https://hg.mozilla.org/mozilla-central/rev/5a5f2c1fdb6c
https://hg.mozilla.org/mozilla-central/rev/76d79937e9e7
https://hg.mozilla.org/mozilla-central/rev/aac9e14b1066
https://hg.mozilla.org/mozilla-central/rev/dee884fd1516
https://hg.mozilla.org/mozilla-central/rev/c460e495ae11
https://hg.mozilla.org/mozilla-central/rev/d853d724b0d4
https://hg.mozilla.org/mozilla-central/rev/25f2c3149eed
Description
•