126392d8c3ed0d69e1afa83bf455027dfd4c94f0
[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(HTMLSelectElementRemove);
301
302         DECLARE_CALLBACK(HTMLOptionsCollectionRemove);
303         DECLARE_CALLBACK(HTMLOptionsCollectionAdd);
304
305         DECLARE_CALLBACK(HTMLDocumentWrite);
306         DECLARE_CALLBACK(HTMLDocumentWriteln);
307         DECLARE_CALLBACK(HTMLDocumentOpen);
308         DECLARE_PROPERTY_ACCESSOR(HTMLDocumentAll);
309         DECLARE_NAMED_PROPERTY_GETTER(HTMLDocument);
310         DECLARE_NAMED_PROPERTY_DELETER(HTMLDocument);
311
312         DECLARE_CALLBACK(DocumentEvaluate);
313         DECLARE_CALLBACK(DocumentGetCSSCanvasContext);
314
315         DECLARE_CALLBACK(DOMWindowAddEventListener);
316         DECLARE_CALLBACK(DOMWindowRemoveEventListener);
317         DECLARE_CALLBACK(DOMWindowPostMessage);
318         DECLARE_CALLBACK(DOMWindowSetTimeout);
319         DECLARE_CALLBACK(DOMWindowSetInterval);
320         DECLARE_CALLBACK(DOMWindowAtob);
321         DECLARE_CALLBACK(DOMWindowBtoa);
322         DECLARE_CALLBACK(DOMWindowNOP);
323         DECLARE_CALLBACK(DOMWindowToString);
324         DECLARE_CALLBACK(DOMWindowShowModalDialog);
325         DECLARE_CALLBACK(DOMWindowOpen);
326         DECLARE_CALLBACK(DOMWindowClearTimeout);
327         DECLARE_CALLBACK(DOMWindowClearInterval);
328
329         DECLARE_CALLBACK(DOMParserConstructor);
330         DECLARE_CALLBACK(HTMLAudioElementConstructor);
331         DECLARE_CALLBACK(HTMLImageElementConstructor);
332         DECLARE_CALLBACK(HTMLOptionElementConstructor);
333         DECLARE_CALLBACK(MessageChannelConstructor);
334         DECLARE_CALLBACK(WebKitCSSMatrixConstructor);
335         DECLARE_CALLBACK(WebKitPointConstructor);
336         DECLARE_CALLBACK(XMLHttpRequestConstructor);
337         DECLARE_CALLBACK(XMLSerializerConstructor);
338         DECLARE_CALLBACK(XPathEvaluatorConstructor);
339         DECLARE_CALLBACK(XSLTProcessorConstructor);
340
341         DECLARE_CALLBACK(XSLTProcessorImportStylesheet);
342         DECLARE_CALLBACK(XSLTProcessorTransformToFragment);
343         DECLARE_CALLBACK(XSLTProcessorTransformToDocument);
344         DECLARE_CALLBACK(XSLTProcessorSetParameter);
345         DECLARE_CALLBACK(XSLTProcessorGetParameter);
346         DECLARE_CALLBACK(XSLTProcessorRemoveParameter);
347
348         DECLARE_CALLBACK(CSSPrimitiveValueGetRGBColorValue);
349
350         DECLARE_CALLBACK(CanvasRenderingContext2DSetStrokeColor);
351         DECLARE_CALLBACK(CanvasRenderingContext2DSetFillColor);
352         DECLARE_CALLBACK(CanvasRenderingContext2DStrokeRect);
353         DECLARE_CALLBACK(CanvasRenderingContext2DSetShadow);
354         DECLARE_CALLBACK(CanvasRenderingContext2DDrawImage);
355         DECLARE_CALLBACK(CanvasRenderingContext2DDrawImageFromRect);
356         DECLARE_CALLBACK(CanvasRenderingContext2DCreatePattern);
357         DECLARE_CALLBACK(CanvasRenderingContext2DFillText);
358         DECLARE_CALLBACK(CanvasRenderingContext2DStrokeText);
359         DECLARE_CALLBACK(CanvasRenderingContext2DPutImageData);
360
361 #if ENABLE(3D_CANVAS)
362         DECLARE_CALLBACK(CanvasRenderingContext3DBufferData);
363         DECLARE_CALLBACK(CanvasRenderingContext3DBufferSubData);
364         DECLARE_CALLBACK(CanvasRenderingContext3DSizeof);
365         DECLARE_CALLBACK(CanvasRenderingContext3DTexImage2D);
366         DECLARE_CALLBACK(CanvasRenderingContext3DTexSubImage2D);
367         DECLARE_CALLBACK(CanvasRenderingContext3DUniform1fv);
368         DECLARE_CALLBACK(CanvasRenderingContext3DUniform1iv);
369         DECLARE_CALLBACK(CanvasRenderingContext3DUniform2fv);
370         DECLARE_CALLBACK(CanvasRenderingContext3DUniform2iv);
371         DECLARE_CALLBACK(CanvasRenderingContext3DUniform3fv);
372         DECLARE_CALLBACK(CanvasRenderingContext3DUniform3iv);
373         DECLARE_CALLBACK(CanvasRenderingContext3DUniform4fv);
374         DECLARE_CALLBACK(CanvasRenderingContext3DUniform4iv);
375         DECLARE_CALLBACK(CanvasRenderingContext3DUniformMatrix2fv);
376         DECLARE_CALLBACK(CanvasRenderingContext3DUniformMatrix3fv);
377         DECLARE_CALLBACK(CanvasRenderingContext3DUniformMatrix4fv);
378         DECLARE_CALLBACK(CanvasRenderingContext3DVertexAttrib1fv);
379         DECLARE_CALLBACK(CanvasRenderingContext3DVertexAttrib2fv);
380         DECLARE_CALLBACK(CanvasRenderingContext3DVertexAttrib3fv);
381         DECLARE_CALLBACK(CanvasRenderingContext3DVertexAttrib4fv);
382
383         DECLARE_CALLBACK(CanvasArrayBufferConstructor);
384         DECLARE_CALLBACK(CanvasByteArrayConstructor);
385         DECLARE_CALLBACK(CanvasFloatArrayConstructor);
386         DECLARE_CALLBACK(CanvasIntArrayConstructor);
387         DECLARE_CALLBACK(CanvasShortArrayConstructor);
388         DECLARE_CALLBACK(CanvasUnsignedByteArrayConstructor);
389         DECLARE_CALLBACK(CanvasUnsignedIntArrayConstructor);
390         DECLARE_CALLBACK(CanvasUnsignedShortArrayConstructor);
391 #endif
392
393         DECLARE_PROPERTY_ACCESSOR_GETTER(ClipboardTypes);
394         DECLARE_CALLBACK(ClipboardClearData);
395         DECLARE_CALLBACK(ClipboardGetData);
396         DECLARE_CALLBACK(ClipboardSetData);
397         DECLARE_CALLBACK(ClipboardSetDragImage);
398
399         DECLARE_CALLBACK(ElementQuerySelector);
400         DECLARE_CALLBACK(ElementQuerySelectorAll);
401         DECLARE_CALLBACK(ElementSetAttribute);
402         DECLARE_CALLBACK(ElementSetAttributeNode);
403         DECLARE_CALLBACK(ElementSetAttributeNS);
404         DECLARE_CALLBACK(ElementSetAttributeNodeNS);
405
406         DECLARE_PROPERTY_ACCESSOR_SETTER(LocationProtocol);
407         DECLARE_PROPERTY_ACCESSOR_SETTER(LocationHost);
408         DECLARE_PROPERTY_ACCESSOR_SETTER(LocationHostname);
409         DECLARE_PROPERTY_ACCESSOR_SETTER(LocationPort);
410         DECLARE_PROPERTY_ACCESSOR_SETTER(LocationPathname);
411         DECLARE_PROPERTY_ACCESSOR_SETTER(LocationSearch);
412         DECLARE_PROPERTY_ACCESSOR_SETTER(LocationHash);
413         DECLARE_PROPERTY_ACCESSOR_SETTER(LocationHref);
414         DECLARE_PROPERTY_ACCESSOR_GETTER(LocationAssign);
415         DECLARE_PROPERTY_ACCESSOR_GETTER(LocationReplace);
416         DECLARE_PROPERTY_ACCESSOR_GETTER(LocationReload);
417         DECLARE_CALLBACK(LocationAssign);
418         DECLARE_CALLBACK(LocationReplace);
419         DECLARE_CALLBACK(LocationReload);
420         DECLARE_CALLBACK(LocationToString);
421         DECLARE_CALLBACK(LocationValueOf);
422
423         DECLARE_CALLBACK(NodeAddEventListener);
424         DECLARE_CALLBACK(NodeRemoveEventListener);
425         DECLARE_CALLBACK(NodeInsertBefore);
426         DECLARE_CALLBACK(NodeReplaceChild);
427         DECLARE_CALLBACK(NodeRemoveChild);
428         DECLARE_CALLBACK(NodeAppendChild);
429
430         // We actually only need this because WebKit has
431         // navigator.appVersion as custom. Our version just
432         // passes through.
433         DECLARE_PROPERTY_ACCESSOR(NavigatorAppVersion);
434
435         DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestOnabort);
436         DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestOnerror);
437         DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestOnload);
438         DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestOnloadstart);
439         DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestOnprogress);
440         DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestOnreadystatechange);
441         DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestResponseText);
442         DECLARE_CALLBACK(XMLHttpRequestAddEventListener);
443         DECLARE_CALLBACK(XMLHttpRequestRemoveEventListener);
444         DECLARE_CALLBACK(XMLHttpRequestOpen);
445         DECLARE_CALLBACK(XMLHttpRequestSend);
446         DECLARE_CALLBACK(XMLHttpRequestSetRequestHeader);
447         DECLARE_CALLBACK(XMLHttpRequestGetResponseHeader);
448         DECLARE_CALLBACK(XMLHttpRequestOverrideMimeType);
449         DECLARE_CALLBACK(XMLHttpRequestDispatchEvent);
450
451         DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestUploadOnabort);
452         DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestUploadOnerror);
453         DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestUploadOnload);
454         DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestUploadOnloadstart);
455         DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestUploadOnprogress);
456         DECLARE_CALLBACK(XMLHttpRequestUploadAddEventListener);
457         DECLARE_CALLBACK(XMLHttpRequestUploadRemoveEventListener);
458         DECLARE_CALLBACK(XMLHttpRequestUploadDispatchEvent);
459
460         DECLARE_CALLBACK(TreeWalkerParentNode);
461         DECLARE_CALLBACK(TreeWalkerFirstChild);
462         DECLARE_CALLBACK(TreeWalkerLastChild);
463         DECLARE_CALLBACK(TreeWalkerNextNode);
464         DECLARE_CALLBACK(TreeWalkerPreviousNode);
465         DECLARE_CALLBACK(TreeWalkerNextSibling);
466         DECLARE_CALLBACK(TreeWalkerPreviousSibling);
467
468         DECLARE_CALLBACK(InspectorBackendHighlightDOMNode);
469         DECLARE_CALLBACK(InspectorBackendAddResourceSourceToFrame);
470         DECLARE_CALLBACK(InspectorBackendAddSourceToFrame);
471         DECLARE_CALLBACK(InspectorBackendSearch);
472         DECLARE_CALLBACK(InspectorBackendSetting);
473         DECLARE_CALLBACK(InspectorBackendDatabaseForId);
474         DECLARE_CALLBACK(InspectorBackendInspectedWindow);
475         DECLARE_CALLBACK(InspectorBackendSetSetting);
476         DECLARE_CALLBACK(InspectorBackendCurrentCallFrame);
477         DECLARE_CALLBACK(InspectorBackendDebuggerEnabled);
478         DECLARE_CALLBACK(InspectorBackendPauseOnExceptions);
479         DECLARE_CALLBACK(InspectorBackendProfilerEnabled);
480         DECLARE_CALLBACK(InspectorBackendNodeForId);
481         DECLARE_CALLBACK(InspectorBackendWrapObject);
482         DECLARE_CALLBACK(InspectorBackendUnwrapObject);
483         DECLARE_CALLBACK(InspectorBackendPushNodePathToFrontend);
484 #if ENABLE(DATABASE)
485         DECLARE_CALLBACK(InspectorBackendSelectDatabase);
486 #endif
487 #if ENABLE(DOM_STORAGE)
488         DECLARE_CALLBACK(InspectorBackendSelectDOMStorage);
489 #endif
490         DECLARE_CALLBACK(InspectorBackendWrapCallback);
491
492         DECLARE_CALLBACK(NodeIteratorNextNode);
493         DECLARE_CALLBACK(NodeIteratorPreviousNode);
494
495         DECLARE_CALLBACK(NodeFilterAcceptNode);
496
497         DECLARE_CALLBACK(HTMLFormElementSubmit);
498
499         DECLARE_NAMED_PROPERTY_GETTER(DOMWindow);
500         DECLARE_INDEXED_PROPERTY_GETTER(DOMWindow);
501         DECLARE_NAMED_ACCESS_CHECK(DOMWindow);
502         DECLARE_INDEXED_ACCESS_CHECK(DOMWindow);
503
504         DECLARE_NAMED_PROPERTY_GETTER(HTMLFrameSetElement);
505         DECLARE_NAMED_PROPERTY_GETTER(HTMLFormElement);
506         DECLARE_NAMED_PROPERTY_GETTER(NodeList);
507         DECLARE_NAMED_PROPERTY_GETTER(NamedNodeMap);
508         DECLARE_NAMED_PROPERTY_GETTER(CSSStyleDeclaration);
509         DECLARE_NAMED_PROPERTY_SETTER(CSSStyleDeclaration);
510         DECLARE_NAMED_PROPERTY_GETTER(HTMLPlugInElement);
511         DECLARE_NAMED_PROPERTY_SETTER(HTMLPlugInElement);
512         DECLARE_INDEXED_PROPERTY_GETTER(HTMLPlugInElement);
513         DECLARE_INDEXED_PROPERTY_SETTER(HTMLPlugInElement);
514
515         DECLARE_CALLBACK(HTMLPlugInElement);
516
517         DECLARE_NAMED_PROPERTY_GETTER(StyleSheetList);
518         DECLARE_INDEXED_PROPERTY_GETTER(NamedNodeMap);
519         DECLARE_INDEXED_PROPERTY_GETTER(HTMLFormElement);
520         DECLARE_INDEXED_PROPERTY_GETTER(HTMLOptionsCollection);
521         DECLARE_INDEXED_PROPERTY_SETTER(HTMLOptionsCollection);
522         DECLARE_NAMED_PROPERTY_GETTER(HTMLSelectElementCollection);
523         DECLARE_INDEXED_PROPERTY_SETTER(HTMLSelectElementCollection);
524         DECLARE_NAMED_PROPERTY_GETTER(HTMLCollection);
525
526 #if ENABLE(3D_CANVAS)
527         DECLARE_INDEXED_PROPERTY_GETTER(CanvasByteArray);
528         DECLARE_INDEXED_PROPERTY_SETTER(CanvasByteArray);
529
530         DECLARE_INDEXED_PROPERTY_GETTER(CanvasFloatArray);
531         DECLARE_INDEXED_PROPERTY_SETTER(CanvasFloatArray);
532
533         DECLARE_INDEXED_PROPERTY_GETTER(CanvasIntArray);
534         DECLARE_INDEXED_PROPERTY_SETTER(CanvasIntArray);
535 #endif
536
537         DECLARE_INDEXED_PROPERTY_GETTER(CanvasPixelArray);
538         DECLARE_INDEXED_PROPERTY_SETTER(CanvasPixelArray);
539
540 #if ENABLE(3D_CANVAS)
541         DECLARE_INDEXED_PROPERTY_GETTER(CanvasShortArray);
542         DECLARE_INDEXED_PROPERTY_SETTER(CanvasShortArray);
543
544         DECLARE_INDEXED_PROPERTY_GETTER(CanvasUnsignedByteArray);
545         DECLARE_INDEXED_PROPERTY_SETTER(CanvasUnsignedByteArray);
546
547         DECLARE_INDEXED_PROPERTY_GETTER(CanvasUnsignedIntArray);
548         DECLARE_INDEXED_PROPERTY_SETTER(CanvasUnsignedIntArray);
549
550         DECLARE_INDEXED_PROPERTY_GETTER(CanvasUnsignedShortArray);
551         DECLARE_INDEXED_PROPERTY_SETTER(CanvasUnsignedShortArray);
552 #endif
553
554         DECLARE_PROPERTY_ACCESSOR_GETTER(MessageEventPorts);
555         DECLARE_CALLBACK(MessageEventInitMessageEvent);
556
557         DECLARE_PROPERTY_ACCESSOR(MessagePortOnmessage);
558         DECLARE_PROPERTY_ACCESSOR(MessagePortOnclose);
559         DECLARE_CALLBACK(MessagePortAddEventListener);
560         DECLARE_CALLBACK(MessagePortPostMessage);
561         DECLARE_CALLBACK(MessagePortRemoveEventListener);
562         DECLARE_CALLBACK(MessagePortStartConversation);
563
564         DECLARE_CALLBACK(DatabaseChangeVersion);
565         DECLARE_CALLBACK(DatabaseTransaction);
566         DECLARE_CALLBACK(DatabaseReadTransaction);
567         DECLARE_CALLBACK(SQLTransactionExecuteSql);
568         DECLARE_CALLBACK(SQLResultSetRowListItem);
569
570         DECLARE_INDEXED_PROPERTY_GETTER(ClientRectList);
571         DECLARE_INDEXED_PROPERTY_GETTER(FileList);
572   
573 #if ENABLE(DATAGRID)
574         DECLARE_PROPERTY_ACCESSOR(HTMLDataGridElementDataSource);
575         DECLARE_INDEXED_PROPERTY_GETTER(DataGridColumnList);
576         DECLARE_NAMED_PROPERTY_GETTER(DataGridColumnList);
577 #endif      
578
579 #if ENABLE(DOM_STORAGE)
580         DECLARE_ACCESSOR_RUNTIME_ENABLER(DOMWindowLocalStorage);
581         DECLARE_ACCESSOR_RUNTIME_ENABLER(DOMWindowSessionStorage);
582         DECLARE_INDEXED_PROPERTY_GETTER(Storage);
583         DECLARE_INDEXED_PROPERTY_SETTER(Storage);
584         DECLARE_INDEXED_PROPERTY_DELETER(Storage);
585         DECLARE_NAMED_PROPERTY_GETTER(Storage);
586         DECLARE_NAMED_PROPERTY_SETTER(Storage);
587         DECLARE_NAMED_PROPERTY_DELETER(Storage);
588         static v8::Handle<v8::Array> v8StorageNamedPropertyEnumerator(const v8::AccessorInfo& info);
589 #endif
590
591 #if ENABLE(SVG)
592         DECLARE_PROPERTY_ACCESSOR_GETTER(SVGLengthValue);
593         DECLARE_CALLBACK(SVGLengthConvertToSpecifiedUnits);
594         DECLARE_CALLBACK(SVGMatrixInverse);
595         DECLARE_CALLBACK(SVGMatrixRotateFromVector);
596         DECLARE_CALLBACK(SVGElementInstanceAddEventListener);
597         DECLARE_CALLBACK(SVGElementInstanceRemoveEventListener);
598 #endif
599
600 #if ENABLE(WORKERS)
601         DECLARE_PROPERTY_ACCESSOR(AbstractWorkerOnerror);
602         DECLARE_CALLBACK(AbstractWorkerAddEventListener);
603         DECLARE_CALLBACK(AbstractWorkerRemoveEventListener);
604
605         DECLARE_PROPERTY_ACCESSOR(DedicatedWorkerContextOnmessage);
606         DECLARE_CALLBACK(DedicatedWorkerContextPostMessage);
607
608         DECLARE_PROPERTY_ACCESSOR(WorkerOnmessage);
609         DECLARE_CALLBACK(WorkerPostMessage);
610         DECLARE_CALLBACK(WorkerConstructor);
611
612         DECLARE_PROPERTY_ACCESSOR_GETTER(WorkerContextSelf);
613         DECLARE_PROPERTY_ACCESSOR(WorkerContextOnerror);
614         DECLARE_CALLBACK(WorkerContextImportScripts);
615         DECLARE_CALLBACK(WorkerContextSetTimeout);
616         DECLARE_CALLBACK(WorkerContextClearTimeout);
617         DECLARE_CALLBACK(WorkerContextSetInterval);
618         DECLARE_CALLBACK(WorkerContextClearInterval);
619         DECLARE_CALLBACK(WorkerContextAddEventListener);
620         DECLARE_CALLBACK(WorkerContextRemoveEventListener);
621
622 #if ENABLE(NOTIFICATIONS)
623         DECLARE_ACCESSOR_RUNTIME_ENABLER(WorkerContextWebkitNotifications);
624 #endif
625 #endif // ENABLE(WORKERS)
626
627 #if ENABLE(NOTIFICATIONS)
628         DECLARE_CALLBACK(NotificationCenterRequestPermission);
629         DECLARE_CALLBACK(NotificationCenterCreateNotification);
630         DECLARE_CALLBACK(NotificationCenterCreateHTMLNotification);
631
632         DECLARE_CALLBACK(NotificationAddEventListener);
633         DECLARE_CALLBACK(NotificationRemoveEventListener);
634         DECLARE_PROPERTY_ACCESSOR(NotificationEventHandler);
635 #endif // ENABLE(NOTIFICATIONS)
636
637 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
638         DECLARE_PROPERTY_ACCESSOR(DOMApplicationCacheEventHandler);
639         DECLARE_CALLBACK(DOMApplicationCacheAddEventListener);
640         DECLARE_CALLBACK(DOMApplicationCacheRemoveEventListener);
641 #endif
642
643 #if ENABLE(SHARED_WORKERS)
644         DECLARE_CALLBACK(SharedWorkerConstructor);
645         DECLARE_ACCESSOR_RUNTIME_ENABLER(DOMWindowSharedWorker);
646 #endif
647
648 #if ENABLE(NOTIFICATIONS)
649         DECLARE_ACCESSOR_RUNTIME_ENABLER(DOMWindowWebkitNotifications);
650 #endif
651
652 #if ENABLE(WEB_SOCKETS)
653         DECLARE_PROPERTY_ACCESSOR(WebSocketOnopen);
654         DECLARE_PROPERTY_ACCESSOR(WebSocketOnmessage);
655         DECLARE_PROPERTY_ACCESSOR(WebSocketOnclose);
656         DECLARE_CALLBACK(WebSocketConstructor);
657         DECLARE_CALLBACK(WebSocketAddEventListener);
658         DECLARE_CALLBACK(WebSocketRemoveEventListener);
659         DECLARE_CALLBACK(WebSocketSend);
660         DECLARE_CALLBACK(WebSocketClose);
661         DECLARE_ACCESSOR_RUNTIME_ENABLER(DOMWindowWebSocket);
662 #endif
663
664 #undef DECLARE_INDEXED_ACCESS_CHECK
665 #undef DECLARE_NAMED_ACCESS_CHECK
666
667 #undef DECLARE_PROPERTY_ACCESSOR_SETTER
668 #undef DECLARE_PROPERTY_ACCESSOR_GETTER
669 #undef DECLARE_PROPERTY_ACCESSOR
670
671 #undef DECLARE_NAMED_PROPERTY_GETTER
672 #undef DECLARE_NAMED_PROPERTY_SETTER
673 #undef DECLARE_NAMED_PROPERTY_DELETER
674
675 #undef DECLARE_INDEXED_PROPERTY_GETTER
676 #undef DECLARE_INDEXED_PROPERTY_SETTER
677 #undef DECLARE_INDEXED_PROPERTY_DELETER
678
679 #undef DECLARE_CALLBACK
680
681         // Returns the NPObject corresponding to an HTMLElement object.
682         static NPObject* GetHTMLPlugInElementNPObject(v8::Handle<v8::Object>);
683
684         // Returns the owner frame pointer of a DOM wrapper object. It only works for
685         // these DOM objects requiring cross-domain access check.
686         static Frame* GetTargetFrame(v8::Local<v8::Object> host, v8::Local<v8::Value> data);
687
688         // Special case for downcasting SVG path segments.
689 #if ENABLE(SVG)
690         static V8ClassIndex::V8WrapperType DowncastSVGPathSeg(void* pathSeg);
691 #endif
692
693     private:
694         static v8::Handle<v8::Value> WindowSetTimeoutImpl(const v8::Arguments&, bool singleShot);
695         static void ClearTimeoutImpl(const v8::Arguments&);
696         static void WindowSetLocation(DOMWindow*, const String&);
697     };
698
699 } // namespace WebCore
700
701 #endif // V8CustomBinding_h