Skip to content

Commit c46742f

Browse files
authored
Fix reference implementation's size functions
They should not have .prototypes or be constructible.
1 parent 4012d16 commit c46742f

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

reference-implementation/lib/ByteLengthQueuingStrategy-impl.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ function initializeSizeFunction(globalObject) {
1919
}
2020

2121
// We need to set the 'name' property:
22-
// eslint-disable-next-line prefer-arrow-callback
23-
sizeFunctionWeakMap.set(globalObject, function size(chunk) {
24-
return chunk.byteLength;
25-
});
22+
// The size function must not have a prototype property nor be a constructor
23+
const size = chunk => chunk.byteLength;
24+
sizeFunctionWeakMap.set(globalObject, size);
2625
}

reference-implementation/lib/CountQueuingStrategy-impl.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ function initializeSizeFunction(globalObject) {
1919
}
2020

2121
// We need to set the 'name' property:
22-
// eslint-disable-next-line prefer-arrow-callback
23-
sizeFunctionWeakMap.set(globalObject, function size() {
24-
return 1;
25-
});
22+
// The size function must not have a prototype property nor be a constructor
23+
const size = () => 1;
24+
sizeFunctionWeakMap.set(globalObject, size);
2625
}

0 commit comments

Comments
 (0)