Skip to content
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

Accept polyfilled abort signals #36

Merged
merged 3 commits into from
Oct 7, 2019

Conversation

MattiasBuelens
Copy link
Owner

Currently, the polyfill performs a brand check using the global AbortSignal.prototype.aborted (source). This makes it difficult to use the polyfill in a non-DOM environment where there is no global AbortSignal, and where AbortController and AbortSignal themselves need to be polyfilled.

This PR loosens the check, allowing any object with a boolean aborted property to be accepted as a valid AbortSignal. This is a small deviation from the specification, but makes the polyfill usable in more environments (e.g. Node).

In the future, if the polyfill is able to use the native streams implementation (#20), we must ensure that any polyfilled AbortSignal is first converted to a native AbortSignal before calling the native pipeTo/pipeThrough implementation.

@MattiasBuelens
Copy link
Owner Author

We still create a DOMException here, which also does not exist in non-DOM environments. I'm not sure if/how we want to polyfill that. 😕

@MattiasBuelens MattiasBuelens merged commit 3eb6ee9 into master Oct 7, 2019
@MattiasBuelens MattiasBuelens deleted the accept-abort-signal-polyfill branch October 7, 2019 20:28
@MattiasBuelens MattiasBuelens added this to the v2.0.5 milestone Oct 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant