-
Notifications
You must be signed in to change notification settings - Fork 500
fix ReadableStream.from() cancel behavior per WPT spec #5794
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
base: main
Are you sure you want to change the base?
Conversation
|
The generated output of |
770b7d6 to
b25e45c
Compare
|
The plan is to eventually add a default-on date for |
b25e45c to
6fd01d4
Compare
jasnell
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this should be addressed in the impl of return_(...) more generally rather than being specific to ReadableStream.from().
6fd01d4 to
59907b7
Compare
|
It would be good to update the generator tests directly in addition to just enabling the streams related wpts. |
59907b7 to
c041446
Compare
|
@jasnell please take a look, i've addressed your review |
Co-authored-by: James M Snell <jsnell@cloudflare.com>
Co-authored-by: James M Snell <jsnell@cloudflare.com>
Co-authored-by: James M Snell <jsnell@cloudflare.com>
Co-authored-by: James M Snell <jsnell@cloudflare.com>
Co-authored-by: James M Snell <jsnell@cloudflare.com>
Co-authored-by: James M Snell <jsnell@cloudflare.com>
Co-authored-by: James M Snell <jsnell@cloudflare.com>
| maybeThrow(tryGetGeneratorFunction<ThrowSignature, TypeWrapper>(js, object, "throw"_kj)) { | ||
| // Check if return property exists but isn't callable (per GetMethod spec) | ||
| returnExistsButNotCallable = | ||
| maybeReturn == kj::none && !object.get(js, "return"_kj).isNullOrUndefined(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit non-obvious. The variable is called ...NotCallable but it's being set with a call to isNullOrUndefined. This could use a bit more explanation to be clearer explaining that if return is not a function, maybeReturn will be kj::none and that the additional check here is just an indicator of whether the property actually existed or not (using a has(...) might be better if we keep this check to avoid the additional handle creation?).
Also, the fact that the return property is being looked up twice is rather unfortunate, especially given that the lookup could have side effects in some edge cases and subsequent accesses are not necessarily always guaranteed to yield the same value.
This change fixes 3 edge cases in ReadableStream.from cancel behavior.