René's URL Explorer Experiment


Title: streams: fixes for webstreams by MattiasBuelens · Pull Request #51168 · nodejs/node · GitHub

Open Graph Title: streams: fixes for webstreams by MattiasBuelens · Pull Request #51168 · nodejs/node

X Title: streams: fixes for webstreams by MattiasBuelens · Pull Request #51168 · nodejs/node

Description: Follow-up on #50126. Avoid PromiseResolve in ensureIsPromise. Web IDL requires this to always return a new Promise, whereas PromiseResolve may return the same Promise. This leads to a different timing, since new Promise() takes at least one microtask to resolve. See my previous comment. Fix handling sync errors from source cancel and sink abort. We were not correctly handling synchronously-thrown errors from these, which could leave the stream in an incorrect state. Check for promise only when constructing from source/sink/transformer. When constructing an internal stream, these algorithms must always return a promise, and we shouldn't wrap them again with ensureIsPromise(). Fix TeeReadableStream. This should construct an internal stream with internal callbacks using setupReadableStreamDefaultController, but it was incorrectly using user-land callbacks with setupReadableStreamDefaultControllerFromSource. Use internal streams for teeing a readable byte stream. This was using the user-land ReadableStream constructor, which is incorrect. The new implementation mirrors how we handle teeing "default" readable streams. Use internal streams for ReadableStream.from(). Again, this was incorrectly using the user-land ReadableStream constructor. Use internal streams for TransformStream. Same thing again. Add a helper to create the internal state of a ReadableStream and WritableStream. This code was duplicated a few times, so it made sense to extract a helper function. Remove an unused field in the ReadableStream internal state. This seemed like a copy-paste mistake: other classes (like ReadableStreamDefaultController) do have a stream field in their state, but ReadableStream shouldn't. Fix validating callbacks. Previously, we asserted that the given callbacks were indeed typeof callback === "function" by virtue of bluntly trying to call FunctionPrototypeBind on them. We no longer use FunctionPrototypeBind for this, so we need to manually call validateFunction for each callback. I've wrapped that in a createPromiseCallback helper. Update expectations for the Streams WPT tests.

Open Graph Description: Follow-up on #50126. Avoid PromiseResolve in ensureIsPromise. Web IDL requires this to always return a new Promise, whereas PromiseResolve may return the same Promise. This leads to a different ti...

X Description: Follow-up on #50126. Avoid PromiseResolve in ensureIsPromise. Web IDL requires this to always return a new Promise, whereas PromiseResolve may return the same Promise. This leads to a different ti...

Opengraph URL: https://github.com/nodejs/node/pull/51168

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.114.4

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:9af79fbc-4771-e2c9-6ba6-e3e9f15fd016
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idE552:180D24:8D18DC:B295AA:6B036080
html-safe-nonce35f0184ca83699bc0d97858acf5e6f58354c16f61eea4c012688e322c8b62d0e
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNTUyOjE4MEQyNDo4RDE4REM6QjI5NUFBOjZCMDM2MDgwIiwidmlzaXRvcl9pZCI6IjQ2NTA0MjMyNzA4NjMyMzMxNTIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac67a65281891209dff374ea89044873e4c5846f4c7affcda99726ea534ca52d73
hovercard-subject-tagpull_request:1646697446
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/nodejs/node/pull/51168/files
twitter:imagehttps://avatars.githubusercontent.com/u/649348?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/649348?s=400&v=4
og:image:altFollow-up on #50126. Avoid PromiseResolve in ensureIsPromise. Web IDL requires this to always return a new Promise, whereas PromiseResolve may return the same Promise. This leads to a different ti...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/nodejs/node git https://github.com/nodejs/node.git
octolytics-dimension-user_id9950313
octolytics-dimension-user_loginnodejs
octolytics-dimension-repository_id27193779
octolytics-dimension-repository_nwonodejs/node
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id27193779
octolytics-dimension-repository_network_root_nwonodejs/node
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release423dbb54c5e7bfecc838eb387c1435eb3d0e760d
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/nodejs/node/pull/51168/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fpull%2F51168%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fpull%2F51168%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=nodejs%2Fnode
Reloadhttps://github.com/nodejs/node/pull/51168/files
Reloadhttps://github.com/nodejs/node/pull/51168/files
Reloadhttps://github.com/nodejs/node/pull/51168/files
nodejshttps://github.com/nodejs
nodehttps://github.com/nodejs/node
Codehttps://github.com/nodejs/node
Issues639 (639)https://github.com/nodejs/node/issues
Pull requests667 (667)https://github.com/nodejs/node/pulls
Actionshttps://github.com/nodejs/node/actions
Projectshttps://github.com/nodejs/node/projects
Security and qualityhttps://github.com/nodejs/node/security
Insightshttps://github.com/nodejs/node/insights
Sign up for GitHub https://github.com/signup?return_to=%2Fnodejs%2Fnode%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fnodejs%2Fnode%2Fissues%2Fnew%2Fchoose
nodejs-github-bothttps://github.com/nodejs-github-bot
nodejs:mainhttps://github.com/nodejs/node/tree/main
Conversation 24 https://github.com/nodejs/node/pull/51168
Commits 20 https://github.com/nodejs/node/pull/51168/commits
Checks 0 https://github.com/nodejs/node/pull/51168/checks
Files changed https://github.com/nodejs/node/pull/51168/files
Please reload this pagehttps://github.com/nodejs/node/pull/51168/files
streams: fixes for webstreams https://github.com/nodejs/node/pull/51168/files#top
Show all changes 20 commits https://github.com/nodejs/node/pull/51168/files
cb4e020 stream: fix code style MattiasBuelens Dec 15, 2023 https://github.com/nodejs/node/pull/51168/commits/cb4e020de5b95647dcead2c503c7480b22cd3b83
46022b8 stream: avoid PromiseResolve in ensureIsPromise MattiasBuelens Dec 4, 2023 https://github.com/nodejs/node/pull/51168/commits/46022b87c83c89a406c5d62b675f58f763f9d560
62fc1e1 stream: fix handling sync errors from source cancel and sink abort MattiasBuelens Dec 4, 2023 https://github.com/nodejs/node/pull/51168/commits/62fc1e142f533bbf93c626ee8b46a90892c561db
19e8940 stream: check for promise only when constructing from source/sink/tra… MattiasBuelens Dec 4, 2023 https://github.com/nodejs/node/pull/51168/commits/19e8940b351a946fd2607160ce836052c2730d3c
ab33b45 stream: fix TeeReadableStream MattiasBuelens Dec 4, 2023 https://github.com/nodejs/node/pull/51168/commits/ab33b45ec7529120dbc798fe18e0aa87d9168998
463f49a stream: rename TeeReadableStream to InternalReadableStream MattiasBuelens Dec 4, 2023 https://github.com/nodejs/node/pull/51168/commits/463f49a4017be43259d561a135622aa49cb773a6
36324d5 stream: use internal ReadableStream for teeing byte streams MattiasBuelens Dec 4, 2023 https://github.com/nodejs/node/pull/51168/commits/36324d5d6cbc56c62c5675ecbab7bf8d9c7179ac
f0b1036 stream: use internal ReadableStream for ReadableStream.from() MattiasBuelens Dec 4, 2023 https://github.com/nodejs/node/pull/51168/commits/f0b10365df0d8d8659fa274cf71491bf085f9d2a
3846bfe stream: use internal streams for TransformStream MattiasBuelens Dec 4, 2023 https://github.com/nodejs/node/pull/51168/commits/3846bfed16a387bc62a077e6ffefb06112a00dff
0d45e6f stream: add helpers to create internal state MattiasBuelens Dec 15, 2023 https://github.com/nodejs/node/pull/51168/commits/0d45e6f3ff0ff723a16ffebb203ab2a87e6ab4db
5df4f2e stream: remove unused field in internal state MattiasBuelens Dec 15, 2023 https://github.com/nodejs/node/pull/51168/commits/5df4f2e2e2d6661d489b3edfabaa975709cadb3c
15b30ca stream: fix validating callbacks MattiasBuelens Dec 4, 2023 https://github.com/nodejs/node/pull/51168/commits/15b30ca6c923a26a1842255c18db12a5c57e18b5
0bd501f test: update expectations for streams wpt MattiasBuelens Dec 15, 2023 https://github.com/nodejs/node/pull/51168/commits/0bd501f541cf45ca4e447827fd77b345dd3003b6
112a717 stream: set __proto__ to null for internal state MattiasBuelens Dec 15, 2023 https://github.com/nodejs/node/pull/51168/commits/112a71713286a179b106f80d80759de9264c179c
b9a13b5 fixup! simplify ensureIsPromise MattiasBuelens Dec 15, 2023 https://github.com/nodejs/node/pull/51168/commits/b9a13b528e6330cd7d58e5bf9943909c2eb8a22a
162cfdc fixup! remove unused imports MattiasBuelens Dec 15, 2023 https://github.com/nodejs/node/pull/51168/commits/162cfdc0d99568962e045865603f1889c4cfd631
a889e2c fixup! whitespace MattiasBuelens Dec 15, 2023 https://github.com/nodejs/node/pull/51168/commits/a889e2c7eec96c4e9afaeaa78dbb5b12e5b8c74d
16a9cc7 fixup! code style MattiasBuelens Dec 15, 2023 https://github.com/nodejs/node/pull/51168/commits/16a9cc7113e0b768085c5a5bb3eb90fdea6330fa
11e6f94 fixup! fix timing of ensureIsPromise MattiasBuelens Dec 16, 2023 https://github.com/nodejs/node/pull/51168/commits/11e6f94bd6740e7f3880711edb3727508afe8ab5
0c0e3c1 fixup! rename to invokePromiseCallback MattiasBuelens Dec 16, 2023 https://github.com/nodejs/node/pull/51168/commits/0c0e3c184c600ca98937c7ca760e312179be89eb
Clear filters https://github.com/nodejs/node/pull/51168/files
Please reload this pagehttps://github.com/nodejs/node/pull/51168/files
Please reload this pagehttps://github.com/nodejs/node/pull/51168/files
readablestream.js https://github.com/nodejs/node/pull/51168/files#diff-a75b6b92eada0f88527acce4428a28471b39067fd0ddaab2fcf26cc022bded47
transformstream.js https://github.com/nodejs/node/pull/51168/files#diff-45cad4ef90ad1549d1ed2ed3f3b7bc9782fece8a0daf45f04e4ec93241693c38
util.js https://github.com/nodejs/node/pull/51168/files#diff-aaaca5a0d724d6d820d62d474521e10fb5c7d5714401cf3ac799040a30b5ede9
writablestream.js https://github.com/nodejs/node/pull/51168/files#diff-2495cd91c53a338612a351c4f9e08fdb506d0843f377e20a02641fbb2ac15c78
streams.json https://github.com/nodejs/node/pull/51168/files#diff-83220a2020a08d0cfe6d7eed96c98dbd75f0743a7e829e5e5e75a0525a6456b6
lib/internal/webstreams/readablestream.jshttps://github.com/nodejs/node/pull/51168/files#diff-a75b6b92eada0f88527acce4428a28471b39067fd0ddaab2fcf26cc022bded47
View file https://github.com/nodejs/node/blob/0c0e3c184c600ca98937c7ca760e312179be89eb/lib/internal/webstreams/readablestream.js
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/nodejs/node/pull/51168/{{ revealButtonHref }}
https://github.com/nodejs/node/pull/51168/files#diff-a75b6b92eada0f88527acce4428a28471b39067fd0ddaab2fcf26cc022bded47
https://github.com/nodejs/node/pull/51168/files#diff-a75b6b92eada0f88527acce4428a28471b39067fd0ddaab2fcf26cc022bded47
https://github.com/nodejs/node/pull/51168/files#diff-a75b6b92eada0f88527acce4428a28471b39067fd0ddaab2fcf26cc022bded47
https://github.com/nodejs/node/pull/51168/files#diff-a75b6b92eada0f88527acce4428a28471b39067fd0ddaab2fcf26cc022bded47
https://github.com/nodejs/node/pull/51168/files#diff-a75b6b92eada0f88527acce4428a28471b39067fd0ddaab2fcf26cc022bded47
https://github.com/nodejs/node/pull/51168/files#diff-a75b6b92eada0f88527acce4428a28471b39067fd0ddaab2fcf26cc022bded47
https://github.com/nodejs/node/pull/51168/files#diff-a75b6b92eada0f88527acce4428a28471b39067fd0ddaab2fcf26cc022bded47
https://github.com/nodejs/node/pull/51168/files#diff-a75b6b92eada0f88527acce4428a28471b39067fd0ddaab2fcf26cc022bded47
https://github.com/nodejs/node/pull/51168/files#diff-a75b6b92eada0f88527acce4428a28471b39067fd0ddaab2fcf26cc022bded47
https://github.com/nodejs/node/pull/51168/files#diff-a75b6b92eada0f88527acce4428a28471b39067fd0ddaab2fcf26cc022bded47
https://github.com/nodejs/node/pull/51168/files#diff-a75b6b92eada0f88527acce4428a28471b39067fd0ddaab2fcf26cc022bded47
https://github.com/nodejs/node/pull/51168/files#diff-a75b6b92eada0f88527acce4428a28471b39067fd0ddaab2fcf26cc022bded47
https://github.com/nodejs/node/pull/51168/files#diff-a75b6b92eada0f88527acce4428a28471b39067fd0ddaab2fcf26cc022bded47
https://github.com/nodejs/node/pull/51168/files#diff-a75b6b92eada0f88527acce4428a28471b39067fd0ddaab2fcf26cc022bded47
https://github.com/nodejs/node/pull/51168/files#diff-a75b6b92eada0f88527acce4428a28471b39067fd0ddaab2fcf26cc022bded47
https://github.com/nodejs/node/pull/51168/files#diff-a75b6b92eada0f88527acce4428a28471b39067fd0ddaab2fcf26cc022bded47
https://github.com/nodejs/node/pull/51168/files#diff-a75b6b92eada0f88527acce4428a28471b39067fd0ddaab2fcf26cc022bded47
https://github.com/nodejs/node/pull/51168/files#diff-a75b6b92eada0f88527acce4428a28471b39067fd0ddaab2fcf26cc022bded47
https://github.com/nodejs/node/pull/51168/files#diff-a75b6b92eada0f88527acce4428a28471b39067fd0ddaab2fcf26cc022bded47
https://github.com/nodejs/node/pull/51168/files#diff-a75b6b92eada0f88527acce4428a28471b39067fd0ddaab2fcf26cc022bded47
https://github.com/nodejs/node/pull/51168/files#diff-a75b6b92eada0f88527acce4428a28471b39067fd0ddaab2fcf26cc022bded47
https://github.com/nodejs/node/pull/51168/files#diff-a75b6b92eada0f88527acce4428a28471b39067fd0ddaab2fcf26cc022bded47
https://github.com/nodejs/node/pull/51168/files#diff-a75b6b92eada0f88527acce4428a28471b39067fd0ddaab2fcf26cc022bded47
https://github.com/nodejs/node/pull/51168/files#diff-a75b6b92eada0f88527acce4428a28471b39067fd0ddaab2fcf26cc022bded47
https://github.com/nodejs/node/pull/51168/files#diff-a75b6b92eada0f88527acce4428a28471b39067fd0ddaab2fcf26cc022bded47
https://github.com/nodejs/node/pull/51168/files#diff-a75b6b92eada0f88527acce4428a28471b39067fd0ddaab2fcf26cc022bded47
https://github.com/nodejs/node/pull/51168/files#diff-a75b6b92eada0f88527acce4428a28471b39067fd0ddaab2fcf26cc022bded47
https://github.com/nodejs/node/pull/51168/files#diff-a75b6b92eada0f88527acce4428a28471b39067fd0ddaab2fcf26cc022bded47
https://github.com/nodejs/node/pull/51168/files#diff-a75b6b92eada0f88527acce4428a28471b39067fd0ddaab2fcf26cc022bded47
https://github.com/nodejs/node/pull/51168/files#diff-a75b6b92eada0f88527acce4428a28471b39067fd0ddaab2fcf26cc022bded47
Please reload this pagehttps://github.com/nodejs/node/pull/51168/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlno-cache

Viewport: width=device-width


URLs of crawlers that visited me.