e5639fdc0b216c5046047fa9585a32f3c7ca86a2
[WebKit-https.git] / Source / JavaScriptCore / Scripts / tests / builtins / expected / WebCore-xmlCasingTest-Separate.js-result
1 ### Begin File: xmlCasingTestBuiltins.h
2 /*
3  * Copyright (c) 2015 Canon Inc. All rights reserved.
4  * Copyright (c) 2016 Apple Inc. All rights reserved.
5  * 
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  * 
15  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
16  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
17  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
19  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
25  * THE POSSIBILITY OF SUCH DAMAGE.
26  * 
27  */
28
29 // DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for
30 // builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py
31
32 #pragma once
33
34 #if ENABLE(STREAMS_API)
35
36 #include <JavaScriptCore/BuiltinUtils.h>
37 #include <JavaScriptCore/Identifier.h>
38 #include <JavaScriptCore/JSFunction.h>
39 #include <JavaScriptCore/UnlinkedFunctionExecutable.h>
40
41 namespace JSC {
42 class FunctionExecutable;
43 }
44
45 namespace WebCore {
46
47 /* xmlCasingTest */
48 extern const char* s_xmlCasingTestXMLCasingTestCode;
49 extern const int s_xmlCasingTestXMLCasingTestCodeLength;
50 extern const JSC::ConstructAbility s_xmlCasingTestXMLCasingTestCodeConstructAbility;
51 extern const char* s_xmlCasingTestCssCasingTestCode;
52 extern const int s_xmlCasingTestCssCasingTestCodeLength;
53 extern const JSC::ConstructAbility s_xmlCasingTestCssCasingTestCodeConstructAbility;
54 extern const char* s_xmlCasingTestUrlCasingTestCode;
55 extern const int s_xmlCasingTestUrlCasingTestCodeLength;
56 extern const JSC::ConstructAbility s_xmlCasingTestUrlCasingTestCodeConstructAbility;
57
58 #define WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_DATA(macro) \
59     macro(xmlCasingTest, xmlCasingTestXMLCasingTest, 1) \
60     macro(cssCasingTest, xmlCasingTestCssCasingTest, 2) \
61     macro(urlCasingTest, xmlCasingTestUrlCasingTest, 3) \
62
63 #define WEBCORE_BUILTIN_XMLCASINGTEST_XMLCASINGTEST 1
64 #define WEBCORE_BUILTIN_XMLCASINGTEST_CSSCASINGTEST 1
65 #define WEBCORE_BUILTIN_XMLCASINGTEST_URLCASINGTEST 1
66
67 #define WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_CODE(macro) \
68     macro(xmlCasingTestXMLCasingTestCode, xmlCasingTest, static_cast<const char*>(nullptr), s_xmlCasingTestXMLCasingTestCodeLength) \
69     macro(xmlCasingTestCssCasingTestCode, cssCasingTest, static_cast<const char*>(nullptr), s_xmlCasingTestCssCasingTestCodeLength) \
70     macro(xmlCasingTestUrlCasingTestCode, urlCasingTest, static_cast<const char*>(nullptr), s_xmlCasingTestUrlCasingTestCodeLength) \
71
72 #define WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_FUNCTION_NAME(macro) \
73     macro(cssCasingTest) \
74     macro(urlCasingTest) \
75     macro(xmlCasingTest) \
76
77 #define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \
78     JSC::FunctionExecutable* codeName##Generator(JSC::VM&);
79
80 WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR)
81 #undef DECLARE_BUILTIN_GENERATOR
82
83 class xmlCasingTestBuiltinsWrapper : private JSC::WeakHandleOwner {
84 public:
85     explicit xmlCasingTestBuiltinsWrapper(JSC::VM* vm)
86         : m_vm(*vm)
87         WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES)
88 #define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createFromLiteral(s_##name, length), { }))
89         WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS)
90 #undef INITIALIZE_BUILTIN_SOURCE_MEMBERS
91     {
92     }
93
94 #define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \
95     JSC::UnlinkedFunctionExecutable* name##Executable(); \
96     const JSC::SourceCode& name##Source() const { return m_##name##Source; }
97     WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES)
98 #undef EXPOSE_BUILTIN_EXECUTABLES
99
100     WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR)
101
102     void exportNames();
103
104 private:
105     JSC::VM& m_vm;
106
107     WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES)
108
109 #define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \
110     JSC::SourceCode m_##name##Source;\
111     JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable;
112     WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS)
113 #undef DECLARE_BUILTIN_SOURCE_MEMBERS
114
115 };
116
117 #define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \
118 inline JSC::UnlinkedFunctionExecutable* xmlCasingTestBuiltinsWrapper::name##Executable() \
119 {\
120     if (!m_##name##Executable) {\
121         JSC::Identifier executableName = functionName##PublicName();\
122         if (overriddenName)\
123             executableName = JSC::Identifier::fromString(&m_vm, overriddenName);\
124         m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ConstructAbility), this, &m_##name##Executable);\
125     }\
126     return m_##name##Executable.get();\
127 }
128 WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES)
129 #undef DEFINE_BUILTIN_EXECUTABLES
130
131 inline void xmlCasingTestBuiltinsWrapper::exportNames()
132 {
133 #define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName());
134     WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME)
135 #undef EXPORT_FUNCTION_NAME
136 }
137
138 class xmlCasingTestBuiltinFunctions {
139 public:
140     explicit xmlCasingTestBuiltinFunctions(JSC::VM& vm) : m_vm(vm) { }
141
142     void init(JSC::JSGlobalObject&);
143     void visit(JSC::SlotVisitor&);
144
145 public:
146     JSC::VM& m_vm;
147
148 #define DECLARE_BUILTIN_SOURCE_MEMBERS(functionName) \
149     JSC::WriteBarrier<JSC::JSFunction> m_##functionName##Function;
150     WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_SOURCE_MEMBERS)
151 #undef DECLARE_BUILTIN_SOURCE_MEMBERS
152 };
153
154 inline void xmlCasingTestBuiltinFunctions::init(JSC::JSGlobalObject& globalObject)
155 {
156 #define EXPORT_FUNCTION(codeName, functionName, overriddenName, length)\
157     m_##functionName##Function.set(m_vm, &globalObject, JSC::JSFunction::create(m_vm, codeName##Generator(m_vm), &globalObject));
158     WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_CODE(EXPORT_FUNCTION)
159 #undef EXPORT_FUNCTION
160 }
161
162 inline void xmlCasingTestBuiltinFunctions::visit(JSC::SlotVisitor& visitor)
163 {
164 #define VISIT_FUNCTION(name) visitor.append(m_##name##Function);
165     WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_FUNCTION_NAME(VISIT_FUNCTION)
166 #undef VISIT_FUNCTION
167 }
168
169
170 } // namespace WebCore
171
172 #endif // ENABLE(STREAMS_API)
173 ### End File: xmlCasingTestBuiltins.h
174
175 ### Begin File: xmlCasingTestBuiltins.cpp
176 /*
177  * Copyright (c) 2015 Canon Inc. All rights reserved.
178  * Copyright (c) 2016 Apple Inc. All rights reserved.
179  * 
180  * Redistribution and use in source and binary forms, with or without
181  * modification, are permitted provided that the following conditions
182  * are met:
183  * 1. Redistributions of source code must retain the above copyright
184  *    notice, this list of conditions and the following disclaimer.
185  * 2. Redistributions in binary form must reproduce the above copyright
186  *    notice, this list of conditions and the following disclaimer in the
187  *    documentation and/or other materials provided with the distribution.
188  * 
189  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
190  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
191  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
192  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
193  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
194  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
195  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
196  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
197  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
198  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
199  * THE POSSIBILITY OF SUCH DAMAGE.
200  * 
201  */
202
203 // DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for
204 // builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py
205
206 #include "config.h"
207 #include "xmlCasingTestBuiltins.h"
208
209 #if ENABLE(STREAMS_API)
210
211 #include "WebCoreJSClientData.h"
212 #include <JavaScriptCore/HeapInlines.h>
213 #include <JavaScriptCore/IdentifierInlines.h>
214 #include <JavaScriptCore/Intrinsic.h>
215 #include <JavaScriptCore/JSCJSValueInlines.h>
216 #include <JavaScriptCore/JSCellInlines.h>
217 #include <JavaScriptCore/StructureInlines.h>
218 #include <JavaScriptCore/VM.h>
219
220 namespace WebCore {
221
222 const JSC::ConstructAbility s_xmlCasingTestXMLCasingTestCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
223 const int s_xmlCasingTestXMLCasingTestCodeLength = 71;
224 static const JSC::Intrinsic s_xmlCasingTestXMLCasingTestCodeIntrinsic = JSC::NoIntrinsic;
225 const char* s_xmlCasingTestXMLCasingTestCode =
226     "(function (stream)\n" \
227     "{\n" \
228     "   \"use strict\";\n" \
229     "\n" \
230     "    return !!stream.@reader;\n" \
231     "})\n" \
232 ;
233
234 const JSC::ConstructAbility s_xmlCasingTestCssCasingTestCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
235 const int s_xmlCasingTestCssCasingTestCodeLength = 402;
236 static const JSC::Intrinsic s_xmlCasingTestCssCasingTestCodeIntrinsic = JSC::NoIntrinsic;
237 const char* s_xmlCasingTestCssCasingTestCode =
238     "(function (stream, reason)\n" \
239     "{\n" \
240     "    \"use strict\";\n" \
241     "\n" \
242     "    if (stream.@state === @readableStreamClosed)\n" \
243     "        return Promise.resolve();\n" \
244     "    if (stream.@state === @readableStreamErrored)\n" \
245     "        return Promise.reject(stream.@storedError);\n" \
246     "    stream.@queue = [];\n" \
247     "    @finishClosingReadableStream(stream);\n" \
248     "    return @promiseInvokeOrNoop(stream.@underlyingSource, \"cancel\", [reason]).then(function() { });\n" \
249     "})\n" \
250 ;
251
252 const JSC::ConstructAbility s_xmlCasingTestUrlCasingTestCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
253 const int s_xmlCasingTestUrlCasingTestCodeLength = 338;
254 static const JSC::Intrinsic s_xmlCasingTestUrlCasingTestCodeIntrinsic = JSC::NoIntrinsic;
255 const char* s_xmlCasingTestUrlCasingTestCode =
256     "(function (object, key, args)\n" \
257     "{\n" \
258     "    \"use strict\";\n" \
259     "\n" \
260     "    try {\n" \
261     "        var method = object[key];\n" \
262     "        if (typeof method === \"undefined\")\n" \
263     "            return Promise.resolve();\n" \
264     "        var result = method.@apply(object, args);\n" \
265     "        return Promise.resolve(result);\n" \
266     "    }\n" \
267     "    catch(error) {\n" \
268     "        return Promise.reject(error);\n" \
269     "    }\n" \
270     "})\n" \
271 ;
272
273
274 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \
275 JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
276 {\
277     JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \
278     return clientData->builtinFunctions().xmlCasingTestBuiltins().codeName##Executable()->link(vm, clientData->builtinFunctions().xmlCasingTestBuiltins().codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); \
279 }
280 WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
281 #undef DEFINE_BUILTIN_GENERATOR
282
283
284 } // namespace WebCore
285
286 #endif // ENABLE(STREAMS_API)
287
288 ### End File: xmlCasingTestBuiltins.cpp