aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/bindings/webcore/EventTargetFactory.cpp
blob: 809cceda922574c9a0dbc744ff41bde42bde1034 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
/*
 * THIS FILE WAS AUTOMATICALLY GENERATED, DO NOT EDIT.
 *
 * Copyright (C) 2011 Google Inc.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY GOOGLE, INC. ``AS IS'' AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#include "config.h"
#include "EventTargetHeaders.h"
#include "JSDOMWrapperCache.h"

#include "JSDOMGlobalObject.h"
#include <JavaScriptCore/StructureInlines.h>

namespace WebCore {

JSC::JSValue toJS(JSC::JSGlobalObject* state, JSDOMGlobalObject* globalObject, EventTarget& impl)
{
    switch (impl.eventTargetInterface()) {
    case EventTargetInterfaceType:
        break;
    case AbortSignalEventTargetInterfaceType:
        return toJS(state, globalObject, static_cast<AbortSignal&>(impl));
        // #if ENABLE(APPLE_PAY)
        //     case ApplePaySessionEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<ApplePaySession&>(impl));
        // #endif
        // #if ENABLE(WEB_AUDIO)
        //     case AudioNodeEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<AudioNode&>(impl));
        // #endif
        // #if ENABLE(VIDEO)
        //     case AudioTrackListEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<AudioTrackList&>(impl));
        // #endif
        // #if ENABLE(WEB_AUDIO)
        //     case BaseAudioContextEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<BaseAudioContext&>(impl));
        // #endif
    case BroadcastChannelEventTargetInterfaceType:
        return toJS(state, globalObject, static_cast<BroadcastChannel&>(impl));
        //     case ClipboardEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<Clipboard&>(impl));
        //     case DOMApplicationCacheEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<DOMApplicationCache&>(impl));
    case DOMWindowEventTargetInterfaceType:
        return globalObject;
        //     case DedicatedWorkerGlobalScopeEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<DedicatedWorkerGlobalScope&>(impl));
        //     case EventSourceEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<EventSource&>(impl));
        //     case FileReaderEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<FileReader&>(impl));
        //     case FontFaceSetEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<FontFaceSet&>(impl));
        //     case GPUDeviceEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<GPUDevice&>(impl));
        //     case IDBDatabaseEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<IDBDatabase&>(impl));
        //     case IDBOpenDBRequestEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<IDBOpenDBRequest&>(impl));
        //     case IDBRequestEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<IDBRequest&>(impl));
        //     case IDBTransactionEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<IDBTransaction&>(impl));
        // #if ENABLE(VIDEO)
        //     case MediaControllerEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<MediaController&>(impl));
        // #endif
        // #if ENABLE(MEDIA_STREAM)
        //     case MediaDevicesEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<MediaDevices&>(impl));
        // #endif
        // #if ENABLE(ENCRYPTED_MEDIA)
        //     case MediaKeySessionEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<MediaKeySession&>(impl));
        // #endif
        //     case MediaQueryListEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<MediaQueryList&>(impl));
        // #if ENABLE(MEDIA_RECORDER)
        //     case MediaRecorderEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<MediaRecorder&>(impl));
        // #endif
        // #if ENABLE(MEDIA_SESSION_COORDINATOR)
        //     case MediaSessionCoordinatorEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<MediaSessionCoordinator&>(impl));
        // #endif
        // #if ENABLE(MEDIA_SOURCE)
        //     case MediaSourceEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<MediaSource&>(impl));
        // #endif
        // #if ENABLE(MEDIA_STREAM)
        //     case MediaStreamEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<MediaStream&>(impl));
        // #endif
        // #if ENABLE(MEDIA_STREAM)
        //     case MediaStreamTrackEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<MediaStreamTrack&>(impl));
        // #endif
    case MessagePortEventTargetInterfaceType:
        return toJS(state, globalObject, static_cast<MessagePort&>(impl));
        //     case NodeEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<Node&>(impl));
        // #if ENABLE(NOTIFICATIONS)
        //     case NotificationEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<Notification&>(impl));
        // #endif
        // #if ENABLE(OFFSCREEN_CANVAS)
        //     case OffscreenCanvasEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<OffscreenCanvas&>(impl));
        // #endif
        // #if ENABLE(PAYMENT_REQUEST)
        //     case PaymentRequestEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<PaymentRequest&>(impl));
        // #endif
        // #if ENABLE(PAYMENT_REQUEST)
        //     case PaymentResponseEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<PaymentResponse&>(impl));
        // #endif
        //     case PerformanceEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<Performance&>(impl));
        //     case PermissionStatusEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<PermissionStatus&>(impl));
        // #if ENABLE(PICTURE_IN_PICTURE_API)
        //     case PictureInPictureWindowEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<PictureInPictureWindow&>(impl));
        // #endif
        // #if ENABLE(WEB_RTC)
        //     case RTCDTMFSenderEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<RTCDTMFSender&>(impl));
        // #endif
        // #if ENABLE(WEB_RTC)
        //     case RTCDataChannelEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<RTCDataChannel&>(impl));
        // #endif
        // #if ENABLE(WEB_RTC)
        //     case RTCDtlsTransportEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<RTCDtlsTransport&>(impl));
        // #endif
        // #if ENABLE(WEB_RTC)
        //     case RTCIceTransportEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<RTCIceTransport&>(impl));
        // #endif
        // #if ENABLE(WEB_RTC)
        //     case RTCPeerConnectionEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<RTCPeerConnection&>(impl));
        // #endif
        // #if ENABLE(WEB_RTC)
        //     case RTCRtpSFrameTransformEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<RTCRtpSFrameTransform&>(impl));
        // #endif
        // #if ENABLE(WEB_RTC)
        //     case RTCRtpScriptTransformEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<RTCRtpScriptTransform&>(impl));
        // #endif
        // #if ENABLE(WEB_RTC)
        //     case RTCSctpTransportEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<RTCSctpTransport&>(impl));
        // #endif
        // #if ENABLE(WIRELESS_PLAYBACK_TARGET)
        //     case RemotePlaybackEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<RemotePlayback&>(impl));
        // #endif
        // #if ENABLE(SERVICE_WORKER)
        //     case ServiceWorkerEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<ServiceWorker&>(impl));
        // #endif
        // #if ENABLE(SERVICE_WORKER)
        //     case ServiceWorkerContainerEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<ServiceWorkerContainer&>(impl));
        // #endif
        // #if ENABLE(SERVICE_WORKER)
        //     case ServiceWorkerGlobalScopeEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<ServiceWorkerGlobalScope&>(impl));
        // #endif
        // #if ENABLE(SERVICE_WORKER)
        //     case ServiceWorkerRegistrationEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<ServiceWorkerRegistration&>(impl));
        // #endif
        //     case SharedWorkerEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<SharedWorker&>(impl));
        //     case SharedWorkerGlobalScopeEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<SharedWorkerGlobalScope&>(impl));
        // #if ENABLE(MEDIA_SOURCE)
        //     case SourceBufferEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<SourceBuffer&>(impl));
        // #endif
        // #if ENABLE(MEDIA_SOURCE)
        //     case SourceBufferListEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<SourceBufferList&>(impl));
        // #endif
        //     case SpeechRecognitionEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<SpeechRecognition&>(impl));
        // #if ENABLE(SPEECH_SYNTHESIS)
        //     case SpeechSynthesisEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<SpeechSynthesis&>(impl));
        // #endif
        // #if ENABLE(SPEECH_SYNTHESIS)
        //     case SpeechSynthesisUtteranceEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<SpeechSynthesisUtterance&>(impl));
        // #endif
        // #if ENABLE(VIDEO)
        //     case TextTrackEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<TextTrack&>(impl));
        // #endif
        // #if ENABLE(VIDEO)
        //     case TextTrackCueEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<TextTrackCue&>(impl));
        // #endif
        // #if ENABLE(VIDEO)
        //     case TextTrackCueGenericEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<TextTrackCueGeneric&>(impl));
        // #endif
        // #if ENABLE(VIDEO)
        //     case TextTrackListEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<TextTrackList&>(impl));
        // #endif
        // #if ENABLE(VIDEO)
        //     case VideoTrackListEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<VideoTrackList&>(impl));
        // #endif
        //     case VisualViewportEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<VisualViewport&>(impl));
        //     case WebAnimationEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<WebAnimation&>(impl));
        // #if ENABLE(LEGACY_ENCRYPTED_MEDIA)
        //     case WebKitMediaKeySessionEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<WebKitMediaKeySession&>(impl));
        // #endif
    case WebSocketEventTargetInterfaceType:
        return toJS(state, globalObject, static_cast<WebSocket&>(impl));
        // #if ENABLE(WEBXR)
        //     case WebXRLayerEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<WebXRLayer&>(impl));
        // #endif
        // #if ENABLE(WEBXR)
        //     case WebXRSessionEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<WebXRSession&>(impl));
        // #endif
        // #if ENABLE(WEBXR)
        //     case WebXRSpaceEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<WebXRSpace&>(impl));
        // #endif
        // #if ENABLE(WEBXR)
        //     case WebXRSystemEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<WebXRSystem&>(impl));
        // #endif
    case WorkerEventTargetInterfaceType:
        return toJS(state, globalObject, static_cast<Worker&>(impl));
        //     case WorkletGlobalScopeEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<WorkletGlobalScope&>(impl));
        //     case XMLHttpRequestEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<XMLHttpRequest&>(impl));
        //     case XMLHttpRequestUploadEventTargetInterfaceType:
        //         return toJS(state, globalObject, static_cast<XMLHttpRequestUpload&>(impl));
        //     }
    }
    return wrap(state, globalObject, impl);
}

} // namespace WebCore