Closed Bug 1592415 Opened 5 years ago Closed 5 years ago

[jsdbg2] Debugger.Frames for async calls should provide promise of return value

Categories

(Core :: JavaScript Engine, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla73
Tracking Status
firefox73 --- fixed

People

(Reporter: jimb, Assigned: loganfsmyth)

References

Details

Attachments

(1 file)

Given a Debugger.Frame object referring to an asynchronous function call, the Debugger API currently provides no way to obtain the promise of the call's return value that was originally returned to the caller of the async function.

Being able to obtain a Debugger.Object referring to the promise of an async call's resolution would be one step in allowing the devtools server to include awaiter->awaitee links in stack traces.

A Debugger.Frame for an async call should have an accessor that consults its GeneratorInfo object, and if the underlying generator is an AsyncFunctionGeneratorObject, returns a Debugger.Object referring to the promise in its PROMISE_SLOT. That slot should always hold a PromiseObject.

We'll also need a way to get from a promise to Debugger.Frames for async calls awaiting the promise's resolution, but that's a separate bug.

Component: Debugger → JavaScript Engine
Product: DevTools → Core
Blocks: 1592430
Priority: -- → P3
Blocks: dbg-72
Assignee: nobody → loganfsmyth
Status: NEW → ASSIGNED

If you're in an async generator, do we want to also allow frame.promise to be the promise that will be resolved by the next yield? Seems like that would be nice.

(In reply to Logan Smyth [:loganfsmyth] from comment #1)

If you're in an async generator, do we want to also allow frame.promise to be the promise that will be resolved by the next yield? Seems like that would be nice.

Yes, definitely. That would mean that, if you've got a for await loop consuming the values from the generator, that could appear as the awaiter of the generator when it is awaiting something else, right?

Attachment #9110184 - Attachment description: Bug 1592415 - Create Debugger.Frame.prototype.promise for async fns. r=jimb! → Bug 1592415 - Create Debugger.Frame.prototype.pendingAsyncPromise for async fns. r=jimb!
Attachment #9110184 - Attachment description: Bug 1592415 - Create Debugger.Frame.prototype.pendingAsyncPromise for async fns. r=jimb! → Bug 1592415 - Create Debugger.Frame.prototype.asyncPromise for async fns/gens. r=jimb!
Pushed by loganfsmyth@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/d5d4fb7e0941
Create Debugger.Frame.prototype.asyncPromise for async fns/gens. r=jimb
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla73
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: