blob: ae9cca0a107a6cf6a70de0c3506c6cc2be6a45c0 [file] [log] [blame]
/*
* Copyright (c) 2015 Canon Inc. All rights reserved.
* Copyright (c) 2015 Igalia.
* Copyright (c) 2016 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
*/
// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for
// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py
#include "config.h"
#include "ReadableStreamInternalsBuiltins.h"
#if ENABLE(READABLE_STREAM_API)
#include "WebCoreJSClientData.h"
#include <heap/HeapInlines.h>
#include <runtime/Executable.h>
#include <runtime/Intrinsic.h>
#include <runtime/JSCJSValueInlines.h>
#include <runtime/JSCellInlines.h>
#include <runtime/StructureInlines.h>
#include <runtime/VM.h>
namespace WebCore {
const JSC::ConstructAbility s_readableStreamInternalsPrivateInitializeReadableStreamDefaultReaderCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
const int s_readableStreamInternalsPrivateInitializeReadableStreamDefaultReaderCodeLength = 798;
static const JSC::Intrinsic s_readableStreamInternalsPrivateInitializeReadableStreamDefaultReaderCodeIntrinsic = JSC::NoIntrinsic;
const char* s_readableStreamInternalsPrivateInitializeReadableStreamDefaultReaderCode =
"(function (stream)\n" \
"{\n" \
" \"use strict\";\n" \
" if (!@isReadableStream(stream))\n" \
" throw new @TypeError(\"ReadableStreamDefaultReader needs a ReadableStream\");\n" \
" if (@isReadableStreamLocked(stream))\n" \
" throw new @TypeError(\"ReadableStream is locked\");\n" \
" this.@readRequests = [];\n" \
" this.@ownerReadableStream = stream;\n" \
" stream.@reader = this;\n" \
" if (stream.@state === @streamReadable) {\n" \
" this.@closedPromiseCapability = @newPromiseCapability(@Promise);\n" \
" return this;\n" \
" }\n" \
" if (stream.@state === @streamClosed) {\n" \
" this.@closedPromiseCapability = { @promise: @Promise.@resolve() };\n" \
" return this;\n" \
" }\n" \
" @assert(stream.@state === @streamErrored);\n" \
" this.@closedPromiseCapability = { @promise: @Promise.@reject(stream.@storedError) };\n" \
" return this;\n" \
"})\n" \
;
const JSC::ConstructAbility s_readableStreamInternalsPrivateInitializeReadableStreamDefaultControllerCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
const int s_readableStreamInternalsPrivateInitializeReadableStreamDefaultControllerCodeLength = 1683;
static const JSC::Intrinsic s_readableStreamInternalsPrivateInitializeReadableStreamDefaultControllerCodeIntrinsic = JSC::NoIntrinsic;
const char* s_readableStreamInternalsPrivateInitializeReadableStreamDefaultControllerCode =
"(function (stream, underlyingSource, size, highWaterMark)\n" \
"{\n" \
" \"use strict\";\n" \
" if (!@isReadableStream(stream))\n" \
" throw new @TypeError(\"ReadableStreamDefaultController needs a ReadableStream\");\n" \
" if (stream.@readableStreamController !== null)\n" \
" throw new @TypeError(\"ReadableStream already has a controller\");\n" \
" this.@controlledReadableStream = stream;\n" \
" this.@underlyingSource = underlyingSource;\n" \
" this.@queue = @newQueue();\n" \
" this.@started = false;\n" \
" this.@closeRequested = false;\n" \
" this.@pullAgain = false;\n" \
" this.@pulling = false;\n" \
" this.@strategy = @validateAndNormalizeQueuingStrategy(size, highWaterMark);\n" \
" const controller = this;\n" \
" const startResult = @promiseInvokeOrNoopNoCatch(underlyingSource, \"start\", [this]).@then(() => {\n" \
" controller.@started = true;\n" \
" @requestReadableStreamPull(controller);\n" \
" }, (error) => {\n" \
" if (stream.@state === @streamReadable)\n" \
" @readableStreamDefaultControllerError(controller, error);\n" \
" });\n" \
" this.@pull = function() {\n" \
" \"use strict\";\n" \
" const stream = controller.@controlledReadableStream;\n" \
" if (controller.@queue.content.length) {\n" \
" const chunk = @dequeueValue(controller.@queue);\n" \
" if (controller.@closeRequested && controller.@queue.content.length === 0)\n" \
" @closeReadableStream(stream);\n" \
" else\n" \
" @requestReadableStreamPull(controller);\n" \
" return @Promise.@resolve({value: chunk, done: false});\n" \
" }\n" \
" const pendingPromise = @readableStreamAddReadRequest(stream);\n" \
" @requestReadableStreamPull(controller);\n" \
" return pendingPromise;\n" \
" }\n" \
" return this;\n" \
"})\n" \
;
const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultControllerErrorCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
const int s_readableStreamInternalsReadableStreamDefaultControllerErrorCodeLength = 236;
static const JSC::Intrinsic s_readableStreamInternalsReadableStreamDefaultControllerErrorCodeIntrinsic = JSC::NoIntrinsic;
const char* s_readableStreamInternalsReadableStreamDefaultControllerErrorCode =
"(function (controller, error)\n" \
"{\n" \
" \"use strict\";\n" \
" const stream = controller.@controlledReadableStream;\n" \
" @assert(stream.@state === @streamReadable);\n" \
" controller.@queue = @newQueue();\n" \
" @errorReadableStream(stream, error);\n" \
"})\n" \
;
const JSC::ConstructAbility s_readableStreamInternalsTeeReadableStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
const int s_readableStreamInternalsTeeReadableStreamCodeLength = 1305;
static const JSC::Intrinsic s_readableStreamInternalsTeeReadableStreamCodeIntrinsic = JSC::NoIntrinsic;
const char* s_readableStreamInternalsTeeReadableStreamCode =
"(function (stream, shouldClone)\n" \
"{\n" \
" \"use strict\";\n" \
" @assert(@isReadableStream(stream));\n" \
" @assert(typeof(shouldClone) === \"boolean\");\n" \
" const reader = new @ReadableStreamDefaultReader(stream);\n" \
" const teeState = {\n" \
" closedOrErrored: false,\n" \
" canceled1: false,\n" \
" canceled2: false,\n" \
" reason1: @undefined,\n" \
" reason2: @undefined,\n" \
" };\n" \
" teeState.cancelPromiseCapability = @newPromiseCapability(@InternalPromise);\n" \
" const pullFunction = @teeReadableStreamPullFunction(teeState, reader, shouldClone);\n" \
" const branch1 = new @ReadableStream({\n" \
" \"pull\": pullFunction,\n" \
" \"cancel\": @teeReadableStreamBranch1CancelFunction(teeState, stream)\n" \
" });\n" \
" const branch2 = new @ReadableStream({\n" \
" \"pull\": pullFunction,\n" \
" \"cancel\": @teeReadableStreamBranch2CancelFunction(teeState, stream)\n" \
" });\n" \
" reader.@closedPromiseCapability.@promise.@then(@undefined, function(e) {\n" \
" if (teeState.closedOrErrored)\n" \
" return;\n" \
" @readableStreamDefaultControllerError(branch1.@readableStreamController, e);\n" \
" @readableStreamDefaultControllerError(branch2.@readableStreamController, e);\n" \
" teeState.closedOrErrored = true;\n" \
" });\n" \
" teeState.branch1 = branch1;\n" \
" teeState.branch2 = branch2;\n" \
" return [branch1, branch2];\n" \
"})\n" \
;
const JSC::ConstructAbility s_readableStreamInternalsDoStructuredCloneCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
const int s_readableStreamInternalsDoStructuredCloneCodeLength = 304;
static const JSC::Intrinsic s_readableStreamInternalsDoStructuredCloneCodeIntrinsic = JSC::NoIntrinsic;
const char* s_readableStreamInternalsDoStructuredCloneCode =
"(function (object)\n" \
"{\n" \
" \"use strict\";\n" \
" if (object instanceof @ArrayBuffer)\n" \
" return @structuredCloneArrayBuffer(object);\n" \
" if (@ArrayBuffer.@isView(object))\n" \
" return @structuredCloneArrayBufferView(object);\n" \
" throw new @TypeError(\"structuredClone not implemented for: \" + object);\n" \
"})\n" \
;
const JSC::ConstructAbility s_readableStreamInternalsTeeReadableStreamPullFunctionCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
const int s_readableStreamInternalsTeeReadableStreamPullFunctionCodeLength = 1155;
static const JSC::Intrinsic s_readableStreamInternalsTeeReadableStreamPullFunctionCodeIntrinsic = JSC::NoIntrinsic;
const char* s_readableStreamInternalsTeeReadableStreamPullFunctionCode =
"(function (teeState, reader, shouldClone)\n" \
"{\n" \
" \"use strict\";\n" \
" return function() {\n" \
" @Promise.prototype.@then.@call(@readFromReadableStreamDefaultReader(reader), function(result) {\n" \
" @assert(@isObject(result));\n" \
" @assert(typeof result.done === \"boolean\");\n" \
" if (result.done && !teeState.closedOrErrored) {\n" \
" if (!teeState.canceled1)\n" \
" @readableStreamDefaultControllerClose(teeState.branch1.@readableStreamController);\n" \
" if (!teeState.canceled2)\n" \
" @readableStreamDefaultControllerClose(teeState.branch2.@readableStreamController);\n" \
" teeState.closedOrErrored = true;\n" \
" }\n" \
" if (teeState.closedOrErrored)\n" \
" return;\n" \
" if (!teeState.canceled1)\n" \
" @enqueueInReadableStream(teeState.branch1.@readableStreamController, shouldClone ? @doStructuredClone(result.value) : result.value);\n" \
" if (!teeState.canceled2)\n" \
" @enqueueInReadableStream(teeState.branch2.@readableStreamController, shouldClone ? @doStructuredClone(result.value) : result.value);\n" \
" });\n" \
" }\n" \
"})\n" \
;
const JSC::ConstructAbility s_readableStreamInternalsTeeReadableStreamBranch1CancelFunctionCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
const int s_readableStreamInternalsTeeReadableStreamBranch1CancelFunctionCodeLength = 455;
static const JSC::Intrinsic s_readableStreamInternalsTeeReadableStreamBranch1CancelFunctionCodeIntrinsic = JSC::NoIntrinsic;
const char* s_readableStreamInternalsTeeReadableStreamBranch1CancelFunctionCode =
"(function (teeState, stream)\n" \
"{\n" \
" \"use strict\";\n" \
" return function(r) {\n" \
" teeState.canceled1 = true;\n" \
" teeState.reason1 = r;\n" \
" if (teeState.canceled2) {\n" \
" @cancelReadableStream(stream, [teeState.reason1, teeState.reason2]).@then(\n" \
" teeState.cancelPromiseCapability.@resolve,\n" \
" teeState.cancelPromiseCapability.@reject);\n" \
" }\n" \
" return teeState.cancelPromiseCapability.@promise;\n" \
" }\n" \
"})\n" \
;
const JSC::ConstructAbility s_readableStreamInternalsTeeReadableStreamBranch2CancelFunctionCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
const int s_readableStreamInternalsTeeReadableStreamBranch2CancelFunctionCodeLength = 455;
static const JSC::Intrinsic s_readableStreamInternalsTeeReadableStreamBranch2CancelFunctionCodeIntrinsic = JSC::NoIntrinsic;
const char* s_readableStreamInternalsTeeReadableStreamBranch2CancelFunctionCode =
"(function (teeState, stream)\n" \
"{\n" \
" \"use strict\";\n" \
" return function(r) {\n" \
" teeState.canceled2 = true;\n" \
" teeState.reason2 = r;\n" \
" if (teeState.canceled1) {\n" \
" @cancelReadableStream(stream, [teeState.reason1, teeState.reason2]).@then(\n" \
" teeState.cancelPromiseCapability.@resolve,\n" \
" teeState.cancelPromiseCapability.@reject);\n" \
" }\n" \
" return teeState.cancelPromiseCapability.@promise;\n" \
" }\n" \
"})\n" \
;
const JSC::ConstructAbility s_readableStreamInternalsIsReadableStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
const int s_readableStreamInternalsIsReadableStreamCodeLength = 123;
static const JSC::Intrinsic s_readableStreamInternalsIsReadableStreamCodeIntrinsic = JSC::NoIntrinsic;
const char* s_readableStreamInternalsIsReadableStreamCode =
"(function (stream)\n" \
"{\n" \
" \"use strict\";\n" \
" return @isObject(stream) && stream.@readableStreamController !== @undefined;\n" \
"})\n" \
;
const JSC::ConstructAbility s_readableStreamInternalsIsReadableStreamDefaultReaderCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
const int s_readableStreamInternalsIsReadableStreamDefaultReaderCodeLength = 98;
static const JSC::Intrinsic s_readableStreamInternalsIsReadableStreamDefaultReaderCodeIntrinsic = JSC::NoIntrinsic;
const char* s_readableStreamInternalsIsReadableStreamDefaultReaderCode =
"(function (reader)\n" \
"{\n" \
" \"use strict\";\n" \
" return @isObject(reader) && !!reader.@readRequests;\n" \
"})\n" \
;
const JSC::ConstructAbility s_readableStreamInternalsIsReadableStreamDefaultControllerCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
const int s_readableStreamInternalsIsReadableStreamDefaultControllerCodeLength = 114;
static const JSC::Intrinsic s_readableStreamInternalsIsReadableStreamDefaultControllerCodeIntrinsic = JSC::NoIntrinsic;
const char* s_readableStreamInternalsIsReadableStreamDefaultControllerCode =
"(function (controller)\n" \
"{\n" \
" \"use strict\";\n" \
" return @isObject(controller) && !!controller.@underlyingSource;\n" \
"})\n" \
;
const JSC::ConstructAbility s_readableStreamInternalsErrorReadableStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
const int s_readableStreamInternalsErrorReadableStreamCodeLength = 725;
static const JSC::Intrinsic s_readableStreamInternalsErrorReadableStreamCodeIntrinsic = JSC::NoIntrinsic;
const char* s_readableStreamInternalsErrorReadableStreamCode =
"(function (stream, error)\n" \
"{\n" \
" \"use strict\";\n" \
" @assert(@isReadableStream(stream));\n" \
" @assert(stream.@state === @streamReadable);\n" \
" stream.@state = @streamErrored;\n" \
" stream.@storedError = error;\n" \
" if (!stream.@reader)\n" \
" return;\n" \
" const reader = stream.@reader;\n" \
" if (@isReadableStreamDefaultReader(reader)) {\n" \
" const requests = reader.@readRequests;\n" \
" for (let index = 0, length = requests.length; index < length; ++index)\n" \
" requests[index].@reject.@call(@undefined, error);\n" \
" reader.@readRequests = [];\n" \
" } else\n" \
" throw new @TypeError(\"Only ReadableStreamDefaultReader is currently supported\");\n" \
" reader.@closedPromiseCapability.@reject.@call(@undefined, error);\n" \
"})\n" \
;
const JSC::ConstructAbility s_readableStreamInternalsRequestReadableStreamPullCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
const int s_readableStreamInternalsRequestReadableStreamPullCodeLength = 1009;
static const JSC::Intrinsic s_readableStreamInternalsRequestReadableStreamPullCodeIntrinsic = JSC::NoIntrinsic;
const char* s_readableStreamInternalsRequestReadableStreamPullCode =
"(function (controller)\n" \
"{\n" \
" \"use strict\";\n" \
" const stream = controller.@controlledReadableStream;\n" \
" if (stream.@state === @streamClosed || stream.@state === @streamErrored)\n" \
" return;\n" \
" if (controller.@closeRequested)\n" \
" return;\n" \
" if (!controller.@started)\n" \
" return;\n" \
" if ((!@isReadableStreamLocked(stream) || !stream.@reader.@readRequests.length) && @readableStreamDefaultControllerGetDesiredSize(controller) <= 0)\n" \
" return;\n" \
" if (controller.@pulling) {\n" \
" controller.@pullAgain = true;\n" \
" return;\n" \
" }\n" \
" controller.@pulling = true;\n" \
" @promiseInvokeOrNoop(controller.@underlyingSource, \"pull\", [controller]).@then(function() {\n" \
" controller.@pulling = false;\n" \
" if (controller.@pullAgain) {\n" \
" controller.@pullAgain = false;\n" \
" @requestReadableStreamPull(controller);\n" \
" }\n" \
" }, function(error) {\n" \
" if (stream.@state === @streamReadable)\n" \
" @readableStreamDefaultControllerError(controller, error);\n" \
" });\n" \
"})\n" \
;
const JSC::ConstructAbility s_readableStreamInternalsIsReadableStreamLockedCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
const int s_readableStreamInternalsIsReadableStreamLockedCodeLength = 110;
static const JSC::Intrinsic s_readableStreamInternalsIsReadableStreamLockedCodeIntrinsic = JSC::NoIntrinsic;
const char* s_readableStreamInternalsIsReadableStreamLockedCode =
"(function (stream)\n" \
"{\n" \
" \"use strict\";\n" \
" @assert(@isReadableStream(stream));\n" \
" return !!stream.@reader;\n" \
"})\n" \
;
const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultControllerGetDesiredSizeCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
const int s_readableStreamInternalsReadableStreamDefaultControllerGetDesiredSizeCodeLength = 116;
static const JSC::Intrinsic s_readableStreamInternalsReadableStreamDefaultControllerGetDesiredSizeCodeIntrinsic = JSC::NoIntrinsic;
const char* s_readableStreamInternalsReadableStreamDefaultControllerGetDesiredSizeCode =
"(function (controller)\n" \
"{\n" \
" \"use strict\";\n" \
" return controller.@strategy.highWaterMark - controller.@queue.size;\n" \
"})\n" \
;
const JSC::ConstructAbility s_readableStreamInternalsCancelReadableStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
const int s_readableStreamInternalsCancelReadableStreamCodeLength = 568;
static const JSC::Intrinsic s_readableStreamInternalsCancelReadableStreamCodeIntrinsic = JSC::NoIntrinsic;
const char* s_readableStreamInternalsCancelReadableStreamCode =
"(function (stream, reason)\n" \
"{\n" \
" \"use strict\";\n" \
" stream.@disturbed = true;\n" \
" if (stream.@state === @streamClosed)\n" \
" return @Promise.@resolve();\n" \
" if (stream.@state === @streamErrored)\n" \
" return @Promise.@reject(stream.@storedError);\n" \
" @closeReadableStream(stream);\n" \
" const controller = stream.@readableStreamController;\n" \
" var underlyingSource = @undefined;\n" \
" if (controller !== @undefined)\n" \
" underlyingSource = controller.@underlyingSource;\n" \
" return @promiseInvokeOrNoop(underlyingSource, \"cancel\", [reason]).@then(function() { });\n" \
"})\n" \
;
const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultControllerCloseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
const int s_readableStreamInternalsReadableStreamDefaultControllerCloseCodeLength = 318;
static const JSC::Intrinsic s_readableStreamInternalsReadableStreamDefaultControllerCloseCodeIntrinsic = JSC::NoIntrinsic;
const char* s_readableStreamInternalsReadableStreamDefaultControllerCloseCode =
"(function (controller)\n" \
"{\n" \
" \"use strict\";\n" \
" const stream = controller.@controlledReadableStream;\n" \
" @assert(!controller.@closeRequested);\n" \
" @assert(stream.@state === @streamReadable);\n" \
" controller.@closeRequested = true;\n" \
" if (controller.@queue.content.length === 0)\n" \
" @closeReadableStream(stream);\n" \
"})\n" \
;
const JSC::ConstructAbility s_readableStreamInternalsCloseReadableStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
const int s_readableStreamInternalsCloseReadableStreamCodeLength = 552;
static const JSC::Intrinsic s_readableStreamInternalsCloseReadableStreamCodeIntrinsic = JSC::NoIntrinsic;
const char* s_readableStreamInternalsCloseReadableStreamCode =
"(function (stream)\n" \
"{\n" \
" \"use strict\";\n" \
" @assert(stream.@state === @streamReadable);\n" \
" stream.@state = @streamClosed;\n" \
" const reader = stream.@reader;\n" \
" if (!reader)\n" \
" return;\n" \
" if (@isReadableStreamDefaultReader(reader)) {\n" \
" const requests = reader.@readRequests;\n" \
" for (let index = 0, length = requests.length; index < length; ++index)\n" \
" requests[index].@resolve.@call(@undefined, {value:@undefined, done: true});\n" \
" reader.@readRequests = [];\n" \
" }\n" \
" reader.@closedPromiseCapability.@resolve.@call();\n" \
"})\n" \
;
const JSC::ConstructAbility s_readableStreamInternalsEnqueueInReadableStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
const int s_readableStreamInternalsEnqueueInReadableStreamCodeLength = 885;
static const JSC::Intrinsic s_readableStreamInternalsEnqueueInReadableStreamCodeIntrinsic = JSC::NoIntrinsic;
const char* s_readableStreamInternalsEnqueueInReadableStreamCode =
"(function (controller, chunk)\n" \
"{\n" \
" \"use strict\";\n" \
" const stream = controller.@controlledReadableStream;\n" \
" @assert(!controller.@closeRequested);\n" \
" @assert(stream.@state === @streamReadable);\n" \
" if (@isReadableStreamLocked(stream) && stream.@reader.@readRequests.length) {\n" \
" stream.@reader.@readRequests.@shift().@resolve.@call(@undefined, {value: chunk, done: false});\n" \
" @requestReadableStreamPull(controller);\n" \
" return;\n" \
" }\n" \
" try {\n" \
" let chunkSize = 1;\n" \
" if (controller.@strategy.size !== @undefined)\n" \
" chunkSize = controller.@strategy.size(chunk);\n" \
" @enqueueValueWithSize(controller.@queue, chunk, chunkSize);\n" \
" }\n" \
" catch(error) {\n" \
" if (stream.@state === @streamReadable)\n" \
" @readableStreamDefaultControllerError(controller, error);\n" \
" throw error;\n" \
" }\n" \
" @requestReadableStreamPull(controller);\n" \
"})\n" \
;
const JSC::ConstructAbility s_readableStreamInternalsReadFromReadableStreamDefaultReaderCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
const int s_readableStreamInternalsReadFromReadableStreamDefaultReaderCodeLength = 448;
static const JSC::Intrinsic s_readableStreamInternalsReadFromReadableStreamDefaultReaderCodeIntrinsic = JSC::NoIntrinsic;
const char* s_readableStreamInternalsReadFromReadableStreamDefaultReaderCode =
"(function (reader)\n" \
"{\n" \
" \"use strict\";\n" \
" const stream = reader.@ownerReadableStream;\n" \
" @assert(!!stream);\n" \
" stream.@disturbed = true;\n" \
" if (stream.@state === @streamClosed)\n" \
" return @Promise.@resolve({value: @undefined, done: true});\n" \
" if (stream.@state === @streamErrored)\n" \
" return @Promise.@reject(stream.@storedError);\n" \
" @assert(stream.@state === @streamReadable);\n" \
" return stream.@readableStreamController.@pull();\n" \
"})\n" \
;
const JSC::ConstructAbility s_readableStreamInternalsReadableStreamAddReadRequestCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
const int s_readableStreamInternalsReadableStreamAddReadRequestCodeLength = 293;
static const JSC::Intrinsic s_readableStreamInternalsReadableStreamAddReadRequestCodeIntrinsic = JSC::NoIntrinsic;
const char* s_readableStreamInternalsReadableStreamAddReadRequestCode =
"(function (stream)\n" \
"{\n" \
" \"use strict\";\n" \
" @assert(@isReadableStreamDefaultReader(stream.@reader));\n" \
" @assert(stream.@state == @streamReadable);\n" \
" const readRequest = @newPromiseCapability(@Promise);\n" \
" stream.@reader.@readRequests.@push(readRequest);\n" \
" return readRequest.@promise;\n" \
"})\n" \
;
const JSC::ConstructAbility s_readableStreamInternalsIsReadableStreamDisturbedCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
const int s_readableStreamInternalsIsReadableStreamDisturbedCodeLength = 112;
static const JSC::Intrinsic s_readableStreamInternalsIsReadableStreamDisturbedCodeIntrinsic = JSC::NoIntrinsic;
const char* s_readableStreamInternalsIsReadableStreamDisturbedCode =
"(function (stream)\n" \
"{\n" \
" \"use strict\";\n" \
" @assert(@isReadableStream(stream));\n" \
" return stream.@disturbed;\n" \
"})\n" \
;
#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
{\
JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \
return clientData->builtinFunctions().readableStreamInternalsBuiltins().codeName##Executable()->link(vm, clientData->builtinFunctions().readableStreamInternalsBuiltins().codeName##Source(), Nullopt, s_##codeName##Intrinsic); \
}
WEBCORE_FOREACH_READABLESTREAMINTERNALS_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
#undef DEFINE_BUILTIN_GENERATOR
} // namespace WebCore
#endif // ENABLE(READABLE_STREAM_API)