summaryrefslogtreecommitdiff
path: root/ext/web/06_streams.js
diff options
context:
space:
mode:
authorLuca Casonato <hello@lcas.dev>2024-05-23 00:03:35 +0200
committerGitHub <noreply@github.com>2024-05-23 00:03:35 +0200
commit971f09abe486185247e1faf4e8d1419ba2506b8d (patch)
tree3ed0cf608116ad06e88a87552333e930824cc790 /ext/web/06_streams.js
parent6c167c64d61ecfc912dc1b68d300f02aa3677235 (diff)
fix(runtime): use more null proto objects (#23921)
This is a primordialization effort to improve resistance against users tampering with the global `Object` prototype. --------- Co-authored-by: Bartek IwaƄczuk <biwanczuk@gmail.com>
Diffstat (limited to 'ext/web/06_streams.js')
-rw-r--r--ext/web/06_streams.js12
1 files changed, 6 insertions, 6 deletions
diff --git a/ext/web/06_streams.js b/ext/web/06_streams.js
index 9c2a05980..e01ece6c8 100644
--- a/ext/web/06_streams.js
+++ b/ext/web/06_streams.js
@@ -5274,7 +5274,7 @@ class ReadableStream {
"Argument 1",
);
} else {
- options = {};
+ options = { __proto__: null };
}
if (options.mode === undefined) {
return acquireReadableStreamDefaultReader(this);
@@ -5290,7 +5290,7 @@ class ReadableStream {
* @param {PipeOptions=} options
* @returns {ReadableStream<T>}
*/
- pipeThrough(transform, options = {}) {
+ pipeThrough(transform, options = { __proto__: null }) {
webidl.assertBranded(this, ReadableStreamPrototype);
const prefix = "Failed to execute 'pipeThrough' on 'ReadableStream'";
webidl.requiredArguments(arguments.length, 1, prefix);
@@ -5329,7 +5329,7 @@ class ReadableStream {
* @param {PipeOptions=} options
* @returns {Promise<void>}
*/
- pipeTo(destination, options = {}) {
+ pipeTo(destination, options = { __proto__: null }) {
try {
webidl.assertBranded(this, ReadableStreamPrototype);
const prefix = "Failed to execute 'pipeTo' on 'ReadableStream'";
@@ -5567,7 +5567,7 @@ class ReadableStreamBYOBReader {
* @param {ReadableStreamBYOBReaderReadOptions} options
* @returns {Promise<ReadableStreamBYOBReadResult>}
*/
- read(view, options = {}) {
+ read(view, options = { __proto__: null }) {
try {
webidl.assertBranded(this, ReadableStreamBYOBReaderPrototype);
const prefix = "Failed to execute 'read' on 'ReadableStreamBYOBReader'";
@@ -6151,8 +6151,8 @@ class TransformStream {
*/
constructor(
transformer = undefined,
- writableStrategy = {},
- readableStrategy = {},
+ writableStrategy = { __proto__: null },
+ readableStrategy = { __proto__: null },
) {
const prefix = "Failed to construct 'TransformStream'";
if (transformer !== undefined) {