This repository was archived by the owner on Jul 28, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Implement using web-streams-polyfill #3
Closed
Closed
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
8042b06
Implement using web-streams-polyfill
MattiasBuelens 40a80f0
Add WPT fixtures
MattiasBuelens 0247851
Hack idlharness to use worker interfaces when running in our JS shell
MattiasBuelens 770a58d
Add WPT runner
MattiasBuelens 35cb5db
Set up tests
MattiasBuelens File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev
Previous commit
Set up tests
- Loading branch information
commit 35cb5db1de17bbfb59b6beb66539c5a132214488
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| { | ||
| "piping/pipe-through.any.js": { | ||
| "fail": "Node does not perform a brand check for AbortSignal.prototype.aborted" | ||
| }, | ||
| "queuing-strategies-size-function-per-global.window.js": { | ||
| "skip": "test requires an <iframe>" | ||
| }, | ||
| "readable-byte-streams/bad-buffers-and-views.any.js": { | ||
| "skip": "Node does not have detached ArrayBuffers" | ||
| }, | ||
| "transferable/deserialize-error.window.js": { | ||
| "skip": "test requires an <iframe>" | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| 'use strict'; | ||
|
|
||
| // Flags: --expose-internals --expose_gc | ||
| // Note: | ||
| // - The --expose-internals flag is specific to Node.js core's | ||
| // internal error system and is unnecessary for external users. | ||
| // - The --expose_gc flag is specific to the WPT stream tests | ||
|
|
||
| const { WPTRunner } = require('../common/wpt'); | ||
| const runner = new WPTRunner('streams'); | ||
| const whatwgStreamPath = require.resolve('../../'); | ||
|
|
||
| runner.setFlags(['--expose-internals']); | ||
|
|
||
| runner.setInitScript(` | ||
| const { internalBinding } = require('internal/test/binding'); | ||
| const { DOMException } = internalBinding('messaging'); | ||
| global.DOMException = DOMException; | ||
|
|
||
| const whatwgStream = require(${JSON.stringify(whatwgStreamPath)}); | ||
| for (const [name, value] of Object.entries(whatwgStream)) { | ||
| Object.defineProperty(global, name, { | ||
| value, | ||
| writable: true, | ||
| configurable: true | ||
| }); | ||
| } | ||
| `); | ||
|
|
||
| runner.runJsTests(); |
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.
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 test checks whether passing a "bad"
AbortSignal(in particular ) causespipeThrough()to throw. The polyfill implements this by trying to retrieveAbortSignal.prototype.abortedand checking that it does not throw. WebIDL requires this attribute to perform a brand check, so a compliant implementation should throw aTypeErrorwhen this getter is run on such a "bad"AbortSignal.Unfortunately, Node's AbortSignal implementation does not throw an error when
AbortSignal.prototype.abortedis run such a signal. Instead, it will returnfalseand the polyfill will consider this to be a validAbortSignal.I'm not sure what we want to do here. Should we fix Node to perform a brand check in
get aborted(i.e. throw an error ifthis[kAborted]does not exist)? Or should we change how the polyfill does this check (although I'm not sure how)?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.
If I understand you correctly, I think the best course of action is to make an upstream change to Node.js core AbortSignal so that it aligns more with the spec.
Uh oh!
There was an error while loading. Please reload this page.
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.
On it! π
EDIT: Opened nodejs/node#37720.