13:35
<littledan>
Andreu, Ms2ger and I learned today in a call with Yoav that they wanted to move task attribution from the context to the isolate. So this shouldn't form a barrier to implementing task attribution on top of AsyncContext.
13:36
<littledan>
Overall I think the call was excellent--we were able to talk through a number of core issues, not necessarily coming to any conclusion, but definitely a deeper shared understanding.
13:36
<littledan>
Thanks for arranging this, Andreu!
13:36
<Andreu Botella>
sure!
13:36
<littledan>
(did my comments in the call seem reasonable to you? Is there anything you'd disagree with?)
13:37
<Yoav Weiss>
https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/messaging/message_port.cc;l=322;drc=d76bbe1456ab0713d884cc51742ba565fb808cf8;bpv=1;bpt=1
13:38
<littledan>
Yoav Weiss: Is "isolated world" there referring to extensions?
13:38
<Yoav Weiss>
yeah
13:39
<Andreu Botella>
Everything sounded reasonable, yeah.
15:54
<Andreu Botella>
let reject;
new Promise((_, rejectFn) => {
  reject = rejectFn;
});

window.onunhandledrejection = (evt) => {
    // Creates a new unhandled promise based on `promise`,
    // which will cause this listener to be called (again and again).
    evt.promise.then();
};

reject();
15:54
<Andreu Botella>
do you expect the unhandledrejection listener to be always called with the same snapshot?
15:59
<Andreu Botella>
(assuming no other promises)
16:10
<Andreu Botella>
I think if we want this, and we also want promise.then() with no arguments to not catch the current snapshot, we would need to add a new slot to promises
16:13
<Mathieu Hofman>
Out of curiosity, what is the behavior when doing new Promise(resolve => resolve(evt.promise))? Is it any different than evt.promise.then() ?
16:17
<Andreu Botella>
it would behave the same, I think
16:21
<Mathieu Hofman>

Asking because the former is roughly what internally happens with an async function's return value. In those case, do we want the event handler to run in the context of the initial rejection, or in the context of the call to the async function ?

const ctx = new AsyncContext()

window.onunhandledrejection = (evt) => {
    ctx.get(); // ??
};

const wrap = async (p) => p;

let reject;
ctx.run(1, () => wrap(new Promise((_, rejectFn) => {
  reject = rejectFn;
}));

ctx.run(2, reject);