-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Aborting tasks with async hops #60
Comments
Isn't this about Promise chaining. Run the following in a browser's web console and check how the outer Promise is fullfilled:
But I could very well miss still something. |
A bit modified version which rejects the inner but resolves the outer that is close to the testcase and p is rejected because of 6.2 |
I was thinking this should be covered by promise chaining at first too, but I think it's different -- in the test case we're rejecting the outer after it was resolved with the inner promise, something like:
(controller.abort == rejectOuter). ^^ that gets stuck at for me in FF and Chrome, which makes sense because the outer is dependent on inner. I believe this would be the scenario if the abort steps in 6.2 runs and |
ah, I see. But the promise isn't yet resolved (because of the inner), yet does Chrome in the test get resolved p... because the function eventually returns. (I'll need to play with this a bit more tomorrow :) ) |
I filed a Gecko bug about this https://bugzilla.mozilla.org/show_bug.cgi?id=1767087 |
This was mis-optimization in SpiderMonkey, and Resolving promise should set Then, SpiderMonkey doesn't create Promise Resolve Function and Promise Reject Function if they're known not to be exposed to user JS code, but resolve/reject is done only from C++ code internally or with public APIs, Fixing in bug 1767087. |
Fixed by web-platform-tests/wpt@146851f |
Thanks @arai-a and @smaug----! Thinking about the behavior a bit more, the current behavior here seems reasonable? To abort a running async task (e.g. in response to user input), the task's promise would need to be rejected along with the rest of the task. Using |
At least we could close this issue, since this became a debugging session :) |
FF folks recently added test cases (thanks!) for aborting ongoing tasks from within the task itself. The second test fails in Chromium, which is essentially boils down to:
In Chromium,
p
is not rejected because we resolve thepostTask
promise with the promise returned by the async function, so when the controller aborts it's a no-op. I believe this matches the current spec text (5.1 of the schedule a task to invoke a callback algorithm) since there we resolve the promise with the result of invoking a callback, which should return a promise in the async function case.But, I think the behavior of the test makes more sense and that we should update the spec to match. I think that would involve "awaiting" the result of invoking the callback and resolving the promise result with that value (or propagating the error). @sefeng211 is that what you did in the FF implementation?
The text was updated successfully, but these errors were encountered: