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

stream: fix size function returned from QueuingStrategies #44867

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 8 additions & 5 deletions lib/internal/webstreams/queuingstrategies.js
Expand Up @@ -2,6 +2,7 @@

const {
ObjectDefineProperties,
ObjectDefineProperty,
SymbolToStringTag,
} = primordials;

Expand Down Expand Up @@ -47,11 +48,13 @@ const isCountQueuingStrategy =
* }} QueuingStrategy
*/

// eslint-disable-next-line func-name-matching,func-style
const byteSizeFunction = function size(chunk) { return chunk.byteLength; };

// eslint-disable-next-line func-name-matching,func-style
const countSizeFunction = function size() { return 1; };
const nameDescriptor = { __proto__: null, value: 'size' };
const byteSizeFunction = ObjectDefineProperty(
(chunk) => chunk.byteLength,
'name',
nameDescriptor
);
const countSizeFunction = ObjectDefineProperty(() => 1, 'name', nameDescriptor);

/**
* @type {QueuingStrategy}
Expand Down
10 changes: 0 additions & 10 deletions test/wpt/status/streams.json
Expand Up @@ -2,16 +2,6 @@
"queuing-strategies-size-function-per-global.window.js": {
"skip": "Browser-specific test"
},
"queuing-strategies.any.js": {
"fail": {
"expected": [
"CountQueuingStrategy: size should not have a prototype property",
"ByteLengthQueuingStrategy: size should not have a prototype property",
"CountQueuingStrategy: size should not be a constructor",
"ByteLengthQueuingStrategy: size should not be a constructor"
]
}
},
"readable-streams/cross-realm-crash.window.js": {
"skip": "Browser-specific test"
},
Expand Down