1/*
2 * Copyright (c) 2016 Apple Inc. All rights reserved.
3 * Copyright (c) 2017 Canon Inc.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
15 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
16 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
18 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
24 * THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 */
27
28// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for
29// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py
30
31#include "config.h"
32#include "ReadableStreamBYOBRequestBuiltins.h"
33
34#if ENABLE(STREAMS_API)
35
36#include "WebCoreJSClientData.h"
37#include <JavaScriptCore/HeapInlines.h>
38#include <JavaScriptCore/IdentifierInlines.h>
39#include <JavaScriptCore/Intrinsic.h>
40#include <JavaScriptCore/JSCJSValueInlines.h>
41#include <JavaScriptCore/JSCellInlines.h>
42#include <JavaScriptCore/StructureInlines.h>
43#include <JavaScriptCore/VM.h>
44
45namespace WebCore {
46
47const JSC::ConstructAbility s_readableStreamBYOBRequestInitializeReadableStreamBYOBRequestCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
48const int s_readableStreamBYOBRequestInitializeReadableStreamBYOBRequestCodeLength = 306;
49static const JSC::Intrinsic s_readableStreamBYOBRequestInitializeReadableStreamBYOBRequestCodeIntrinsic = JSC::NoIntrinsic;
50const char* const s_readableStreamBYOBRequestInitializeReadableStreamBYOBRequestCode =
51 "(function (controller, view)\n" \
52 "{\n" \
53 " \"use strict\";\n" \
54 "\n" \
55 " if (arguments.length !== 3 && arguments[2] !== @isReadableStream)\n" \
56 " @throwTypeError(\"ReadableStreamBYOBRequest constructor should not be called directly\");\n" \
57 "\n" \
58 " return @privateInitializeReadableStreamBYOBRequest.@call(this, controller, view);\n" \
59 "})\n" \
60;
61
62const JSC::ConstructAbility s_readableStreamBYOBRequestRespondCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
63const int s_readableStreamBYOBRequestRespondCodeLength = 504;
64static const JSC::Intrinsic s_readableStreamBYOBRequestRespondCodeIntrinsic = JSC::NoIntrinsic;
65const char* const s_readableStreamBYOBRequestRespondCode =
66 "(function (bytesWritten)\n" \
67 "{\n" \
68 " \"use strict\";\n" \
69 "\n" \
70 " if (!@isReadableStreamBYOBRequest(this))\n" \
71 " throw @makeThisTypeError(\"ReadableStreamBYOBRequest\", \"respond\");\n" \
72 "\n" \
73 " if (@getByIdDirectPrivate(this, \"associatedReadableByteStreamController\") === @undefined)\n" \
74 " @throwTypeError(\"ReadableStreamBYOBRequest.associatedReadableByteStreamController is undefined\");\n" \
75 "\n" \
76 " return @readableByteStreamControllerRespond(@getByIdDirectPrivate(this, \"associatedReadableByteStreamController\"), bytesWritten);\n" \
77 "})\n" \
78;
79
80const JSC::ConstructAbility s_readableStreamBYOBRequestRespondWithNewViewCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
81const int s_readableStreamBYOBRequestRespondWithNewViewCodeLength = 691;
82static const JSC::Intrinsic s_readableStreamBYOBRequestRespondWithNewViewCodeIntrinsic = JSC::NoIntrinsic;
83const char* const s_readableStreamBYOBRequestRespondWithNewViewCode =
84 "(function (view)\n" \
85 "{\n" \
86 " \"use strict\";\n" \
87 "\n" \
88 " if (!@isReadableStreamBYOBRequest(this))\n" \
89 " throw @makeThisTypeError(\"ReadableStreamBYOBRequest\", \"respond\");\n" \
90 "\n" \
91 " if (@getByIdDirectPrivate(this, \"associatedReadableByteStreamController\") === @undefined)\n" \
92 " @throwTypeError(\"ReadableStreamBYOBRequest.associatedReadableByteStreamController is undefined\");\n" \
93 "\n" \
94 " if (!@isObject(view))\n" \
95 " @throwTypeError(\"Provided view is not an object\");\n" \
96 "\n" \
97 " if (!@ArrayBuffer.@isView(view))\n" \
98 " @throwTypeError(\"Provided view is not an ArrayBufferView\");\n" \
99 "\n" \
100 " return @readableByteStreamControllerRespondWithNewView(@getByIdDirectPrivate(this, \"associatedReadableByteStreamController\"), view);\n" \
101 "})\n" \
102;
103
104const JSC::ConstructAbility s_readableStreamBYOBRequestViewCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
105const int s_readableStreamBYOBRequestViewCodeLength = 204;
106static const JSC::Intrinsic s_readableStreamBYOBRequestViewCodeIntrinsic = JSC::NoIntrinsic;
107const char* const s_readableStreamBYOBRequestViewCode =
108 "(function ()\n" \
109 "{\n" \
110 " \"use strict\";\n" \
111 "\n" \
112 " if (!@isReadableStreamBYOBRequest(this))\n" \
113 " throw @makeGetterTypeError(\"ReadableStreamBYOBRequest\", \"view\");\n" \
114 "\n" \
115 " return @getByIdDirectPrivate(this, \"view\");\n" \
116 "})\n" \
117;
118
119
120#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \
121JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
122{\
123 JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \
124 return clientData->builtinFunctions().readableStreamBYOBRequestBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().readableStreamBYOBRequestBuiltins().codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); \
125}
126WEBCORE_FOREACH_READABLESTREAMBYOBREQUEST_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
127#undef DEFINE_BUILTIN_GENERATOR
128
129
130} // namespace WebCore
131
132#endif // ENABLE(STREAMS_API)
133