Returning promise from C++ automatically blocks microtasks on Gecko but not on Blink?
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
People
(Reporter: saschanaz, Unassigned)
References
Details
(Keywords: parity-chrome, parity-safari, Whiteboard: webcompat:risk-moderate )
Attachments
(1 file)
|
1.51 KB,
text/html
|
Details |
During investigation in bug 1819086 I found that somehow returning Promises from C++ can automatically trigger nsAutoMicroTask via PromiseBinding (then again via CallbackObject::CallSetup). Is this a Gecko quirk or is it in any spec?
| Reporter | ||
Comment 1•2 years ago
|
||
Both Blink and WebKit does run microtask in the above code (logs "shouldn't have run microtasks yet" ... because the code is copied from bug 1612308), while Gecko logs "Did not run microtask".
Hi Peter, is this something you can answer? Thanks!
| Reporter | ||
Comment 2•2 years ago
|
||
(For now I marked it as defect as it's a web-visible difference, but not sure it really is a defect)
Comment 3•2 years ago
|
||
What does "blocks" mean in this context?
| Reporter | ||
Comment 4•2 years ago
|
||
"Prevents microtask runs (but let it run later, of course)" it means.
Comment 5•2 years ago
|
||
The testcase talks about fetch., but I don't see any fetch usage.
Anyhow, JS shouldn't be able to trigger microtask checkpoint in middle of JS execution.
Microtasks run at the end of the outermost JS execution or at the end of the innermost task (if there is no JS running)
| Reporter | ||
Comment 6•2 years ago
|
||
That's my fault and those are just copied from the testcase in bug 1612308. 😬
Anyhow, JS shouldn't be able to trigger microtask checkpoint in middle of JS execution.
Practically yes but I don't think that's what others do here, what spec actually forces it?
Comment 7•2 years ago
|
||
| Reporter | ||
Comment 8•2 years ago
|
||
That's supposed to be called when running script, but in the repro code permissions.query() does not call any script, right?
Comment 9•2 years ago
|
||
It does call a script, the then callback, no? So there is script on the stack and microtask checkpoint shouldn't happen.
| Reporter | ||
Comment 10•2 years ago
|
||
(In reply to Olli Pettay [:smaug][bugs@pettay.fi] from comment #9)
It does call a script, the then callback, no?
Not sure I understand, yes it does call a script but that's because of .then quirk of promise resolution, isn't it? Is there anything left for the IDL to do at that point?
| Reporter | ||
Comment 11•1 year ago
|
||
The behavior changed here to match Chrome on 2023-07-20 but not sure what fixed it. The range: https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=898b3ffbdca34afc5fd0304f07f769e3d243265e&tochange=0bc898fe076442e9a552e9918f1b50ece1c87859
Description
•