a8fd96c6d8326f07105c30c281ca39b7829ca130
[WebKit-https.git] / WebCore / bindings / v8 / custom / V8CustomBinding.h
1 /*
2  * Copyright (C) 2009 Google Inc. All rights reserved.
3  * 
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are
6  * met:
7  * 
8  *     * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *     * Redistributions in binary form must reproduce the above
11  * copyright notice, this list of conditions and the following disclaimer
12  * in the documentation and/or other materials provided with the
13  * distribution.
14  *     * Neither the name of Google Inc. nor the names of its
15  * contributors may be used to endorse or promote products derived from
16  * this software without specific prior written permission.
17  * 
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30  
31 #ifndef V8CustomBinding_h
32 #define V8CustomBinding_h
33
34 #include "V8Index.h"
35 #include <v8.h>
36
37 struct NPObject;
38
39 #define CALLBACK_FUNC_DECL(NAME) v8::Handle<v8::Value> V8Custom::v8##NAME##Callback(const v8::Arguments& args)
40
41 #define ACCESSOR_GETTER(NAME) \
42     v8::Handle<v8::Value> V8Custom::v8##NAME##AccessorGetter( \
43         v8::Local<v8::String> name, const v8::AccessorInfo& info)
44
45 #define ACCESSOR_SETTER(NAME) \
46     void V8Custom::v8##NAME##AccessorSetter(v8::Local<v8::String> name, \
47         v8::Local<v8::Value> value, const v8::AccessorInfo& info)
48
49 #define INDEXED_PROPERTY_GETTER(NAME) \
50     v8::Handle<v8::Value> V8Custom::v8##NAME##IndexedPropertyGetter( \
51         uint32_t index, const v8::AccessorInfo& info)
52
53 #define INDEXED_PROPERTY_SETTER(NAME) \
54     v8::Handle<v8::Value> V8Custom::v8##NAME##IndexedPropertySetter( \
55         uint32_t index, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
56
57 #define INDEXED_PROPERTY_DELETER(NAME) \
58     v8::Handle<v8::Boolean> V8Custom::v8##NAME##IndexedPropertyDeleter( \
59         uint32_t index, const v8::AccessorInfo& info)
60
61 #define NAMED_PROPERTY_GETTER(NAME) \
62     v8::Handle<v8::Value> V8Custom::v8##NAME##NamedPropertyGetter( \
63         v8::Local<v8::String> name, const v8::AccessorInfo& info)
64
65 #define NAMED_PROPERTY_SETTER(NAME) \
66     v8::Handle<v8::Value> V8Custom::v8##NAME##NamedPropertySetter( \
67         v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
68
69 #define NAMED_PROPERTY_DELETER(NAME) \
70     v8::Handle<v8::Boolean> V8Custom::v8##NAME##NamedPropertyDeleter( \
71         v8::Local<v8::String> name, const v8::AccessorInfo& info)
72
73 #define NAMED_ACCESS_CHECK(NAME) \
74     bool V8Custom::v8##NAME##NamedSecurityCheck(v8::Local<v8::Object> host, \
75         v8::Local<v8::Value> key, v8::AccessType type, v8::Local<v8::Value> data)
76
77 #define INDEXED_ACCESS_CHECK(NAME) \
78     bool V8Custom::v8##NAME##IndexedSecurityCheck(v8::Local<v8::Object> host, \
79         uint32_t index, v8::AccessType type, v8::Local<v8::Value> data)
80
81 #define ACCESSOR_RUNTIME_ENABLER(NAME) bool V8Custom::v8##NAME##Enabled()
82
83 namespace WebCore {
84
85     class DOMWindow;
86     class Element;
87     class Frame;
88     class HTMLCollection;
89     class HTMLFrameElementBase;
90     class String;
91     class V8Proxy;
92
93     bool allowSettingFrameSrcToJavascriptUrl(HTMLFrameElementBase*, String value);
94     bool allowSettingSrcToJavascriptURL(Element*, String name, String value);
95
96     class V8Custom {
97     public:
98         // Constants.
99         static const int kDOMWrapperTypeIndex = 0;
100         static const int kDOMWrapperObjectIndex = 1;
101         static const int kDefaultWrapperInternalFieldCount = 2;
102
103         static const int kNPObjectInternalFieldCount = kDefaultWrapperInternalFieldCount + 0;
104
105         static const int kNodeEventListenerCacheIndex = kDefaultWrapperInternalFieldCount + 0;
106         static const int kNodeMinimumInternalFieldCount = kDefaultWrapperInternalFieldCount + 1;
107
108         static const int kDocumentImplementationIndex = kNodeMinimumInternalFieldCount + 0;
109         static const int kDocumentMinimumInternalFieldCount = kNodeMinimumInternalFieldCount + 1;
110
111         static const int kHTMLDocumentMarkerIndex = kDocumentMinimumInternalFieldCount + 0;
112         static const int kHTMLDocumentShadowIndex = kDocumentMinimumInternalFieldCount + 1;
113         static const int kHTMLDocumentInternalFieldCount = kDocumentMinimumInternalFieldCount + 2;
114
115         static const int kXMLHttpRequestCacheIndex = kDefaultWrapperInternalFieldCount + 0;
116         static const int kXMLHttpRequestInternalFieldCount = kDefaultWrapperInternalFieldCount + 1;
117
118         static const int kMessageChannelPort1Index = kDefaultWrapperInternalFieldCount + 0;
119         static const int kMessageChannelPort2Index = kDefaultWrapperInternalFieldCount + 1;
120         static const int kMessageChannelInternalFieldCount = kDefaultWrapperInternalFieldCount + 2;
121
122         static const int kMessagePortRequestCacheIndex = kDefaultWrapperInternalFieldCount + 0;
123         static const int kMessagePortEntangledPortIndex = kDefaultWrapperInternalFieldCount + 1;
124         static const int kMessagePortInternalFieldCount = kDefaultWrapperInternalFieldCount + 2;
125
126 #if ENABLE(WORKERS)
127         static const int kAbstractWorkerRequestCacheIndex = kDefaultWrapperInternalFieldCount + 0;
128         static const int kAbstractWorkerInternalFieldCount = kDefaultWrapperInternalFieldCount + 1;
129
130         static const int kWorkerRequestCacheIndex = kAbstractWorkerInternalFieldCount + 0;
131         static const int kWorkerInternalFieldCount = kAbstractWorkerInternalFieldCount + 1;
132
133         static const int kWorkerContextRequestCacheIndex = kDefaultWrapperInternalFieldCount + 0;
134         static const int kWorkerContextMinimumInternalFieldCount = kDefaultWrapperInternalFieldCount + 1;
135
136         static const int kDedicatedWorkerContextRequestCacheIndex = kWorkerContextMinimumInternalFieldCount + 0;
137         static const int kDedicatedWorkerContextInternalFieldCount = kWorkerContextMinimumInternalFieldCount + 1;
138 #endif
139
140 #if ENABLE(SHARED_WORKERS)
141         static const int kSharedWorkerRequestCacheIndex = kAbstractWorkerInternalFieldCount + 0;
142         static const int kSharedWorkerInternalFieldCount = kAbstractWorkerInternalFieldCount + 1;
143
144         static const int kSharedWorkerContextRequestCacheIndex = kWorkerContextMinimumInternalFieldCount + 0;
145         static const int kSharedWorkerContextInternalFieldCount = kWorkerContextMinimumInternalFieldCount + 1;
146 #endif
147
148 #if ENABLE(NOTIFICATIONS)
149         static const int kNotificationRequestCacheIndex = kDefaultWrapperInternalFieldCount + 0;
150         static const int kNotificationInternalFieldCount = kDefaultWrapperInternalFieldCount + 1;
151 #endif
152
153 #if ENABLE(SVG)
154         static const int kSVGElementInstanceEventListenerCacheIndex = kDefaultWrapperInternalFieldCount + 0;
155         static const int kSVGElementInstanceInternalFieldCount = kDefaultWrapperInternalFieldCount + 1;
156 #endif
157
158         static const int kDOMWindowConsoleIndex = kDefaultWrapperInternalFieldCount + 0;
159         static const int kDOMWindowHistoryIndex = kDefaultWrapperInternalFieldCount + 1;
160         static const int kDOMWindowLocationbarIndex = kDefaultWrapperInternalFieldCount + 2;
161         static const int kDOMWindowMenubarIndex = kDefaultWrapperInternalFieldCount + 3;
162         static const int kDOMWindowNavigatorIndex = kDefaultWrapperInternalFieldCount + 4;
163         static const int kDOMWindowPersonalbarIndex = kDefaultWrapperInternalFieldCount + 5;
164         static const int kDOMWindowScreenIndex = kDefaultWrapperInternalFieldCount + 6;
165         static const int kDOMWindowScrollbarsIndex = kDefaultWrapperInternalFieldCount + 7;
166         static const int kDOMWindowSelectionIndex = kDefaultWrapperInternalFieldCount + 8;
167         static const int kDOMWindowStatusbarIndex = kDefaultWrapperInternalFieldCount + 9;
168         static const int kDOMWindowToolbarIndex = kDefaultWrapperInternalFieldCount + 10;
169         static const int kDOMWindowLocationIndex = kDefaultWrapperInternalFieldCount + 11;
170         static const int kDOMWindowDOMSelectionIndex = kDefaultWrapperInternalFieldCount + 12;
171         static const int kDOMWindowEventListenerCacheIndex = kDefaultWrapperInternalFieldCount + 13;
172         static const int kDOMWindowInternalFieldCount = kDefaultWrapperInternalFieldCount + 14;
173
174         static const int kStyleSheetOwnerNodeIndex = kDefaultWrapperInternalFieldCount + 0;
175         static const int kStyleSheetInternalFieldCount = kDefaultWrapperInternalFieldCount + 1;
176
177 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
178         static const int kDOMApplicationCacheCacheIndex = kDefaultWrapperInternalFieldCount + 0;
179         static const int kDOMApplicationCacheFieldCount = kDefaultWrapperInternalFieldCount + 1;
180 #endif
181
182 #if ENABLE(WEB_SOCKETS)
183         static const int kWebSocketCacheIndex = kDefaultWrapperInternalFieldCount + 0;
184         static const int kWebSocketInternalFieldCount = kDefaultWrapperInternalFieldCount + 1;
185 #endif
186
187 #define DECLARE_PROPERTY_ACCESSOR_GETTER(NAME) \
188     static v8::Handle<v8::Value> v8##NAME##AccessorGetter( \
189         v8::Local<v8::String> name, const v8::AccessorInfo& info)
190
191 #define DECLARE_PROPERTY_ACCESSOR_SETTER(NAME)  \
192     static void v8##NAME##AccessorSetter(v8::Local<v8::String> name, \
193         v8::Local<v8::Value> value, const v8::AccessorInfo& info)
194
195 #define DECLARE_PROPERTY_ACCESSOR(NAME) DECLARE_PROPERTY_ACCESSOR_GETTER(NAME); DECLARE_PROPERTY_ACCESSOR_SETTER(NAME)
196
197 #define DECLARE_NAMED_PROPERTY_GETTER(NAME)  \
198     static v8::Handle<v8::Value> v8##NAME##NamedPropertyGetter( \
199         v8::Local<v8::String> name, const v8::AccessorInfo& info)
200
201 #define DECLARE_NAMED_PROPERTY_SETTER(NAME) \
202     static v8::Handle<v8::Value> v8##NAME##NamedPropertySetter( \
203         v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
204
205 #define DECLARE_NAMED_PROPERTY_DELETER(NAME) \
206     static v8::Handle<v8::Boolean> v8##NAME##NamedPropertyDeleter( \
207         v8::Local<v8::String> name, const v8::AccessorInfo& info)
208
209 #define USE_NAMED_PROPERTY_GETTER(NAME) V8Custom::v8##NAME##NamedPropertyGetter
210
211 #define USE_NAMED_PROPERTY_SETTER(NAME) V8Custom::v8##NAME##NamedPropertySetter
212
213 #define USE_NAMED_PROPERTY_DELETER(NAME) V8Custom::v8##NAME##NamedPropertyDeleter
214
215 #define DECLARE_INDEXED_PROPERTY_GETTER(NAME) \
216     static v8::Handle<v8::Value> v8##NAME##IndexedPropertyGetter( \
217         uint32_t index, const v8::AccessorInfo& info)
218
219 #define DECLARE_INDEXED_PROPERTY_SETTER(NAME) \
220     static v8::Handle<v8::Value> v8##NAME##IndexedPropertySetter( \
221         uint32_t index, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
222
223 #define DECLARE_INDEXED_PROPERTY_DELETER(NAME) \
224     static v8::Handle<v8::Boolean> v8##NAME##IndexedPropertyDeleter( \
225         uint32_t index, const v8::AccessorInfo& info)
226
227 #define USE_INDEXED_PROPERTY_GETTER(NAME) V8Custom::v8##NAME##IndexedPropertyGetter
228
229 #define USE_INDEXED_PROPERTY_SETTER(NAME) V8Custom::v8##NAME##IndexedPropertySetter
230
231 #define USE_INDEXED_PROPERTY_DELETER(NAME) V8Custom::v8##NAME##IndexedPropertyDeleter
232
233 #define DECLARE_CALLBACK(NAME) static v8::Handle<v8::Value> v8##NAME##Callback(const v8::Arguments& args)
234
235 #define USE_CALLBACK(NAME) V8Custom::v8##NAME##Callback
236
237 #define DECLARE_NAMED_ACCESS_CHECK(NAME) \
238     static bool v8##NAME##NamedSecurityCheck(v8::Local<v8::Object> host, \
239         v8::Local<v8::Value> key, v8::AccessType type, v8::Local<v8::Value> data)
240
241 #define DECLARE_INDEXED_ACCESS_CHECK(NAME) \
242     static bool v8##NAME##IndexedSecurityCheck(v8::Local<v8::Object> host, \
243         uint32_t index, v8::AccessType type, v8::Local<v8::Value> data)
244
245 #define DECLARE_ACCESSOR_RUNTIME_ENABLER(NAME) static bool v8##NAME##Enabled()
246
247         DECLARE_PROPERTY_ACCESSOR(CanvasRenderingContext2DStrokeStyle);
248         DECLARE_PROPERTY_ACCESSOR(CanvasRenderingContext2DFillStyle);
249         DECLARE_PROPERTY_ACCESSOR(DOMWindowEvent);
250         DECLARE_PROPERTY_ACCESSOR_GETTER(DOMWindowCrypto);
251         DECLARE_PROPERTY_ACCESSOR_SETTER(DOMWindowLocation);
252         DECLARE_PROPERTY_ACCESSOR_SETTER(DOMWindowOpener);
253
254 #if ENABLE(VIDEO)
255         DECLARE_PROPERTY_ACCESSOR_GETTER(DOMWindowAudio);
256         DECLARE_ACCESSOR_RUNTIME_ENABLER(DOMWindowAudio);
257         DECLARE_ACCESSOR_RUNTIME_ENABLER(DOMWindowHTMLMediaElement);
258         DECLARE_ACCESSOR_RUNTIME_ENABLER(DOMWindowHTMLAudioElement);
259         DECLARE_ACCESSOR_RUNTIME_ENABLER(DOMWindowHTMLVideoElement);
260         DECLARE_ACCESSOR_RUNTIME_ENABLER(DOMWindowMediaError);
261 #endif
262
263         DECLARE_PROPERTY_ACCESSOR_GETTER(DOMWindowImage);
264         DECLARE_PROPERTY_ACCESSOR_GETTER(DOMWindowOption);
265
266         DECLARE_PROPERTY_ACCESSOR(DocumentLocation);
267         DECLARE_PROPERTY_ACCESSOR(DocumentImplementation);
268         DECLARE_PROPERTY_ACCESSOR_GETTER(EventSrcElement);
269         DECLARE_PROPERTY_ACCESSOR(EventReturnValue);
270         DECLARE_PROPERTY_ACCESSOR_GETTER(EventDataTransfer);
271         DECLARE_PROPERTY_ACCESSOR_GETTER(EventClipboardData);
272
273         DECLARE_PROPERTY_ACCESSOR(DOMWindowEventHandler);
274
275         DECLARE_CALLBACK(HTMLCanvasElementGetContext);
276
277         DECLARE_PROPERTY_ACCESSOR_SETTER(HTMLFrameElementSrc);
278         DECLARE_PROPERTY_ACCESSOR_SETTER(HTMLFrameElementLocation);
279         DECLARE_PROPERTY_ACCESSOR_SETTER(HTMLIFrameElementSrc);
280
281         DECLARE_PROPERTY_ACCESSOR_SETTER(AttrValue);
282
283         DECLARE_PROPERTY_ACCESSOR(HTMLOptionsCollectionLength);
284
285         DECLARE_CALLBACK(HTMLInputElementSetSelectionRange);
286
287         DECLARE_PROPERTY_ACCESSOR(HTMLInputElementSelectionStart);
288         DECLARE_PROPERTY_ACCESSOR(HTMLInputElementSelectionEnd);
289
290         DECLARE_NAMED_ACCESS_CHECK(Location);
291         DECLARE_INDEXED_ACCESS_CHECK(History);
292
293         DECLARE_NAMED_ACCESS_CHECK(History);
294         DECLARE_INDEXED_ACCESS_CHECK(Location);
295
296         DECLARE_CALLBACK(HTMLCollectionItem);
297         DECLARE_CALLBACK(HTMLCollectionNamedItem);
298         DECLARE_CALLBACK(HTMLCollectionCallAsFunction);
299
300         DECLARE_CALLBACK(HTMLAllCollectionItem);
301         DECLARE_CALLBACK(HTMLAllCollectionNamedItem);
302         DECLARE_CALLBACK(HTMLAllCollectionCallAsFunction);
303
304         DECLARE_CALLBACK(HTMLSelectElementRemove);
305
306         DECLARE_CALLBACK(HTMLOptionsCollectionRemove);
307         DECLARE_CALLBACK(HTMLOptionsCollectionAdd);
308
309         DECLARE_CALLBACK(HTMLDocumentWrite);
310         DECLARE_CALLBACK(HTMLDocumentWriteln);
311         DECLARE_CALLBACK(HTMLDocumentOpen);
312         DECLARE_PROPERTY_ACCESSOR(HTMLDocumentAll);
313         DECLARE_NAMED_PROPERTY_GETTER(HTMLDocument);
314         DECLARE_NAMED_PROPERTY_DELETER(HTMLDocument);
315
316         DECLARE_CALLBACK(DocumentEvaluate);
317         DECLARE_CALLBACK(DocumentGetCSSCanvasContext);
318
319         DECLARE_CALLBACK(DOMWindowAddEventListener);
320         DECLARE_CALLBACK(DOMWindowRemoveEventListener);
321         DECLARE_CALLBACK(DOMWindowPostMessage);
322         DECLARE_CALLBACK(DOMWindowSetTimeout);
323         DECLARE_CALLBACK(DOMWindowSetInterval);
324         DECLARE_CALLBACK(DOMWindowAtob);
325         DECLARE_CALLBACK(DOMWindowBtoa);
326         DECLARE_CALLBACK(DOMWindowNOP);
327         DECLARE_CALLBACK(DOMWindowToString);
328         DECLARE_CALLBACK(DOMWindowShowModalDialog);
329         DECLARE_CALLBACK(DOMWindowOpen);
330         DECLARE_CALLBACK(DOMWindowClearTimeout);
331         DECLARE_CALLBACK(DOMWindowClearInterval);
332
333         DECLARE_CALLBACK(DOMParserConstructor);
334         DECLARE_CALLBACK(HTMLAudioElementConstructor);
335         DECLARE_CALLBACK(HTMLImageElementConstructor);
336         DECLARE_CALLBACK(HTMLOptionElementConstructor);
337         DECLARE_CALLBACK(MessageChannelConstructor);
338         DECLARE_CALLBACK(WebKitCSSMatrixConstructor);
339         DECLARE_CALLBACK(WebKitPointConstructor);
340         DECLARE_CALLBACK(XMLHttpRequestConstructor);
341         DECLARE_CALLBACK(XMLSerializerConstructor);
342         DECLARE_CALLBACK(XPathEvaluatorConstructor);
343         DECLARE_CALLBACK(XSLTProcessorConstructor);
344
345         DECLARE_CALLBACK(XSLTProcessorImportStylesheet);
346         DECLARE_CALLBACK(XSLTProcessorTransformToFragment);
347         DECLARE_CALLBACK(XSLTProcessorTransformToDocument);
348         DECLARE_CALLBACK(XSLTProcessorSetParameter);
349         DECLARE_CALLBACK(XSLTProcessorGetParameter);
350         DECLARE_CALLBACK(XSLTProcessorRemoveParameter);
351
352         DECLARE_CALLBACK(CSSPrimitiveValueGetRGBColorValue);
353
354         DECLARE_CALLBACK(CanvasRenderingContext2DSetStrokeColor);
355         DECLARE_CALLBACK(CanvasRenderingContext2DSetFillColor);
356         DECLARE_CALLBACK(CanvasRenderingContext2DStrokeRect);
357         DECLARE_CALLBACK(CanvasRenderingContext2DSetShadow);
358         DECLARE_CALLBACK(CanvasRenderingContext2DDrawImage);
359         DECLARE_CALLBACK(CanvasRenderingContext2DDrawImageFromRect);
360         DECLARE_CALLBACK(CanvasRenderingContext2DCreatePattern);
361         DECLARE_CALLBACK(CanvasRenderingContext2DFillText);
362         DECLARE_CALLBACK(CanvasRenderingContext2DStrokeText);
363         DECLARE_CALLBACK(CanvasRenderingContext2DPutImageData);
364
365 #if ENABLE(3D_CANVAS)
366         DECLARE_CALLBACK(WebGLRenderingContextBufferData);
367         DECLARE_CALLBACK(WebGLRenderingContextBufferSubData);
368         DECLARE_CALLBACK(WebGLRenderingContextGetBufferParameter);
369         DECLARE_CALLBACK(WebGLRenderingContextGetFramebufferAttachmentParameter);
370         DECLARE_CALLBACK(WebGLRenderingContextGetParameter);
371         DECLARE_CALLBACK(WebGLRenderingContextGetProgramParameter);
372         DECLARE_CALLBACK(WebGLRenderingContextGetRenderbufferParameter);
373         DECLARE_CALLBACK(WebGLRenderingContextGetShaderParameter);
374         DECLARE_CALLBACK(WebGLRenderingContextGetTexParameter);
375         DECLARE_CALLBACK(WebGLRenderingContextGetUniform);
376         DECLARE_CALLBACK(WebGLRenderingContextGetVertexAttrib);
377         DECLARE_CALLBACK(WebGLRenderingContextTexImage2D);
378         DECLARE_CALLBACK(WebGLRenderingContextTexSubImage2D);
379         DECLARE_CALLBACK(WebGLRenderingContextUniform1fv);
380         DECLARE_CALLBACK(WebGLRenderingContextUniform1iv);
381         DECLARE_CALLBACK(WebGLRenderingContextUniform2fv);
382         DECLARE_CALLBACK(WebGLRenderingContextUniform2iv);
383         DECLARE_CALLBACK(WebGLRenderingContextUniform3fv);
384         DECLARE_CALLBACK(WebGLRenderingContextUniform3iv);
385         DECLARE_CALLBACK(WebGLRenderingContextUniform4fv);
386         DECLARE_CALLBACK(WebGLRenderingContextUniform4iv);
387         DECLARE_CALLBACK(WebGLRenderingContextUniformMatrix2fv);
388         DECLARE_CALLBACK(WebGLRenderingContextUniformMatrix3fv);
389         DECLARE_CALLBACK(WebGLRenderingContextUniformMatrix4fv);
390         DECLARE_CALLBACK(WebGLRenderingContextVertexAttrib1fv);
391         DECLARE_CALLBACK(WebGLRenderingContextVertexAttrib2fv);
392         DECLARE_CALLBACK(WebGLRenderingContextVertexAttrib3fv);
393         DECLARE_CALLBACK(WebGLRenderingContextVertexAttrib4fv);
394
395         DECLARE_CALLBACK(WebGLArrayBufferConstructor);
396         DECLARE_CALLBACK(WebGLByteArrayConstructor);
397         DECLARE_CALLBACK(WebGLFloatArrayConstructor);
398         DECLARE_CALLBACK(WebGLIntArrayConstructor);
399         DECLARE_CALLBACK(WebGLShortArrayConstructor);
400         DECLARE_CALLBACK(WebGLUnsignedByteArrayConstructor);
401         DECLARE_CALLBACK(WebGLUnsignedIntArrayConstructor);
402         DECLARE_CALLBACK(WebGLUnsignedShortArrayConstructor);
403 #endif
404
405         DECLARE_PROPERTY_ACCESSOR_GETTER(ClipboardTypes);
406         DECLARE_CALLBACK(ClipboardClearData);
407         DECLARE_CALLBACK(ClipboardGetData);
408         DECLARE_CALLBACK(ClipboardSetData);
409         DECLARE_CALLBACK(ClipboardSetDragImage);
410
411         DECLARE_CALLBACK(ElementQuerySelector);
412         DECLARE_CALLBACK(ElementQuerySelectorAll);
413         DECLARE_CALLBACK(ElementSetAttribute);
414         DECLARE_CALLBACK(ElementSetAttributeNode);
415         DECLARE_CALLBACK(ElementSetAttributeNS);
416         DECLARE_CALLBACK(ElementSetAttributeNodeNS);
417
418         DECLARE_PROPERTY_ACCESSOR_SETTER(LocationProtocol);
419         DECLARE_PROPERTY_ACCESSOR_SETTER(LocationHost);
420         DECLARE_PROPERTY_ACCESSOR_SETTER(LocationHostname);
421         DECLARE_PROPERTY_ACCESSOR_SETTER(LocationPort);
422         DECLARE_PROPERTY_ACCESSOR_SETTER(LocationPathname);
423         DECLARE_PROPERTY_ACCESSOR_SETTER(LocationSearch);
424         DECLARE_PROPERTY_ACCESSOR_SETTER(LocationHash);
425         DECLARE_PROPERTY_ACCESSOR_SETTER(LocationHref);
426         DECLARE_PROPERTY_ACCESSOR_GETTER(LocationAssign);
427         DECLARE_PROPERTY_ACCESSOR_GETTER(LocationReplace);
428         DECLARE_PROPERTY_ACCESSOR_GETTER(LocationReload);
429         DECLARE_CALLBACK(LocationAssign);
430         DECLARE_CALLBACK(LocationReplace);
431         DECLARE_CALLBACK(LocationReload);
432         DECLARE_CALLBACK(LocationToString);
433         DECLARE_CALLBACK(LocationValueOf);
434
435         DECLARE_CALLBACK(NodeAddEventListener);
436         DECLARE_CALLBACK(NodeRemoveEventListener);
437         DECLARE_CALLBACK(NodeInsertBefore);
438         DECLARE_CALLBACK(NodeReplaceChild);
439         DECLARE_CALLBACK(NodeRemoveChild);
440         DECLARE_CALLBACK(NodeAppendChild);
441
442         // We actually only need this because WebKit has
443         // navigator.appVersion as custom. Our version just
444         // passes through.
445         DECLARE_PROPERTY_ACCESSOR(NavigatorAppVersion);
446
447         DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestOnabort);
448         DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestOnerror);
449         DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestOnload);
450         DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestOnloadstart);
451         DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestOnprogress);
452         DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestOnreadystatechange);
453         DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestResponseText);
454         DECLARE_CALLBACK(XMLHttpRequestAddEventListener);
455         DECLARE_CALLBACK(XMLHttpRequestRemoveEventListener);
456         DECLARE_CALLBACK(XMLHttpRequestOpen);
457         DECLARE_CALLBACK(XMLHttpRequestSend);
458         DECLARE_CALLBACK(XMLHttpRequestSetRequestHeader);
459         DECLARE_CALLBACK(XMLHttpRequestGetResponseHeader);
460         DECLARE_CALLBACK(XMLHttpRequestOverrideMimeType);
461         DECLARE_CALLBACK(XMLHttpRequestDispatchEvent);
462
463         DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestUploadOnabort);
464         DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestUploadOnerror);
465         DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestUploadOnload);
466         DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestUploadOnloadstart);
467         DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestUploadOnprogress);
468         DECLARE_CALLBACK(XMLHttpRequestUploadAddEventListener);
469         DECLARE_CALLBACK(XMLHttpRequestUploadRemoveEventListener);
470         DECLARE_CALLBACK(XMLHttpRequestUploadDispatchEvent);
471
472         DECLARE_CALLBACK(TreeWalkerParentNode);
473         DECLARE_CALLBACK(TreeWalkerFirstChild);
474         DECLARE_CALLBACK(TreeWalkerLastChild);
475         DECLARE_CALLBACK(TreeWalkerNextNode);
476         DECLARE_CALLBACK(TreeWalkerPreviousNode);
477         DECLARE_CALLBACK(TreeWalkerNextSibling);
478         DECLARE_CALLBACK(TreeWalkerPreviousSibling);
479
480         DECLARE_CALLBACK(InspectorBackendHighlightDOMNode);
481         DECLARE_CALLBACK(InspectorBackendAddResourceSourceToFrame);
482         DECLARE_CALLBACK(InspectorBackendAddSourceToFrame);
483         DECLARE_CALLBACK(InspectorBackendSearch);
484         DECLARE_CALLBACK(InspectorBackendSetting);
485         DECLARE_CALLBACK(InspectorBackendDatabaseForId);
486         DECLARE_CALLBACK(InspectorBackendInspectedWindow);
487         DECLARE_CALLBACK(InspectorBackendSetSetting);
488         DECLARE_CALLBACK(InspectorBackendCurrentCallFrame);
489         DECLARE_CALLBACK(InspectorBackendDebuggerEnabled);
490         DECLARE_CALLBACK(InspectorBackendPauseOnExceptions);
491         DECLARE_CALLBACK(InspectorBackendProfilerEnabled);
492         DECLARE_CALLBACK(InspectorBackendNodeForId);
493         DECLARE_CALLBACK(InspectorBackendWrapObject);
494         DECLARE_CALLBACK(InspectorBackendUnwrapObject);
495         DECLARE_CALLBACK(InspectorBackendPushNodePathToFrontend);
496 #if ENABLE(DATABASE)
497         DECLARE_CALLBACK(InspectorBackendSelectDatabase);
498 #endif
499 #if ENABLE(DOM_STORAGE)
500         DECLARE_CALLBACK(InspectorBackendSelectDOMStorage);
501 #endif
502         DECLARE_CALLBACK(InspectorBackendWrapCallback);
503
504         DECLARE_CALLBACK(ConsoleProfile);
505         DECLARE_CALLBACK(ConsoleProfileEnd);
506
507         DECLARE_CALLBACK(NodeIteratorNextNode);
508         DECLARE_CALLBACK(NodeIteratorPreviousNode);
509
510         DECLARE_CALLBACK(NodeFilterAcceptNode);
511
512         DECLARE_CALLBACK(HTMLFormElementSubmit);
513
514         DECLARE_NAMED_PROPERTY_GETTER(DOMWindow);
515         DECLARE_INDEXED_PROPERTY_GETTER(DOMWindow);
516         DECLARE_NAMED_ACCESS_CHECK(DOMWindow);
517         DECLARE_INDEXED_ACCESS_CHECK(DOMWindow);
518
519         DECLARE_NAMED_PROPERTY_GETTER(HTMLFrameSetElement);
520         DECLARE_NAMED_PROPERTY_GETTER(HTMLFormElement);
521         DECLARE_NAMED_PROPERTY_GETTER(NodeList);
522         DECLARE_NAMED_PROPERTY_GETTER(NamedNodeMap);
523         DECLARE_NAMED_PROPERTY_GETTER(CSSStyleDeclaration);
524         DECLARE_NAMED_PROPERTY_SETTER(CSSStyleDeclaration);
525         DECLARE_NAMED_PROPERTY_GETTER(HTMLPlugInElement);
526         DECLARE_NAMED_PROPERTY_SETTER(HTMLPlugInElement);
527         DECLARE_INDEXED_PROPERTY_GETTER(HTMLPlugInElement);
528         DECLARE_INDEXED_PROPERTY_SETTER(HTMLPlugInElement);
529
530         DECLARE_CALLBACK(HTMLPlugInElement);
531
532         DECLARE_NAMED_PROPERTY_GETTER(StyleSheetList);
533         DECLARE_INDEXED_PROPERTY_GETTER(NamedNodeMap);
534         DECLARE_INDEXED_PROPERTY_GETTER(HTMLFormElement);
535         DECLARE_INDEXED_PROPERTY_GETTER(HTMLOptionsCollection);
536         DECLARE_INDEXED_PROPERTY_SETTER(HTMLOptionsCollection);
537         DECLARE_NAMED_PROPERTY_GETTER(HTMLSelectElementCollection);
538         DECLARE_INDEXED_PROPERTY_SETTER(HTMLSelectElementCollection);
539         DECLARE_NAMED_PROPERTY_GETTER(HTMLAllCollection);
540         DECLARE_NAMED_PROPERTY_GETTER(HTMLCollection);
541
542 #if ENABLE(3D_CANVAS)
543         DECLARE_CALLBACK(WebGLByteArrayGet);
544         DECLARE_CALLBACK(WebGLByteArraySet);
545         DECLARE_INDEXED_PROPERTY_GETTER(WebGLByteArray);
546         DECLARE_INDEXED_PROPERTY_SETTER(WebGLByteArray);
547
548         DECLARE_CALLBACK(WebGLFloatArrayGet);
549         DECLARE_CALLBACK(WebGLFloatArraySet);
550         DECLARE_INDEXED_PROPERTY_GETTER(WebGLFloatArray);
551         DECLARE_INDEXED_PROPERTY_SETTER(WebGLFloatArray);
552
553         DECLARE_CALLBACK(WebGLIntArrayGet);
554         DECLARE_CALLBACK(WebGLIntArraySet);
555         DECLARE_INDEXED_PROPERTY_GETTER(WebGLIntArray);
556         DECLARE_INDEXED_PROPERTY_SETTER(WebGLIntArray);
557
558         DECLARE_CALLBACK(WebGLShortArrayGet);
559         DECLARE_CALLBACK(WebGLShortArraySet);
560         DECLARE_INDEXED_PROPERTY_GETTER(WebGLShortArray);
561         DECLARE_INDEXED_PROPERTY_SETTER(WebGLShortArray);
562
563         DECLARE_CALLBACK(WebGLUnsignedByteArrayGet);
564         DECLARE_CALLBACK(WebGLUnsignedByteArraySet);
565         DECLARE_INDEXED_PROPERTY_GETTER(WebGLUnsignedByteArray);
566         DECLARE_INDEXED_PROPERTY_SETTER(WebGLUnsignedByteArray);
567
568         DECLARE_CALLBACK(WebGLUnsignedIntArrayGet);
569         DECLARE_CALLBACK(WebGLUnsignedIntArraySet);
570         DECLARE_INDEXED_PROPERTY_GETTER(WebGLUnsignedIntArray);
571         DECLARE_INDEXED_PROPERTY_SETTER(WebGLUnsignedIntArray);
572
573         DECLARE_CALLBACK(WebGLUnsignedShortArrayGet);
574         DECLARE_CALLBACK(WebGLUnsignedShortArraySet);
575         DECLARE_INDEXED_PROPERTY_GETTER(WebGLUnsignedShortArray);
576         DECLARE_INDEXED_PROPERTY_SETTER(WebGLUnsignedShortArray);
577 #endif
578
579         DECLARE_PROPERTY_ACCESSOR_GETTER(MessageEventPorts);
580         DECLARE_CALLBACK(MessageEventInitMessageEvent);
581
582         DECLARE_PROPERTY_ACCESSOR(MessagePortOnmessage);
583         DECLARE_PROPERTY_ACCESSOR(MessagePortOnclose);
584         DECLARE_CALLBACK(MessagePortAddEventListener);
585         DECLARE_CALLBACK(MessagePortPostMessage);
586         DECLARE_CALLBACK(MessagePortRemoveEventListener);
587         DECLARE_CALLBACK(MessagePortStartConversation);
588
589         DECLARE_CALLBACK(DatabaseChangeVersion);
590         DECLARE_CALLBACK(DatabaseTransaction);
591         DECLARE_CALLBACK(DatabaseReadTransaction);
592         DECLARE_CALLBACK(SQLTransactionExecuteSql);
593         DECLARE_CALLBACK(SQLResultSetRowListItem);
594
595         DECLARE_INDEXED_PROPERTY_GETTER(ClientRectList);
596         DECLARE_INDEXED_PROPERTY_GETTER(FileList);
597
598 #if ENABLE(DATAGRID)
599         DECLARE_PROPERTY_ACCESSOR(HTMLDataGridElementDataSource);
600         DECLARE_INDEXED_PROPERTY_GETTER(DataGridColumnList);
601         DECLARE_NAMED_PROPERTY_GETTER(DataGridColumnList);
602 #endif
603
604 #if ENABLE(DATABASE)
605         DECLARE_ACCESSOR_RUNTIME_ENABLER(DOMWindowOpenDatabase);
606 #endif
607
608 #if ENABLE(DOM_STORAGE)
609         DECLARE_ACCESSOR_RUNTIME_ENABLER(DOMWindowLocalStorage);
610         DECLARE_ACCESSOR_RUNTIME_ENABLER(DOMWindowSessionStorage);
611         DECLARE_INDEXED_PROPERTY_GETTER(Storage);
612         DECLARE_INDEXED_PROPERTY_SETTER(Storage);
613         DECLARE_INDEXED_PROPERTY_DELETER(Storage);
614         DECLARE_NAMED_PROPERTY_GETTER(Storage);
615         DECLARE_NAMED_PROPERTY_SETTER(Storage);
616         DECLARE_NAMED_PROPERTY_DELETER(Storage);
617         static v8::Handle<v8::Array> v8StorageNamedPropertyEnumerator(const v8::AccessorInfo& info);
618 #endif
619
620 #if ENABLE(SVG)
621         DECLARE_PROPERTY_ACCESSOR_GETTER(SVGLengthValue);
622         DECLARE_CALLBACK(SVGLengthConvertToSpecifiedUnits);
623         DECLARE_CALLBACK(SVGMatrixMultiply);
624         DECLARE_CALLBACK(SVGMatrixInverse);
625         DECLARE_CALLBACK(SVGMatrixRotateFromVector);
626         DECLARE_CALLBACK(SVGElementInstanceAddEventListener);
627         DECLARE_CALLBACK(SVGElementInstanceRemoveEventListener);
628 #endif
629
630 #if ENABLE(WORKERS)
631         DECLARE_PROPERTY_ACCESSOR(AbstractWorkerOnerror);
632         DECLARE_CALLBACK(AbstractWorkerAddEventListener);
633         DECLARE_CALLBACK(AbstractWorkerRemoveEventListener);
634
635         DECLARE_PROPERTY_ACCESSOR(DedicatedWorkerContextOnmessage);
636         DECLARE_CALLBACK(DedicatedWorkerContextPostMessage);
637
638         DECLARE_PROPERTY_ACCESSOR(WorkerOnmessage);
639         DECLARE_CALLBACK(WorkerPostMessage);
640         DECLARE_CALLBACK(WorkerConstructor);
641
642         DECLARE_PROPERTY_ACCESSOR_GETTER(WorkerContextSelf);
643         DECLARE_PROPERTY_ACCESSOR(WorkerContextOnerror);
644         DECLARE_CALLBACK(WorkerContextImportScripts);
645         DECLARE_CALLBACK(WorkerContextSetTimeout);
646         DECLARE_CALLBACK(WorkerContextClearTimeout);
647         DECLARE_CALLBACK(WorkerContextSetInterval);
648         DECLARE_CALLBACK(WorkerContextClearInterval);
649         DECLARE_CALLBACK(WorkerContextAddEventListener);
650         DECLARE_CALLBACK(WorkerContextRemoveEventListener);
651
652 #if ENABLE(NOTIFICATIONS)
653         DECLARE_ACCESSOR_RUNTIME_ENABLER(WorkerContextWebkitNotifications);
654 #endif
655 #endif // ENABLE(WORKERS)
656
657 #if ENABLE(NOTIFICATIONS)
658         DECLARE_CALLBACK(NotificationCenterRequestPermission);
659         DECLARE_CALLBACK(NotificationCenterCreateNotification);
660         DECLARE_CALLBACK(NotificationCenterCreateHTMLNotification);
661
662         DECLARE_CALLBACK(NotificationAddEventListener);
663         DECLARE_CALLBACK(NotificationRemoveEventListener);
664         DECLARE_PROPERTY_ACCESSOR(NotificationEventHandler);
665 #endif // ENABLE(NOTIFICATIONS)
666
667 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
668         DECLARE_ACCESSOR_RUNTIME_ENABLER(DOMWindowApplicationCache);
669         DECLARE_PROPERTY_ACCESSOR(DOMApplicationCacheEventHandler);
670         DECLARE_CALLBACK(DOMApplicationCacheAddEventListener);
671         DECLARE_CALLBACK(DOMApplicationCacheRemoveEventListener);
672 #endif
673
674 #if ENABLE(SHARED_WORKERS)
675         DECLARE_CALLBACK(SharedWorkerConstructor);
676         DECLARE_ACCESSOR_RUNTIME_ENABLER(DOMWindowSharedWorker);
677 #endif
678
679 #if ENABLE(NOTIFICATIONS)
680         DECLARE_ACCESSOR_RUNTIME_ENABLER(DOMWindowWebkitNotifications);
681 #endif
682
683 #if ENABLE(WEB_SOCKETS)
684         DECLARE_PROPERTY_ACCESSOR(WebSocketOnopen);
685         DECLARE_PROPERTY_ACCESSOR(WebSocketOnmessage);
686         DECLARE_PROPERTY_ACCESSOR(WebSocketOnclose);
687         DECLARE_CALLBACK(WebSocketConstructor);
688         DECLARE_CALLBACK(WebSocketAddEventListener);
689         DECLARE_CALLBACK(WebSocketRemoveEventListener);
690         DECLARE_CALLBACK(WebSocketSend);
691         DECLARE_CALLBACK(WebSocketClose);
692         DECLARE_ACCESSOR_RUNTIME_ENABLER(DOMWindowWebSocket);
693 #endif
694
695 #undef DECLARE_INDEXED_ACCESS_CHECK
696 #undef DECLARE_NAMED_ACCESS_CHECK
697
698 #undef DECLARE_PROPERTY_ACCESSOR_SETTER
699 #undef DECLARE_PROPERTY_ACCESSOR_GETTER
700 #undef DECLARE_PROPERTY_ACCESSOR
701
702 #undef DECLARE_NAMED_PROPERTY_GETTER
703 #undef DECLARE_NAMED_PROPERTY_SETTER
704 #undef DECLARE_NAMED_PROPERTY_DELETER
705
706 #undef DECLARE_INDEXED_PROPERTY_GETTER
707 #undef DECLARE_INDEXED_PROPERTY_SETTER
708 #undef DECLARE_INDEXED_PROPERTY_DELETER
709
710 #undef DECLARE_CALLBACK
711
712         // Returns the NPObject corresponding to an HTMLElement object.
713         static NPObject* GetHTMLPlugInElementNPObject(v8::Handle<v8::Object>);
714
715         // Returns the owner frame pointer of a DOM wrapper object. It only works for
716         // these DOM objects requiring cross-domain access check.
717         static Frame* GetTargetFrame(v8::Local<v8::Object> host, v8::Local<v8::Value> data);
718
719         // Special case for downcasting SVG path segments.
720 #if ENABLE(SVG)
721         static V8ClassIndex::V8WrapperType DowncastSVGPathSeg(void* pathSeg);
722 #endif
723
724     private:
725         static v8::Handle<v8::Value> WindowSetTimeoutImpl(const v8::Arguments&, bool singleShot);
726         static void ClearTimeoutImpl(const v8::Arguments&);
727         static void WindowSetLocation(DOMWindow*, const String&);
728     };
729
730 } // namespace WebCore
731
732 #endif // V8CustomBinding_h