GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Test native web streams in modern browsers by twiss · Pull Request #1934 · openpgpjs/openpgpjs

Conversation

@twiss

@twiss twiss commented Nov 26, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Test native web streams where available; only load the web streams polyfill when necessary.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@twiss
twiss force-pushed the test-native-web-streams branch from a26a4ad to 500568a Compare November 26, 2025 20:39
larabr
larabr reviewed Nov 27, 2025
View reviewed changes
Comment thread test/unittests.js Outdated
return detectNodeWebStreams() || import('web-streams-polyfill/polyfill');
globalThis.loadStreamsPolyfill = async function() {
if (!globalThis.TransformStream) {
Object.assign(globalThis, await import('web-streams-polyfill'));

@larabr larabr Nov 27, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

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.

Why the assignment? (Instead of just importing the polyfill)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@twiss twiss Nov 27, 2025

Copy link
Copy Markdown
Member Author

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.

It doesn't work in the bundled browser tests, because the polyfill is bundled together with the tests, and overwrites the globals immediately (unconditionally), rather than only when await import is called

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

larabr reacted with confused emoji
All reactions
  • 😕 1 reaction
@twiss
twiss force-pushed the test-native-web-streams branch from 71e4761 to 7d6b63c Compare December 2, 2025 14:16
larabr
larabr reviewed Dec 3, 2025
View reviewed changes
Comment thread test/initOpenpgp.js Outdated
openpgp.config.s2kIterationCountByte = 0;

if (!globalThis.TransformStream) {
Object.assign(globalThis, await import('web-streams-polyfill'));

@larabr larabr Dec 3, 2025

Copy link
Copy Markdown
Collaborator

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.

The top-level await doesn't work in Safari 14.
But Since TransformsStreams are supported from Safari 14.1 and iOS Safari 14.5, meaning most platforms we will test on won't need it, I think we can just not await it (void import().then(...)), and eventually drop it.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@twiss twiss Dec 3, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

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.

Ah, right.
Since it's bundled anyway, we can also just do a top-level import and assign it conditionally rather than importing conditionally. This only hurts the Node tests performance a tiny bit but shouldn't really be significant.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
twiss added 2 commits December 3, 2025 16:48
@twiss
Conditionally load web streams polyfill in tests
4108df1
Only load the web streams polyfill if needed.
@twiss
Centralize loading the web stream tools polyfill
25403cc
@twiss
twiss force-pushed the test-native-web-streams branch from 7d6b63c to 25403cc Compare December 3, 2025 15:48
larabr
larabr reviewed Dec 4, 2025
View reviewed changes
Comment thread test/initOpenpgp.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

@larabr
Clarify webStreamsPonyfill import
564e61c
larabr
larabr approved these changes Dec 4, 2025
View reviewed changes
@twiss
Ignore unhandled rejections in tests on Mobile Safari
d5420be
Mobile Safari, like Desktop Safari, triggers `unhandledrejection` events
for handled Promise rejections. Ignore them in the browser tests.
@larabr
larabr merged commit 6ab6b9c into openpgpjs:main Dec 5, 2025
@twiss
twiss deleted the test-native-web-streams branch December 5, 2025 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@larabr larabr larabr approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@twiss @larabr
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.