1 | /* |
2 | This file is part of the WebKit open source project. |
3 | This file has been generated by generate-bindings.pl. DO NOT MODIFY! |
4 | |
5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. |
9 | |
10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. |
14 | |
15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 | Boston, MA 02110-1301, USA. |
19 | */ |
20 | |
21 | #include "config.h" |
22 | #include "JSDOMURL.h" |
23 | |
24 | #include "JSBlob.h" |
25 | #include "JSDOMAttribute.h" |
26 | #include "JSDOMBinding.h" |
27 | #include "JSDOMConstructor.h" |
28 | #include "JSDOMConvertInterface.h" |
29 | #include "JSDOMConvertStrings.h" |
30 | #include "JSDOMExceptionHandling.h" |
31 | #include "JSDOMGlobalObject.h" |
32 | #include "JSDOMOperation.h" |
33 | #include "JSDOMURL.h" |
34 | #include "JSDOMWrapperCache.h" |
35 | #include "JSURLSearchParams.h" |
36 | #include "ScriptExecutionContext.h" |
37 | #include <JavaScriptCore/FunctionPrototype.h> |
38 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
39 | #include <JavaScriptCore/JSCInlines.h> |
40 | #include <wtf/GetPtr.h> |
41 | #include <wtf/PointerPreparations.h> |
42 | #include <wtf/URL.h> |
43 | |
44 | #if ENABLE(MEDIA_SOURCE) |
45 | #include "DOMURLMediaSource.h" |
46 | #include "JSMediaSource.h" |
47 | #endif |
48 | |
49 | |
50 | namespace WebCore { |
51 | using namespace JSC; |
52 | |
53 | // Functions |
54 | |
55 | JSC::EncodedJSValue JSC_HOST_CALL jsDOMURLPrototypeFunctionToJSON(JSC::ExecState*); |
56 | JSC::EncodedJSValue JSC_HOST_CALL jsDOMURLConstructorFunctionCreateObjectURL(JSC::ExecState*); |
57 | JSC::EncodedJSValue JSC_HOST_CALL jsDOMURLConstructorFunctionRevokeObjectURL(JSC::ExecState*); |
58 | JSC::EncodedJSValue JSC_HOST_CALL jsDOMURLPrototypeFunctionToString(JSC::ExecState*); |
59 | |
60 | // Attributes |
61 | |
62 | JSC::EncodedJSValue jsDOMURLConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
63 | bool setJSDOMURLConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
64 | JSC::EncodedJSValue jsDOMURLHref(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
65 | bool setJSDOMURLHref(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
66 | JSC::EncodedJSValue jsDOMURLOrigin(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
67 | JSC::EncodedJSValue jsDOMURLProtocol(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
68 | bool setJSDOMURLProtocol(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
69 | JSC::EncodedJSValue jsDOMURLUsername(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
70 | bool setJSDOMURLUsername(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
71 | JSC::EncodedJSValue jsDOMURLPassword(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
72 | bool setJSDOMURLPassword(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
73 | JSC::EncodedJSValue jsDOMURLHost(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
74 | bool setJSDOMURLHost(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
75 | JSC::EncodedJSValue jsDOMURLHostname(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
76 | bool setJSDOMURLHostname(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
77 | JSC::EncodedJSValue jsDOMURLPort(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
78 | bool setJSDOMURLPort(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
79 | JSC::EncodedJSValue jsDOMURLPathname(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
80 | bool setJSDOMURLPathname(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
81 | JSC::EncodedJSValue jsDOMURLHash(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
82 | bool setJSDOMURLHash(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
83 | JSC::EncodedJSValue jsDOMURLSearch(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
84 | bool setJSDOMURLSearch(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
85 | JSC::EncodedJSValue jsDOMURLSearchParams(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
86 | |
87 | class JSDOMURLPrototype : public JSC::JSNonFinalObject { |
88 | public: |
89 | using Base = JSC::JSNonFinalObject; |
90 | static JSDOMURLPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
91 | { |
92 | JSDOMURLPrototype* ptr = new (NotNull, JSC::allocateCell<JSDOMURLPrototype>(vm.heap)) JSDOMURLPrototype(vm, globalObject, structure); |
93 | ptr->finishCreation(vm); |
94 | return ptr; |
95 | } |
96 | |
97 | DECLARE_INFO; |
98 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
99 | { |
100 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
101 | } |
102 | |
103 | private: |
104 | JSDOMURLPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
105 | : JSC::JSNonFinalObject(vm, structure) |
106 | { |
107 | } |
108 | |
109 | void finishCreation(JSC::VM&); |
110 | }; |
111 | |
112 | using JSDOMURLConstructor = JSDOMConstructor<JSDOMURL>; |
113 | |
114 | /* Hash table for constructor */ |
115 | |
116 | static const HashTableValue JSDOMURLConstructorTableValues[] = |
117 | { |
118 | { "createObjectURL" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsDOMURLConstructorFunctionCreateObjectURL), (intptr_t) (1) } }, |
119 | { "revokeObjectURL" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsDOMURLConstructorFunctionRevokeObjectURL), (intptr_t) (1) } }, |
120 | }; |
121 | |
122 | static inline EncodedJSValue constructJSDOMURL1(ExecState* state) |
123 | { |
124 | VM& vm = state->vm(); |
125 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
126 | UNUSED_PARAM(throwScope); |
127 | auto* castedThis = jsCast<JSDOMURLConstructor*>(state->jsCallee()); |
128 | ASSERT(castedThis); |
129 | auto url = convert<IDLUSVString>(*state, state->uncheckedArgument(0)); |
130 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
131 | auto object = DOMURL::create(WTFMove(url)); |
132 | return JSValue::encode(toJSNewlyCreated<IDLInterface<DOMURL>>(*state, *castedThis->globalObject(), throwScope, WTFMove(object))); |
133 | } |
134 | |
135 | static inline EncodedJSValue constructJSDOMURL2(ExecState* state) |
136 | { |
137 | VM& vm = state->vm(); |
138 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
139 | UNUSED_PARAM(throwScope); |
140 | auto* castedThis = jsCast<JSDOMURLConstructor*>(state->jsCallee()); |
141 | ASSERT(castedThis); |
142 | auto url = convert<IDLUSVString>(*state, state->uncheckedArgument(0)); |
143 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
144 | auto base = convert<IDLUSVString>(*state, state->uncheckedArgument(1)); |
145 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
146 | auto object = DOMURL::create(WTFMove(url), WTFMove(base)); |
147 | return JSValue::encode(toJSNewlyCreated<IDLInterface<DOMURL>>(*state, *castedThis->globalObject(), throwScope, WTFMove(object))); |
148 | } |
149 | |
150 | static inline EncodedJSValue constructJSDOMURL3(ExecState* state) |
151 | { |
152 | VM& vm = state->vm(); |
153 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
154 | UNUSED_PARAM(throwScope); |
155 | auto* castedThis = jsCast<JSDOMURLConstructor*>(state->jsCallee()); |
156 | ASSERT(castedThis); |
157 | auto url = convert<IDLUSVString>(*state, state->uncheckedArgument(0)); |
158 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
159 | auto base = convert<IDLInterface<DOMURL>>(*state, state->uncheckedArgument(1), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 1, "base" , "URL" , nullptr, "DOMURL" ); }); |
160 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
161 | auto object = DOMURL::create(WTFMove(url), *base); |
162 | return JSValue::encode(toJSNewlyCreated<IDLInterface<DOMURL>>(*state, *castedThis->globalObject(), throwScope, WTFMove(object))); |
163 | } |
164 | |
165 | template<> EncodedJSValue JSC_HOST_CALL JSDOMURLConstructor::construct(ExecState* state) |
166 | { |
167 | VM& vm = state->vm(); |
168 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
169 | UNUSED_PARAM(throwScope); |
170 | size_t argsCount = std::min<size_t>(2, state->argumentCount()); |
171 | if (argsCount == 1) { |
172 | return constructJSDOMURL1(state); |
173 | } |
174 | if (argsCount == 2) { |
175 | JSValue distinguishingArg = state->uncheckedArgument(1); |
176 | if (distinguishingArg.isObject() && asObject(distinguishingArg)->inherits<JSDOMURL>(vm)) |
177 | return constructJSDOMURL3(state); |
178 | return constructJSDOMURL2(state); |
179 | } |
180 | return argsCount < 1 ? throwVMError(state, throwScope, createNotEnoughArgumentsError(state)) : throwVMTypeError(state, throwScope); |
181 | } |
182 | |
183 | template<> JSValue JSDOMURLConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
184 | { |
185 | UNUSED_PARAM(vm); |
186 | return globalObject.functionPrototype(); |
187 | } |
188 | |
189 | template<> void JSDOMURLConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
190 | { |
191 | putDirect(vm, vm.propertyNames->prototype, JSDOMURL::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
192 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("URL"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
193 | putDirect(vm, vm.propertyNames->length, jsNumber(1), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
194 | reifyStaticProperties(vm, JSDOMURL::info(), JSDOMURLConstructorTableValues, *this); |
195 | } |
196 | |
197 | template<> const ClassInfo JSDOMURLConstructor::s_info = { "URL" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDOMURLConstructor) }; |
198 | |
199 | /* Hash table for prototype */ |
200 | |
201 | static const HashTableValue JSDOMURLPrototypeTableValues[] = |
202 | { |
203 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMURLConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSDOMURLConstructor) } }, |
204 | { "href" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMURLHref), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSDOMURLHref) } }, |
205 | { "origin" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMURLOrigin), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
206 | { "protocol" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMURLProtocol), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSDOMURLProtocol) } }, |
207 | { "username" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMURLUsername), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSDOMURLUsername) } }, |
208 | { "password" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMURLPassword), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSDOMURLPassword) } }, |
209 | { "host" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMURLHost), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSDOMURLHost) } }, |
210 | { "hostname" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMURLHostname), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSDOMURLHostname) } }, |
211 | { "port" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMURLPort), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSDOMURLPort) } }, |
212 | { "pathname" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMURLPathname), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSDOMURLPathname) } }, |
213 | { "hash" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMURLHash), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSDOMURLHash) } }, |
214 | { "search" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMURLSearch), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSDOMURLSearch) } }, |
215 | { "searchParams" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMURLSearchParams), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
216 | { "toJSON" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsDOMURLPrototypeFunctionToJSON), (intptr_t) (0) } }, |
217 | { "toString" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsDOMURLPrototypeFunctionToString), (intptr_t) (0) } }, |
218 | }; |
219 | |
220 | const ClassInfo JSDOMURLPrototype::s_info = { "URLPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDOMURLPrototype) }; |
221 | |
222 | void JSDOMURLPrototype::finishCreation(VM& vm) |
223 | { |
224 | Base::finishCreation(vm); |
225 | reifyStaticProperties(vm, JSDOMURL::info(), JSDOMURLPrototypeTableValues, *this); |
226 | } |
227 | |
228 | const ClassInfo JSDOMURL::s_info = { "URL" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDOMURL) }; |
229 | |
230 | JSDOMURL::JSDOMURL(Structure* structure, JSDOMGlobalObject& globalObject, Ref<DOMURL>&& impl) |
231 | : JSDOMWrapper<DOMURL>(structure, globalObject, WTFMove(impl)) |
232 | { |
233 | } |
234 | |
235 | void JSDOMURL::finishCreation(VM& vm) |
236 | { |
237 | Base::finishCreation(vm); |
238 | ASSERT(inherits(vm, info())); |
239 | |
240 | } |
241 | |
242 | JSObject* JSDOMURL::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
243 | { |
244 | return JSDOMURLPrototype::create(vm, &globalObject, JSDOMURLPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); |
245 | } |
246 | |
247 | JSObject* JSDOMURL::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
248 | { |
249 | return getDOMPrototype<JSDOMURL>(vm, globalObject); |
250 | } |
251 | |
252 | JSValue JSDOMURL::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
253 | { |
254 | return getDOMConstructor<JSDOMURLConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
255 | } |
256 | |
257 | void JSDOMURL::destroy(JSC::JSCell* cell) |
258 | { |
259 | JSDOMURL* thisObject = static_cast<JSDOMURL*>(cell); |
260 | thisObject->JSDOMURL::~JSDOMURL(); |
261 | } |
262 | |
263 | template<> inline JSDOMURL* IDLAttribute<JSDOMURL>::cast(ExecState& state, EncodedJSValue thisValue) |
264 | { |
265 | return jsDynamicCast<JSDOMURL*>(state.vm(), JSValue::decode(thisValue)); |
266 | } |
267 | |
268 | template<> inline JSDOMURL* IDLOperation<JSDOMURL>::cast(ExecState& state) |
269 | { |
270 | return jsDynamicCast<JSDOMURL*>(state.vm(), state.thisValue()); |
271 | } |
272 | |
273 | EncodedJSValue jsDOMURLConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
274 | { |
275 | VM& vm = state->vm(); |
276 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
277 | auto* prototype = jsDynamicCast<JSDOMURLPrototype*>(vm, JSValue::decode(thisValue)); |
278 | if (UNLIKELY(!prototype)) |
279 | return throwVMTypeError(state, throwScope); |
280 | return JSValue::encode(JSDOMURL::getConstructor(state->vm(), prototype->globalObject())); |
281 | } |
282 | |
283 | bool setJSDOMURLConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
284 | { |
285 | VM& vm = state->vm(); |
286 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
287 | auto* prototype = jsDynamicCast<JSDOMURLPrototype*>(vm, JSValue::decode(thisValue)); |
288 | if (UNLIKELY(!prototype)) { |
289 | throwVMTypeError(state, throwScope); |
290 | return false; |
291 | } |
292 | // Shadowing a built-in constructor |
293 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
294 | } |
295 | |
296 | static inline JSValue jsDOMURLHrefGetter(ExecState& state, JSDOMURL& thisObject, ThrowScope& throwScope) |
297 | { |
298 | UNUSED_PARAM(throwScope); |
299 | UNUSED_PARAM(state); |
300 | auto& impl = thisObject.wrapped(); |
301 | JSValue result = toJS<IDLUSVString>(state, throwScope, impl.href()); |
302 | return result; |
303 | } |
304 | |
305 | EncodedJSValue jsDOMURLHref(ExecState* state, EncodedJSValue thisValue, PropertyName) |
306 | { |
307 | return IDLAttribute<JSDOMURL>::get<jsDOMURLHrefGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "href" ); |
308 | } |
309 | |
310 | static inline bool setJSDOMURLHrefSetter(ExecState& state, JSDOMURL& thisObject, JSValue value, ThrowScope& throwScope) |
311 | { |
312 | UNUSED_PARAM(throwScope); |
313 | auto& impl = thisObject.wrapped(); |
314 | auto nativeValue = convert<IDLUSVString>(state, value); |
315 | RETURN_IF_EXCEPTION(throwScope, false); |
316 | AttributeSetter::call(state, throwScope, [&] { |
317 | return impl.setHref(WTFMove(nativeValue)); |
318 | }); |
319 | return true; |
320 | } |
321 | |
322 | bool setJSDOMURLHref(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
323 | { |
324 | return IDLAttribute<JSDOMURL>::set<setJSDOMURLHrefSetter>(*state, thisValue, encodedValue, "href" ); |
325 | } |
326 | |
327 | static inline JSValue jsDOMURLOriginGetter(ExecState& state, JSDOMURL& thisObject, ThrowScope& throwScope) |
328 | { |
329 | UNUSED_PARAM(throwScope); |
330 | UNUSED_PARAM(state); |
331 | auto& impl = thisObject.wrapped(); |
332 | JSValue result = toJS<IDLUSVString>(state, throwScope, impl.origin()); |
333 | return result; |
334 | } |
335 | |
336 | EncodedJSValue jsDOMURLOrigin(ExecState* state, EncodedJSValue thisValue, PropertyName) |
337 | { |
338 | return IDLAttribute<JSDOMURL>::get<jsDOMURLOriginGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "origin" ); |
339 | } |
340 | |
341 | static inline JSValue jsDOMURLProtocolGetter(ExecState& state, JSDOMURL& thisObject, ThrowScope& throwScope) |
342 | { |
343 | UNUSED_PARAM(throwScope); |
344 | UNUSED_PARAM(state); |
345 | auto& impl = thisObject.wrapped(); |
346 | JSValue result = toJS<IDLUSVString>(state, throwScope, impl.protocol()); |
347 | return result; |
348 | } |
349 | |
350 | EncodedJSValue jsDOMURLProtocol(ExecState* state, EncodedJSValue thisValue, PropertyName) |
351 | { |
352 | return IDLAttribute<JSDOMURL>::get<jsDOMURLProtocolGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "protocol" ); |
353 | } |
354 | |
355 | static inline bool setJSDOMURLProtocolSetter(ExecState& state, JSDOMURL& thisObject, JSValue value, ThrowScope& throwScope) |
356 | { |
357 | UNUSED_PARAM(throwScope); |
358 | auto& impl = thisObject.wrapped(); |
359 | auto nativeValue = convert<IDLUSVString>(state, value); |
360 | RETURN_IF_EXCEPTION(throwScope, false); |
361 | AttributeSetter::call(state, throwScope, [&] { |
362 | return impl.setProtocol(WTFMove(nativeValue)); |
363 | }); |
364 | return true; |
365 | } |
366 | |
367 | bool setJSDOMURLProtocol(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
368 | { |
369 | return IDLAttribute<JSDOMURL>::set<setJSDOMURLProtocolSetter>(*state, thisValue, encodedValue, "protocol" ); |
370 | } |
371 | |
372 | static inline JSValue jsDOMURLUsernameGetter(ExecState& state, JSDOMURL& thisObject, ThrowScope& throwScope) |
373 | { |
374 | UNUSED_PARAM(throwScope); |
375 | UNUSED_PARAM(state); |
376 | auto& impl = thisObject.wrapped(); |
377 | JSValue result = toJS<IDLUSVString>(state, throwScope, impl.username()); |
378 | return result; |
379 | } |
380 | |
381 | EncodedJSValue jsDOMURLUsername(ExecState* state, EncodedJSValue thisValue, PropertyName) |
382 | { |
383 | return IDLAttribute<JSDOMURL>::get<jsDOMURLUsernameGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "username" ); |
384 | } |
385 | |
386 | static inline bool setJSDOMURLUsernameSetter(ExecState& state, JSDOMURL& thisObject, JSValue value, ThrowScope& throwScope) |
387 | { |
388 | UNUSED_PARAM(throwScope); |
389 | auto& impl = thisObject.wrapped(); |
390 | auto nativeValue = convert<IDLUSVString>(state, value); |
391 | RETURN_IF_EXCEPTION(throwScope, false); |
392 | AttributeSetter::call(state, throwScope, [&] { |
393 | return impl.setUsername(WTFMove(nativeValue)); |
394 | }); |
395 | return true; |
396 | } |
397 | |
398 | bool setJSDOMURLUsername(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
399 | { |
400 | return IDLAttribute<JSDOMURL>::set<setJSDOMURLUsernameSetter>(*state, thisValue, encodedValue, "username" ); |
401 | } |
402 | |
403 | static inline JSValue jsDOMURLPasswordGetter(ExecState& state, JSDOMURL& thisObject, ThrowScope& throwScope) |
404 | { |
405 | UNUSED_PARAM(throwScope); |
406 | UNUSED_PARAM(state); |
407 | auto& impl = thisObject.wrapped(); |
408 | JSValue result = toJS<IDLUSVString>(state, throwScope, impl.password()); |
409 | return result; |
410 | } |
411 | |
412 | EncodedJSValue jsDOMURLPassword(ExecState* state, EncodedJSValue thisValue, PropertyName) |
413 | { |
414 | return IDLAttribute<JSDOMURL>::get<jsDOMURLPasswordGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "password" ); |
415 | } |
416 | |
417 | static inline bool setJSDOMURLPasswordSetter(ExecState& state, JSDOMURL& thisObject, JSValue value, ThrowScope& throwScope) |
418 | { |
419 | UNUSED_PARAM(throwScope); |
420 | auto& impl = thisObject.wrapped(); |
421 | auto nativeValue = convert<IDLUSVString>(state, value); |
422 | RETURN_IF_EXCEPTION(throwScope, false); |
423 | AttributeSetter::call(state, throwScope, [&] { |
424 | return impl.setPassword(WTFMove(nativeValue)); |
425 | }); |
426 | return true; |
427 | } |
428 | |
429 | bool setJSDOMURLPassword(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
430 | { |
431 | return IDLAttribute<JSDOMURL>::set<setJSDOMURLPasswordSetter>(*state, thisValue, encodedValue, "password" ); |
432 | } |
433 | |
434 | static inline JSValue jsDOMURLHostGetter(ExecState& state, JSDOMURL& thisObject, ThrowScope& throwScope) |
435 | { |
436 | UNUSED_PARAM(throwScope); |
437 | UNUSED_PARAM(state); |
438 | auto& impl = thisObject.wrapped(); |
439 | JSValue result = toJS<IDLUSVString>(state, throwScope, impl.host()); |
440 | return result; |
441 | } |
442 | |
443 | EncodedJSValue jsDOMURLHost(ExecState* state, EncodedJSValue thisValue, PropertyName) |
444 | { |
445 | return IDLAttribute<JSDOMURL>::get<jsDOMURLHostGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "host" ); |
446 | } |
447 | |
448 | static inline bool setJSDOMURLHostSetter(ExecState& state, JSDOMURL& thisObject, JSValue value, ThrowScope& throwScope) |
449 | { |
450 | UNUSED_PARAM(throwScope); |
451 | auto& impl = thisObject.wrapped(); |
452 | auto nativeValue = convert<IDLUSVString>(state, value); |
453 | RETURN_IF_EXCEPTION(throwScope, false); |
454 | AttributeSetter::call(state, throwScope, [&] { |
455 | return impl.setHost(WTFMove(nativeValue)); |
456 | }); |
457 | return true; |
458 | } |
459 | |
460 | bool setJSDOMURLHost(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
461 | { |
462 | return IDLAttribute<JSDOMURL>::set<setJSDOMURLHostSetter>(*state, thisValue, encodedValue, "host" ); |
463 | } |
464 | |
465 | static inline JSValue jsDOMURLHostnameGetter(ExecState& state, JSDOMURL& thisObject, ThrowScope& throwScope) |
466 | { |
467 | UNUSED_PARAM(throwScope); |
468 | UNUSED_PARAM(state); |
469 | auto& impl = thisObject.wrapped(); |
470 | JSValue result = toJS<IDLUSVString>(state, throwScope, impl.hostname()); |
471 | return result; |
472 | } |
473 | |
474 | EncodedJSValue jsDOMURLHostname(ExecState* state, EncodedJSValue thisValue, PropertyName) |
475 | { |
476 | return IDLAttribute<JSDOMURL>::get<jsDOMURLHostnameGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "hostname" ); |
477 | } |
478 | |
479 | static inline bool setJSDOMURLHostnameSetter(ExecState& state, JSDOMURL& thisObject, JSValue value, ThrowScope& throwScope) |
480 | { |
481 | UNUSED_PARAM(throwScope); |
482 | auto& impl = thisObject.wrapped(); |
483 | auto nativeValue = convert<IDLUSVString>(state, value); |
484 | RETURN_IF_EXCEPTION(throwScope, false); |
485 | AttributeSetter::call(state, throwScope, [&] { |
486 | return impl.setHostname(WTFMove(nativeValue)); |
487 | }); |
488 | return true; |
489 | } |
490 | |
491 | bool setJSDOMURLHostname(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
492 | { |
493 | return IDLAttribute<JSDOMURL>::set<setJSDOMURLHostnameSetter>(*state, thisValue, encodedValue, "hostname" ); |
494 | } |
495 | |
496 | static inline JSValue jsDOMURLPortGetter(ExecState& state, JSDOMURL& thisObject, ThrowScope& throwScope) |
497 | { |
498 | UNUSED_PARAM(throwScope); |
499 | UNUSED_PARAM(state); |
500 | auto& impl = thisObject.wrapped(); |
501 | JSValue result = toJS<IDLUSVString>(state, throwScope, impl.port()); |
502 | return result; |
503 | } |
504 | |
505 | EncodedJSValue jsDOMURLPort(ExecState* state, EncodedJSValue thisValue, PropertyName) |
506 | { |
507 | return IDLAttribute<JSDOMURL>::get<jsDOMURLPortGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "port" ); |
508 | } |
509 | |
510 | static inline bool setJSDOMURLPortSetter(ExecState& state, JSDOMURL& thisObject, JSValue value, ThrowScope& throwScope) |
511 | { |
512 | UNUSED_PARAM(throwScope); |
513 | auto& impl = thisObject.wrapped(); |
514 | auto nativeValue = convert<IDLUSVString>(state, value); |
515 | RETURN_IF_EXCEPTION(throwScope, false); |
516 | AttributeSetter::call(state, throwScope, [&] { |
517 | return impl.setPort(WTFMove(nativeValue)); |
518 | }); |
519 | return true; |
520 | } |
521 | |
522 | bool setJSDOMURLPort(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
523 | { |
524 | return IDLAttribute<JSDOMURL>::set<setJSDOMURLPortSetter>(*state, thisValue, encodedValue, "port" ); |
525 | } |
526 | |
527 | static inline JSValue jsDOMURLPathnameGetter(ExecState& state, JSDOMURL& thisObject, ThrowScope& throwScope) |
528 | { |
529 | UNUSED_PARAM(throwScope); |
530 | UNUSED_PARAM(state); |
531 | auto& impl = thisObject.wrapped(); |
532 | JSValue result = toJS<IDLUSVString>(state, throwScope, impl.pathname()); |
533 | return result; |
534 | } |
535 | |
536 | EncodedJSValue jsDOMURLPathname(ExecState* state, EncodedJSValue thisValue, PropertyName) |
537 | { |
538 | return IDLAttribute<JSDOMURL>::get<jsDOMURLPathnameGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "pathname" ); |
539 | } |
540 | |
541 | static inline bool setJSDOMURLPathnameSetter(ExecState& state, JSDOMURL& thisObject, JSValue value, ThrowScope& throwScope) |
542 | { |
543 | UNUSED_PARAM(throwScope); |
544 | auto& impl = thisObject.wrapped(); |
545 | auto nativeValue = convert<IDLUSVString>(state, value); |
546 | RETURN_IF_EXCEPTION(throwScope, false); |
547 | AttributeSetter::call(state, throwScope, [&] { |
548 | return impl.setPathname(WTFMove(nativeValue)); |
549 | }); |
550 | return true; |
551 | } |
552 | |
553 | bool setJSDOMURLPathname(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
554 | { |
555 | return IDLAttribute<JSDOMURL>::set<setJSDOMURLPathnameSetter>(*state, thisValue, encodedValue, "pathname" ); |
556 | } |
557 | |
558 | static inline JSValue jsDOMURLHashGetter(ExecState& state, JSDOMURL& thisObject, ThrowScope& throwScope) |
559 | { |
560 | UNUSED_PARAM(throwScope); |
561 | UNUSED_PARAM(state); |
562 | auto& impl = thisObject.wrapped(); |
563 | JSValue result = toJS<IDLUSVString>(state, throwScope, impl.hash()); |
564 | return result; |
565 | } |
566 | |
567 | EncodedJSValue jsDOMURLHash(ExecState* state, EncodedJSValue thisValue, PropertyName) |
568 | { |
569 | return IDLAttribute<JSDOMURL>::get<jsDOMURLHashGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "hash" ); |
570 | } |
571 | |
572 | static inline bool setJSDOMURLHashSetter(ExecState& state, JSDOMURL& thisObject, JSValue value, ThrowScope& throwScope) |
573 | { |
574 | UNUSED_PARAM(throwScope); |
575 | auto& impl = thisObject.wrapped(); |
576 | auto nativeValue = convert<IDLUSVString>(state, value); |
577 | RETURN_IF_EXCEPTION(throwScope, false); |
578 | AttributeSetter::call(state, throwScope, [&] { |
579 | return impl.setHash(WTFMove(nativeValue)); |
580 | }); |
581 | return true; |
582 | } |
583 | |
584 | bool setJSDOMURLHash(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
585 | { |
586 | return IDLAttribute<JSDOMURL>::set<setJSDOMURLHashSetter>(*state, thisValue, encodedValue, "hash" ); |
587 | } |
588 | |
589 | static inline JSValue jsDOMURLSearchGetter(ExecState& state, JSDOMURL& thisObject, ThrowScope& throwScope) |
590 | { |
591 | UNUSED_PARAM(throwScope); |
592 | UNUSED_PARAM(state); |
593 | auto& impl = thisObject.wrapped(); |
594 | JSValue result = toJS<IDLUSVString>(state, throwScope, impl.search()); |
595 | return result; |
596 | } |
597 | |
598 | EncodedJSValue jsDOMURLSearch(ExecState* state, EncodedJSValue thisValue, PropertyName) |
599 | { |
600 | return IDLAttribute<JSDOMURL>::get<jsDOMURLSearchGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "search" ); |
601 | } |
602 | |
603 | static inline bool setJSDOMURLSearchSetter(ExecState& state, JSDOMURL& thisObject, JSValue value, ThrowScope& throwScope) |
604 | { |
605 | UNUSED_PARAM(throwScope); |
606 | auto& impl = thisObject.wrapped(); |
607 | auto nativeValue = convert<IDLUSVString>(state, value); |
608 | RETURN_IF_EXCEPTION(throwScope, false); |
609 | AttributeSetter::call(state, throwScope, [&] { |
610 | return impl.setSearch(WTFMove(nativeValue)); |
611 | }); |
612 | return true; |
613 | } |
614 | |
615 | bool setJSDOMURLSearch(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
616 | { |
617 | return IDLAttribute<JSDOMURL>::set<setJSDOMURLSearchSetter>(*state, thisValue, encodedValue, "search" ); |
618 | } |
619 | |
620 | static inline JSValue jsDOMURLSearchParamsGetter(ExecState& state, JSDOMURL& thisObject, ThrowScope& throwScope) |
621 | { |
622 | UNUSED_PARAM(throwScope); |
623 | UNUSED_PARAM(state); |
624 | if (JSValue cachedValue = thisObject.m_searchParams.get()) |
625 | return cachedValue; |
626 | auto& impl = thisObject.wrapped(); |
627 | JSValue result = toJS<IDLInterface<URLSearchParams>>(state, *thisObject.globalObject(), throwScope, impl.searchParams()); |
628 | thisObject.m_searchParams.set(state.vm(), &thisObject, result); |
629 | return result; |
630 | } |
631 | |
632 | EncodedJSValue jsDOMURLSearchParams(ExecState* state, EncodedJSValue thisValue, PropertyName) |
633 | { |
634 | return IDLAttribute<JSDOMURL>::get<jsDOMURLSearchParamsGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "searchParams" ); |
635 | } |
636 | |
637 | static inline JSC::EncodedJSValue jsDOMURLPrototypeFunctionToJSONBody(JSC::ExecState* state, typename IDLOperation<JSDOMURL>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
638 | { |
639 | UNUSED_PARAM(state); |
640 | UNUSED_PARAM(throwScope); |
641 | auto& impl = castedThis->wrapped(); |
642 | return JSValue::encode(toJS<IDLUSVString>(*state, impl.toJSON())); |
643 | } |
644 | |
645 | EncodedJSValue JSC_HOST_CALL jsDOMURLPrototypeFunctionToJSON(ExecState* state) |
646 | { |
647 | return IDLOperation<JSDOMURL>::call<jsDOMURLPrototypeFunctionToJSONBody>(*state, "toJSON" ); |
648 | } |
649 | |
650 | static inline JSC::EncodedJSValue jsDOMURLConstructorFunctionCreateObjectURL1Body(JSC::ExecState* state, JSC::ThrowScope& throwScope) |
651 | { |
652 | UNUSED_PARAM(state); |
653 | UNUSED_PARAM(throwScope); |
654 | auto* context = jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject())->scriptExecutionContext(); |
655 | if (UNLIKELY(!context)) |
656 | return JSValue::encode(jsUndefined()); |
657 | auto blob = convert<IDLInterface<Blob>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "blob" , "URL" , "createObjectURL" , "Blob" ); }); |
658 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
659 | return JSValue::encode(toJS<IDLDOMString>(*state, DOMURL::createObjectURL(*context, *blob))); |
660 | } |
661 | |
662 | static inline JSC::EncodedJSValue jsDOMURLConstructorFunctionRevokeObjectURLBody(JSC::ExecState* state, JSC::ThrowScope& throwScope) |
663 | { |
664 | UNUSED_PARAM(state); |
665 | UNUSED_PARAM(throwScope); |
666 | if (UNLIKELY(state->argumentCount() < 1)) |
667 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
668 | auto* context = jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject())->scriptExecutionContext(); |
669 | if (UNLIKELY(!context)) |
670 | return JSValue::encode(jsUndefined()); |
671 | auto url = convert<IDLDOMString>(*state, state->uncheckedArgument(0)); |
672 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
673 | DOMURL::revokeObjectURL(*context, WTFMove(url)); |
674 | return JSValue::encode(jsUndefined()); |
675 | } |
676 | |
677 | EncodedJSValue JSC_HOST_CALL jsDOMURLConstructorFunctionRevokeObjectURL(ExecState* state) |
678 | { |
679 | return IDLOperation<JSDOMURL>::callStatic<jsDOMURLConstructorFunctionRevokeObjectURLBody>(*state, "revokeObjectURL" ); |
680 | } |
681 | |
682 | #if ENABLE(MEDIA_SOURCE) |
683 | static inline JSC::EncodedJSValue jsDOMURLConstructorFunctionCreateObjectURL2Body(JSC::ExecState* state, JSC::ThrowScope& throwScope) |
684 | { |
685 | UNUSED_PARAM(state); |
686 | UNUSED_PARAM(throwScope); |
687 | auto* context = jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject())->scriptExecutionContext(); |
688 | if (UNLIKELY(!context)) |
689 | return JSValue::encode(jsUndefined()); |
690 | auto source = convert<IDLInterface<MediaSource>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "source" , "URL" , "createObjectURL" , "MediaSource" ); }); |
691 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
692 | return JSValue::encode(toJS<IDLDOMString>(*state, WebCore::DOMURLMediaSource::createObjectURL(*context, *source))); |
693 | } |
694 | |
695 | #endif |
696 | |
697 | static inline JSC::EncodedJSValue jsDOMURLConstructorFunctionCreateObjectURLOverloadDispatcher(JSC::ExecState* state, JSC::ThrowScope& throwScope) |
698 | { |
699 | UNUSED_PARAM(state); |
700 | UNUSED_PARAM(throwScope); |
701 | VM& vm = state->vm(); |
702 | UNUSED_PARAM(vm); |
703 | size_t argsCount = std::min<size_t>(1, state->argumentCount()); |
704 | if (argsCount == 1) { |
705 | JSValue distinguishingArg = state->uncheckedArgument(0); |
706 | if (distinguishingArg.isObject() && asObject(distinguishingArg)->inherits<JSBlob>(vm)) |
707 | return jsDOMURLConstructorFunctionCreateObjectURL1Body(state, throwScope); |
708 | #if ENABLE(MEDIA_SOURCE) |
709 | if (distinguishingArg.isObject() && asObject(distinguishingArg)->inherits<JSMediaSource>(vm)) |
710 | return jsDOMURLConstructorFunctionCreateObjectURL2Body(state, throwScope); |
711 | #endif |
712 | } |
713 | return argsCount < 1 ? throwVMError(state, throwScope, createNotEnoughArgumentsError(state)) : throwVMTypeError(state, throwScope); |
714 | } |
715 | |
716 | EncodedJSValue JSC_HOST_CALL jsDOMURLConstructorFunctionCreateObjectURL(ExecState* state) |
717 | { |
718 | return IDLOperation<JSDOMURL>::callStatic<jsDOMURLConstructorFunctionCreateObjectURLOverloadDispatcher>(*state, "createObjectURL" ); |
719 | } |
720 | |
721 | static inline JSC::EncodedJSValue jsDOMURLPrototypeFunctionToStringBody(JSC::ExecState* state, typename IDLOperation<JSDOMURL>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
722 | { |
723 | UNUSED_PARAM(state); |
724 | UNUSED_PARAM(throwScope); |
725 | auto& impl = castedThis->wrapped(); |
726 | return JSValue::encode(toJS<IDLUSVString>(*state, impl.href())); |
727 | } |
728 | |
729 | EncodedJSValue JSC_HOST_CALL jsDOMURLPrototypeFunctionToString(ExecState* state) |
730 | { |
731 | return IDLOperation<JSDOMURL>::call<jsDOMURLPrototypeFunctionToStringBody>(*state, "toString" ); |
732 | } |
733 | |
734 | void JSDOMURL::visitChildren(JSCell* cell, SlotVisitor& visitor) |
735 | { |
736 | auto* thisObject = jsCast<JSDOMURL*>(cell); |
737 | ASSERT_GC_OBJECT_INHERITS(thisObject, info()); |
738 | Base::visitChildren(thisObject, visitor); |
739 | visitor.append(thisObject->m_searchParams); |
740 | } |
741 | |
742 | void JSDOMURL::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
743 | { |
744 | auto* thisObject = jsCast<JSDOMURL*>(cell); |
745 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
746 | if (thisObject->scriptExecutionContext()) |
747 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
748 | Base::heapSnapshot(cell, builder); |
749 | } |
750 | |
751 | bool JSDOMURLOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason) |
752 | { |
753 | UNUSED_PARAM(handle); |
754 | UNUSED_PARAM(visitor); |
755 | UNUSED_PARAM(reason); |
756 | return false; |
757 | } |
758 | |
759 | void JSDOMURLOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) |
760 | { |
761 | auto* jsDOMURL = static_cast<JSDOMURL*>(handle.slot()->asCell()); |
762 | auto& world = *static_cast<DOMWrapperWorld*>(context); |
763 | uncacheWrapper(world, &jsDOMURL->wrapped(), jsDOMURL); |
764 | } |
765 | |
766 | JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<DOMURL>&& impl) |
767 | { |
768 | // If you hit this failure the interface definition has the ImplementationLacksVTable |
769 | // attribute. You should remove that attribute. If the class has subclasses |
770 | // that may be passed through this toJS() function you should use the SkipVTableValidation |
771 | // attribute to DOMURL. |
772 | static_assert(!std::is_polymorphic<DOMURL>::value, "DOMURL is polymorphic but the IDL claims it is not" ); |
773 | return createWrapper<DOMURL>(globalObject, WTFMove(impl)); |
774 | } |
775 | |
776 | JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, DOMURL& impl) |
777 | { |
778 | return wrap(state, globalObject, impl); |
779 | } |
780 | |
781 | DOMURL* JSDOMURL::toWrapped(JSC::VM& vm, JSC::JSValue value) |
782 | { |
783 | if (auto* wrapper = jsDynamicCast<JSDOMURL*>(vm, value)) |
784 | return &wrapper->wrapped(); |
785 | return nullptr; |
786 | } |
787 | |
788 | } |
789 | |