1075bf8c3488bd9847b3ec3ce78e8aef2fbabdb5
[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 namespace WebCore {
82
83     class DOMWindow;
84     class Element;
85     class Frame;
86     class HTMLCollection;
87     class HTMLFrameElementBase;
88     class String;
89     class V8Proxy;
90
91     bool allowSettingFrameSrcToJavascriptUrl(HTMLFrameElementBase*, String value);
92     bool allowSettingSrcToJavascriptURL(Element*, String name, String value);
93
94     class V8Custom {
95     public:
96         // Constants.
97         static const int kDOMWrapperTypeIndex = 0;
98         static const int kDOMWrapperObjectIndex = 1;
99         static const int kDefaultWrapperInternalFieldCount = 2;
100
101         static const int kNPObjectInternalFieldCount = kDefaultWrapperInternalFieldCount + 0;
102
103         static const int kNodeEventListenerCacheIndex = kDefaultWrapperInternalFieldCount + 0;
104         static const int kNodeMinimumInternalFieldCount = kDefaultWrapperInternalFieldCount + 1;
105
106         static const int kDocumentImplementationIndex = kNodeMinimumInternalFieldCount + 0;
107         static const int kDocumentMinimumInternalFieldCount = kNodeMinimumInternalFieldCount + 1;
108
109         static const int kHTMLDocumentMarkerIndex = kDocumentMinimumInternalFieldCount + 0;
110         static const int kHTMLDocumentShadowIndex = kDocumentMinimumInternalFieldCount + 1;
111         static const int kHTMLDocumentInternalFieldCount = kDocumentMinimumInternalFieldCount + 2;
112
113         static const int kXMLHttpRequestCacheIndex = kDefaultWrapperInternalFieldCount + 0;
114         static const int kXMLHttpRequestInternalFieldCount = kDefaultWrapperInternalFieldCount + 1;
115
116         static const int kMessageChannelPort1Index = kDefaultWrapperInternalFieldCount + 0;
117         static const int kMessageChannelPort2Index = kDefaultWrapperInternalFieldCount + 1;
118         static const int kMessageChannelInternalFieldCount = kDefaultWrapperInternalFieldCount + 2;
119
120         static const int kMessagePortRequestCacheIndex = kDefaultWrapperInternalFieldCount + 0;
121         static const int kMessagePortEntangledPortIndex = kDefaultWrapperInternalFieldCount + 1;
122         static const int kMessagePortInternalFieldCount = kDefaultWrapperInternalFieldCount + 2;
123
124 #if ENABLE(WORKERS)
125         static const int kWorkerRequestCacheIndex = kDefaultWrapperInternalFieldCount + 0;
126         static const int kWorkerInternalFieldCount = kDefaultWrapperInternalFieldCount + 1;
127
128         static const int kWorkerContextRequestCacheIndex = kDefaultWrapperInternalFieldCount + 0;
129         static const int kWorkerContextMinimumInternalFieldCount = kDefaultWrapperInternalFieldCount + 1;
130
131         static const int kDedicatedWorkerContextRequestCacheIndex = kWorkerContextMinimumInternalFieldCount + 0;
132         static const int kDedicatedWorkerContextInternalFieldCount = kWorkerContextMinimumInternalFieldCount + 1;
133
134         static const int kAbstractWorkerRequestCacheIndex = kDefaultWrapperInternalFieldCount + 0;
135         static const int kAbstractWorkerInternalFieldCount = kDefaultWrapperInternalFieldCount + 1;
136 #endif
137
138 #if ENABLE(NOTIFICATIONS)
139         static const int kNotificationRequestCacheIndex = kDefaultWrapperInternalFieldCount + 0;
140         static const int kNotificationInternalFieldCount = kDefaultWrapperInternalFieldCount + 1;
141 #endif
142
143         static const int kDOMWindowConsoleIndex = kDefaultWrapperInternalFieldCount + 0;
144         static const int kDOMWindowHistoryIndex = kDefaultWrapperInternalFieldCount + 1;
145         static const int kDOMWindowLocationbarIndex = kDefaultWrapperInternalFieldCount + 2;
146         static const int kDOMWindowMenubarIndex = kDefaultWrapperInternalFieldCount + 3;
147         static const int kDOMWindowNavigatorIndex = kDefaultWrapperInternalFieldCount + 4;
148         static const int kDOMWindowPersonalbarIndex = kDefaultWrapperInternalFieldCount + 5;
149         static const int kDOMWindowScreenIndex = kDefaultWrapperInternalFieldCount + 6;
150         static const int kDOMWindowScrollbarsIndex = kDefaultWrapperInternalFieldCount + 7;
151         static const int kDOMWindowSelectionIndex = kDefaultWrapperInternalFieldCount + 8;
152         static const int kDOMWindowStatusbarIndex = kDefaultWrapperInternalFieldCount + 9;
153         static const int kDOMWindowToolbarIndex = kDefaultWrapperInternalFieldCount + 10;
154         static const int kDOMWindowLocationIndex = kDefaultWrapperInternalFieldCount + 11;
155         static const int kDOMWindowDOMSelectionIndex = kDefaultWrapperInternalFieldCount + 12;
156         static const int kDOMWindowInternalFieldCount = kDefaultWrapperInternalFieldCount + 13;
157
158         static const int kStyleSheetOwnerNodeIndex = kDefaultWrapperInternalFieldCount + 0;
159         static const int kStyleSheetInternalFieldCount = kDefaultWrapperInternalFieldCount + 1;
160
161 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
162         static const int kDOMApplicationCacheCacheIndex = kDefaultWrapperInternalFieldCount + 0;
163         static const int kDOMApplicationCacheFieldCount = kDefaultWrapperInternalFieldCount + 1;
164 #endif
165
166 #if ENABLE(WEB_SOCKETS)
167         static const int kWebSocketCacheIndex = kDefaultWrapperInternalFieldCount + 0;
168         static const int kWebSocketInternalFieldCount = kDefaultWrapperInternalFieldCount + 1;
169 #endif
170
171 #define DECLARE_PROPERTY_ACCESSOR_GETTER(NAME) \
172     static v8::Handle<v8::Value> v8##NAME##AccessorGetter( \
173         v8::Local<v8::String> name, const v8::AccessorInfo& info)
174
175 #define DECLARE_PROPERTY_ACCESSOR_SETTER(NAME)  \
176     static void v8##NAME##AccessorSetter(v8::Local<v8::String> name, \
177         v8::Local<v8::Value> value, const v8::AccessorInfo& info)
178
179 #define DECLARE_PROPERTY_ACCESSOR(NAME) DECLARE_PROPERTY_ACCESSOR_GETTER(NAME); DECLARE_PROPERTY_ACCESSOR_SETTER(NAME)
180
181 #define DECLARE_NAMED_PROPERTY_GETTER(NAME)  \
182     static v8::Handle<v8::Value> v8##NAME##NamedPropertyGetter( \
183         v8::Local<v8::String> name, const v8::AccessorInfo& info)
184
185 #define DECLARE_NAMED_PROPERTY_SETTER(NAME) \
186     static v8::Handle<v8::Value> v8##NAME##NamedPropertySetter( \
187         v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
188
189 #define DECLARE_NAMED_PROPERTY_DELETER(NAME) \
190     static v8::Handle<v8::Boolean> v8##NAME##NamedPropertyDeleter( \
191         v8::Local<v8::String> name, const v8::AccessorInfo& info)
192
193 #define USE_NAMED_PROPERTY_GETTER(NAME) V8Custom::v8##NAME##NamedPropertyGetter
194
195 #define USE_NAMED_PROPERTY_SETTER(NAME) V8Custom::v8##NAME##NamedPropertySetter
196
197 #define USE_NAMED_PROPERTY_DELETER(NAME) V8Custom::v8##NAME##NamedPropertyDeleter
198
199 #define DECLARE_INDEXED_PROPERTY_GETTER(NAME) \
200     static v8::Handle<v8::Value> v8##NAME##IndexedPropertyGetter( \
201         uint32_t index, const v8::AccessorInfo& info)
202
203 #define DECLARE_INDEXED_PROPERTY_SETTER(NAME) \
204     static v8::Handle<v8::Value> v8##NAME##IndexedPropertySetter( \
205         uint32_t index, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
206
207 #define DECLARE_INDEXED_PROPERTY_DELETER(NAME) \
208     static v8::Handle<v8::Boolean> v8##NAME##IndexedPropertyDeleter( \
209         uint32_t index, const v8::AccessorInfo& info)
210
211 #define USE_INDEXED_PROPERTY_GETTER(NAME) V8Custom::v8##NAME##IndexedPropertyGetter
212
213 #define USE_INDEXED_PROPERTY_SETTER(NAME) V8Custom::v8##NAME##IndexedPropertySetter
214
215 #define USE_INDEXED_PROPERTY_DELETER(NAME) V8Custom::v8##NAME##IndexedPropertyDeleter
216
217 #define DECLARE_CALLBACK(NAME) static v8::Handle<v8::Value> v8##NAME##Callback(const v8::Arguments& args)
218
219 #define USE_CALLBACK(NAME) V8Custom::v8##NAME##Callback
220
221 #define DECLARE_NAMED_ACCESS_CHECK(NAME) \
222     static bool v8##NAME##NamedSecurityCheck(v8::Local<v8::Object> host, \
223         v8::Local<v8::Value> key, v8::AccessType type, v8::Local<v8::Value> data)
224
225 #define DECLARE_INDEXED_ACCESS_CHECK(NAME) \
226     static bool v8##NAME##IndexedSecurityCheck(v8::Local<v8::Object> host, \
227         uint32_t index, v8::AccessType type, v8::Local<v8::Value> data)
228
229         DECLARE_PROPERTY_ACCESSOR(CanvasRenderingContext2DStrokeStyle);
230         DECLARE_PROPERTY_ACCESSOR(CanvasRenderingContext2DFillStyle);
231         DECLARE_PROPERTY_ACCESSOR(DOMWindowEvent);
232         DECLARE_PROPERTY_ACCESSOR_GETTER(DOMWindowCrypto);
233         DECLARE_PROPERTY_ACCESSOR_SETTER(DOMWindowLocation);
234         DECLARE_PROPERTY_ACCESSOR_SETTER(DOMWindowOpener);
235
236         DECLARE_PROPERTY_ACCESSOR(DocumentLocation);
237         DECLARE_PROPERTY_ACCESSOR(DocumentImplementation);
238         DECLARE_PROPERTY_ACCESSOR_GETTER(EventSrcElement);
239         DECLARE_PROPERTY_ACCESSOR(EventReturnValue);
240         DECLARE_PROPERTY_ACCESSOR_GETTER(EventDataTransfer);
241         DECLARE_PROPERTY_ACCESSOR_GETTER(EventClipboardData);
242
243         DECLARE_PROPERTY_ACCESSOR(DOMWindowEventHandler);
244
245         DECLARE_CALLBACK(HTMLCanvasElementGetContext);
246
247         DECLARE_PROPERTY_ACCESSOR_SETTER(HTMLFrameElementSrc);
248         DECLARE_PROPERTY_ACCESSOR_SETTER(HTMLFrameElementLocation);
249         DECLARE_PROPERTY_ACCESSOR_SETTER(HTMLIFrameElementSrc);
250
251         DECLARE_PROPERTY_ACCESSOR_SETTER(AttrValue);
252
253         DECLARE_PROPERTY_ACCESSOR(HTMLOptionsCollectionLength);
254
255         DECLARE_CALLBACK(HTMLInputElementSetSelectionRange);
256
257         DECLARE_PROPERTY_ACCESSOR(HTMLInputElementSelectionStart);
258         DECLARE_PROPERTY_ACCESSOR(HTMLInputElementSelectionEnd);
259
260         DECLARE_NAMED_ACCESS_CHECK(Location);
261         DECLARE_INDEXED_ACCESS_CHECK(History);
262
263         DECLARE_NAMED_ACCESS_CHECK(History);
264         DECLARE_INDEXED_ACCESS_CHECK(Location);
265
266         DECLARE_CALLBACK(HTMLCollectionItem);
267         DECLARE_CALLBACK(HTMLCollectionNamedItem);
268         DECLARE_CALLBACK(HTMLCollectionCallAsFunction);
269
270         DECLARE_CALLBACK(HTMLSelectElementRemove);
271
272         DECLARE_CALLBACK(HTMLOptionsCollectionRemove);
273         DECLARE_CALLBACK(HTMLOptionsCollectionAdd);
274
275         DECLARE_CALLBACK(HTMLDocumentWrite);
276         DECLARE_CALLBACK(HTMLDocumentWriteln);
277         DECLARE_CALLBACK(HTMLDocumentOpen);
278         DECLARE_PROPERTY_ACCESSOR(HTMLDocumentAll);
279         DECLARE_NAMED_PROPERTY_GETTER(HTMLDocument);
280         DECLARE_NAMED_PROPERTY_DELETER(HTMLDocument);
281
282         DECLARE_CALLBACK(DocumentEvaluate);
283         DECLARE_CALLBACK(DocumentGetCSSCanvasContext);
284
285         DECLARE_CALLBACK(DOMWindowAddEventListener);
286         DECLARE_CALLBACK(DOMWindowRemoveEventListener);
287         DECLARE_CALLBACK(DOMWindowPostMessage);
288         DECLARE_CALLBACK(DOMWindowSetTimeout);
289         DECLARE_CALLBACK(DOMWindowSetInterval);
290         DECLARE_CALLBACK(DOMWindowAtob);
291         DECLARE_CALLBACK(DOMWindowBtoa);
292         DECLARE_CALLBACK(DOMWindowNOP);
293         DECLARE_CALLBACK(DOMWindowToString);
294         DECLARE_CALLBACK(DOMWindowShowModalDialog);
295         DECLARE_CALLBACK(DOMWindowOpen);
296         DECLARE_CALLBACK(DOMWindowClearTimeout);
297         DECLARE_CALLBACK(DOMWindowClearInterval);
298
299         DECLARE_CALLBACK(DOMParserConstructor);
300         DECLARE_CALLBACK(HTMLAudioElementConstructor);
301         DECLARE_CALLBACK(HTMLImageElementConstructor);
302         DECLARE_CALLBACK(HTMLOptionElementConstructor);
303         DECLARE_CALLBACK(MessageChannelConstructor);
304         DECLARE_CALLBACK(WebKitCSSMatrixConstructor);
305         DECLARE_CALLBACK(WebKitPointConstructor);
306         DECLARE_CALLBACK(XMLHttpRequestConstructor);
307         DECLARE_CALLBACK(XMLSerializerConstructor);
308         DECLARE_CALLBACK(XPathEvaluatorConstructor);
309         DECLARE_CALLBACK(XSLTProcessorConstructor);
310
311         DECLARE_CALLBACK(XSLTProcessorImportStylesheet);
312         DECLARE_CALLBACK(XSLTProcessorTransformToFragment);
313         DECLARE_CALLBACK(XSLTProcessorTransformToDocument);
314         DECLARE_CALLBACK(XSLTProcessorSetParameter);
315         DECLARE_CALLBACK(XSLTProcessorGetParameter);
316         DECLARE_CALLBACK(XSLTProcessorRemoveParameter);
317
318         DECLARE_CALLBACK(CSSPrimitiveValueGetRGBColorValue);
319
320         DECLARE_CALLBACK(CanvasRenderingContext2DSetStrokeColor);
321         DECLARE_CALLBACK(CanvasRenderingContext2DSetFillColor);
322         DECLARE_CALLBACK(CanvasRenderingContext2DStrokeRect);
323         DECLARE_CALLBACK(CanvasRenderingContext2DSetShadow);
324         DECLARE_CALLBACK(CanvasRenderingContext2DDrawImage);
325         DECLARE_CALLBACK(CanvasRenderingContext2DDrawImageFromRect);
326         DECLARE_CALLBACK(CanvasRenderingContext2DCreatePattern);
327         DECLARE_CALLBACK(CanvasRenderingContext2DFillText);
328         DECLARE_CALLBACK(CanvasRenderingContext2DStrokeText);
329         DECLARE_CALLBACK(CanvasRenderingContext2DPutImageData);
330
331         DECLARE_PROPERTY_ACCESSOR_GETTER(ClipboardTypes);
332         DECLARE_CALLBACK(ClipboardClearData);
333         DECLARE_CALLBACK(ClipboardGetData);
334         DECLARE_CALLBACK(ClipboardSetData);
335         DECLARE_CALLBACK(ClipboardSetDragImage);
336
337         DECLARE_CALLBACK(ElementQuerySelector);
338         DECLARE_CALLBACK(ElementQuerySelectorAll);
339         DECLARE_CALLBACK(ElementSetAttribute);
340         DECLARE_CALLBACK(ElementSetAttributeNode);
341         DECLARE_CALLBACK(ElementSetAttributeNS);
342         DECLARE_CALLBACK(ElementSetAttributeNodeNS);
343
344         DECLARE_PROPERTY_ACCESSOR_SETTER(LocationProtocol);
345         DECLARE_PROPERTY_ACCESSOR_SETTER(LocationHost);
346         DECLARE_PROPERTY_ACCESSOR_SETTER(LocationHostname);
347         DECLARE_PROPERTY_ACCESSOR_SETTER(LocationPort);
348         DECLARE_PROPERTY_ACCESSOR_SETTER(LocationPathname);
349         DECLARE_PROPERTY_ACCESSOR_SETTER(LocationSearch);
350         DECLARE_PROPERTY_ACCESSOR_SETTER(LocationHash);
351         DECLARE_PROPERTY_ACCESSOR_SETTER(LocationHref);
352         DECLARE_PROPERTY_ACCESSOR_GETTER(LocationAssign);
353         DECLARE_PROPERTY_ACCESSOR_GETTER(LocationReplace);
354         DECLARE_PROPERTY_ACCESSOR_GETTER(LocationReload);
355         DECLARE_CALLBACK(LocationAssign);
356         DECLARE_CALLBACK(LocationReplace);
357         DECLARE_CALLBACK(LocationReload);
358         DECLARE_CALLBACK(LocationToString);
359         DECLARE_CALLBACK(LocationValueOf);
360
361         DECLARE_CALLBACK(NodeAddEventListener);
362         DECLARE_CALLBACK(NodeRemoveEventListener);
363         DECLARE_CALLBACK(NodeInsertBefore);
364         DECLARE_CALLBACK(NodeReplaceChild);
365         DECLARE_CALLBACK(NodeRemoveChild);
366         DECLARE_CALLBACK(NodeAppendChild);
367
368         // We actually only need this because WebKit has
369         // navigator.appVersion as custom. Our version just
370         // passes through.
371         DECLARE_PROPERTY_ACCESSOR(NavigatorAppVersion);
372
373         DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestOnabort);
374         DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestOnerror);
375         DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestOnload);
376         DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestOnloadstart);
377         DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestOnprogress);
378         DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestOnreadystatechange);
379         DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestResponseText);
380         DECLARE_CALLBACK(XMLHttpRequestAddEventListener);
381         DECLARE_CALLBACK(XMLHttpRequestRemoveEventListener);
382         DECLARE_CALLBACK(XMLHttpRequestOpen);
383         DECLARE_CALLBACK(XMLHttpRequestSend);
384         DECLARE_CALLBACK(XMLHttpRequestSetRequestHeader);
385         DECLARE_CALLBACK(XMLHttpRequestGetResponseHeader);
386         DECLARE_CALLBACK(XMLHttpRequestOverrideMimeType);
387         DECLARE_CALLBACK(XMLHttpRequestDispatchEvent);
388
389         DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestUploadOnabort);
390         DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestUploadOnerror);
391         DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestUploadOnload);
392         DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestUploadOnloadstart);
393         DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestUploadOnprogress);
394         DECLARE_CALLBACK(XMLHttpRequestUploadAddEventListener);
395         DECLARE_CALLBACK(XMLHttpRequestUploadRemoveEventListener);
396         DECLARE_CALLBACK(XMLHttpRequestUploadDispatchEvent);
397
398         DECLARE_CALLBACK(TreeWalkerParentNode);
399         DECLARE_CALLBACK(TreeWalkerFirstChild);
400         DECLARE_CALLBACK(TreeWalkerLastChild);
401         DECLARE_CALLBACK(TreeWalkerNextNode);
402         DECLARE_CALLBACK(TreeWalkerPreviousNode);
403         DECLARE_CALLBACK(TreeWalkerNextSibling);
404         DECLARE_CALLBACK(TreeWalkerPreviousSibling);
405
406         DECLARE_CALLBACK(InspectorBackendProfiles);
407         DECLARE_CALLBACK(InspectorBackendHighlightDOMNode);
408         DECLARE_CALLBACK(InspectorBackendAddResourceSourceToFrame);
409         DECLARE_CALLBACK(InspectorBackendAddSourceToFrame);
410         DECLARE_CALLBACK(InspectorBackendSearch);
411         DECLARE_CALLBACK(InspectorBackendSetting);
412         DECLARE_CALLBACK(InspectorBackendInspectedWindow);
413         DECLARE_CALLBACK(InspectorBackendSetSetting);
414         DECLARE_CALLBACK(InspectorBackendCurrentCallFrame);
415         DECLARE_CALLBACK(InspectorBackendDebuggerEnabled);
416         DECLARE_CALLBACK(InspectorBackendPauseOnExceptions);
417         DECLARE_CALLBACK(InspectorBackendProfilerEnabled);
418         DECLARE_CALLBACK(InspectorBackendNodeForId);
419         DECLARE_CALLBACK(InspectorBackendWrapObject);
420         DECLARE_CALLBACK(InspectorBackendUnwrapObject);
421         DECLARE_CALLBACK(InspectorBackendPushNodePathToFrontend);
422 #if ENABLE(DATABASE)
423         DECLARE_CALLBACK(InspectorBackendDatabaseTableNames);
424         DECLARE_CALLBACK(InspectorBackendSelectDatabase);
425 #endif
426 #if ENABLE(DOM_STORAGE)
427         DECLARE_CALLBACK(InspectorBackendSelectDOMStorage);
428 #endif
429         DECLARE_CALLBACK(InspectorBackendWrapCallback);
430
431         DECLARE_CALLBACK(NodeIteratorNextNode);
432         DECLARE_CALLBACK(NodeIteratorPreviousNode);
433
434         DECLARE_CALLBACK(NodeFilterAcceptNode);
435
436         DECLARE_CALLBACK(HTMLFormElementSubmit);
437
438         DECLARE_NAMED_PROPERTY_GETTER(DOMWindow);
439         DECLARE_INDEXED_PROPERTY_GETTER(DOMWindow);
440         DECLARE_NAMED_ACCESS_CHECK(DOMWindow);
441         DECLARE_INDEXED_ACCESS_CHECK(DOMWindow);
442
443         DECLARE_NAMED_PROPERTY_GETTER(HTMLFrameSetElement);
444         DECLARE_NAMED_PROPERTY_GETTER(HTMLFormElement);
445         DECLARE_NAMED_PROPERTY_GETTER(NodeList);
446         DECLARE_NAMED_PROPERTY_GETTER(NamedNodeMap);
447         DECLARE_NAMED_PROPERTY_GETTER(CSSStyleDeclaration);
448         DECLARE_NAMED_PROPERTY_SETTER(CSSStyleDeclaration);
449         DECLARE_NAMED_PROPERTY_GETTER(HTMLPlugInElement);
450         DECLARE_NAMED_PROPERTY_SETTER(HTMLPlugInElement);
451         DECLARE_INDEXED_PROPERTY_GETTER(HTMLPlugInElement);
452         DECLARE_INDEXED_PROPERTY_SETTER(HTMLPlugInElement);
453
454         DECLARE_CALLBACK(HTMLPlugInElement);
455
456         DECLARE_NAMED_PROPERTY_GETTER(StyleSheetList);
457         DECLARE_INDEXED_PROPERTY_GETTER(NamedNodeMap);
458         DECLARE_INDEXED_PROPERTY_GETTER(HTMLFormElement);
459         DECLARE_INDEXED_PROPERTY_GETTER(HTMLOptionsCollection);
460         DECLARE_INDEXED_PROPERTY_SETTER(HTMLOptionsCollection);
461         DECLARE_NAMED_PROPERTY_GETTER(HTMLSelectElementCollection);
462         DECLARE_INDEXED_PROPERTY_SETTER(HTMLSelectElementCollection);
463         DECLARE_NAMED_PROPERTY_GETTER(HTMLCollection);
464
465         DECLARE_INDEXED_PROPERTY_GETTER(CanvasPixelArray);
466         DECLARE_INDEXED_PROPERTY_SETTER(CanvasPixelArray);
467
468         DECLARE_PROPERTY_ACCESSOR(MessagePortOnmessage);
469         DECLARE_PROPERTY_ACCESSOR(MessagePortOnclose);
470         DECLARE_CALLBACK(MessagePortStartConversation);
471         DECLARE_CALLBACK(MessagePortAddEventListener);
472         DECLARE_CALLBACK(MessagePortRemoveEventListener);
473
474         DECLARE_CALLBACK(DatabaseChangeVersion);
475         DECLARE_CALLBACK(DatabaseTransaction);
476         DECLARE_CALLBACK(SQLTransactionExecuteSql);
477         DECLARE_CALLBACK(SQLResultSetRowListItem);
478
479         DECLARE_INDEXED_PROPERTY_GETTER(ClientRectList);
480   
481 #if ENABLE(DATAGRID)
482         DECLARE_PROPERTY_ACCESSOR(HTMLDataGridElementDataSource);
483         DECLARE_INDEXED_PROPERTY_GETTER(DataGridColumnList);
484         DECLARE_NAMED_PROPERTY_GETTER(DataGridColumnList);
485 #endif      
486
487 #if ENABLE(DOM_STORAGE)
488         DECLARE_INDEXED_PROPERTY_GETTER(Storage);
489         DECLARE_INDEXED_PROPERTY_SETTER(Storage);
490         DECLARE_INDEXED_PROPERTY_DELETER(Storage);
491         DECLARE_NAMED_PROPERTY_GETTER(Storage);
492         DECLARE_NAMED_PROPERTY_SETTER(Storage);
493         DECLARE_NAMED_PROPERTY_DELETER(Storage);
494         static v8::Handle<v8::Array> v8StorageNamedPropertyEnumerator(const v8::AccessorInfo& info);
495 #endif
496
497 #if ENABLE(SVG)
498         DECLARE_PROPERTY_ACCESSOR_GETTER(SVGLengthValue);
499         DECLARE_CALLBACK(SVGLengthConvertToSpecifiedUnits);
500         DECLARE_CALLBACK(SVGMatrixInverse);
501         DECLARE_CALLBACK(SVGMatrixRotateFromVector);
502         DECLARE_CALLBACK(SVGElementInstanceAddEventListener);
503         DECLARE_CALLBACK(SVGElementInstanceRemoveEventListener);
504 #endif
505
506 #if ENABLE(WORKERS)
507         DECLARE_PROPERTY_ACCESSOR(AbstractWorkerOnerror);
508         DECLARE_CALLBACK(AbstractWorkerAddEventListener);
509         DECLARE_CALLBACK(AbstractWorkerRemoveEventListener);
510
511         DECLARE_PROPERTY_ACCESSOR(DedicatedWorkerContextOnmessage);
512
513         DECLARE_PROPERTY_ACCESSOR(WorkerOnmessage);
514         DECLARE_CALLBACK(WorkerConstructor);
515
516         DECLARE_PROPERTY_ACCESSOR_GETTER(WorkerContextSelf);
517         DECLARE_PROPERTY_ACCESSOR(WorkerContextOnerror);
518         DECLARE_CALLBACK(WorkerContextImportScripts);
519         DECLARE_CALLBACK(WorkerContextSetTimeout);
520         DECLARE_CALLBACK(WorkerContextClearTimeout);
521         DECLARE_CALLBACK(WorkerContextSetInterval);
522         DECLARE_CALLBACK(WorkerContextClearInterval);
523         DECLARE_CALLBACK(WorkerContextAddEventListener);
524         DECLARE_CALLBACK(WorkerContextRemoveEventListener);
525 #endif // ENABLE(WORKERS)
526
527 #if ENABLE(NOTIFICATIONS)
528         DECLARE_CALLBACK(NotificationCenterRequestPermission);
529         DECLARE_CALLBACK(NotificationCenterCreateNotification);
530         DECLARE_CALLBACK(NotificationCenterCreateHTMLNotification);
531
532         DECLARE_CALLBACK(NotificationAddEventListener);
533         DECLARE_CALLBACK(NotificationRemoveEventListener);
534         DECLARE_PROPERTY_ACCESSOR(NotificationEventHandler);
535 #endif // ENABLE(NOTIFICATIONS)
536
537 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
538         DECLARE_PROPERTY_ACCESSOR(DOMApplicationCacheEventHandler);
539         DECLARE_CALLBACK(DOMApplicationCacheAddEventListener);
540         DECLARE_CALLBACK(DOMApplicationCacheRemoveEventListener);
541 #endif
542
543 #if ENABLE(SHARED_WORKERS)
544         DECLARE_CALLBACK(SharedWorkerConstructor);
545 #endif
546
547 #if ENABLE(WEB_SOCKETS)
548         DECLARE_PROPERTY_ACCESSOR(WebSocketOnopen);
549         DECLARE_PROPERTY_ACCESSOR(WebSocketOnmessage);
550         DECLARE_PROPERTY_ACCESSOR(WebSocketOnclose);
551         DECLARE_CALLBACK(WebSocketConstructor);
552         DECLARE_CALLBACK(WebSocketSend);
553         DECLARE_CALLBACK(WebSocketClose);
554 #endif
555
556 #undef DECLARE_INDEXED_ACCESS_CHECK
557 #undef DECLARE_NAMED_ACCESS_CHECK
558
559 #undef DECLARE_PROPERTY_ACCESSOR_SETTER
560 #undef DECLARE_PROPERTY_ACCESSOR_GETTER
561 #undef DECLARE_PROPERTY_ACCESSOR
562
563 #undef DECLARE_NAMED_PROPERTY_GETTER
564 #undef DECLARE_NAMED_PROPERTY_SETTER
565 #undef DECLARE_NAMED_PROPERTY_DELETER
566
567 #undef DECLARE_INDEXED_PROPERTY_GETTER
568 #undef DECLARE_INDEXED_PROPERTY_SETTER
569 #undef DECLARE_INDEXED_PROPERTY_DELETER
570
571 #undef DECLARE_CALLBACK
572
573         // Returns the NPObject corresponding to an HTMLElement object.
574         static NPObject* GetHTMLPlugInElementNPObject(v8::Handle<v8::Object>);
575
576         // Returns the owner frame pointer of a DOM wrapper object. It only works for
577         // these DOM objects requiring cross-domain access check.
578         static Frame* GetTargetFrame(v8::Local<v8::Object> host, v8::Local<v8::Value> data);
579
580         // Special case for downcasting SVG path segments.
581 #if ENABLE(SVG)
582         static V8ClassIndex::V8WrapperType DowncastSVGPathSeg(void* pathSeg);
583 #endif
584
585     private:
586         static v8::Handle<v8::Value> WindowSetTimeoutImpl(const v8::Arguments&, bool singleShot);
587         static void ClearTimeoutImpl(const v8::Arguments&);
588         static void WindowSetLocation(DOMWindow*, const String&);
589     };
590
591 } // namespace WebCore
592
593 #endif // V8CustomBinding_h