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