2009-11-25 Drew Wilson <atwilson@chromium.org>
[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 kMessagePortInternalFieldCount = kDefaultWrapperInternalFieldCount + 1;
124
125 #if ENABLE(WORKERS)
126         static const int kAbstractWorkerRequestCacheIndex = kDefaultWrapperInternalFieldCount + 0;
127         static const int kAbstractWorkerInternalFieldCount = kDefaultWrapperInternalFieldCount + 1;
128
129         static const int kWorkerRequestCacheIndex = kAbstractWorkerInternalFieldCount + 0;
130         static const int kWorkerInternalFieldCount = kAbstractWorkerInternalFieldCount + 1;
131
132         static const int kWorkerContextRequestCacheIndex = kDefaultWrapperInternalFieldCount + 0;
133         static const int kWorkerContextMinimumInternalFieldCount = kDefaultWrapperInternalFieldCount + 1;
134
135         static const int kDedicatedWorkerContextRequestCacheIndex = kWorkerContextMinimumInternalFieldCount + 0;
136         static const int kDedicatedWorkerContextInternalFieldCount = kWorkerContextMinimumInternalFieldCount + 1;
137 #endif
138
139 #if ENABLE(SHARED_WORKERS)
140         static const int kSharedWorkerRequestCacheIndex = kAbstractWorkerInternalFieldCount + 0;
141         static const int kSharedWorkerInternalFieldCount = kAbstractWorkerInternalFieldCount + 1;
142
143         static const int kSharedWorkerContextRequestCacheIndex = kWorkerContextMinimumInternalFieldCount + 0;
144         static const int kSharedWorkerContextInternalFieldCount = kWorkerContextMinimumInternalFieldCount + 1;
145 #endif
146
147 #if ENABLE(NOTIFICATIONS)
148         static const int kNotificationRequestCacheIndex = kDefaultWrapperInternalFieldCount + 0;
149         static const int kNotificationInternalFieldCount = kDefaultWrapperInternalFieldCount + 1;
150 #endif
151
152 #if ENABLE(SVG)
153         static const int kSVGElementInstanceEventListenerCacheIndex = kDefaultWrapperInternalFieldCount + 0;
154         static const int kSVGElementInstanceInternalFieldCount = kDefaultWrapperInternalFieldCount + 1;
155 #endif
156
157         static const int kDOMWindowConsoleIndex = kDefaultWrapperInternalFieldCount + 0;
158         static const int kDOMWindowHistoryIndex = kDefaultWrapperInternalFieldCount + 1;
159         static const int kDOMWindowLocationbarIndex = kDefaultWrapperInternalFieldCount + 2;
160         static const int kDOMWindowMenubarIndex = kDefaultWrapperInternalFieldCount + 3;
161         static const int kDOMWindowNavigatorIndex = kDefaultWrapperInternalFieldCount + 4;
162         static const int kDOMWindowPersonalbarIndex = kDefaultWrapperInternalFieldCount + 5;
163         static const int kDOMWindowScreenIndex = kDefaultWrapperInternalFieldCount + 6;
164         static const int kDOMWindowScrollbarsIndex = kDefaultWrapperInternalFieldCount + 7;
165         static const int kDOMWindowSelectionIndex = kDefaultWrapperInternalFieldCount + 8;
166         static const int kDOMWindowStatusbarIndex = kDefaultWrapperInternalFieldCount + 9;
167         static const int kDOMWindowToolbarIndex = kDefaultWrapperInternalFieldCount + 10;
168         static const int kDOMWindowLocationIndex = kDefaultWrapperInternalFieldCount + 11;
169         static const int kDOMWindowDOMSelectionIndex = kDefaultWrapperInternalFieldCount + 12;
170         static const int kDOMWindowEventListenerCacheIndex = kDefaultWrapperInternalFieldCount + 13;
171         static const int kDOMWindowInternalFieldCount = kDefaultWrapperInternalFieldCount + 14;
172
173         static const int kStyleSheetOwnerNodeIndex = kDefaultWrapperInternalFieldCount + 0;
174         static const int kStyleSheetInternalFieldCount = kDefaultWrapperInternalFieldCount + 1;
175
176 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
177         static const int kDOMApplicationCacheCacheIndex = kDefaultWrapperInternalFieldCount + 0;
178         static const int kDOMApplicationCacheFieldCount = kDefaultWrapperInternalFieldCount + 1;
179 #endif
180
181 #if ENABLE(WEB_SOCKETS)
182         static const int kWebSocketCacheIndex = kDefaultWrapperInternalFieldCount + 0;
183         static const int kWebSocketInternalFieldCount = kDefaultWrapperInternalFieldCount + 1;
184 #endif
185
186 #define DECLARE_PROPERTY_ACCESSOR_GETTER(NAME) \
187     static v8::Handle<v8::Value> v8##NAME##AccessorGetter( \
188         v8::Local<v8::String> name, const v8::AccessorInfo& info)
189
190 #define DECLARE_PROPERTY_ACCESSOR_SETTER(NAME)  \
191     static void v8##NAME##AccessorSetter(v8::Local<v8::String> name, \
192         v8::Local<v8::Value> value, const v8::AccessorInfo& info)
193
194 #define DECLARE_PROPERTY_ACCESSOR(NAME) DECLARE_PROPERTY_ACCESSOR_GETTER(NAME); DECLARE_PROPERTY_ACCESSOR_SETTER(NAME)
195
196 #define DECLARE_NAMED_PROPERTY_GETTER(NAME)  \
197     static v8::Handle<v8::Value> v8##NAME##NamedPropertyGetter( \
198         v8::Local<v8::String> name, const v8::AccessorInfo& info)
199
200 #define DECLARE_NAMED_PROPERTY_SETTER(NAME) \
201     static v8::Handle<v8::Value> v8##NAME##NamedPropertySetter( \
202         v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
203
204 #define DECLARE_NAMED_PROPERTY_DELETER(NAME) \
205     static v8::Handle<v8::Boolean> v8##NAME##NamedPropertyDeleter( \
206         v8::Local<v8::String> name, const v8::AccessorInfo& info)
207
208 #define USE_NAMED_PROPERTY_GETTER(NAME) V8Custom::v8##NAME##NamedPropertyGetter
209
210 #define USE_NAMED_PROPERTY_SETTER(NAME) V8Custom::v8##NAME##NamedPropertySetter
211
212 #define USE_NAMED_PROPERTY_DELETER(NAME) V8Custom::v8##NAME##NamedPropertyDeleter
213
214 #define DECLARE_INDEXED_PROPERTY_GETTER(NAME) \
215     static v8::Handle<v8::Value> v8##NAME##IndexedPropertyGetter( \
216         uint32_t index, const v8::AccessorInfo& info)
217
218 #define DECLARE_INDEXED_PROPERTY_SETTER(NAME) \
219     static v8::Handle<v8::Value> v8##NAME##IndexedPropertySetter( \
220         uint32_t index, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
221
222 #define DECLARE_INDEXED_PROPERTY_DELETER(NAME) \
223     static v8::Handle<v8::Boolean> v8##NAME##IndexedPropertyDeleter( \
224         uint32_t index, const v8::AccessorInfo& info)
225
226 #define USE_INDEXED_PROPERTY_GETTER(NAME) V8Custom::v8##NAME##IndexedPropertyGetter
227
228 #define USE_INDEXED_PROPERTY_SETTER(NAME) V8Custom::v8##NAME##IndexedPropertySetter
229
230 #define USE_INDEXED_PROPERTY_DELETER(NAME) V8Custom::v8##NAME##IndexedPropertyDeleter
231
232 #define DECLARE_CALLBACK(NAME) static v8::Handle<v8::Value> v8##NAME##Callback(const v8::Arguments& args)
233
234 #define USE_CALLBACK(NAME) V8Custom::v8##NAME##Callback
235
236 #define DECLARE_NAMED_ACCESS_CHECK(NAME) \
237     static bool v8##NAME##NamedSecurityCheck(v8::Local<v8::Object> host, \
238         v8::Local<v8::Value> key, v8::AccessType type, v8::Local<v8::Value> data)
239
240 #define DECLARE_INDEXED_ACCESS_CHECK(NAME) \
241     static bool v8##NAME##IndexedSecurityCheck(v8::Local<v8::Object> host, \
242         uint32_t index, v8::AccessType type, v8::Local<v8::Value> data)
243
244 #define DECLARE_ACCESSOR_RUNTIME_ENABLER(NAME) static bool v8##NAME##Enabled()
245
246         DECLARE_PROPERTY_ACCESSOR(CanvasRenderingContext2DStrokeStyle);
247         DECLARE_PROPERTY_ACCESSOR(CanvasRenderingContext2DFillStyle);
248         DECLARE_PROPERTY_ACCESSOR(DOMWindowEvent);
249         DECLARE_PROPERTY_ACCESSOR_GETTER(DOMWindowCrypto);
250         DECLARE_PROPERTY_ACCESSOR_SETTER(DOMWindowLocation);
251         DECLARE_PROPERTY_ACCESSOR_SETTER(DOMWindowOpener);
252
253 #if ENABLE(VIDEO)
254         DECLARE_PROPERTY_ACCESSOR_GETTER(DOMWindowAudio);
255         DECLARE_ACCESSOR_RUNTIME_ENABLER(DOMWindowAudio);
256         DECLARE_ACCESSOR_RUNTIME_ENABLER(DOMWindowHTMLMediaElement);
257         DECLARE_ACCESSOR_RUNTIME_ENABLER(DOMWindowHTMLAudioElement);
258         DECLARE_ACCESSOR_RUNTIME_ENABLER(DOMWindowHTMLVideoElement);
259         DECLARE_ACCESSOR_RUNTIME_ENABLER(DOMWindowMediaError);
260 #endif
261
262         DECLARE_PROPERTY_ACCESSOR_GETTER(DOMWindowImage);
263         DECLARE_PROPERTY_ACCESSOR_GETTER(DOMWindowOption);
264
265         DECLARE_PROPERTY_ACCESSOR(DocumentLocation);
266         DECLARE_PROPERTY_ACCESSOR(DocumentImplementation);
267         DECLARE_PROPERTY_ACCESSOR_GETTER(EventSrcElement);
268         DECLARE_PROPERTY_ACCESSOR(EventReturnValue);
269         DECLARE_PROPERTY_ACCESSOR_GETTER(EventDataTransfer);
270         DECLARE_PROPERTY_ACCESSOR_GETTER(EventClipboardData);
271
272         DECLARE_PROPERTY_ACCESSOR(DOMWindowEventHandler);
273
274         DECLARE_CALLBACK(HTMLCanvasElementGetContext);
275
276         DECLARE_PROPERTY_ACCESSOR_SETTER(HTMLFrameElementSrc);
277         DECLARE_PROPERTY_ACCESSOR_SETTER(HTMLFrameElementLocation);
278         DECLARE_PROPERTY_ACCESSOR_SETTER(HTMLIFrameElementSrc);
279
280         DECLARE_PROPERTY_ACCESSOR_SETTER(AttrValue);
281
282         DECLARE_PROPERTY_ACCESSOR(HTMLOptionsCollectionLength);
283
284         DECLARE_CALLBACK(HTMLInputElementSetSelectionRange);
285
286         DECLARE_PROPERTY_ACCESSOR(HTMLInputElementSelectionStart);
287         DECLARE_PROPERTY_ACCESSOR(HTMLInputElementSelectionEnd);
288
289         DECLARE_NAMED_ACCESS_CHECK(Location);
290         DECLARE_INDEXED_ACCESS_CHECK(History);
291
292         DECLARE_NAMED_ACCESS_CHECK(History);
293         DECLARE_INDEXED_ACCESS_CHECK(Location);
294
295         DECLARE_CALLBACK(HTMLCollectionItem);
296         DECLARE_CALLBACK(HTMLCollectionNamedItem);
297         DECLARE_CALLBACK(HTMLCollectionCallAsFunction);
298
299         DECLARE_CALLBACK(HTMLAllCollectionItem);
300         DECLARE_CALLBACK(HTMLAllCollectionNamedItem);
301         DECLARE_CALLBACK(HTMLAllCollectionCallAsFunction);
302
303         DECLARE_CALLBACK(HTMLSelectElementRemove);
304
305         DECLARE_CALLBACK(HTMLOptionsCollectionRemove);
306         DECLARE_CALLBACK(HTMLOptionsCollectionAdd);
307
308         DECLARE_CALLBACK(HTMLDocumentWrite);
309         DECLARE_CALLBACK(HTMLDocumentWriteln);
310         DECLARE_CALLBACK(HTMLDocumentOpen);
311         DECLARE_PROPERTY_ACCESSOR(HTMLDocumentAll);
312         DECLARE_NAMED_PROPERTY_GETTER(HTMLDocument);
313         DECLARE_NAMED_PROPERTY_DELETER(HTMLDocument);
314
315         DECLARE_CALLBACK(DocumentEvaluate);
316         DECLARE_CALLBACK(DocumentGetCSSCanvasContext);
317
318         DECLARE_CALLBACK(DOMWindowAddEventListener);
319         DECLARE_CALLBACK(DOMWindowRemoveEventListener);
320         DECLARE_CALLBACK(DOMWindowPostMessage);
321         DECLARE_CALLBACK(DOMWindowSetTimeout);
322         DECLARE_CALLBACK(DOMWindowSetInterval);
323         DECLARE_CALLBACK(DOMWindowAtob);
324         DECLARE_CALLBACK(DOMWindowBtoa);
325         DECLARE_CALLBACK(DOMWindowNOP);
326         DECLARE_CALLBACK(DOMWindowToString);
327         DECLARE_CALLBACK(DOMWindowShowModalDialog);
328         DECLARE_CALLBACK(DOMWindowOpen);
329         DECLARE_CALLBACK(DOMWindowClearTimeout);
330         DECLARE_CALLBACK(DOMWindowClearInterval);
331
332         DECLARE_CALLBACK(DOMParserConstructor);
333         DECLARE_CALLBACK(HTMLAudioElementConstructor);
334         DECLARE_CALLBACK(HTMLImageElementConstructor);
335         DECLARE_CALLBACK(HTMLOptionElementConstructor);
336         DECLARE_CALLBACK(MessageChannelConstructor);
337         DECLARE_CALLBACK(WebKitCSSMatrixConstructor);
338         DECLARE_CALLBACK(WebKitPointConstructor);
339         DECLARE_CALLBACK(XMLHttpRequestConstructor);
340         DECLARE_CALLBACK(XMLSerializerConstructor);
341         DECLARE_CALLBACK(XPathEvaluatorConstructor);
342         DECLARE_CALLBACK(XSLTProcessorConstructor);
343
344         DECLARE_CALLBACK(XSLTProcessorImportStylesheet);
345         DECLARE_CALLBACK(XSLTProcessorTransformToFragment);
346         DECLARE_CALLBACK(XSLTProcessorTransformToDocument);
347         DECLARE_CALLBACK(XSLTProcessorSetParameter);
348         DECLARE_CALLBACK(XSLTProcessorGetParameter);
349         DECLARE_CALLBACK(XSLTProcessorRemoveParameter);
350
351         DECLARE_CALLBACK(CSSPrimitiveValueGetRGBColorValue);
352
353         DECLARE_CALLBACK(CanvasRenderingContext2DSetStrokeColor);
354         DECLARE_CALLBACK(CanvasRenderingContext2DSetFillColor);
355         DECLARE_CALLBACK(CanvasRenderingContext2DStrokeRect);
356         DECLARE_CALLBACK(CanvasRenderingContext2DSetShadow);
357         DECLARE_CALLBACK(CanvasRenderingContext2DDrawImage);
358         DECLARE_CALLBACK(CanvasRenderingContext2DDrawImageFromRect);
359         DECLARE_CALLBACK(CanvasRenderingContext2DCreatePattern);
360         DECLARE_CALLBACK(CanvasRenderingContext2DFillText);
361         DECLARE_CALLBACK(CanvasRenderingContext2DStrokeText);
362         DECLARE_CALLBACK(CanvasRenderingContext2DPutImageData);
363
364 #if ENABLE(3D_CANVAS)
365         DECLARE_CALLBACK(WebGLRenderingContextBufferData);
366         DECLARE_CALLBACK(WebGLRenderingContextBufferSubData);
367         DECLARE_CALLBACK(WebGLRenderingContextGetBufferParameter);
368         DECLARE_CALLBACK(WebGLRenderingContextGetFramebufferAttachmentParameter);
369         DECLARE_CALLBACK(WebGLRenderingContextGetParameter);
370         DECLARE_CALLBACK(WebGLRenderingContextGetProgramParameter);
371         DECLARE_CALLBACK(WebGLRenderingContextGetRenderbufferParameter);
372         DECLARE_CALLBACK(WebGLRenderingContextGetShaderParameter);
373         DECLARE_CALLBACK(WebGLRenderingContextGetTexParameter);
374         DECLARE_CALLBACK(WebGLRenderingContextGetUniform);
375         DECLARE_CALLBACK(WebGLRenderingContextGetVertexAttrib);
376         DECLARE_CALLBACK(WebGLRenderingContextTexImage2D);
377         DECLARE_CALLBACK(WebGLRenderingContextTexSubImage2D);
378         DECLARE_CALLBACK(WebGLRenderingContextUniform1fv);
379         DECLARE_CALLBACK(WebGLRenderingContextUniform1iv);
380         DECLARE_CALLBACK(WebGLRenderingContextUniform2fv);
381         DECLARE_CALLBACK(WebGLRenderingContextUniform2iv);
382         DECLARE_CALLBACK(WebGLRenderingContextUniform3fv);
383         DECLARE_CALLBACK(WebGLRenderingContextUniform3iv);
384         DECLARE_CALLBACK(WebGLRenderingContextUniform4fv);
385         DECLARE_CALLBACK(WebGLRenderingContextUniform4iv);
386         DECLARE_CALLBACK(WebGLRenderingContextUniformMatrix2fv);
387         DECLARE_CALLBACK(WebGLRenderingContextUniformMatrix3fv);
388         DECLARE_CALLBACK(WebGLRenderingContextUniformMatrix4fv);
389         DECLARE_CALLBACK(WebGLRenderingContextVertexAttrib1fv);
390         DECLARE_CALLBACK(WebGLRenderingContextVertexAttrib2fv);
391         DECLARE_CALLBACK(WebGLRenderingContextVertexAttrib3fv);
392         DECLARE_CALLBACK(WebGLRenderingContextVertexAttrib4fv);
393
394         DECLARE_CALLBACK(WebGLArrayBufferConstructor);
395         DECLARE_CALLBACK(WebGLByteArrayConstructor);
396         DECLARE_CALLBACK(WebGLFloatArrayConstructor);
397         DECLARE_CALLBACK(WebGLIntArrayConstructor);
398         DECLARE_CALLBACK(WebGLShortArrayConstructor);
399         DECLARE_CALLBACK(WebGLUnsignedByteArrayConstructor);
400         DECLARE_CALLBACK(WebGLUnsignedIntArrayConstructor);
401         DECLARE_CALLBACK(WebGLUnsignedShortArrayConstructor);
402 #endif
403
404         DECLARE_PROPERTY_ACCESSOR_GETTER(ClipboardTypes);
405         DECLARE_CALLBACK(ClipboardClearData);
406         DECLARE_CALLBACK(ClipboardGetData);
407         DECLARE_CALLBACK(ClipboardSetData);
408         DECLARE_CALLBACK(ClipboardSetDragImage);
409
410         DECLARE_CALLBACK(ElementQuerySelector);
411         DECLARE_CALLBACK(ElementQuerySelectorAll);
412         DECLARE_CALLBACK(ElementSetAttribute);
413         DECLARE_CALLBACK(ElementSetAttributeNode);
414         DECLARE_CALLBACK(ElementSetAttributeNS);
415         DECLARE_CALLBACK(ElementSetAttributeNodeNS);
416
417         DECLARE_PROPERTY_ACCESSOR_SETTER(LocationProtocol);
418         DECLARE_PROPERTY_ACCESSOR_SETTER(LocationHost);
419         DECLARE_PROPERTY_ACCESSOR_SETTER(LocationHostname);
420         DECLARE_PROPERTY_ACCESSOR_SETTER(LocationPort);
421         DECLARE_PROPERTY_ACCESSOR_SETTER(LocationPathname);
422         DECLARE_PROPERTY_ACCESSOR_SETTER(LocationSearch);
423         DECLARE_PROPERTY_ACCESSOR_SETTER(LocationHash);
424         DECLARE_PROPERTY_ACCESSOR_SETTER(LocationHref);
425         DECLARE_PROPERTY_ACCESSOR_GETTER(LocationAssign);
426         DECLARE_PROPERTY_ACCESSOR_GETTER(LocationReplace);
427         DECLARE_PROPERTY_ACCESSOR_GETTER(LocationReload);
428         DECLARE_CALLBACK(LocationAssign);
429         DECLARE_CALLBACK(LocationReplace);
430         DECLARE_CALLBACK(LocationReload);
431         DECLARE_CALLBACK(LocationToString);
432         DECLARE_CALLBACK(LocationValueOf);
433
434         DECLARE_CALLBACK(NodeAddEventListener);
435         DECLARE_CALLBACK(NodeRemoveEventListener);
436         DECLARE_CALLBACK(NodeInsertBefore);
437         DECLARE_CALLBACK(NodeReplaceChild);
438         DECLARE_CALLBACK(NodeRemoveChild);
439         DECLARE_CALLBACK(NodeAppendChild);
440
441         // We actually only need this because WebKit has
442         // navigator.appVersion as custom. Our version just
443         // passes through.
444         DECLARE_PROPERTY_ACCESSOR(NavigatorAppVersion);
445
446         DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestOnabort);
447         DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestOnerror);
448         DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestOnload);
449         DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestOnloadstart);
450         DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestOnprogress);
451         DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestOnreadystatechange);
452         DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestResponseText);
453         DECLARE_CALLBACK(XMLHttpRequestAddEventListener);
454         DECLARE_CALLBACK(XMLHttpRequestRemoveEventListener);
455         DECLARE_CALLBACK(XMLHttpRequestOpen);
456         DECLARE_CALLBACK(XMLHttpRequestSend);
457         DECLARE_CALLBACK(XMLHttpRequestSetRequestHeader);
458         DECLARE_CALLBACK(XMLHttpRequestGetResponseHeader);
459         DECLARE_CALLBACK(XMLHttpRequestOverrideMimeType);
460         DECLARE_CALLBACK(XMLHttpRequestDispatchEvent);
461
462         DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestUploadOnabort);
463         DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestUploadOnerror);
464         DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestUploadOnload);
465         DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestUploadOnloadstart);
466         DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestUploadOnprogress);
467         DECLARE_CALLBACK(XMLHttpRequestUploadAddEventListener);
468         DECLARE_CALLBACK(XMLHttpRequestUploadRemoveEventListener);
469         DECLARE_CALLBACK(XMLHttpRequestUploadDispatchEvent);
470
471         DECLARE_CALLBACK(TreeWalkerParentNode);
472         DECLARE_CALLBACK(TreeWalkerFirstChild);
473         DECLARE_CALLBACK(TreeWalkerLastChild);
474         DECLARE_CALLBACK(TreeWalkerNextNode);
475         DECLARE_CALLBACK(TreeWalkerPreviousNode);
476         DECLARE_CALLBACK(TreeWalkerNextSibling);
477         DECLARE_CALLBACK(TreeWalkerPreviousSibling);
478
479         DECLARE_CALLBACK(InspectorBackendHighlightDOMNode);
480         DECLARE_CALLBACK(InspectorBackendAddResourceSourceToFrame);
481         DECLARE_CALLBACK(InspectorBackendAddSourceToFrame);
482         DECLARE_CALLBACK(InspectorBackendSearch);
483         DECLARE_CALLBACK(InspectorBackendSetting);
484         DECLARE_CALLBACK(InspectorBackendDatabaseForId);
485         DECLARE_CALLBACK(InspectorBackendInspectedWindow);
486         DECLARE_CALLBACK(InspectorBackendSetSetting);
487         DECLARE_CALLBACK(InspectorBackendCurrentCallFrame);
488         DECLARE_CALLBACK(InspectorBackendDebuggerEnabled);
489         DECLARE_CALLBACK(InspectorBackendPauseOnExceptions);
490         DECLARE_CALLBACK(InspectorBackendProfilerEnabled);
491         DECLARE_CALLBACK(InspectorBackendNodeForId);
492         DECLARE_CALLBACK(InspectorBackendWrapObject);
493         DECLARE_CALLBACK(InspectorBackendUnwrapObject);
494         DECLARE_CALLBACK(InspectorBackendPushNodePathToFrontend);
495 #if ENABLE(DATABASE)
496         DECLARE_CALLBACK(InspectorBackendSelectDatabase);
497 #endif
498 #if ENABLE(DOM_STORAGE)
499         DECLARE_CALLBACK(InspectorBackendSelectDOMStorage);
500 #endif
501         DECLARE_CALLBACK(InspectorBackendWrapCallback);
502
503         DECLARE_CALLBACK(ConsoleProfile);
504         DECLARE_CALLBACK(ConsoleProfileEnd);
505
506         DECLARE_CALLBACK(NodeIteratorNextNode);
507         DECLARE_CALLBACK(NodeIteratorPreviousNode);
508
509         DECLARE_CALLBACK(NodeFilterAcceptNode);
510
511         DECLARE_CALLBACK(HTMLFormElementSubmit);
512
513         DECLARE_NAMED_PROPERTY_GETTER(DOMWindow);
514         DECLARE_INDEXED_PROPERTY_GETTER(DOMWindow);
515         DECLARE_NAMED_ACCESS_CHECK(DOMWindow);
516         DECLARE_INDEXED_ACCESS_CHECK(DOMWindow);
517
518         DECLARE_NAMED_PROPERTY_GETTER(HTMLFrameSetElement);
519         DECLARE_NAMED_PROPERTY_GETTER(HTMLFormElement);
520         DECLARE_NAMED_PROPERTY_GETTER(NodeList);
521         DECLARE_NAMED_PROPERTY_GETTER(NamedNodeMap);
522         DECLARE_NAMED_PROPERTY_GETTER(CSSStyleDeclaration);
523         DECLARE_NAMED_PROPERTY_SETTER(CSSStyleDeclaration);
524         DECLARE_NAMED_PROPERTY_GETTER(HTMLPlugInElement);
525         DECLARE_NAMED_PROPERTY_SETTER(HTMLPlugInElement);
526         DECLARE_INDEXED_PROPERTY_GETTER(HTMLPlugInElement);
527         DECLARE_INDEXED_PROPERTY_SETTER(HTMLPlugInElement);
528
529         DECLARE_CALLBACK(HTMLPlugInElement);
530
531         DECLARE_NAMED_PROPERTY_GETTER(StyleSheetList);
532         DECLARE_INDEXED_PROPERTY_GETTER(NamedNodeMap);
533         DECLARE_INDEXED_PROPERTY_GETTER(HTMLFormElement);
534         DECLARE_INDEXED_PROPERTY_GETTER(HTMLOptionsCollection);
535         DECLARE_INDEXED_PROPERTY_SETTER(HTMLOptionsCollection);
536         DECLARE_NAMED_PROPERTY_GETTER(HTMLSelectElementCollection);
537         DECLARE_INDEXED_PROPERTY_SETTER(HTMLSelectElementCollection);
538         DECLARE_NAMED_PROPERTY_GETTER(HTMLAllCollection);
539         DECLARE_NAMED_PROPERTY_GETTER(HTMLCollection);
540
541 #if ENABLE(3D_CANVAS)
542         DECLARE_CALLBACK(WebGLByteArrayGet);
543         DECLARE_CALLBACK(WebGLByteArraySet);
544         DECLARE_INDEXED_PROPERTY_GETTER(WebGLByteArray);
545         DECLARE_INDEXED_PROPERTY_SETTER(WebGLByteArray);
546
547         DECLARE_CALLBACK(WebGLFloatArrayGet);
548         DECLARE_CALLBACK(WebGLFloatArraySet);
549         DECLARE_INDEXED_PROPERTY_GETTER(WebGLFloatArray);
550         DECLARE_INDEXED_PROPERTY_SETTER(WebGLFloatArray);
551
552         DECLARE_CALLBACK(WebGLIntArrayGet);
553         DECLARE_CALLBACK(WebGLIntArraySet);
554         DECLARE_INDEXED_PROPERTY_GETTER(WebGLIntArray);
555         DECLARE_INDEXED_PROPERTY_SETTER(WebGLIntArray);
556
557         DECLARE_CALLBACK(WebGLShortArrayGet);
558         DECLARE_CALLBACK(WebGLShortArraySet);
559         DECLARE_INDEXED_PROPERTY_GETTER(WebGLShortArray);
560         DECLARE_INDEXED_PROPERTY_SETTER(WebGLShortArray);
561
562         DECLARE_CALLBACK(WebGLUnsignedByteArrayGet);
563         DECLARE_CALLBACK(WebGLUnsignedByteArraySet);
564         DECLARE_INDEXED_PROPERTY_GETTER(WebGLUnsignedByteArray);
565         DECLARE_INDEXED_PROPERTY_SETTER(WebGLUnsignedByteArray);
566
567         DECLARE_CALLBACK(WebGLUnsignedIntArrayGet);
568         DECLARE_CALLBACK(WebGLUnsignedIntArraySet);
569         DECLARE_INDEXED_PROPERTY_GETTER(WebGLUnsignedIntArray);
570         DECLARE_INDEXED_PROPERTY_SETTER(WebGLUnsignedIntArray);
571
572         DECLARE_CALLBACK(WebGLUnsignedShortArrayGet);
573         DECLARE_CALLBACK(WebGLUnsignedShortArraySet);
574         DECLARE_INDEXED_PROPERTY_GETTER(WebGLUnsignedShortArray);
575         DECLARE_INDEXED_PROPERTY_SETTER(WebGLUnsignedShortArray);
576 #endif
577
578         DECLARE_PROPERTY_ACCESSOR_GETTER(MessageEventPorts);
579         DECLARE_CALLBACK(MessageEventInitMessageEvent);
580
581         DECLARE_PROPERTY_ACCESSOR(MessagePortOnmessage);
582         DECLARE_PROPERTY_ACCESSOR(MessagePortOnclose);
583         DECLARE_CALLBACK(MessagePortAddEventListener);
584         DECLARE_CALLBACK(MessagePortPostMessage);
585         DECLARE_CALLBACK(MessagePortRemoveEventListener);
586         DECLARE_CALLBACK(MessagePortStartConversation);
587
588         DECLARE_CALLBACK(DatabaseChangeVersion);
589         DECLARE_CALLBACK(DatabaseTransaction);
590         DECLARE_CALLBACK(DatabaseReadTransaction);
591         DECLARE_CALLBACK(SQLTransactionExecuteSql);
592         DECLARE_CALLBACK(SQLResultSetRowListItem);
593
594         DECLARE_INDEXED_PROPERTY_GETTER(ClientRectList);
595         DECLARE_INDEXED_PROPERTY_GETTER(FileList);
596
597 #if ENABLE(DATAGRID)
598         DECLARE_PROPERTY_ACCESSOR(HTMLDataGridElementDataSource);
599         DECLARE_INDEXED_PROPERTY_GETTER(DataGridColumnList);
600         DECLARE_NAMED_PROPERTY_GETTER(DataGridColumnList);
601 #endif
602
603 #if ENABLE(DATABASE)
604         DECLARE_ACCESSOR_RUNTIME_ENABLER(DOMWindowOpenDatabase);
605 #endif
606
607 #if ENABLE(DOM_STORAGE)
608         DECLARE_ACCESSOR_RUNTIME_ENABLER(DOMWindowLocalStorage);
609         DECLARE_ACCESSOR_RUNTIME_ENABLER(DOMWindowSessionStorage);
610         DECLARE_INDEXED_PROPERTY_GETTER(Storage);
611         DECLARE_INDEXED_PROPERTY_SETTER(Storage);
612         DECLARE_INDEXED_PROPERTY_DELETER(Storage);
613         DECLARE_NAMED_PROPERTY_GETTER(Storage);
614         DECLARE_NAMED_PROPERTY_SETTER(Storage);
615         DECLARE_NAMED_PROPERTY_DELETER(Storage);
616         static v8::Handle<v8::Array> v8StorageNamedPropertyEnumerator(const v8::AccessorInfo& info);
617 #endif
618
619 #if ENABLE(SVG)
620         DECLARE_PROPERTY_ACCESSOR_GETTER(SVGLengthValue);
621         DECLARE_CALLBACK(SVGLengthConvertToSpecifiedUnits);
622         DECLARE_CALLBACK(SVGMatrixMultiply);
623         DECLARE_CALLBACK(SVGMatrixInverse);
624         DECLARE_CALLBACK(SVGMatrixRotateFromVector);
625         DECLARE_CALLBACK(SVGElementInstanceAddEventListener);
626         DECLARE_CALLBACK(SVGElementInstanceRemoveEventListener);
627 #endif
628
629 #if ENABLE(WORKERS)
630         DECLARE_PROPERTY_ACCESSOR(AbstractWorkerOnerror);
631         DECLARE_CALLBACK(AbstractWorkerAddEventListener);
632         DECLARE_CALLBACK(AbstractWorkerRemoveEventListener);
633
634         DECLARE_PROPERTY_ACCESSOR(DedicatedWorkerContextOnmessage);
635         DECLARE_CALLBACK(DedicatedWorkerContextPostMessage);
636
637         DECLARE_PROPERTY_ACCESSOR(WorkerOnmessage);
638         DECLARE_CALLBACK(WorkerPostMessage);
639         DECLARE_CALLBACK(WorkerConstructor);
640
641         DECLARE_PROPERTY_ACCESSOR_GETTER(WorkerContextSelf);
642         DECLARE_PROPERTY_ACCESSOR(WorkerContextOnerror);
643         DECLARE_CALLBACK(WorkerContextImportScripts);
644         DECLARE_CALLBACK(WorkerContextSetTimeout);
645         DECLARE_CALLBACK(WorkerContextClearTimeout);
646         DECLARE_CALLBACK(WorkerContextSetInterval);
647         DECLARE_CALLBACK(WorkerContextClearInterval);
648         DECLARE_CALLBACK(WorkerContextAddEventListener);
649         DECLARE_CALLBACK(WorkerContextRemoveEventListener);
650
651 #if ENABLE(NOTIFICATIONS)
652         DECLARE_ACCESSOR_RUNTIME_ENABLER(WorkerContextWebkitNotifications);
653 #endif
654 #endif // ENABLE(WORKERS)
655
656 #if ENABLE(NOTIFICATIONS)
657         DECLARE_CALLBACK(NotificationCenterRequestPermission);
658         DECLARE_CALLBACK(NotificationCenterCreateNotification);
659         DECLARE_CALLBACK(NotificationCenterCreateHTMLNotification);
660
661         DECLARE_CALLBACK(NotificationAddEventListener);
662         DECLARE_CALLBACK(NotificationRemoveEventListener);
663         DECLARE_PROPERTY_ACCESSOR(NotificationEventHandler);
664 #endif // ENABLE(NOTIFICATIONS)
665
666 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
667         DECLARE_ACCESSOR_RUNTIME_ENABLER(DOMWindowApplicationCache);
668         DECLARE_PROPERTY_ACCESSOR(DOMApplicationCacheEventHandler);
669         DECLARE_CALLBACK(DOMApplicationCacheAddEventListener);
670         DECLARE_CALLBACK(DOMApplicationCacheRemoveEventListener);
671 #endif
672
673 #if ENABLE(SHARED_WORKERS)
674         DECLARE_CALLBACK(SharedWorkerConstructor);
675         DECLARE_ACCESSOR_RUNTIME_ENABLER(DOMWindowSharedWorker);
676 #endif
677
678 #if ENABLE(NOTIFICATIONS)
679         DECLARE_ACCESSOR_RUNTIME_ENABLER(DOMWindowWebkitNotifications);
680 #endif
681
682 #if ENABLE(WEB_SOCKETS)
683         DECLARE_PROPERTY_ACCESSOR(WebSocketOnopen);
684         DECLARE_PROPERTY_ACCESSOR(WebSocketOnmessage);
685         DECLARE_PROPERTY_ACCESSOR(WebSocketOnclose);
686         DECLARE_CALLBACK(WebSocketConstructor);
687         DECLARE_CALLBACK(WebSocketAddEventListener);
688         DECLARE_CALLBACK(WebSocketRemoveEventListener);
689         DECLARE_CALLBACK(WebSocketSend);
690         DECLARE_CALLBACK(WebSocketClose);
691         DECLARE_ACCESSOR_RUNTIME_ENABLER(DOMWindowWebSocket);
692 #endif
693
694 #undef DECLARE_INDEXED_ACCESS_CHECK
695 #undef DECLARE_NAMED_ACCESS_CHECK
696
697 #undef DECLARE_PROPERTY_ACCESSOR_SETTER
698 #undef DECLARE_PROPERTY_ACCESSOR_GETTER
699 #undef DECLARE_PROPERTY_ACCESSOR
700
701 #undef DECLARE_NAMED_PROPERTY_GETTER
702 #undef DECLARE_NAMED_PROPERTY_SETTER
703 #undef DECLARE_NAMED_PROPERTY_DELETER
704
705 #undef DECLARE_INDEXED_PROPERTY_GETTER
706 #undef DECLARE_INDEXED_PROPERTY_SETTER
707 #undef DECLARE_INDEXED_PROPERTY_DELETER
708
709 #undef DECLARE_CALLBACK
710
711         // Returns the NPObject corresponding to an HTMLElement object.
712         static NPObject* GetHTMLPlugInElementNPObject(v8::Handle<v8::Object>);
713
714         // Returns the owner frame pointer of a DOM wrapper object. It only works for
715         // these DOM objects requiring cross-domain access check.
716         static Frame* GetTargetFrame(v8::Local<v8::Object> host, v8::Local<v8::Value> data);
717
718         // Special case for downcasting SVG path segments.
719 #if ENABLE(SVG)
720         static V8ClassIndex::V8WrapperType DowncastSVGPathSeg(void* pathSeg);
721 #endif
722
723     private:
724         static v8::Handle<v8::Value> WindowSetTimeoutImpl(const v8::Arguments&, bool singleShot);
725         static void ClearTimeoutImpl(const v8::Arguments&);
726         static void WindowSetLocation(DOMWindow*, const String&);
727     };
728
729 } // namespace WebCore
730
731 #endif // V8CustomBinding_h