Promise then-handlers can still be executed while the debugger is paused.
Categories
(DevTools :: Debugger, defect, P1)
Tracking
(firefox67 fixed)
| Tracking | Status | |
|---|---|---|
| firefox67 | --- | fixed |
People
(Reporter: bdahl, Assigned: jimb)
References
(Blocks 1 open bug)
Details
(Whiteboard: [devtools-platform])
Attachments
(10 files, 13 obsolete files)
|
436 bytes,
text/html
|
Details | |
|
2.33 KB,
patch
|
Details | Diff | Splinter Review | |
|
47 bytes,
text/x-phabricator-request
|
jimb
:
checkin+
|
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 |
| Reporter | ||
Updated•10 years ago
|
Comment 1•10 years ago
|
||
| Reporter | ||
Comment 2•10 years ago
|
||
| Reporter | ||
Comment 3•10 years ago
|
||
| Reporter | ||
Updated•10 years ago
|
Updated•10 years ago
|
Updated•10 years ago
|
Comment 4•10 years ago
|
||
Updated•10 years ago
|
Comment 6•10 years ago
|
||
Comment 7•10 years ago
|
||
Updated•9 years ago
|
Comment 8•8 years ago
|
||
Updated•7 years ago
|
| Assignee | ||
Comment 10•7 years ago
|
||
| Assignee | ||
Comment 11•7 years ago
|
||
| Assignee | ||
Comment 12•7 years ago
|
||
| Assignee | ||
Comment 13•7 years ago
|
||
| Assignee | ||
Comment 14•7 years ago
|
||
| Assignee | ||
Comment 15•7 years ago
|
||
| Assignee | ||
Comment 16•7 years ago
|
||
Comment 17•7 years ago
|
||
| Assignee | ||
Comment 18•7 years ago
|
||
| Assignee | ||
Comment 19•7 years ago
|
||
| Assignee | ||
Comment 20•7 years ago
|
||
| Assignee | ||
Comment 21•7 years ago
|
||
| Assignee | ||
Comment 22•7 years ago
|
||
| Assignee | ||
Comment 23•7 years ago
|
||
| Assignee | ||
Comment 24•7 years ago
|
||
| Assignee | ||
Comment 25•7 years ago
|
||
| Assignee | ||
Comment 26•7 years ago
|
||
| Assignee | ||
Updated•7 years ago
|
| Assignee | ||
Updated•7 years ago
|
| Assignee | ||
Updated•7 years ago
|
| Assignee | ||
Comment 27•7 years ago
|
||
| Assignee | ||
Updated•7 years ago
|
Comment 28•7 years ago
|
||
| Assignee | ||
Comment 29•7 years ago
|
||
Comment 30•7 years ago
|
||
| bugherder | ||
Comment 31•7 years ago
|
||
Comment 32•7 years ago
|
||
| bugherder | ||
| Assignee | ||
Comment 33•7 years ago
|
||
| Assignee | ||
Comment 34•7 years ago
|
||
| Assignee | ||
Comment 35•7 years ago
|
||
| Assignee | ||
Comment 36•7 years ago
|
||
| Assignee | ||
Comment 39•7 years ago
|
||
Revised. This covers all Debugger hooks.
| Assignee | ||
Updated•7 years ago
|
| Assignee | ||
Comment 40•7 years ago
|
||
This includes an implementation of JS::JobQueue for the browser as well as the shell. Not really tested.
| Assignee | ||
Comment 41•7 years ago
|
||
| Assignee | ||
Comment 42•7 years ago
|
||
While the behavior of ECMAScript Promises and their associated job queue is
covered by the ECMAScript standard, the HTML specification amends that with
additional behavior the web platform requires. To support this, SpiderMonkey
provides hooks the embedding can set to replace SpiderMonkey's queue with its
own implementation.
At present, these hooks are C-style function-pointer-and-void-pointer pairs,
which are awkward to handle and mistake-prone, as passing a function the wrong
void* is not a type error. Later patches in this series must add new hooks,
making a bad situation worse.
A C++ abstract base class is a well-typed alternative. This introduces a new
JS::JobQueue abstract class, and adapts SpiderMonkey's internal job queue and
Gecko's customization to use it. GetIncumbentGlobalCallback and
EnqueuePromiseJobCallback become virtual methods.
Within SpiderMonkey, the patch gathers the various fields of JSContext that
implement the internal queue into their own type, js::InternalJobQueue. Various
jsfriendapi functions become veneers for calls to methods specific to the
derived class. The InternalJobQueue type itself remains private to SpiderMonkey,
as it uses types like TraceableFifo, derived from Fifo, that are not part of
SpiderMonkey's public API.
Within Gecko, CycleCollectedJSContext acquires JS::JobQueue as a private base
class, and a few static methods are cleaned up nicely.
There are a few other hooks defined in js/public/Promise.h that might make sense
to turn into virtual methods on JobQueue. For example,
DispatchToEventLoopCallback, used for resolving promises of results from
off-main-thread tasks, is probably necessarily connected to the JobQueue
implementation in use, so it might not be sensible to set one without the other.
But it was left unchanged to reduce this patch's size.
Depends on D17543
| Assignee | ||
Comment 43•7 years ago
|
||
Define a new RAII class, AutoSaveJobQueue, to save and restore the current
ECMAScript job queue, to protect the debuggee's job queue from activity that
occurs in debugger callbacks. Add a new method to the JS::JobQueue abstract base
class, saveJobQueue, to support AutoSaveJobQueue. Comments on AutoSaveJobQueue
provide details.
Implement saveJobQueue for SpiderMonkey's internal job queue and for Gecko's job
queue in CycleCollectedJSContext.
Depends on D17544
| Assignee | ||
Comment 44•7 years ago
|
||
Modify the Debugger API implementation to ensure that debugger code's promise
activity (resolving promises; running reaction jobs) cannot interfere with the
debuggee's.
Specifically, ensure that there is an AutoSaveJobQueue in scope at every site in
the Debugger implementation that might invoke a debugger hook function. This
saves the debuggee's job queue, emplaces a fresh empty queue, lets the hooks
run, drains the queue, and then restores the debuggee's original queue.
Since we must already mark sites that could invoke hooks with
EnterDebuggeeNoExecute, we ensure our job queue protection coverage is
complete statically by having EnterDebuggeeNoExecute's constructor require a
reference to an AutoSaveJobQueue.
Depends on D17546
| Assignee | ||
Comment 45•7 years ago
|
||
Depends on D17547
| Assignee | ||
Updated•7 years ago
|
| Assignee | ||
Updated•7 years ago
|
| Assignee | ||
Updated•7 years ago
|
| Assignee | ||
Updated•7 years ago
|
| Assignee | ||
Updated•7 years ago
|
| Assignee | ||
Comment 46•7 years ago
|
||
Adding job queue drains to Debugger hooks runs afoul of some OffThreadPromiseTask assumptions. Filed bug 1522945 for that, with patches already attached.
Updated•7 years ago
|
Updated•7 years ago
|
Comment 47•7 years ago
|
||
Comment 48•7 years ago
|
||
| bugherder | ||
| Assignee | ||
Comment 49•7 years ago
|
||
Evaluation of debuggee code should always begin with an empty microtask queue.
In xpcshell tests, this is not guaranteed, as it is in the web platform. This
patch changes those devtools server xpcshell tests that break this rule in a
detectable way to run the debuggee code as a separate HTML task.
In an actual browser environment, debuggee JavaScript runs as an HTML task.
Since HTML requires a microtask checkpoint at the end of each task, this means
that a debuggee task begins execution with an empty microtask queue, free of
microtasks from other tabs or the browser machinery itself. Hence, while the
debugger is pausing debuggee code, it is safe for it to save the debuggee's
microtask queue, so that those jobs do not make progress. (Which is fortunate,
because it must do so, lest the debuggee's microtasks run during the pause!)
In an xpcshell test, however, there is no guarantee that debuggee code begins
execution with a fresh microtask queue: the test may call eval or
evalInSandbox at any time. If such an evaluation hits a breakpoint, debugger
statement, etc. that invokes a Debugger hook, supervisory microtasks from the
test harness code may be set aside along with the debuggee's microtasks. If the
hook code then blocks waiting for those microtasks to run, the test will hang.
Updated•7 years ago
|
Updated•7 years ago
|
Updated•7 years ago
|
| Assignee | ||
Comment 50•7 years ago
|
||
Comment 51•7 years ago
|
||
(Phabricator is hopeless for any discussions.)
What do devtools in other browsers do regarding microtasks when debugger is used?
Updated•7 years ago
|
Updated•7 years ago
|
Comment 52•7 years ago
|
||
Comment 53•7 years ago
|
||
Comment 54•7 years ago
|
||
Comment 55•7 years ago
|
||
Comment 56•7 years ago
|
||
Comment 57•7 years ago
|
||
| bugherder | ||
| Assignee | ||
Updated•7 years ago
|
Updated•7 years ago
|
Description
•