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 "JSRemoteDOMWindow.h" |
23 | |
24 | #include "DOMWindow.h" |
25 | #include "JSDOMAttribute.h" |
26 | #include "JSDOMBinding.h" |
27 | #include "JSDOMConvertAny.h" |
28 | #include "JSDOMConvertBoolean.h" |
29 | #include "JSDOMConvertInterface.h" |
30 | #include "JSDOMConvertNullable.h" |
31 | #include "JSDOMConvertNumbers.h" |
32 | #include "JSDOMConvertObject.h" |
33 | #include "JSDOMConvertSequences.h" |
34 | #include "JSDOMConvertStrings.h" |
35 | #include "JSDOMExceptionHandling.h" |
36 | #include "JSDOMGlobalObject.h" |
37 | #include "JSDOMOperation.h" |
38 | #include "JSDOMWindowBase.h" |
39 | #include "JSDOMWrapperCache.h" |
40 | #include "JSLocation.h" |
41 | #include "JSWindowProxy.h" |
42 | #include "ScriptExecutionContext.h" |
43 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
44 | #include <JavaScriptCore/JSArray.h> |
45 | #include <JavaScriptCore/JSCInlines.h> |
46 | #include <wtf/GetPtr.h> |
47 | #include <wtf/PointerPreparations.h> |
48 | #include <wtf/URL.h> |
49 | |
50 | |
51 | namespace WebCore { |
52 | using namespace JSC; |
53 | |
54 | // Functions |
55 | |
56 | |
57 | // Attributes |
58 | |
59 | JSC::EncodedJSValue jsRemoteDOMWindowWindow(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
60 | JSC::EncodedJSValue jsRemoteDOMWindowSelf(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
61 | bool setJSRemoteDOMWindowSelf(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
62 | JSC::EncodedJSValue jsRemoteDOMWindowLocation(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
63 | bool setJSRemoteDOMWindowLocation(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
64 | JSC::EncodedJSValue jsRemoteDOMWindowFrames(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
65 | bool setJSRemoteDOMWindowFrames(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
66 | JSC::EncodedJSValue jsRemoteDOMWindowLength(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
67 | bool setJSRemoteDOMWindowLength(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
68 | JSC::EncodedJSValue jsRemoteDOMWindowTop(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
69 | JSC::EncodedJSValue jsRemoteDOMWindowOpener(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
70 | JSC::EncodedJSValue jsRemoteDOMWindowParent(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
71 | bool setJSRemoteDOMWindowParent(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
72 | |
73 | /* Hash table */ |
74 | |
75 | static const struct CompactHashIndex JSRemoteDOMWindowTableIndex[34] = { |
76 | { -1, -1 }, |
77 | { -1, -1 }, |
78 | { -1, -1 }, |
79 | { 11, -1 }, |
80 | { -1, -1 }, |
81 | { 0, 32 }, |
82 | { 1, -1 }, |
83 | { 6, -1 }, |
84 | { 4, 33 }, |
85 | { -1, -1 }, |
86 | { -1, -1 }, |
87 | { -1, -1 }, |
88 | { -1, -1 }, |
89 | { -1, -1 }, |
90 | { -1, -1 }, |
91 | { -1, -1 }, |
92 | { 2, -1 }, |
93 | { 5, -1 }, |
94 | { -1, -1 }, |
95 | { 8, -1 }, |
96 | { -1, -1 }, |
97 | { -1, -1 }, |
98 | { -1, -1 }, |
99 | { -1, -1 }, |
100 | { -1, -1 }, |
101 | { 12, -1 }, |
102 | { 9, -1 }, |
103 | { -1, -1 }, |
104 | { -1, -1 }, |
105 | { -1, -1 }, |
106 | { 10, -1 }, |
107 | { -1, -1 }, |
108 | { 3, -1 }, |
109 | { 7, -1 }, |
110 | }; |
111 | |
112 | |
113 | static const HashTableValue JSRemoteDOMWindowTableValues[] = |
114 | { |
115 | { "window" , static_cast<unsigned>(JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsRemoteDOMWindowWindow), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
116 | { "self" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsRemoteDOMWindowSelf), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSRemoteDOMWindowSelf) } }, |
117 | { "location" , static_cast<unsigned>(JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::CustomAccessor), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsRemoteDOMWindowLocation), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSRemoteDOMWindowLocation) } }, |
118 | { "closed" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsRemoteDOMWindowClosed), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
119 | { "frames" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsRemoteDOMWindowFrames), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSRemoteDOMWindowFrames) } }, |
120 | { "length" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsRemoteDOMWindowLength), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSRemoteDOMWindowLength) } }, |
121 | { "top" , static_cast<unsigned>(JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsRemoteDOMWindowTop), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
122 | { "opener" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsRemoteDOMWindowOpener), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
123 | { "parent" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsRemoteDOMWindowParent), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSRemoteDOMWindowParent) } }, |
124 | { "close" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsRemoteDOMWindowInstanceFunctionClose), (intptr_t) (0) } }, |
125 | { "focus" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsRemoteDOMWindowInstanceFunctionFocus), (intptr_t) (0) } }, |
126 | { "blur" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsRemoteDOMWindowInstanceFunctionBlur), (intptr_t) (0) } }, |
127 | { "postMessage" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsRemoteDOMWindowInstanceFunctionPostMessage), (intptr_t) (2) } }, |
128 | }; |
129 | |
130 | static const HashTable JSRemoteDOMWindowTable = { 13, 31, true, JSRemoteDOMWindow::info(), JSRemoteDOMWindowTableValues, JSRemoteDOMWindowTableIndex }; |
131 | /* Hash table for prototype */ |
132 | |
133 | static const struct CompactHashIndex JSRemoteDOMWindowPrototypeTableIndex[1] = { |
134 | { -1, -1 }, |
135 | }; |
136 | |
137 | |
138 | static const HashTableValue JSRemoteDOMWindowPrototypeTableValues[] = |
139 | { |
140 | { 0, 0, NoIntrinsic, { 0, 0 } } |
141 | }; |
142 | |
143 | static const HashTable JSRemoteDOMWindowPrototypeTable = { 0, 0, false, JSRemoteDOMWindow::info(), JSRemoteDOMWindowPrototypeTableValues, JSRemoteDOMWindowPrototypeTableIndex }; |
144 | const ClassInfo JSRemoteDOMWindowPrototype::s_info = { "WindowPrototype" , &Base::s_info, &JSRemoteDOMWindowPrototypeTable, nullptr, CREATE_METHOD_TABLE(JSRemoteDOMWindowPrototype) }; |
145 | |
146 | const ClassInfo JSRemoteDOMWindow::s_info = { "Window" , &Base::s_info, &JSRemoteDOMWindowTable, nullptr, CREATE_METHOD_TABLE(JSRemoteDOMWindow) }; |
147 | |
148 | JSRemoteDOMWindow::JSRemoteDOMWindow(VM& vm, Structure* structure, Ref<RemoteDOMWindow>&& impl, JSWindowProxy* proxy) |
149 | : JSRemoteDOMWindowBase(vm, structure, WTFMove(impl), proxy) |
150 | { |
151 | } |
152 | |
153 | void JSRemoteDOMWindow::finishCreation(VM& vm, JSWindowProxy* proxy) |
154 | { |
155 | Base::finishCreation(vm, proxy); |
156 | |
157 | } |
158 | |
159 | template<> inline JSRemoteDOMWindow* IDLAttribute<JSRemoteDOMWindow>::cast(ExecState& state, EncodedJSValue thisValue) |
160 | { |
161 | auto decodedThisValue = JSValue::decode(thisValue); |
162 | if (decodedThisValue.isUndefinedOrNull()) |
163 | decodedThisValue = state.thisValue().toThis(&state, NotStrictMode); |
164 | return toJSRemoteDOMWindow(state.vm(), decodedThisValue);} |
165 | |
166 | template<> inline JSRemoteDOMWindow* IDLOperation<JSRemoteDOMWindow>::cast(ExecState& state) |
167 | { |
168 | return toJSRemoteDOMWindow(state.vm(), state.thisValue().toThis(&state, NotStrictMode)); |
169 | } |
170 | |
171 | static inline JSValue jsRemoteDOMWindowWindowGetter(ExecState& state, JSRemoteDOMWindow& thisObject, ThrowScope& throwScope) |
172 | { |
173 | UNUSED_PARAM(throwScope); |
174 | UNUSED_PARAM(state); |
175 | auto& impl = thisObject.wrapped(); |
176 | JSValue result = toJS<IDLInterface<WindowProxy>>(state, *thisObject.globalObject(), throwScope, impl.self()); |
177 | return result; |
178 | } |
179 | |
180 | EncodedJSValue jsRemoteDOMWindowWindow(ExecState* state, EncodedJSValue thisValue, PropertyName) |
181 | { |
182 | return IDLAttribute<JSRemoteDOMWindow>::get<jsRemoteDOMWindowWindowGetter>(*state, thisValue, "window" ); |
183 | } |
184 | |
185 | static inline JSValue jsRemoteDOMWindowSelfGetter(ExecState& state, JSRemoteDOMWindow& thisObject, ThrowScope& throwScope) |
186 | { |
187 | UNUSED_PARAM(throwScope); |
188 | UNUSED_PARAM(state); |
189 | auto& impl = thisObject.wrapped(); |
190 | JSValue result = toJS<IDLInterface<WindowProxy>>(state, *thisObject.globalObject(), throwScope, impl.self()); |
191 | return result; |
192 | } |
193 | |
194 | EncodedJSValue jsRemoteDOMWindowSelf(ExecState* state, EncodedJSValue thisValue, PropertyName) |
195 | { |
196 | return IDLAttribute<JSRemoteDOMWindow>::get<jsRemoteDOMWindowSelfGetter>(*state, thisValue, "self" ); |
197 | } |
198 | |
199 | static inline bool setJSRemoteDOMWindowSelfSetter(ExecState& state, JSRemoteDOMWindow& thisObject, JSValue value, ThrowScope& throwScope) |
200 | { |
201 | UNUSED_PARAM(throwScope); |
202 | // Shadowing a built-in property. |
203 | return replaceStaticPropertySlot(state.vm(), &thisObject, Identifier::fromString(&state.vm(), reinterpret_cast<const LChar*>("self" ), strlen("self" )), value); |
204 | } |
205 | |
206 | bool setJSRemoteDOMWindowSelf(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
207 | { |
208 | return IDLAttribute<JSRemoteDOMWindow>::set<setJSRemoteDOMWindowSelfSetter>(*state, thisValue, encodedValue, "self" ); |
209 | } |
210 | |
211 | static inline JSValue jsRemoteDOMWindowLocationGetter(ExecState& state, JSRemoteDOMWindow& thisObject, ThrowScope& throwScope) |
212 | { |
213 | UNUSED_PARAM(throwScope); |
214 | UNUSED_PARAM(state); |
215 | auto& impl = thisObject.wrapped(); |
216 | JSValue result = toJS<IDLNullable<IDLInterface<Location>>>(state, *thisObject.globalObject(), throwScope, impl.location()); |
217 | return result; |
218 | } |
219 | |
220 | EncodedJSValue jsRemoteDOMWindowLocation(ExecState* state, EncodedJSValue thisValue, PropertyName) |
221 | { |
222 | return IDLAttribute<JSRemoteDOMWindow>::get<jsRemoteDOMWindowLocationGetter>(*state, thisValue, "location" ); |
223 | } |
224 | |
225 | static inline bool setJSRemoteDOMWindowLocationSetter(ExecState& state, JSRemoteDOMWindow& thisObject, JSValue value, ThrowScope& throwScope) |
226 | { |
227 | UNUSED_PARAM(throwScope); |
228 | auto id = Identifier::fromString(&state.vm(), reinterpret_cast<const LChar*>("location" ), strlen("location" )); |
229 | auto valueToForwardTo = thisObject.get(&state, id); |
230 | RETURN_IF_EXCEPTION(throwScope, false); |
231 | if (UNLIKELY(!valueToForwardTo.isObject())) { |
232 | throwTypeError(&state, throwScope); |
233 | return false; |
234 | } |
235 | auto forwardId = Identifier::fromString(&state.vm(), reinterpret_cast<const LChar*>("href" ), strlen("href" )); |
236 | PutPropertySlot slot(valueToForwardTo, false); |
237 | asObject(valueToForwardTo)->methodTable(state.vm())->put(asObject(valueToForwardTo), &state, forwardId, value, slot); |
238 | RETURN_IF_EXCEPTION(throwScope, false); |
239 | return true; |
240 | } |
241 | |
242 | bool setJSRemoteDOMWindowLocation(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
243 | { |
244 | return IDLAttribute<JSRemoteDOMWindow>::set<setJSRemoteDOMWindowLocationSetter>(*state, thisValue, encodedValue, "location" ); |
245 | } |
246 | |
247 | static inline JSValue jsRemoteDOMWindowClosedGetter(ExecState& state, JSRemoteDOMWindow& thisObject, ThrowScope& throwScope) |
248 | { |
249 | UNUSED_PARAM(throwScope); |
250 | UNUSED_PARAM(state); |
251 | auto& impl = thisObject.wrapped(); |
252 | JSValue result = toJS<IDLBoolean>(state, throwScope, impl.closed()); |
253 | return result; |
254 | } |
255 | |
256 | EncodedJSValue jsRemoteDOMWindowClosed(ExecState* state, EncodedJSValue thisValue, PropertyName) |
257 | { |
258 | return IDLAttribute<JSRemoteDOMWindow>::get<jsRemoteDOMWindowClosedGetter>(*state, thisValue, "closed" ); |
259 | } |
260 | |
261 | static inline JSValue jsRemoteDOMWindowFramesGetter(ExecState& state, JSRemoteDOMWindow& thisObject, ThrowScope& throwScope) |
262 | { |
263 | UNUSED_PARAM(throwScope); |
264 | UNUSED_PARAM(state); |
265 | auto& impl = thisObject.wrapped(); |
266 | JSValue result = toJS<IDLInterface<WindowProxy>>(state, *thisObject.globalObject(), throwScope, impl.self()); |
267 | return result; |
268 | } |
269 | |
270 | EncodedJSValue jsRemoteDOMWindowFrames(ExecState* state, EncodedJSValue thisValue, PropertyName) |
271 | { |
272 | return IDLAttribute<JSRemoteDOMWindow>::get<jsRemoteDOMWindowFramesGetter>(*state, thisValue, "frames" ); |
273 | } |
274 | |
275 | static inline bool setJSRemoteDOMWindowFramesSetter(ExecState& state, JSRemoteDOMWindow& thisObject, JSValue value, ThrowScope& throwScope) |
276 | { |
277 | UNUSED_PARAM(throwScope); |
278 | // Shadowing a built-in property. |
279 | return replaceStaticPropertySlot(state.vm(), &thisObject, Identifier::fromString(&state.vm(), reinterpret_cast<const LChar*>("frames" ), strlen("frames" )), value); |
280 | } |
281 | |
282 | bool setJSRemoteDOMWindowFrames(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
283 | { |
284 | return IDLAttribute<JSRemoteDOMWindow>::set<setJSRemoteDOMWindowFramesSetter>(*state, thisValue, encodedValue, "frames" ); |
285 | } |
286 | |
287 | static inline JSValue jsRemoteDOMWindowLengthGetter(ExecState& state, JSRemoteDOMWindow& thisObject, ThrowScope& throwScope) |
288 | { |
289 | UNUSED_PARAM(throwScope); |
290 | UNUSED_PARAM(state); |
291 | auto& impl = thisObject.wrapped(); |
292 | JSValue result = toJS<IDLUnsignedLong>(state, throwScope, impl.length()); |
293 | return result; |
294 | } |
295 | |
296 | EncodedJSValue jsRemoteDOMWindowLength(ExecState* state, EncodedJSValue thisValue, PropertyName) |
297 | { |
298 | return IDLAttribute<JSRemoteDOMWindow>::get<jsRemoteDOMWindowLengthGetter>(*state, thisValue, "length" ); |
299 | } |
300 | |
301 | static inline bool setJSRemoteDOMWindowLengthSetter(ExecState& state, JSRemoteDOMWindow& thisObject, JSValue value, ThrowScope& throwScope) |
302 | { |
303 | UNUSED_PARAM(throwScope); |
304 | // Shadowing a built-in property. |
305 | return replaceStaticPropertySlot(state.vm(), &thisObject, Identifier::fromString(&state.vm(), reinterpret_cast<const LChar*>("length" ), strlen("length" )), value); |
306 | } |
307 | |
308 | bool setJSRemoteDOMWindowLength(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
309 | { |
310 | return IDLAttribute<JSRemoteDOMWindow>::set<setJSRemoteDOMWindowLengthSetter>(*state, thisValue, encodedValue, "length" ); |
311 | } |
312 | |
313 | static inline JSValue jsRemoteDOMWindowTopGetter(ExecState& state, JSRemoteDOMWindow& thisObject, ThrowScope& throwScope) |
314 | { |
315 | UNUSED_PARAM(throwScope); |
316 | UNUSED_PARAM(state); |
317 | auto& impl = thisObject.wrapped(); |
318 | JSValue result = toJS<IDLNullable<IDLInterface<WindowProxy>>>(state, *thisObject.globalObject(), throwScope, impl.top()); |
319 | return result; |
320 | } |
321 | |
322 | EncodedJSValue jsRemoteDOMWindowTop(ExecState* state, EncodedJSValue thisValue, PropertyName) |
323 | { |
324 | return IDLAttribute<JSRemoteDOMWindow>::get<jsRemoteDOMWindowTopGetter>(*state, thisValue, "top" ); |
325 | } |
326 | |
327 | static inline JSValue jsRemoteDOMWindowOpenerGetter(ExecState& state, JSRemoteDOMWindow& thisObject, ThrowScope& throwScope) |
328 | { |
329 | UNUSED_PARAM(throwScope); |
330 | UNUSED_PARAM(state); |
331 | auto& impl = thisObject.wrapped(); |
332 | JSValue result = toJS<IDLNullable<IDLInterface<WindowProxy>>>(state, *thisObject.globalObject(), throwScope, impl.opener()); |
333 | return result; |
334 | } |
335 | |
336 | EncodedJSValue jsRemoteDOMWindowOpener(ExecState* state, EncodedJSValue thisValue, PropertyName) |
337 | { |
338 | return IDLAttribute<JSRemoteDOMWindow>::get<jsRemoteDOMWindowOpenerGetter>(*state, thisValue, "opener" ); |
339 | } |
340 | |
341 | static inline JSValue jsRemoteDOMWindowParentGetter(ExecState& state, JSRemoteDOMWindow& thisObject, ThrowScope& throwScope) |
342 | { |
343 | UNUSED_PARAM(throwScope); |
344 | UNUSED_PARAM(state); |
345 | auto& impl = thisObject.wrapped(); |
346 | JSValue result = toJS<IDLNullable<IDLInterface<WindowProxy>>>(state, *thisObject.globalObject(), throwScope, impl.parent()); |
347 | return result; |
348 | } |
349 | |
350 | EncodedJSValue jsRemoteDOMWindowParent(ExecState* state, EncodedJSValue thisValue, PropertyName) |
351 | { |
352 | return IDLAttribute<JSRemoteDOMWindow>::get<jsRemoteDOMWindowParentGetter>(*state, thisValue, "parent" ); |
353 | } |
354 | |
355 | static inline bool setJSRemoteDOMWindowParentSetter(ExecState& state, JSRemoteDOMWindow& thisObject, JSValue value, ThrowScope& throwScope) |
356 | { |
357 | UNUSED_PARAM(throwScope); |
358 | // Shadowing a built-in property. |
359 | return replaceStaticPropertySlot(state.vm(), &thisObject, Identifier::fromString(&state.vm(), reinterpret_cast<const LChar*>("parent" ), strlen("parent" )), value); |
360 | } |
361 | |
362 | bool setJSRemoteDOMWindowParent(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
363 | { |
364 | return IDLAttribute<JSRemoteDOMWindow>::set<setJSRemoteDOMWindowParentSetter>(*state, thisValue, encodedValue, "parent" ); |
365 | } |
366 | |
367 | static inline JSC::EncodedJSValue jsRemoteDOMWindowInstanceFunctionCloseBody(JSC::ExecState* state, typename IDLOperation<JSRemoteDOMWindow>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
368 | { |
369 | UNUSED_PARAM(state); |
370 | UNUSED_PARAM(throwScope); |
371 | auto& impl = castedThis->wrapped(); |
372 | auto* incumbentDocument = incumbentDOMWindow(*state).document(); |
373 | if (!incumbentDocument) |
374 | return JSValue::encode(jsUndefined()); |
375 | impl.close(*incumbentDocument); |
376 | return JSValue::encode(jsUndefined()); |
377 | } |
378 | |
379 | EncodedJSValue JSC_HOST_CALL jsRemoteDOMWindowInstanceFunctionClose(ExecState* state) |
380 | { |
381 | return IDLOperation<JSRemoteDOMWindow>::call<jsRemoteDOMWindowInstanceFunctionCloseBody>(*state, "close" ); |
382 | } |
383 | |
384 | static inline JSC::EncodedJSValue jsRemoteDOMWindowInstanceFunctionFocusBody(JSC::ExecState* state, typename IDLOperation<JSRemoteDOMWindow>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
385 | { |
386 | UNUSED_PARAM(state); |
387 | UNUSED_PARAM(throwScope); |
388 | auto& impl = castedThis->wrapped(); |
389 | impl.focus(incumbentDOMWindow(*state)); |
390 | return JSValue::encode(jsUndefined()); |
391 | } |
392 | |
393 | EncodedJSValue JSC_HOST_CALL jsRemoteDOMWindowInstanceFunctionFocus(ExecState* state) |
394 | { |
395 | return IDLOperation<JSRemoteDOMWindow>::call<jsRemoteDOMWindowInstanceFunctionFocusBody>(*state, "focus" ); |
396 | } |
397 | |
398 | static inline JSC::EncodedJSValue jsRemoteDOMWindowInstanceFunctionBlurBody(JSC::ExecState* state, typename IDLOperation<JSRemoteDOMWindow>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
399 | { |
400 | UNUSED_PARAM(state); |
401 | UNUSED_PARAM(throwScope); |
402 | auto& impl = castedThis->wrapped(); |
403 | impl.blur(); |
404 | return JSValue::encode(jsUndefined()); |
405 | } |
406 | |
407 | EncodedJSValue JSC_HOST_CALL jsRemoteDOMWindowInstanceFunctionBlur(ExecState* state) |
408 | { |
409 | return IDLOperation<JSRemoteDOMWindow>::call<jsRemoteDOMWindowInstanceFunctionBlurBody>(*state, "blur" ); |
410 | } |
411 | |
412 | static inline JSC::EncodedJSValue jsRemoteDOMWindowInstanceFunctionPostMessageBody(JSC::ExecState* state, typename IDLOperation<JSRemoteDOMWindow>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
413 | { |
414 | UNUSED_PARAM(state); |
415 | UNUSED_PARAM(throwScope); |
416 | auto& impl = castedThis->wrapped(); |
417 | if (UNLIKELY(state->argumentCount() < 2)) |
418 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
419 | auto message = convert<IDLAny>(*state, state->uncheckedArgument(0)); |
420 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
421 | auto targetOrigin = convert<IDLUSVString>(*state, state->uncheckedArgument(1)); |
422 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
423 | auto transfer = state->argument(2).isUndefined() ? Converter<IDLSequence<IDLObject>>::ReturnType{ } : convert<IDLSequence<IDLObject>>(*state, state->uncheckedArgument(2)); |
424 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
425 | impl.postMessage(*state, incumbentDOMWindow(*state), WTFMove(message), WTFMove(targetOrigin), WTFMove(transfer)); |
426 | return JSValue::encode(jsUndefined()); |
427 | } |
428 | |
429 | EncodedJSValue JSC_HOST_CALL jsRemoteDOMWindowInstanceFunctionPostMessage(ExecState* state) |
430 | { |
431 | return IDLOperation<JSRemoteDOMWindow>::call<jsRemoteDOMWindowInstanceFunctionPostMessageBody>(*state, "postMessage" ); |
432 | } |
433 | |
434 | void JSRemoteDOMWindow::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
435 | { |
436 | auto* thisObject = jsCast<JSRemoteDOMWindow*>(cell); |
437 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
438 | if (thisObject->scriptExecutionContext()) |
439 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
440 | Base::heapSnapshot(cell, builder); |
441 | } |
442 | |
443 | |
444 | } |
445 | |