[jsdbg2] Debugger cannot follow cross-compartment promise resolutions
Categories
(Core :: JavaScript Engine, enhancement, P2)
Tracking
()
People
(Reporter: jimb, Unassigned)
References
(Blocks 1 open bug)
Details
If we resolve a promise P1 to another promise P2 (such that resolving P2 resolves P1 in the same way), and the two promises are in different compartments, the Debugger API does not provide enough information to recover P1 from P2's reaction records.
I think this means that Debugger will not be able to include an async function's awaiter in the stack trace if the promise being awaited is in a different compartment than the the awaiting function.
Cross-compartment promise resolution as described above produces a reaction record like that used for a call to then or catch, with internal resolve and reject functions with extended slots referring to P1. Debugger.Object.prototype.getReactionRecords lets us recover the functions, but we have no way to recognize these internal functions and retrieve their internal slots.
Possible solutions:
-
Debuggercould acquire methods and accessors for recognizing such functions and retrieving the value of their internal slots. -
PromiseObject::forEachReactionRecordcould recognize such internal functions, retrieve the promise they will resolve, and present it to thePromiseReactionRecordBuildercallback object directly. ThenD.O.p.getReactionRecordscould include it as an additional property of the object used to represent the reaction record.
Updated•6 years ago
|
| Reporter | ||
Comment 1•6 years ago
|
||
I'm not sure how often these situations will arise in practice. It seems like, with fission, each process should be same-origin, and same-origin realms can share a compartment now, so compartments should only serve to separate chrome and content. And I don't see when chrome is going to attach reactions to content promises, or vice versa.
But I am not at all sure about this.
Updated•5 years ago
|
Updated•3 years ago
|
Description
•