summaryrefslogtreecommitdiff
path: root/ext/web/06_streams.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/web/06_streams.js')
-rw-r--r--ext/web/06_streams.js53
1 files changed, 29 insertions, 24 deletions
diff --git a/ext/web/06_streams.js b/ext/web/06_streams.js
index 6dbf69951..eb16fff2d 100644
--- a/ext/web/06_streams.js
+++ b/ext/web/06_streams.js
@@ -60,6 +60,7 @@
WeakMapPrototypeSet,
} = globalThis.__bootstrap.primordials;
const consoleInternal = window.__bootstrap.console;
+ const ops = core.ops;
const { AssertionError, assert } = window.__bootstrap.infra;
/** @template T */
@@ -224,15 +225,9 @@
* @returns {ArrayBufferLike}
*/
function transferArrayBuffer(O) {
- assert(!isDetachedBuffer(O));
- const transferredIshVersion = O.slice(0);
- ObjectDefineProperty(O, "byteLength", {
- get() {
- return 0;
- },
- });
+ const v = ops.op_transfer_arraybuffer(O);
O[isFakeDetached] = true;
- return transferredIshVersion;
+ return v;
}
/**
@@ -4620,26 +4615,32 @@
* @param {UnderlyingSource<R>=} underlyingSource
* @param {QueuingStrategy<R>=} strategy
*/
- constructor(underlyingSource = undefined, strategy = {}) {
+ constructor(underlyingSource = undefined, strategy = undefined) {
const prefix = "Failed to construct 'ReadableStream'";
if (underlyingSource !== undefined) {
underlyingSource = webidl.converters.object(underlyingSource, {
prefix,
context: "Argument 1",
});
+ } else {
+ underlyingSource = null;
+ }
+ if (strategy !== undefined) {
+ strategy = webidl.converters.QueuingStrategy(strategy, {
+ prefix,
+ context: "Argument 2",
+ });
+ } else {
+ strategy = {};
}
- strategy = webidl.converters.QueuingStrategy(strategy, {
- prefix,
- context: "Argument 2",
- });
this[webidl.brand] = webidl.brand;
- if (underlyingSource === undefined) {
- underlyingSource = null;
+ let underlyingSourceDict = {};
+ if (underlyingSource !== undefined) {
+ underlyingSourceDict = webidl.converters.UnderlyingSource(
+ underlyingSource,
+ { prefix, context: "underlyingSource" },
+ );
}
- const underlyingSourceDict = webidl.converters.UnderlyingSource(
- underlyingSource,
- { prefix, context: "underlyingSource" },
- );
initializeReadableStream(this);
if (underlyingSourceDict.type === "bytes") {
if (strategy.size !== undefined) {
@@ -4700,13 +4701,17 @@
* @param {ReadableStreamGetReaderOptions=} options
* @returns {ReadableStreamDefaultReader<R> | ReadableStreamBYOBReader}
*/
- getReader(options = {}) {
+ getReader(options = undefined) {
webidl.assertBranded(this, ReadableStreamPrototype);
const prefix = "Failed to execute 'getReader' on 'ReadableStream'";
- options = webidl.converters.ReadableStreamGetReaderOptions(options, {
- prefix,
- context: "Argument 1",
- });
+ if (options !== undefined) {
+ options = webidl.converters.ReadableStreamGetReaderOptions(options, {
+ prefix,
+ context: "Argument 1",
+ });
+ } else {
+ options = {};
+ }
if (options.mode === undefined) {
return acquireReadableStreamDefaultReader(this);
} else {