-
Notifications
You must be signed in to change notification settings - Fork 22
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
Update with DOM's abort reason #48
Conversation
There is a slight behavior change here. I don't this it is an issue but I'm curious if, considering all the specifications using |
I'm not aware of any issues that have arose regarding such changes so far where we reject with the abort reason. If you have any suggestions on how this could be better fixed though, I'm also open to that. |
I just wanted to add/update my answer to your question. The existing behavior will not be changed unless an |
The current specification language ignores the abort reason and always rejects the promise with an "AbortError" const controller = new AbortController();
controller.abort();
const idleDetector = new IdleDetector();
try {
await idleDetector.start({ signal: controller.signal });
} catch (error) {
console.log(error.name);
} |
Actually, if you look at the current DOM spec, |
Thank you for clarifying the current behavior. When I was last looking into this that behavior had not been specified or implemented in Chromium and so I frequently observed promises being rejected with |
This change updates the start() method and abort steps attached to the provided AbortSignal so that the reason provided to the AbortController is used to reject the Promise returned by start. The web-visible effect of this change is minimal because by default the abort reason is set to the same AbortError DOMException which was already being used. This corresponding specification change is: WICG/idle-detection#48 Bug: 1309731 Change-Id: I949aeb9d8f23d73a890af8be5da027c9588e812b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3546855 Reviewed-by: Nidhi Jaju <nidhijaju@chromium.org> Commit-Queue: Reilly Grant <reillyg@chromium.org> Cr-Commit-Position: refs/heads/main@{#984953}
This change updates the start() method and abort steps attached to the provided AbortSignal so that the reason provided to the AbortController is used to reject the Promise returned by start. The web-visible effect of this change is minimal because by default the abort reason is set to the same AbortError DOMException which was already being used. This corresponding specification change is: WICG/idle-detection#48 Bug: 1309731 Change-Id: I949aeb9d8f23d73a890af8be5da027c9588e812b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3546855 Reviewed-by: Nidhi Jaju <nidhijaju@chromium.org> Commit-Queue: Reilly Grant <reillyg@chromium.org> Cr-Commit-Position: refs/heads/main@{#984953} NOKEYCHECK=True GitOrigin-RevId: bf31b4283028e2c117a4a559feeceea61d5aeb61
whatwg/dom#1027 removed the "aborted flag" from DOM's AbortSignal.
This change updates the Idle Detection spec with the aborted predicate and rejecting promises with the signal's abort reason, instead of with a new "AbortError" DOMException.
Preview | Diff