diff options
| author | Ben Murdoch <benm@google.com> | 2009-06-23 11:07:28 +0100 |
|---|---|---|
| committer | Ben Murdoch <benm@google.com> | 2009-06-26 12:16:45 +0100 |
| commit | d7d12df62dd2e1bbf1aff207ab8edbd6b4492341 (patch) | |
| tree | d7e760be59096f419d0f9c249540f80a67b69590 /V8Binding/binding | |
| parent | 8520036e325f7e1ef2351410a555610f05d15957 (diff) | |
| download | external_webkit-d7d12df62dd2e1bbf1aff207ab8edbd6b4492341.zip external_webkit-d7d12df62dd2e1bbf1aff207ab8edbd6b4492341.tar.gz external_webkit-d7d12df62dd2e1bbf1aff207ab8edbd6b4492341.tar.bz2 | |
Implement V8 bindings for DOM Storage.
Diffstat (limited to 'V8Binding/binding')
| -rw-r--r-- | V8Binding/binding/DOMObjectsInclude.h | 5 | ||||
| -rw-r--r-- | V8Binding/binding/NPV8Object.cpp | 2 | ||||
| -rw-r--r-- | V8Binding/binding/v8_custom.cpp | 247 | ||||
| -rw-r--r-- | V8Binding/binding/v8_custom.h | 600 | ||||
| -rw-r--r-- | V8Binding/binding/v8_index.cpp | 5 | ||||
| -rw-r--r-- | V8Binding/binding/v8_index.h | 9 | ||||
| -rw-r--r-- | V8Binding/binding/v8_proxy.cpp | 17 | ||||
| -rw-r--r-- | V8Binding/binding/v8_proxy.h | 7 |
8 files changed, 42 insertions, 850 deletions
diff --git a/V8Binding/binding/DOMObjectsInclude.h b/V8Binding/binding/DOMObjectsInclude.h index a79f03d..9db9b6d 100644 --- a/V8Binding/binding/DOMObjectsInclude.h +++ b/V8Binding/binding/DOMObjectsInclude.h @@ -127,6 +127,11 @@ #include "XPathNSResolver.h" #include "XPathResult.h" +#if ENABLE(DOM_STORAGE) +#include "Storage.h" +#include "StorageEvent.h" +#endif + #if ENABLE(SVG) #include "SVGAngle.h" #include "SVGAnimatedPoints.h" diff --git a/V8Binding/binding/NPV8Object.cpp b/V8Binding/binding/NPV8Object.cpp index e7ce792..3bd55d7 100644 --- a/V8Binding/binding/NPV8Object.cpp +++ b/V8Binding/binding/NPV8Object.cpp @@ -39,7 +39,7 @@ #include "npruntime_priv.h" #include "PlatformString.h" #include "ScriptController.h" -#include "v8_custom.h" +#include "V8CustomBinding.h" #include "v8_helpers.h" #include "V8NPUtils.h" #include "v8_proxy.h" diff --git a/V8Binding/binding/v8_custom.cpp b/V8Binding/binding/v8_custom.cpp deleted file mode 100644 index 2af9cbd..0000000 --- a/V8Binding/binding/v8_custom.cpp +++ /dev/null @@ -1,247 +0,0 @@ -/* - * Copyright (C) 2000 Harri Porten (porten@kde.org) - * Copyright (C) 2001 Peter Kelly (pmk@post.com) - * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. - * Copyright (C) 2006 James G. Speth (speth@end.com) - * Copyright (C) 2006 Samuel Weinig (sam@webkit.org) - * Copyright (C) 2007, 2008 Google Inc. All Rights Reserved. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "config.h" - -#include <Assertions.h> -#include <wtf/ASCIICType.h> - -#include "v8_proxy.h" -#include "v8_binding.h" -#include "V8NPObject.h" - -#include "V8CanvasGradient.h" -#include "V8CanvasPattern.h" -#include "V8CustomEventListener.h" -#include "V8Document.h" -#include "V8DOMWindow.h" -#include "V8HTMLCanvasElement.h" -#include "V8HTMLDocument.h" -#include "V8HTMLImageElement.h" -#include "V8NamedNodesCollection.h" -#include "V8Node.h" -#include "V8Proxy.h" -#if ENABLE(XPATH) -#include "V8XPathNSResolver.h" -#include "V8XPathResult.h" -#endif - -#include "Attr.h" -#include "Base64.h" -#include "CanvasGradient.h" -#include "CanvasPattern.h" -#include "CanvasRenderingContext2D.h" -#include "CanvasStyle.h" -#include "Clipboard.h" -#include "ClipboardEvent.h" -#include "Console.h" -#include "DOMParser.h" -#include "DOMStringList.h" -#include "DOMTimer.h" -#include "Document.h" -#include "DocumentFragment.h" -#include "Event.h" -#include "EventTarget.h" -#include "FloatRect.h" -#include "Frame.h" -#include "FrameLoader.h" -#include "FrameTree.h" -#include "HTMLBodyElement.h" -#include "HTMLCanvasElement.h" -#include "HTMLDocument.h" -#include "HTMLEmbedElement.h" -#include "HTMLImageElement.h" -#include "HTMLInputElement.h" -#include "HTMLNames.h" -#include "History.h" -#include "JSXPathNSResolver.h" -#include "KURL.h" -#include "Location.h" -#include "MessageChannel.h" -#include "MessagePort.h" -#include "MouseEvent.h" -#include "NodeIterator.h" -#include "NodeList.h" -#include "RGBColor.h" -#include "RenderPartObject.h" -#include "RenderWidget.h" -#include "ScheduledAction.h" -#include "ScriptState.h" -#include "ScriptController.h" -#include "ScriptSourceCode.h" -#include "SecurityOrigin.h" -#include "StyleSheetList.h" -#include "TreeWalker.h" -#include "WebKitCSSMatrix.h" -#include "WebKitPoint.h" -#include "XMLSerializer.h" -#include "XPathEvaluator.h" -#include "XPathResult.h" -#include "XSLTProcessor.h" - -#if ENABLE(SVG) -#include "V8SVGPODTypeWrapper.h" -#include "SVGElementInstance.h" -#include "SVGException.h" -#include "SVGPathSeg.h" -#endif - -#include "Navigator.h" - -namespace WebCore { - -CALLBACK_FUNC_DECL(WebKitPointConstructor) { - INC_STATS("DOM.WebKitPoint.Constructor"); - return V8Proxy::ConstructDOMObject<V8ClassIndex::WEBKITPOINT, - WebKitPoint>(args); -} - -// DOMImplementation is a singleton in WebCore. If we use our normal -// mapping from DOM objects to V8 wrappers, the same wrapper will be -// shared for all frames in the same process. This is a major -// security problem. Therefore, we generate a DOMImplementation -// wrapper per document and store it in an internal field of the -// document. Since the DOMImplementation object is a singleton, we do -// not have to do anything to keep the DOMImplementation object alive -// for the lifetime of the wrapper. -ACCESSOR_GETTER(DocumentImplementation) { - ASSERT(info.Holder()->InternalFieldCount() >= - kDocumentMinimumInternalFieldCount); - // Check if the internal field already contains a wrapper. - v8::Local<v8::Value> implementation = - info.Holder()->GetInternalField(kDocumentImplementationIndex); - if (!implementation->IsUndefined()) { - return implementation; - } - // Generate a wrapper. - Document* doc = V8Proxy::DOMWrapperToNative<Document>(info.Holder()); - v8::Handle<v8::Value> wrapper = - V8Proxy::DOMImplementationToV8Object(doc->implementation()); - // Store the wrapper in the internal field. - info.Holder()->SetInternalField(kDocumentImplementationIndex, wrapper); - - return wrapper; -} - -// --------------- Security Checks ------------------------- -INDEXED_ACCESS_CHECK(History) { - ASSERT(V8ClassIndex::FromInt(data->Int32Value()) == V8ClassIndex::HISTORY); - // Only allow same origin access - History* imp = - V8Proxy::ToNativeObject<History>(V8ClassIndex::HISTORY, host); - return V8Proxy::CanAccessFrame(imp->frame(), false); -} - - -NAMED_ACCESS_CHECK(History) { - ASSERT(V8ClassIndex::FromInt(data->Int32Value()) == V8ClassIndex::HISTORY); - // Only allow same origin access - History* imp = - V8Proxy::ToNativeObject<History>(V8ClassIndex::HISTORY, host); - return V8Proxy::CanAccessFrame(imp->frame(), false); -} - - - -#undef INDEXED_ACCESS_CHECK -#undef NAMED_ACCESS_CHECK -#undef NAMED_PROPERTY_GETTER -#undef NAMED_PROPERTY_SETTER - - -// static -Frame* V8Custom::GetTargetFrame(v8::Local<v8::Object> host, - v8::Local<v8::Value> data) { - Frame* target = 0; - switch (V8ClassIndex::FromInt(data->Int32Value())) { - case V8ClassIndex::DOMWINDOW: { - v8::Handle<v8::Value> window = - V8Proxy::LookupDOMWrapper(V8ClassIndex::DOMWINDOW, host); - if (window.IsEmpty()) - return target; - - DOMWindow* target_win = - V8Proxy::ToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, window); - target = target_win->frame(); - break; - } - case V8ClassIndex::LOCATION: { - History* imp = - V8Proxy::ToNativeObject<History>(V8ClassIndex::HISTORY, host); - target = imp->frame(); - break; - } - case V8ClassIndex::HISTORY: { - Location* imp = - V8Proxy::ToNativeObject<Location>(V8ClassIndex::LOCATION, host); - target = imp->frame(); - break; - } - default: - break; - } - return target; -} - -#if ENABLE(SVG) -V8ClassIndex::V8WrapperType V8Custom::DowncastSVGPathSeg(void* path_seg) { - WebCore::SVGPathSeg *real_path_seg = - reinterpret_cast<WebCore::SVGPathSeg*>(path_seg); - - switch (real_path_seg->pathSegType()) { -#define MAKE_CASE(svg_val, v8_val) \ - case WebCore::SVGPathSeg::svg_val: \ - return V8ClassIndex::v8_val; - -MAKE_CASE(PATHSEG_CLOSEPATH, SVGPATHSEGCLOSEPATH) -MAKE_CASE(PATHSEG_MOVETO_ABS, SVGPATHSEGMOVETOABS) -MAKE_CASE(PATHSEG_MOVETO_REL, SVGPATHSEGMOVETOREL) -MAKE_CASE(PATHSEG_LINETO_ABS, SVGPATHSEGLINETOABS) -MAKE_CASE(PATHSEG_LINETO_REL, SVGPATHSEGLINETOREL) -MAKE_CASE(PATHSEG_CURVETO_CUBIC_ABS, SVGPATHSEGCURVETOCUBICABS) -MAKE_CASE(PATHSEG_CURVETO_CUBIC_REL, SVGPATHSEGCURVETOCUBICREL) -MAKE_CASE(PATHSEG_CURVETO_QUADRATIC_ABS, SVGPATHSEGCURVETOQUADRATICABS) -MAKE_CASE(PATHSEG_CURVETO_QUADRATIC_REL, SVGPATHSEGCURVETOQUADRATICREL) -MAKE_CASE(PATHSEG_ARC_ABS, SVGPATHSEGARCABS) -MAKE_CASE(PATHSEG_ARC_REL, SVGPATHSEGARCREL) -MAKE_CASE(PATHSEG_LINETO_HORIZONTAL_ABS, SVGPATHSEGLINETOHORIZONTALABS) -MAKE_CASE(PATHSEG_LINETO_HORIZONTAL_REL, SVGPATHSEGLINETOHORIZONTALREL) -MAKE_CASE(PATHSEG_LINETO_VERTICAL_ABS, SVGPATHSEGLINETOVERTICALABS) -MAKE_CASE(PATHSEG_LINETO_VERTICAL_REL, SVGPATHSEGLINETOVERTICALREL) -MAKE_CASE(PATHSEG_CURVETO_CUBIC_SMOOTH_ABS, SVGPATHSEGCURVETOCUBICSMOOTHABS) -MAKE_CASE(PATHSEG_CURVETO_CUBIC_SMOOTH_REL, SVGPATHSEGCURVETOCUBICSMOOTHREL) -MAKE_CASE(PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS, \ - SVGPATHSEGCURVETOQUADRATICSMOOTHABS) -MAKE_CASE(PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL, \ - SVGPATHSEGCURVETOQUADRATICSMOOTHREL) - -#undef MAKE_CASE - - default: - return V8ClassIndex::INVALID_CLASS_INDEX; - } -} - -#endif // ENABLE(SVG) - -} // namespace WebCore diff --git a/V8Binding/binding/v8_custom.h b/V8Binding/binding/v8_custom.h deleted file mode 100644 index 3e8f52e..0000000 --- a/V8Binding/binding/v8_custom.h +++ /dev/null @@ -1,600 +0,0 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef V8_CUSTOM_H__ -#define V8_CUSTOM_H__ - -#include <v8.h> -#include "v8_index.h" - -struct NPObject; - -#define CALLBACK_FUNC_DECL(NAME) \ -v8::Handle<v8::Value> V8Custom::v8##NAME##Callback(const v8::Arguments& args) - -#define ACCESSOR_GETTER(NAME) \ -v8::Handle<v8::Value> V8Custom::v8##NAME##AccessorGetter(\ - v8::Local<v8::String> name, const v8::AccessorInfo& info) - -#define ACCESSOR_SETTER(NAME) \ -void V8Custom::v8##NAME##AccessorSetter(v8::Local<v8::String> name, \ - v8::Local<v8::Value> value, \ - const v8::AccessorInfo& info) - -#define INDEXED_PROPERTY_GETTER(NAME) \ -v8::Handle<v8::Value> V8Custom::v8##NAME##IndexedPropertyGetter(\ - uint32_t index, const v8::AccessorInfo& info) - -#define INDEXED_PROPERTY_SETTER(NAME) \ -v8::Handle<v8::Value> V8Custom::v8##NAME##IndexedPropertySetter(\ - uint32_t index, v8::Local<v8::Value> value, const v8::AccessorInfo& info) - -#define INDEXED_PROPERTY_DELETER(NAME) \ -v8::Handle<v8::Boolean> V8Custom::v8##NAME##IndexedPropertyDeleter(\ - uint32_t index, const v8::AccessorInfo& info) - -#define NAMED_PROPERTY_GETTER(NAME) \ - v8::Handle<v8::Value> V8Custom::v8##NAME##NamedPropertyGetter(\ - v8::Local<v8::String> name, const v8::AccessorInfo& info) - -#define NAMED_PROPERTY_SETTER(NAME) \ - v8::Handle<v8::Value> V8Custom::v8##NAME##NamedPropertySetter(\ - v8::Local<v8::String> name, v8::Local<v8::Value> value, \ - const v8::AccessorInfo& info) - -#define NAMED_PROPERTY_DELETER(NAME) \ - v8::Handle<v8::Boolean> V8Custom::v8##NAME##NamedPropertyDeleter(\ - v8::Local<v8::String> name, const v8::AccessorInfo& info) - -#define NAMED_ACCESS_CHECK(NAME) \ - bool V8Custom::v8##NAME##NamedSecurityCheck(v8::Local<v8::Object> host, \ - v8::Local<v8::Value> key, \ - v8::AccessType type, \ - v8::Local<v8::Value> data) - -#define INDEXED_ACCESS_CHECK(NAME) \ - bool V8Custom::v8##NAME##IndexedSecurityCheck(v8::Local<v8::Object> host, \ - uint32_t index, \ - v8::AccessType type, \ - v8::Local<v8::Value> data) - -namespace WebCore { - -class Frame; -class V8Proxy; -class String; -class HTMLCollection; -class DOMWindow; - -class V8Custom { - public: - - // Constants. - static const int kDOMWrapperTypeIndex = 0; - static const int kDOMWrapperObjectIndex = 1; - static const int kDefaultWrapperInternalFieldCount = 2; - - static const int kNPObjectInternalFieldCount = - kDefaultWrapperInternalFieldCount + 0; - - static const int kDocumentImplementationIndex = - kDefaultWrapperInternalFieldCount + 0; - static const int kDocumentMinimumInternalFieldCount = - kDefaultWrapperInternalFieldCount + 1; - - static const int kHTMLDocumentMarkerIndex = - kDocumentMinimumInternalFieldCount + 0; - static const int kHTMLDocumentShadowIndex = - kDocumentMinimumInternalFieldCount + 1; - static const int kHTMLDocumentInternalFieldCount = - kDocumentMinimumInternalFieldCount + 2; - - static const int kXMLHttpRequestCacheIndex = - kDefaultWrapperInternalFieldCount + 0; - static const int kXMLHttpRequestInternalFieldCount = - kDefaultWrapperInternalFieldCount + 1; - - static const int kMessageChannelPort1Index = - kDefaultWrapperInternalFieldCount + 0; - static const int kMessageChannelPort2Index = - kDefaultWrapperInternalFieldCount + 1; - static const int kMessageChannelInternalFieldCount = - kDefaultWrapperInternalFieldCount + 2; - - static const int kMessagePortRequestCacheIndex = - kDefaultWrapperInternalFieldCount + 0; - static const int kMessagePortEntangledPortIndex = - kDefaultWrapperInternalFieldCount + 1; - static const int kMessagePortInternalFieldCount = - kDefaultWrapperInternalFieldCount + 2; - -#if ENABLE(WORKERS) - static const int kWorkerRequestCacheIndex = - kDefaultWrapperInternalFieldCount + 0; - static const int kWorkerInternalFieldCount = - kDefaultWrapperInternalFieldCount + 1; - - static const int kWorkerContextRequestCacheIndex = - kDefaultWrapperInternalFieldCount + 0; - static const int kWorkerContextInternalFieldCount = - kDefaultWrapperInternalFieldCount + 1; -#endif - - static const int kDOMWindowConsoleIndex = - kDefaultWrapperInternalFieldCount + 0; - static const int kDOMWindowHistoryIndex = - kDefaultWrapperInternalFieldCount + 1; - static const int kDOMWindowLocationbarIndex = - kDefaultWrapperInternalFieldCount + 2; - static const int kDOMWindowMenubarIndex = - kDefaultWrapperInternalFieldCount + 3; - static const int kDOMWindowNavigatorIndex = - kDefaultWrapperInternalFieldCount + 4; - static const int kDOMWindowPersonalbarIndex = - kDefaultWrapperInternalFieldCount + 5; - static const int kDOMWindowScreenIndex = - kDefaultWrapperInternalFieldCount + 6; - static const int kDOMWindowScrollbarsIndex = - kDefaultWrapperInternalFieldCount + 7; - static const int kDOMWindowSelectionIndex = - kDefaultWrapperInternalFieldCount + 8; - static const int kDOMWindowStatusbarIndex = - kDefaultWrapperInternalFieldCount + 9; - static const int kDOMWindowToolbarIndex = - kDefaultWrapperInternalFieldCount + 10; - static const int kDOMWindowLocationIndex = - kDefaultWrapperInternalFieldCount + 11; - static const int kDOMWindowDOMSelectionIndex = - kDefaultWrapperInternalFieldCount + 12; - static const int kDOMWindowInternalFieldCount = - kDefaultWrapperInternalFieldCount + 13; - - static const int kStyleSheetOwnerNodeIndex = - kDefaultWrapperInternalFieldCount + 0; - static const int kStyleSheetInternalFieldCount = - kDefaultWrapperInternalFieldCount + 1; - -#if ENABLE(OFFLINE_WEB_APPLICATIONS) - static const int kDOMApplicationCacheCacheIndex = - kDefaultWrapperInternalFieldCount + 0; - static const int kDOMApplicationCacheFieldCount = - kDefaultWrapperInternalFieldCount + 1; -#endif - -#define DECLARE_PROPERTY_ACCESSOR_GETTER(NAME) \ -static v8::Handle<v8::Value> v8##NAME##AccessorGetter(\ - v8::Local<v8::String> name, const v8::AccessorInfo& info); - -#define DECLARE_PROPERTY_ACCESSOR_SETTER(NAME) \ -static void v8##NAME##AccessorSetter(v8::Local<v8::String> name, \ - v8::Local<v8::Value> value, \ - const v8::AccessorInfo& info); - -#define DECLARE_PROPERTY_ACCESSOR(NAME) \ - DECLARE_PROPERTY_ACCESSOR_GETTER(NAME) \ - DECLARE_PROPERTY_ACCESSOR_SETTER(NAME) - - -#define DECLARE_NAMED_PROPERTY_GETTER(NAME) \ -static v8::Handle<v8::Value> v8##NAME##NamedPropertyGetter(\ - v8::Local<v8::String> name, const v8::AccessorInfo& info); - -#define DECLARE_NAMED_PROPERTY_SETTER(NAME) \ -static v8::Handle<v8::Value> v8##NAME##NamedPropertySetter(\ - v8::Local<v8::String> name, \ - v8::Local<v8::Value> value, \ - const v8::AccessorInfo& info); - -#define DECLARE_NAMED_PROPERTY_DELETER(NAME) \ -static v8::Handle<v8::Boolean> v8##NAME##NamedPropertyDeleter(\ - v8::Local<v8::String> name, const v8::AccessorInfo& info); - -#define USE_NAMED_PROPERTY_GETTER(NAME) \ - V8Custom::v8##NAME##NamedPropertyGetter - -#define USE_NAMED_PROPERTY_SETTER(NAME) \ - V8Custom::v8##NAME##NamedPropertySetter - -#define USE_NAMED_PROPERTY_DELETER(NAME) \ - V8Custom::v8##NAME##NamedPropertyDeleter - -#define DECLARE_INDEXED_PROPERTY_GETTER(NAME) \ -static v8::Handle<v8::Value> v8##NAME##IndexedPropertyGetter(\ - uint32_t index, const v8::AccessorInfo& info); - -#define DECLARE_INDEXED_PROPERTY_SETTER(NAME) \ -static v8::Handle<v8::Value> v8##NAME##IndexedPropertySetter(\ - uint32_t index, v8::Local<v8::Value> value, const v8::AccessorInfo& info); - -#define DECLARE_INDEXED_PROPERTY_DELETER(NAME) \ -static v8::Handle<v8::Boolean> v8##NAME##IndexedPropertyDeleter(\ - uint32_t index, const v8::AccessorInfo& info); - -#define USE_INDEXED_PROPERTY_GETTER(NAME) \ - V8Custom::v8##NAME##IndexedPropertyGetter - -#define USE_INDEXED_PROPERTY_SETTER(NAME) \ - V8Custom::v8##NAME##IndexedPropertySetter - -#define USE_INDEXED_PROPERTY_DELETER(NAME) \ - V8Custom::v8##NAME##IndexedPropertyDeleter - -#define DECLARE_CALLBACK(NAME) \ -static v8::Handle<v8::Value> v8##NAME##Callback(const v8::Arguments& args); - -#define USE_CALLBACK(NAME) \ - V8Custom::v8##NAME##Callback - -#define DECLARE_NAMED_ACCESS_CHECK(NAME) \ -static bool v8##NAME##NamedSecurityCheck(v8::Local<v8::Object> host, \ - v8::Local<v8::Value> key, \ - v8::AccessType type, \ - v8::Local<v8::Value> data); - -#define DECLARE_INDEXED_ACCESS_CHECK(NAME) \ -static bool v8##NAME##IndexedSecurityCheck(v8::Local<v8::Object> host, \ - uint32_t index, \ - v8::AccessType type, \ - v8::Local<v8::Value> data); - -DECLARE_PROPERTY_ACCESSOR(CanvasRenderingContext2DStrokeStyle) -DECLARE_PROPERTY_ACCESSOR(CanvasRenderingContext2DFillStyle) -DECLARE_PROPERTY_ACCESSOR_GETTER(DOMWindowEvent) -DECLARE_PROPERTY_ACCESSOR_GETTER(DOMWindowCrypto) -// Customized getter&setter of DOMWindow.location -DECLARE_PROPERTY_ACCESSOR_SETTER(DOMWindowLocation) -// Customized setter of DOMWindow.opener -DECLARE_PROPERTY_ACCESSOR_SETTER(DOMWindowOpener) - -DECLARE_PROPERTY_ACCESSOR(DocumentLocation) -DECLARE_PROPERTY_ACCESSOR(DocumentImplementation) -DECLARE_PROPERTY_ACCESSOR_GETTER(EventSrcElement) -DECLARE_PROPERTY_ACCESSOR(EventReturnValue) -DECLARE_PROPERTY_ACCESSOR_GETTER(EventDataTransfer) -DECLARE_PROPERTY_ACCESSOR_GETTER(EventClipboardData) - -// Getter/Setter for window event handlers -DECLARE_PROPERTY_ACCESSOR(DOMWindowEventHandler) -// Getter/Setter for Element event handlers -DECLARE_PROPERTY_ACCESSOR(ElementEventHandler) - -// HTMLCanvasElement -DECLARE_CALLBACK(HTMLCanvasElementGetContext) - -// Customized setter of src and location on HTMLFrameElement -DECLARE_PROPERTY_ACCESSOR_SETTER(HTMLFrameElementSrc) -DECLARE_PROPERTY_ACCESSOR_SETTER(HTMLFrameElementLocation) -// Customized setter of src on HTMLIFrameElement -DECLARE_PROPERTY_ACCESSOR_SETTER(HTMLIFrameElementSrc) -// Customized setter of Attr.value -DECLARE_PROPERTY_ACCESSOR_SETTER(AttrValue) - -// Customized setter of HTMLOptionsCollection length -DECLARE_PROPERTY_ACCESSOR(HTMLOptionsCollectionLength) - -DECLARE_CALLBACK(HTMLInputElementSetSelectionRange) - -// Customized accessors for HTMLInputElement -DECLARE_PROPERTY_ACCESSOR(HTMLInputElementSelectionStart) -DECLARE_PROPERTY_ACCESSOR(HTMLInputElementSelectionEnd) - -DECLARE_NAMED_ACCESS_CHECK(Location) -DECLARE_INDEXED_ACCESS_CHECK(History) - -DECLARE_NAMED_ACCESS_CHECK(History) -DECLARE_INDEXED_ACCESS_CHECK(Location) - -// HTMLCollection customized functions. -DECLARE_CALLBACK(HTMLCollectionItem) -DECLARE_CALLBACK(HTMLCollectionNamedItem) -// HTMLCollections are callable as functions. -DECLARE_CALLBACK(HTMLCollectionCallAsFunction) - -// HTMLSelectElement customized functions. -DECLARE_CALLBACK(HTMLSelectElementRemove) - -// HTMLOptionsCollection customized functions. -DECLARE_CALLBACK(HTMLOptionsCollectionRemove) -DECLARE_CALLBACK(HTMLOptionsCollectionAdd) - -// HTMLDocument customized functions -DECLARE_CALLBACK(HTMLDocumentWrite) -DECLARE_CALLBACK(HTMLDocumentWriteln) -DECLARE_CALLBACK(HTMLDocumentOpen) -DECLARE_PROPERTY_ACCESSOR(HTMLDocumentAll) -DECLARE_NAMED_PROPERTY_GETTER(HTMLDocument) -DECLARE_NAMED_PROPERTY_DELETER(HTMLDocument) - -// Document customized functions -DECLARE_CALLBACK(DocumentEvaluate) -DECLARE_CALLBACK(DocumentGetCSSCanvasContext) - -// Window customized functions -DECLARE_CALLBACK(DOMWindowAddEventListener) -DECLARE_CALLBACK(DOMWindowRemoveEventListener) -DECLARE_CALLBACK(DOMWindowPostMessage) -DECLARE_CALLBACK(DOMWindowSetTimeout) -DECLARE_CALLBACK(DOMWindowSetInterval) -DECLARE_CALLBACK(DOMWindowAtob) -DECLARE_CALLBACK(DOMWindowBtoa) -DECLARE_CALLBACK(DOMWindowNOP) -DECLARE_CALLBACK(DOMWindowToString) -DECLARE_CALLBACK(DOMWindowShowModalDialog) -DECLARE_CALLBACK(DOMWindowOpen) -DECLARE_CALLBACK(DOMWindowClearTimeout) -DECLARE_CALLBACK(DOMWindowClearInterval) - -DECLARE_CALLBACK(DOMParserConstructor) -DECLARE_CALLBACK(HTMLImageElementConstructor) -DECLARE_CALLBACK(HTMLOptionElementConstructor) -DECLARE_CALLBACK(MessageChannelConstructor) -DECLARE_CALLBACK(WebKitCSSMatrixConstructor) -DECLARE_CALLBACK(WebKitPointConstructor) -DECLARE_CALLBACK(XMLHttpRequestConstructor) -DECLARE_CALLBACK(XMLSerializerConstructor) -DECLARE_CALLBACK(XPathEvaluatorConstructor) -DECLARE_CALLBACK(XSLTProcessorConstructor) - -// Implementation of custom XSLTProcessor methods. -DECLARE_CALLBACK(XSLTProcessorImportStylesheet) -DECLARE_CALLBACK(XSLTProcessorTransformToFragment) -DECLARE_CALLBACK(XSLTProcessorTransformToDocument) -DECLARE_CALLBACK(XSLTProcessorSetParameter) -DECLARE_CALLBACK(XSLTProcessorGetParameter) -DECLARE_CALLBACK(XSLTProcessorRemoveParameter) - -// CSSPrimitiveValue customized functions -DECLARE_CALLBACK(CSSPrimitiveValueGetRGBColorValue) - -// Canvas 2D customized functions -DECLARE_CALLBACK(CanvasRenderingContext2DSetStrokeColor) -DECLARE_CALLBACK(CanvasRenderingContext2DSetFillColor) -DECLARE_CALLBACK(CanvasRenderingContext2DStrokeRect) -DECLARE_CALLBACK(CanvasRenderingContext2DSetShadow) -DECLARE_CALLBACK(CanvasRenderingContext2DDrawImage) -DECLARE_CALLBACK(CanvasRenderingContext2DDrawImageFromRect) -DECLARE_CALLBACK(CanvasRenderingContext2DCreatePattern) -DECLARE_CALLBACK(CanvasRenderingContext2DFillText) -DECLARE_CALLBACK(CanvasRenderingContext2DStrokeText) -DECLARE_CALLBACK(CanvasRenderingContext2DPutImageData) - -// Implementation of Clipboard attributes and methods. -DECLARE_PROPERTY_ACCESSOR_GETTER(ClipboardTypes) -DECLARE_CALLBACK(ClipboardClearData) -DECLARE_CALLBACK(ClipboardGetData) -DECLARE_CALLBACK(ClipboardSetData) -DECLARE_CALLBACK(ClipboardSetDragImage); - -// Implementation of Element methods. -DECLARE_CALLBACK(ElementQuerySelector) -DECLARE_CALLBACK(ElementQuerySelectorAll) -DECLARE_CALLBACK(ElementSetAttribute) -DECLARE_CALLBACK(ElementSetAttributeNode) -DECLARE_CALLBACK(ElementSetAttributeNS) -DECLARE_CALLBACK(ElementSetAttributeNodeNS) - -// Implementation of custom Location methods. -DECLARE_PROPERTY_ACCESSOR_SETTER(LocationProtocol) -DECLARE_PROPERTY_ACCESSOR_SETTER(LocationHost) -DECLARE_PROPERTY_ACCESSOR_SETTER(LocationHostname) -DECLARE_PROPERTY_ACCESSOR_SETTER(LocationPort) -DECLARE_PROPERTY_ACCESSOR_SETTER(LocationPathname) -DECLARE_PROPERTY_ACCESSOR_SETTER(LocationSearch) -DECLARE_PROPERTY_ACCESSOR_SETTER(LocationHash) -DECLARE_PROPERTY_ACCESSOR_SETTER(LocationHref) -DECLARE_PROPERTY_ACCESSOR_GETTER(LocationAssign) -DECLARE_PROPERTY_ACCESSOR_GETTER(LocationReplace) -DECLARE_PROPERTY_ACCESSOR_GETTER(LocationReload) -DECLARE_CALLBACK(LocationAssign) -DECLARE_CALLBACK(LocationReplace) -DECLARE_CALLBACK(LocationReload) -DECLARE_CALLBACK(LocationToString) -DECLARE_CALLBACK(LocationValueOf) - -// Implementation of custom Node methods. -DECLARE_CALLBACK(NodeAddEventListener) -DECLARE_CALLBACK(NodeRemoveEventListener) -DECLARE_CALLBACK(NodeInsertBefore) -DECLARE_CALLBACK(NodeReplaceChild) -DECLARE_CALLBACK(NodeRemoveChild) -DECLARE_CALLBACK(NodeAppendChild) - -// Custom implementation is Navigator properties. -// We actually only need this because WebKit has -// navigator.appVersion as custom. Our version just -// passes through. -DECLARE_PROPERTY_ACCESSOR(NavigatorAppVersion) - -// Custom implementation of XMLHttpRequest properties -DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestOnabort) -DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestOnerror) -DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestOnload) -DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestOnloadstart) -DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestOnprogress) -DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestOnreadystatechange) -DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestResponseText) -DECLARE_CALLBACK(XMLHttpRequestAddEventListener) -DECLARE_CALLBACK(XMLHttpRequestRemoveEventListener) -DECLARE_CALLBACK(XMLHttpRequestOpen) -DECLARE_CALLBACK(XMLHttpRequestSend) -DECLARE_CALLBACK(XMLHttpRequestSetRequestHeader) -DECLARE_CALLBACK(XMLHttpRequestGetResponseHeader) -DECLARE_CALLBACK(XMLHttpRequestOverrideMimeType) -DECLARE_CALLBACK(XMLHttpRequestDispatchEvent) - -// Custom implementation of XMLHttpRequestUpload properties -DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestUploadOnabort) -DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestUploadOnerror) -DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestUploadOnload) -DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestUploadOnloadstart) -DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestUploadOnprogress) -DECLARE_CALLBACK(XMLHttpRequestUploadAddEventListener) -DECLARE_CALLBACK(XMLHttpRequestUploadRemoveEventListener) -DECLARE_CALLBACK(XMLHttpRequestUploadDispatchEvent) - -// Custom implementation of TreeWalker functions -DECLARE_CALLBACK(TreeWalkerParentNode) -DECLARE_CALLBACK(TreeWalkerFirstChild) -DECLARE_CALLBACK(TreeWalkerLastChild) -DECLARE_CALLBACK(TreeWalkerNextNode) -DECLARE_CALLBACK(TreeWalkerPreviousNode) -DECLARE_CALLBACK(TreeWalkerNextSibling) -DECLARE_CALLBACK(TreeWalkerPreviousSibling) - -// Custom implementation of InspectorController functions -DECLARE_CALLBACK(InspectorControllerProfiles) -DECLARE_CALLBACK(InspectorControllerHighlightDOMNode) -DECLARE_CALLBACK(InspectorControllerAddResourceSourceToFrame) -DECLARE_CALLBACK(InspectorControllerGetResourceDocumentNode) -DECLARE_CALLBACK(InspectorControllerAddSourceToFrame) -DECLARE_CALLBACK(InspectorControllerSearch) -DECLARE_CALLBACK(InspectorControllerSetting) -DECLARE_CALLBACK(InspectorControllerInspectedWindow) -DECLARE_CALLBACK(InspectorControllerSetSetting) -DECLARE_CALLBACK(InspectorControllerCurrentCallFrame) -DECLARE_CALLBACK(InspectorControllerDebuggerEnabled) -DECLARE_CALLBACK(InspectorControllerPauseOnExceptions) -DECLARE_CALLBACK(InspectorControllerProfilerEnabled) -#if ENABLE(DATABASE) -DECLARE_CALLBACK(InspectorControllerDatabaseTableNames) -#endif -DECLARE_CALLBACK(InspectorControllerWrapCallback) - -// Custom implementation of NodeIterator functions -DECLARE_CALLBACK(NodeIteratorNextNode) -DECLARE_CALLBACK(NodeIteratorPreviousNode) - -// Custom implementation of NodeFilter function -DECLARE_CALLBACK(NodeFilterAcceptNode) - -// Custom implementation of HTMLFormElement -DECLARE_CALLBACK(HTMLFormElementSubmit) - -DECLARE_INDEXED_PROPERTY_GETTER(DOMStringList) -DECLARE_CALLBACK(DOMStringListItem) - -DECLARE_NAMED_PROPERTY_GETTER(DOMWindow) -DECLARE_INDEXED_PROPERTY_GETTER(DOMWindow) -DECLARE_NAMED_ACCESS_CHECK(DOMWindow) -DECLARE_INDEXED_ACCESS_CHECK(DOMWindow) - -DECLARE_NAMED_PROPERTY_GETTER(HTMLFrameSetElement) -DECLARE_NAMED_PROPERTY_GETTER(HTMLFormElement) -DECLARE_NAMED_PROPERTY_GETTER(NodeList) -DECLARE_NAMED_PROPERTY_GETTER(NamedNodeMap) -DECLARE_NAMED_PROPERTY_GETTER(CSSStyleDeclaration) -DECLARE_NAMED_PROPERTY_SETTER(CSSStyleDeclaration) -DECLARE_NAMED_PROPERTY_GETTER(HTMLPlugInElement) -DECLARE_NAMED_PROPERTY_SETTER(HTMLPlugInElement) -DECLARE_INDEXED_PROPERTY_GETTER(HTMLPlugInElement) -DECLARE_INDEXED_PROPERTY_SETTER(HTMLPlugInElement) - -// Plugin object can be called as function. -DECLARE_CALLBACK(HTMLPlugInElement) - -DECLARE_NAMED_PROPERTY_GETTER(StyleSheetList) -DECLARE_INDEXED_PROPERTY_GETTER(NamedNodeMap) -DECLARE_INDEXED_PROPERTY_GETTER(HTMLFormElement) -DECLARE_INDEXED_PROPERTY_GETTER(HTMLOptionsCollection) -DECLARE_INDEXED_PROPERTY_SETTER(HTMLOptionsCollection) -DECLARE_NAMED_PROPERTY_GETTER(HTMLSelectElementCollection) -DECLARE_INDEXED_PROPERTY_SETTER(HTMLSelectElementCollection) -DECLARE_NAMED_PROPERTY_GETTER(HTMLCollection) - -// Canvas and supporting classes -DECLARE_INDEXED_PROPERTY_GETTER(CanvasPixelArray) -DECLARE_INDEXED_PROPERTY_SETTER(CanvasPixelArray) - -// MessagePort -DECLARE_PROPERTY_ACCESSOR(MessagePortOnmessage) -DECLARE_PROPERTY_ACCESSOR(MessagePortOnclose) -DECLARE_CALLBACK(MessagePortStartConversation) -DECLARE_CALLBACK(MessagePortAddEventListener) -DECLARE_CALLBACK(MessagePortRemoveEventListener) - -// Database -DECLARE_CALLBACK(DatabaseChangeVersion) -DECLARE_CALLBACK(DatabaseTransaction) -DECLARE_CALLBACK(SQLTransactionExecuteSql) -DECLARE_CALLBACK(SQLResultSetRowListItem) - -// ClientRectList -DECLARE_INDEXED_PROPERTY_GETTER(ClientRectList) - -// SVG custom properties and callbacks -#if ENABLE(SVG) -DECLARE_PROPERTY_ACCESSOR_GETTER(SVGLengthValue) -DECLARE_CALLBACK(SVGLengthConvertToSpecifiedUnits) -DECLARE_CALLBACK(SVGMatrixInverse) -DECLARE_CALLBACK(SVGMatrixRotateFromVector) -DECLARE_CALLBACK(SVGElementInstanceAddEventListener) -DECLARE_CALLBACK(SVGElementInstanceRemoveEventListener) -#endif - -// Worker -#if ENABLE(WORKERS) -DECLARE_PROPERTY_ACCESSOR(WorkerOnmessage) -DECLARE_PROPERTY_ACCESSOR(WorkerOnerror) -DECLARE_CALLBACK(WorkerConstructor) -DECLARE_CALLBACK(WorkerAddEventListener) -DECLARE_CALLBACK(WorkerRemoveEventListener) - -DECLARE_PROPERTY_ACCESSOR_GETTER(WorkerContextSelf) -DECLARE_PROPERTY_ACCESSOR(WorkerContextOnmessage) -DECLARE_CALLBACK(WorkerContextImportScripts) -DECLARE_CALLBACK(WorkerContextSetTimeout) -DECLARE_CALLBACK(WorkerContextClearTimeout) -DECLARE_CALLBACK(WorkerContextSetInterval) -DECLARE_CALLBACK(WorkerContextClearInterval) -DECLARE_CALLBACK(WorkerContextAddEventListener) -DECLARE_CALLBACK(WorkerContextRemoveEventListener) -#endif - -// AppCache -#if ENABLE(OFFLINE_WEB_APPLICATIONS) -DECLARE_PROPERTY_ACCESSOR(DOMApplicationCacheEventHandler) -DECLARE_CALLBACK(DOMApplicationCacheAddEventListener) -DECLARE_CALLBACK(DOMApplicationCacheRemoveEventListener) -#endif - -#undef DECLARE_INDEXED_ACCESS_CHECK -#undef DECLARE_NAMED_ACCESS_CHECK - -#undef DECLARE_PROPERTY_ACCESSOR_SETTER -#undef DECLARE_PROPERTY_ACCESSOR_GETTER -#undef DECLARE_PROPERTY_ACCESSOR - -#undef DECLARE_NAMED_PROPERTY_GETTER -#undef DECLARE_NAMED_PROPERTY_SETTER -#undef DECLARE_NAMED_PROPERTY_DELETER - -#undef DECLARE_INDEXED_PROPERTY_GETTER -#undef DECLARE_INDEXED_PROPERTY_SETTER -#undef DECLARE_INDEXED_PROPERTY_DELETER - -#undef DECLARE_CALLBACK - - // Returns the NPObject corresponding to an HTMLElement object. - static NPObject* GetHTMLPlugInElementNPObject(v8::Handle<v8::Object> object); - - // Returns the owner frame pointer of a DOM wrapper object. It only works for - // these DOM objects requiring cross-domain access check. - static Frame* GetTargetFrame(v8::Local<v8::Object> host, - v8::Local<v8::Value> data); - - // Special case for downcasting SVG path segments -#if ENABLE(SVG) - static V8ClassIndex::V8WrapperType DowncastSVGPathSeg(void* path_seg); -#endif - - private: - static v8::Handle<v8::Value> WindowSetTimeoutImpl(const v8::Arguments& args, - bool single_shot); - static void ClearTimeoutImpl(const v8::Arguments& args); - static void WindowSetLocation(DOMWindow*, const String&); -}; - -} // namespace WebCore - -#endif // V8_CUSTOM_H__ diff --git a/V8Binding/binding/v8_index.cpp b/V8Binding/binding/v8_index.cpp index df138dc..e002dd3 100644 --- a/V8Binding/binding/v8_index.cpp +++ b/V8Binding/binding/v8_index.cpp @@ -202,6 +202,11 @@ #include "V8XMLSerializer.h" #include "V8RGBColor.h" +#if ENABLE(DOM_STORAGE) +#include "V8Storage.h" +#include "V8StorageEvent.h" +#endif + #if PLATFORM(CHROMIUM) #include "V8InspectorController.h" #endif diff --git a/V8Binding/binding/v8_index.h b/V8Binding/binding/v8_index.h index 71453c3..12efa0b 100644 --- a/V8Binding/binding/v8_index.h +++ b/V8Binding/binding/v8_index.h @@ -357,6 +357,14 @@ typedef v8::Persistent<v8::FunctionTemplate> (*FunctionTemplateFactory)(); #define DOM_OBJECT_DATABASE_TYPES(V) #endif +#if ENABLE(DOM_STORAGE) +#define DOM_OBJECT_STORAGE_TYPES(V) \ + V(STORAGE, Storage) \ + V(STORAGEEVENT, StorageEvent) +#else +#define DOM_OBJECT_STORAGE_TYPES(V) +#endif + #if PLATFORM(CHROMIUM) #define DOM_OBJECT_TYPES(V) \ DOM_OBJECT_TYPES_1(V) \ @@ -372,6 +380,7 @@ typedef v8::Persistent<v8::FunctionTemplate> (*FunctionTemplateFactory)(); DOM_OBJECT_TYPES_1(V) \ DOM_OBJECT_TYPES_2(V) \ DOM_OBJECT_DATABASE_TYPES(V) \ + DOM_OBJECT_STORAGE_TYPES(V) \ V(COORDINATES, Coordinates) \ V(GEOLOCATION, Geolocation) \ V(GEOPOSITION, Geoposition) \ diff --git a/V8Binding/binding/v8_proxy.cpp b/V8Binding/binding/v8_proxy.cpp index d3c5db9..c9e7058 100644 --- a/V8Binding/binding/v8_proxy.cpp +++ b/V8Binding/binding/v8_proxy.cpp @@ -41,7 +41,7 @@ #include "v8_proxy.h" #include "v8_index.h" #include "v8_binding.h" -#include "v8_custom.h" +#include "V8CustomBinding.h" #include "V8Collection.h" #include "V8DOMWindow.h" @@ -1468,6 +1468,21 @@ v8::Persistent<v8::FunctionTemplate> V8Proxy::GetTemplate( collectionIndexedPropertyEnumerator<NamedNodeMap>, v8::Integer::New(V8ClassIndex::NODE)); break; +#if ENABLE(DOM_STORAGE) + case V8ClassIndex::STORAGE: + desc->InstanceTemplate()->SetNamedPropertyHandler( + USE_NAMED_PROPERTY_GETTER(Storage), + USE_NAMED_PROPERTY_SETTER(Storage), + 0, + USE_NAMED_PROPERTY_DELETER(Storage), + V8Custom::v8StorageNamedPropertyEnumerator); + desc->InstanceTemplate()->SetIndexedPropertyHandler( + USE_INDEXED_PROPERTY_GETTER(Storage), + USE_INDEXED_PROPERTY_SETTER(Storage), + 0, + USE_INDEXED_PROPERTY_DELETER(Storage)); + break; +#endif case V8ClassIndex::NODELIST: setCollectionIndexedGetter<NodeList, Node>(desc, V8ClassIndex::NODE); desc->InstanceTemplate()->SetNamedPropertyHandler( diff --git a/V8Binding/binding/v8_proxy.h b/V8Binding/binding/v8_proxy.h index a9f871e..708f63d 100644 --- a/V8Binding/binding/v8_proxy.h +++ b/V8Binding/binding/v8_proxy.h @@ -7,7 +7,7 @@ #include <v8.h> #include "v8_index.h" -#include "v8_custom.h" +#include "V8CustomBinding.h" #include "V8Utilities.h" #include "Node.h" #include "NodeFilter.h" @@ -69,6 +69,11 @@ class CSSValueList; class NodeFilter; class ScriptExecutionContext; +#if ENABLE(DOM_STORAGE) +class Storage; +class StorageEvent; +#endif + #if ENABLE(SVG) class SVGElementInstance; #endif |
