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 "JSStorageEvent.h" |
23 | |
24 | #include "JSDOMAttribute.h" |
25 | #include "JSDOMBinding.h" |
26 | #include "JSDOMConstructor.h" |
27 | #include "JSDOMConvertBoolean.h" |
28 | #include "JSDOMConvertInterface.h" |
29 | #include "JSDOMConvertNullable.h" |
30 | #include "JSDOMConvertStrings.h" |
31 | #include "JSDOMExceptionHandling.h" |
32 | #include "JSDOMGlobalObject.h" |
33 | #include "JSDOMOperation.h" |
34 | #include "JSDOMWrapperCache.h" |
35 | #include "JSStorage.h" |
36 | #include "ScriptExecutionContext.h" |
37 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
38 | #include <JavaScriptCore/JSCInlines.h> |
39 | #include <wtf/GetPtr.h> |
40 | #include <wtf/PointerPreparations.h> |
41 | #include <wtf/URL.h> |
42 | |
43 | |
44 | namespace WebCore { |
45 | using namespace JSC; |
46 | |
47 | template<> StorageEvent::Init convertDictionary<StorageEvent::Init>(ExecState& state, JSValue value) |
48 | { |
49 | VM& vm = state.vm(); |
50 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
51 | bool isNullOrUndefined = value.isUndefinedOrNull(); |
52 | auto* object = isNullOrUndefined ? nullptr : value.getObject(); |
53 | if (UNLIKELY(!isNullOrUndefined && !object)) { |
54 | throwTypeError(&state, throwScope); |
55 | return { }; |
56 | } |
57 | StorageEvent::Init result; |
58 | JSValue bubblesValue; |
59 | if (isNullOrUndefined) |
60 | bubblesValue = jsUndefined(); |
61 | else { |
62 | bubblesValue = object->get(&state, Identifier::fromString(&state, "bubbles" )); |
63 | RETURN_IF_EXCEPTION(throwScope, { }); |
64 | } |
65 | if (!bubblesValue.isUndefined()) { |
66 | result.bubbles = convert<IDLBoolean>(state, bubblesValue); |
67 | RETURN_IF_EXCEPTION(throwScope, { }); |
68 | } else |
69 | result.bubbles = false; |
70 | JSValue cancelableValue; |
71 | if (isNullOrUndefined) |
72 | cancelableValue = jsUndefined(); |
73 | else { |
74 | cancelableValue = object->get(&state, Identifier::fromString(&state, "cancelable" )); |
75 | RETURN_IF_EXCEPTION(throwScope, { }); |
76 | } |
77 | if (!cancelableValue.isUndefined()) { |
78 | result.cancelable = convert<IDLBoolean>(state, cancelableValue); |
79 | RETURN_IF_EXCEPTION(throwScope, { }); |
80 | } else |
81 | result.cancelable = false; |
82 | JSValue composedValue; |
83 | if (isNullOrUndefined) |
84 | composedValue = jsUndefined(); |
85 | else { |
86 | composedValue = object->get(&state, Identifier::fromString(&state, "composed" )); |
87 | RETURN_IF_EXCEPTION(throwScope, { }); |
88 | } |
89 | if (!composedValue.isUndefined()) { |
90 | result.composed = convert<IDLBoolean>(state, composedValue); |
91 | RETURN_IF_EXCEPTION(throwScope, { }); |
92 | } else |
93 | result.composed = false; |
94 | JSValue keyValue; |
95 | if (isNullOrUndefined) |
96 | keyValue = jsUndefined(); |
97 | else { |
98 | keyValue = object->get(&state, Identifier::fromString(&state, "key" )); |
99 | RETURN_IF_EXCEPTION(throwScope, { }); |
100 | } |
101 | if (!keyValue.isUndefined()) { |
102 | result.key = convert<IDLNullable<IDLDOMString>>(state, keyValue); |
103 | RETURN_IF_EXCEPTION(throwScope, { }); |
104 | } else |
105 | result.key = String(); |
106 | JSValue newValueValue; |
107 | if (isNullOrUndefined) |
108 | newValueValue = jsUndefined(); |
109 | else { |
110 | newValueValue = object->get(&state, Identifier::fromString(&state, "newValue" )); |
111 | RETURN_IF_EXCEPTION(throwScope, { }); |
112 | } |
113 | if (!newValueValue.isUndefined()) { |
114 | result.newValue = convert<IDLNullable<IDLDOMString>>(state, newValueValue); |
115 | RETURN_IF_EXCEPTION(throwScope, { }); |
116 | } else |
117 | result.newValue = String(); |
118 | JSValue oldValueValue; |
119 | if (isNullOrUndefined) |
120 | oldValueValue = jsUndefined(); |
121 | else { |
122 | oldValueValue = object->get(&state, Identifier::fromString(&state, "oldValue" )); |
123 | RETURN_IF_EXCEPTION(throwScope, { }); |
124 | } |
125 | if (!oldValueValue.isUndefined()) { |
126 | result.oldValue = convert<IDLNullable<IDLDOMString>>(state, oldValueValue); |
127 | RETURN_IF_EXCEPTION(throwScope, { }); |
128 | } else |
129 | result.oldValue = String(); |
130 | JSValue storageAreaValue; |
131 | if (isNullOrUndefined) |
132 | storageAreaValue = jsUndefined(); |
133 | else { |
134 | storageAreaValue = object->get(&state, Identifier::fromString(&state, "storageArea" )); |
135 | RETURN_IF_EXCEPTION(throwScope, { }); |
136 | } |
137 | if (!storageAreaValue.isUndefined()) { |
138 | result.storageArea = convert<IDLNullable<IDLInterface<Storage>>>(state, storageAreaValue); |
139 | RETURN_IF_EXCEPTION(throwScope, { }); |
140 | } else |
141 | result.storageArea = nullptr; |
142 | JSValue urlValue; |
143 | if (isNullOrUndefined) |
144 | urlValue = jsUndefined(); |
145 | else { |
146 | urlValue = object->get(&state, Identifier::fromString(&state, "url" )); |
147 | RETURN_IF_EXCEPTION(throwScope, { }); |
148 | } |
149 | if (!urlValue.isUndefined()) { |
150 | result.url = convert<IDLUSVString>(state, urlValue); |
151 | RETURN_IF_EXCEPTION(throwScope, { }); |
152 | } else |
153 | result.url = emptyString(); |
154 | return result; |
155 | } |
156 | |
157 | // Functions |
158 | |
159 | JSC::EncodedJSValue JSC_HOST_CALL jsStorageEventPrototypeFunctionInitStorageEvent(JSC::ExecState*); |
160 | |
161 | // Attributes |
162 | |
163 | JSC::EncodedJSValue jsStorageEventConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
164 | bool setJSStorageEventConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
165 | JSC::EncodedJSValue jsStorageEventKey(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
166 | JSC::EncodedJSValue jsStorageEventOldValue(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
167 | JSC::EncodedJSValue jsStorageEventNewValue(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
168 | JSC::EncodedJSValue jsStorageEventUrl(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
169 | JSC::EncodedJSValue jsStorageEventStorageArea(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
170 | |
171 | class JSStorageEventPrototype : public JSC::JSNonFinalObject { |
172 | public: |
173 | using Base = JSC::JSNonFinalObject; |
174 | static JSStorageEventPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
175 | { |
176 | JSStorageEventPrototype* ptr = new (NotNull, JSC::allocateCell<JSStorageEventPrototype>(vm.heap)) JSStorageEventPrototype(vm, globalObject, structure); |
177 | ptr->finishCreation(vm); |
178 | return ptr; |
179 | } |
180 | |
181 | DECLARE_INFO; |
182 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
183 | { |
184 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
185 | } |
186 | |
187 | private: |
188 | JSStorageEventPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
189 | : JSC::JSNonFinalObject(vm, structure) |
190 | { |
191 | } |
192 | |
193 | void finishCreation(JSC::VM&); |
194 | }; |
195 | |
196 | using JSStorageEventConstructor = JSDOMConstructor<JSStorageEvent>; |
197 | |
198 | template<> EncodedJSValue JSC_HOST_CALL JSStorageEventConstructor::construct(ExecState* state) |
199 | { |
200 | VM& vm = state->vm(); |
201 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
202 | UNUSED_PARAM(throwScope); |
203 | auto* castedThis = jsCast<JSStorageEventConstructor*>(state->jsCallee()); |
204 | ASSERT(castedThis); |
205 | if (UNLIKELY(state->argumentCount() < 1)) |
206 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
207 | auto type = convert<IDLDOMString>(*state, state->uncheckedArgument(0)); |
208 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
209 | auto eventInitDict = convert<IDLDictionary<StorageEvent::Init>>(*state, state->argument(1)); |
210 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
211 | auto object = StorageEvent::create(WTFMove(type), WTFMove(eventInitDict)); |
212 | return JSValue::encode(toJSNewlyCreated<IDLInterface<StorageEvent>>(*state, *castedThis->globalObject(), WTFMove(object))); |
213 | } |
214 | |
215 | template<> JSValue JSStorageEventConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
216 | { |
217 | return JSEvent::getConstructor(vm, &globalObject); |
218 | } |
219 | |
220 | template<> void JSStorageEventConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
221 | { |
222 | putDirect(vm, vm.propertyNames->prototype, JSStorageEvent::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
223 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("StorageEvent"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
224 | putDirect(vm, vm.propertyNames->length, jsNumber(1), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
225 | } |
226 | |
227 | template<> const ClassInfo JSStorageEventConstructor::s_info = { "StorageEvent" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSStorageEventConstructor) }; |
228 | |
229 | /* Hash table for prototype */ |
230 | |
231 | static const HashTableValue JSStorageEventPrototypeTableValues[] = |
232 | { |
233 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsStorageEventConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSStorageEventConstructor) } }, |
234 | { "key" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsStorageEventKey), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
235 | { "oldValue" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsStorageEventOldValue), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
236 | { "newValue" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsStorageEventNewValue), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
237 | { "url" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsStorageEventUrl), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
238 | { "storageArea" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsStorageEventStorageArea), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
239 | { "initStorageEvent" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsStorageEventPrototypeFunctionInitStorageEvent), (intptr_t) (0) } }, |
240 | }; |
241 | |
242 | const ClassInfo JSStorageEventPrototype::s_info = { "StorageEventPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSStorageEventPrototype) }; |
243 | |
244 | void JSStorageEventPrototype::finishCreation(VM& vm) |
245 | { |
246 | Base::finishCreation(vm); |
247 | reifyStaticProperties(vm, JSStorageEvent::info(), JSStorageEventPrototypeTableValues, *this); |
248 | } |
249 | |
250 | const ClassInfo JSStorageEvent::s_info = { "StorageEvent" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSStorageEvent) }; |
251 | |
252 | JSStorageEvent::JSStorageEvent(Structure* structure, JSDOMGlobalObject& globalObject, Ref<StorageEvent>&& impl) |
253 | : JSEvent(structure, globalObject, WTFMove(impl)) |
254 | { |
255 | } |
256 | |
257 | void JSStorageEvent::finishCreation(VM& vm) |
258 | { |
259 | Base::finishCreation(vm); |
260 | ASSERT(inherits(vm, info())); |
261 | |
262 | } |
263 | |
264 | JSObject* JSStorageEvent::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
265 | { |
266 | return JSStorageEventPrototype::create(vm, &globalObject, JSStorageEventPrototype::createStructure(vm, &globalObject, JSEvent::prototype(vm, globalObject))); |
267 | } |
268 | |
269 | JSObject* JSStorageEvent::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
270 | { |
271 | return getDOMPrototype<JSStorageEvent>(vm, globalObject); |
272 | } |
273 | |
274 | JSValue JSStorageEvent::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
275 | { |
276 | return getDOMConstructor<JSStorageEventConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
277 | } |
278 | |
279 | template<> inline JSStorageEvent* IDLAttribute<JSStorageEvent>::cast(ExecState& state, EncodedJSValue thisValue) |
280 | { |
281 | return jsDynamicCast<JSStorageEvent*>(state.vm(), JSValue::decode(thisValue)); |
282 | } |
283 | |
284 | template<> inline JSStorageEvent* IDLOperation<JSStorageEvent>::cast(ExecState& state) |
285 | { |
286 | return jsDynamicCast<JSStorageEvent*>(state.vm(), state.thisValue()); |
287 | } |
288 | |
289 | EncodedJSValue jsStorageEventConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
290 | { |
291 | VM& vm = state->vm(); |
292 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
293 | auto* prototype = jsDynamicCast<JSStorageEventPrototype*>(vm, JSValue::decode(thisValue)); |
294 | if (UNLIKELY(!prototype)) |
295 | return throwVMTypeError(state, throwScope); |
296 | return JSValue::encode(JSStorageEvent::getConstructor(state->vm(), prototype->globalObject())); |
297 | } |
298 | |
299 | bool setJSStorageEventConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
300 | { |
301 | VM& vm = state->vm(); |
302 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
303 | auto* prototype = jsDynamicCast<JSStorageEventPrototype*>(vm, JSValue::decode(thisValue)); |
304 | if (UNLIKELY(!prototype)) { |
305 | throwVMTypeError(state, throwScope); |
306 | return false; |
307 | } |
308 | // Shadowing a built-in constructor |
309 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
310 | } |
311 | |
312 | static inline JSValue jsStorageEventKeyGetter(ExecState& state, JSStorageEvent& thisObject, ThrowScope& throwScope) |
313 | { |
314 | UNUSED_PARAM(throwScope); |
315 | UNUSED_PARAM(state); |
316 | auto& impl = thisObject.wrapped(); |
317 | JSValue result = toJS<IDLNullable<IDLDOMString>>(state, throwScope, impl.key()); |
318 | return result; |
319 | } |
320 | |
321 | EncodedJSValue jsStorageEventKey(ExecState* state, EncodedJSValue thisValue, PropertyName) |
322 | { |
323 | return IDLAttribute<JSStorageEvent>::get<jsStorageEventKeyGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "key" ); |
324 | } |
325 | |
326 | static inline JSValue jsStorageEventOldValueGetter(ExecState& state, JSStorageEvent& thisObject, ThrowScope& throwScope) |
327 | { |
328 | UNUSED_PARAM(throwScope); |
329 | UNUSED_PARAM(state); |
330 | auto& impl = thisObject.wrapped(); |
331 | JSValue result = toJS<IDLNullable<IDLDOMString>>(state, throwScope, impl.oldValue()); |
332 | return result; |
333 | } |
334 | |
335 | EncodedJSValue jsStorageEventOldValue(ExecState* state, EncodedJSValue thisValue, PropertyName) |
336 | { |
337 | return IDLAttribute<JSStorageEvent>::get<jsStorageEventOldValueGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "oldValue" ); |
338 | } |
339 | |
340 | static inline JSValue jsStorageEventNewValueGetter(ExecState& state, JSStorageEvent& thisObject, ThrowScope& throwScope) |
341 | { |
342 | UNUSED_PARAM(throwScope); |
343 | UNUSED_PARAM(state); |
344 | auto& impl = thisObject.wrapped(); |
345 | JSValue result = toJS<IDLNullable<IDLDOMString>>(state, throwScope, impl.newValue()); |
346 | return result; |
347 | } |
348 | |
349 | EncodedJSValue jsStorageEventNewValue(ExecState* state, EncodedJSValue thisValue, PropertyName) |
350 | { |
351 | return IDLAttribute<JSStorageEvent>::get<jsStorageEventNewValueGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "newValue" ); |
352 | } |
353 | |
354 | static inline JSValue jsStorageEventUrlGetter(ExecState& state, JSStorageEvent& thisObject, ThrowScope& throwScope) |
355 | { |
356 | UNUSED_PARAM(throwScope); |
357 | UNUSED_PARAM(state); |
358 | auto& impl = thisObject.wrapped(); |
359 | JSValue result = toJS<IDLUSVString>(state, throwScope, impl.url()); |
360 | return result; |
361 | } |
362 | |
363 | EncodedJSValue jsStorageEventUrl(ExecState* state, EncodedJSValue thisValue, PropertyName) |
364 | { |
365 | return IDLAttribute<JSStorageEvent>::get<jsStorageEventUrlGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "url" ); |
366 | } |
367 | |
368 | static inline JSValue jsStorageEventStorageAreaGetter(ExecState& state, JSStorageEvent& thisObject, ThrowScope& throwScope) |
369 | { |
370 | UNUSED_PARAM(throwScope); |
371 | UNUSED_PARAM(state); |
372 | auto& impl = thisObject.wrapped(); |
373 | JSValue result = toJS<IDLNullable<IDLInterface<Storage>>>(state, *thisObject.globalObject(), throwScope, impl.storageArea()); |
374 | return result; |
375 | } |
376 | |
377 | EncodedJSValue jsStorageEventStorageArea(ExecState* state, EncodedJSValue thisValue, PropertyName) |
378 | { |
379 | return IDLAttribute<JSStorageEvent>::get<jsStorageEventStorageAreaGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "storageArea" ); |
380 | } |
381 | |
382 | static inline JSC::EncodedJSValue jsStorageEventPrototypeFunctionInitStorageEventBody(JSC::ExecState* state, typename IDLOperation<JSStorageEvent>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
383 | { |
384 | UNUSED_PARAM(state); |
385 | UNUSED_PARAM(throwScope); |
386 | auto& impl = castedThis->wrapped(); |
387 | auto typeArg = convert<IDLDOMString>(*state, state->argument(0)); |
388 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
389 | auto canBubbleArg = convert<IDLBoolean>(*state, state->argument(1)); |
390 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
391 | auto cancelableArg = convert<IDLBoolean>(*state, state->argument(2)); |
392 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
393 | auto keyArg = convert<IDLDOMString>(*state, state->argument(3)); |
394 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
395 | auto oldValueArg = state->argument(4).isUndefined() ? String() : convert<IDLNullable<IDLDOMString>>(*state, state->uncheckedArgument(4)); |
396 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
397 | auto newValueArg = state->argument(5).isUndefined() ? String() : convert<IDLNullable<IDLDOMString>>(*state, state->uncheckedArgument(5)); |
398 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
399 | auto urlArg = convert<IDLUSVString>(*state, state->argument(6)); |
400 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
401 | auto storageAreaArg = convert<IDLNullable<IDLInterface<Storage>>>(*state, state->argument(7), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 7, "storageAreaArg" , "StorageEvent" , "initStorageEvent" , "Storage" ); }); |
402 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
403 | impl.initStorageEvent(WTFMove(typeArg), WTFMove(canBubbleArg), WTFMove(cancelableArg), WTFMove(keyArg), WTFMove(oldValueArg), WTFMove(newValueArg), WTFMove(urlArg), WTFMove(storageAreaArg)); |
404 | return JSValue::encode(jsUndefined()); |
405 | } |
406 | |
407 | EncodedJSValue JSC_HOST_CALL jsStorageEventPrototypeFunctionInitStorageEvent(ExecState* state) |
408 | { |
409 | return IDLOperation<JSStorageEvent>::call<jsStorageEventPrototypeFunctionInitStorageEventBody>(*state, "initStorageEvent" ); |
410 | } |
411 | |
412 | void JSStorageEvent::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
413 | { |
414 | auto* thisObject = jsCast<JSStorageEvent*>(cell); |
415 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
416 | if (thisObject->scriptExecutionContext()) |
417 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
418 | Base::heapSnapshot(cell, builder); |
419 | } |
420 | |
421 | #if ENABLE(BINDING_INTEGRITY) |
422 | #if PLATFORM(WIN) |
423 | #pragma warning(disable: 4483) |
424 | extern "C" { extern void (*const __identifier("??_7StorageEvent@WebCore@@6B@" )[])(); } |
425 | #else |
426 | extern "C" { extern void* _ZTVN7WebCore12StorageEventE[]; } |
427 | #endif |
428 | #endif |
429 | |
430 | JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<StorageEvent>&& impl) |
431 | { |
432 | |
433 | #if ENABLE(BINDING_INTEGRITY) |
434 | void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr())); |
435 | #if PLATFORM(WIN) |
436 | void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(__identifier("??_7StorageEvent@WebCore@@6B@" )); |
437 | #else |
438 | void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(&_ZTVN7WebCore12StorageEventE[2]); |
439 | #endif |
440 | |
441 | // If this fails StorageEvent does not have a vtable, so you need to add the |
442 | // ImplementationLacksVTable attribute to the interface definition |
443 | static_assert(std::is_polymorphic<StorageEvent>::value, "StorageEvent is not polymorphic" ); |
444 | |
445 | // If you hit this assertion you either have a use after free bug, or |
446 | // StorageEvent has subclasses. If StorageEvent has subclasses that get passed |
447 | // to toJS() we currently require StorageEvent you to opt out of binding hardening |
448 | // by adding the SkipVTableValidation attribute to the interface IDL definition |
449 | RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); |
450 | #endif |
451 | return createWrapper<StorageEvent>(globalObject, WTFMove(impl)); |
452 | } |
453 | |
454 | JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, StorageEvent& impl) |
455 | { |
456 | return wrap(state, globalObject, impl); |
457 | } |
458 | |
459 | |
460 | } |
461 | |