Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3fdf6cf

Browse filesBrowse files
authored
stream: fix size function returned from QueuingStrategies
The `size` function returned from the `size` getter of `ByteLengthQueuingStrategy` or `CountQueuingStrategy` should not have a prototype property, nor be a constructor. Refs: https://streams.spec.whatwg.org/#blqs-size Refs: https://streams.spec.whatwg.org/#cqs-size Signed-off-by: Daeyeon Jeong <daeyeon.dev@gmail.com> PR-URL: #44867 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Minwoo Jung <nodecorelab@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent 19a9099 commit 3fdf6cf
Copy full SHA for 3fdf6cf

File tree

Expand file treeCollapse file tree

2 files changed

+8
-15
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+8
-15
lines changed
Open diff view settings
Collapse file

‎lib/internal/webstreams/queuingstrategies.js‎

Copy file name to clipboardExpand all lines: lib/internal/webstreams/queuingstrategies.js
+8-5Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
const {
44
ObjectDefineProperties,
5+
ObjectDefineProperty,
56
SymbolToStringTag,
67
} = primordials;
78

@@ -47,11 +48,13 @@ const isCountQueuingStrategy =
4748
* }} QueuingStrategy
4849
*/
4950

50-
// eslint-disable-next-line func-name-matching,func-style
51-
const byteSizeFunction = function size(chunk) { return chunk.byteLength; };
52-
53-
// eslint-disable-next-line func-name-matching,func-style
54-
const countSizeFunction = function size() { return 1; };
51+
const nameDescriptor = { __proto__: null, value: 'size' };
52+
const byteSizeFunction = ObjectDefineProperty(
53+
(chunk) => chunk.byteLength,
54+
'name',
55+
nameDescriptor
56+
);
57+
const countSizeFunction = ObjectDefineProperty(() => 1, 'name', nameDescriptor);
5558

5659
/**
5760
* @type {QueuingStrategy}
Collapse file

‎test/wpt/status/streams.json‎

Copy file name to clipboardExpand all lines: test/wpt/status/streams.json
-10Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,6 @@
22
"queuing-strategies-size-function-per-global.window.js": {
33
"skip": "Browser-specific test"
44
},
5-
"queuing-strategies.any.js": {
6-
"fail": {
7-
"expected": [
8-
"CountQueuingStrategy: size should not have a prototype property",
9-
"ByteLengthQueuingStrategy: size should not have a prototype property",
10-
"CountQueuingStrategy: size should not be a constructor",
11-
"ByteLengthQueuingStrategy: size should not be a constructor"
12-
]
13-
}
14-
},
155
"readable-streams/cross-realm-crash.window.js": {
166
"skip": "Browser-specific test"
177
},

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.