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

feat(ext/web): add AbortSignal.any() #21087

Merged
merged 14 commits into from
Nov 13, 2023

Conversation

petamoriken
Copy link
Contributor

@petamoriken petamoriken commented Nov 4, 2023

Fixes #18944
Fixes #16487

@petamoriken
Copy link
Contributor Author

@crowlKats please take a look

@crowlKats crowlKats self-requested a review November 4, 2023 15:07
ext/web/03_abort_signal.js Show resolved Hide resolved
}

[remove](algorithm) {
this[abortAlgos] && SetPrototypeDelete(this[abortAlgos], algorithm);
}

constructor(key = null) {
if (key != illegalConstructorKey) {
if (key !== illegalConstructorKey) {
throw new TypeError("Illegal constructor.");
}
super();
this[abortReason] = undefined;
this[abortAlgos] = null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is currently supposed to be an empty set on construction, see https://dom.spec.whatwg.org/#abortsignal-abort-algorithms. That should also cascade on a bunch of "null-check plus re-initialization" which may be redundant now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was done for performance reasons in #12165, though not sure how ideal this is. I wouldn't worry about this though as it works as expected.

throw new TypeError("Illegal constructor.");
}
super();
this[abortReason] = undefined;
this[abortAlgos] = null;
this[dependent] = false;
this[sourceSignals] = null;
this[dependentSignals] = null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think in the specs these two are directly constructed as empty sets.

@lucab
Copy link
Contributor

lucab commented Nov 6, 2023

@petamoriken thanks for the PR! I had some local unfinished code related to this, so I left some drive-by comments in review.

I'll leave the final review to @crowlKats, as he's overall more knowledgeable about this.

@bartlomieju
Copy link
Member

@crowlKats please review

Copy link
Member

@crowlKats crowlKats left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks good!

@crowlKats crowlKats merged commit 39223f7 into denoland:main Nov 13, 2023
13 checks passed
@petamoriken petamoriken deleted the feat/abortsignal-any branch November 13, 2023 21:55
kt3k pushed a commit that referenced this pull request Nov 17, 2023
zifeo pushed a commit to metatypedev/deno that referenced this pull request Nov 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement AbortSignal.any() fetch + signal memory leak
4 participants