diff options
Diffstat (limited to 'WebCore/bindings/v8/custom')
-rw-r--r-- | WebCore/bindings/v8/custom/V8AttrCustom.cpp | 58 | ||||
-rw-r--r-- | WebCore/bindings/v8/custom/V8EventCustom.cpp | 5 | ||||
-rw-r--r-- | WebCore/bindings/v8/custom/V8NamedNodeMapCustom.cpp | 42 | ||||
-rw-r--r-- | WebCore/bindings/v8/custom/V8NamedNodesCollection.cpp | 2 | ||||
-rw-r--r-- | WebCore/bindings/v8/custom/V8NodeCustom.cpp | 63 |
5 files changed, 6 insertions, 164 deletions
diff --git a/WebCore/bindings/v8/custom/V8AttrCustom.cpp b/WebCore/bindings/v8/custom/V8AttrCustom.cpp deleted file mode 100644 index 0da4ae4..0000000 --- a/WebCore/bindings/v8/custom/V8AttrCustom.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (C) 2007-2009 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "V8Attr.h" - -#include "Attr.h" -#include "Element.h" -#include "ExceptionCode.h" -#include "V8Binding.h" -#include "V8BindingState.h" -#include "V8Proxy.h" - -namespace WebCore { - -void V8Attr::valueAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) -{ - Attr* imp = V8Attr::toNative(info.Holder()); - String attrValue = toWebCoreStringWithNullCheck(value); - Element* ownerElement = imp->ownerElement(); - - if (ownerElement && !V8BindingSecurity::allowSettingSrcToJavascriptURL(V8BindingState::Only(), ownerElement, imp->name(), attrValue)) - return; - - ExceptionCode ec = 0; - imp->setValue(attrValue, ec); - if (ec) - throwError(ec); -} - -} // namespace WebCore diff --git a/WebCore/bindings/v8/custom/V8EventCustom.cpp b/WebCore/bindings/v8/custom/V8EventCustom.cpp index 8a1a339..bce1561 100644 --- a/WebCore/bindings/v8/custom/V8EventCustom.cpp +++ b/WebCore/bindings/v8/custom/V8EventCustom.cpp @@ -40,6 +40,7 @@ #include "V8Clipboard.h" #include "V8CompositionEvent.h" #include "V8CustomEvent.h" +#include "V8DeviceOrientationEvent.h" #include "V8ErrorEvent.h" #include "V8IDBErrorEvent.h" #include "V8IDBSuccessEvent.h" @@ -153,6 +154,10 @@ v8::Handle<v8::Value> toV8(Event* impl) #endif if (impl->isBeforeLoadEvent()) return toV8(static_cast<BeforeLoadEvent*>(impl)); +#if ENABLE(DEVICE_ORIENTATION) + if (impl->isDeviceOrientationEvent()) + return toV8(static_cast<DeviceOrientationEvent*>(impl)); +#endif if (impl->isCustomEvent()) return toV8(static_cast<CustomEvent*>(impl)); return V8Event::wrap(impl); diff --git a/WebCore/bindings/v8/custom/V8NamedNodeMapCustom.cpp b/WebCore/bindings/v8/custom/V8NamedNodeMapCustom.cpp index 4e1dd21..d9e1de0 100644 --- a/WebCore/bindings/v8/custom/V8NamedNodeMapCustom.cpp +++ b/WebCore/bindings/v8/custom/V8NamedNodeMapCustom.cpp @@ -75,48 +75,6 @@ v8::Handle<v8::Value> V8NamedNodeMap::namedPropertyGetter(v8::Local<v8::String> return toV8(result.release()); } -v8::Handle<v8::Value> V8NamedNodeMap::setNamedItemNSCallback(const v8::Arguments& args) -{ - INC_STATS("DOM.NamedNodeMap.setNamedItemNS"); - NamedNodeMap* imp = V8NamedNodeMap::toNative(args.Holder()); - Node* newNode = V8Node::HasInstance(args[0]) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0; - - if (newNode && newNode->nodeType() == Node::ATTRIBUTE_NODE && imp->element()) { - if (!V8BindingSecurity::allowSettingSrcToJavascriptURL(V8BindingState::Only(), imp->element(), newNode->nodeName(), newNode->nodeValue())) - return v8::Handle<v8::Value>(); - } - - ExceptionCode ec = 0; - RefPtr<Node> result = imp->setNamedItemNS(newNode, ec); - if (UNLIKELY(ec)) { - throwError(ec); - return v8::Handle<v8::Value>(); - } - - return toV8(result.release()); -} - -v8::Handle<v8::Value> V8NamedNodeMap::setNamedItemCallback(const v8::Arguments & args) -{ - INC_STATS("DOM.NamedNodeMap.setNamedItem"); - NamedNodeMap* imp = V8NamedNodeMap::toNative(args.Holder()); - Node* newNode = V8Node::HasInstance(args[0]) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0; - - if (newNode && newNode->nodeType() == Node::ATTRIBUTE_NODE && imp->element()) { - if (!V8BindingSecurity::allowSettingSrcToJavascriptURL(V8BindingState::Only(), imp->element(), newNode->nodeName(), newNode->nodeValue())) - return v8::Handle<v8::Value>(); - } - - ExceptionCode ec = 0; - RefPtr<Node> result = imp->setNamedItem(newNode, ec); - if (UNLIKELY(ec)) { - throwError(ec); - return v8::Handle<v8::Value>(); - } - - return toV8(result.release()); -} - v8::Handle<v8::Value> toV8(NamedNodeMap* impl) { if (!impl) diff --git a/WebCore/bindings/v8/custom/V8NamedNodesCollection.cpp b/WebCore/bindings/v8/custom/V8NamedNodesCollection.cpp index 0723498..905b23d 100644 --- a/WebCore/bindings/v8/custom/V8NamedNodesCollection.cpp +++ b/WebCore/bindings/v8/custom/V8NamedNodesCollection.cpp @@ -31,7 +31,7 @@ #include "V8NamedNodesCollection.h" #include "Element.h" -#include "NamedAttrMap.h" +#include "NamedNodeMap.h" namespace WebCore { diff --git a/WebCore/bindings/v8/custom/V8NodeCustom.cpp b/WebCore/bindings/v8/custom/V8NodeCustom.cpp index 0a7198a..1f0c79b 100644 --- a/WebCore/bindings/v8/custom/V8NodeCustom.cpp +++ b/WebCore/bindings/v8/custom/V8NodeCustom.cpp @@ -57,57 +57,12 @@ namespace WebCore { -static inline bool isFrameSrc(Element *element, const String& name) -{ - return element && (element->hasTagName(HTMLNames::iframeTag) || element->hasTagName(HTMLNames::frameTag)) && equalIgnoringCase(name, "src"); -} - -void V8Node::textContentAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) -{ - Node* imp = V8Node::toNative(info.Holder()); - String nodeValue = toWebCoreStringWithNullCheck(value); - - if (imp->nodeType() == Node::ATTRIBUTE_NODE) { - Element * ownerElement = V8Attr::toNative(info.Holder())->ownerElement(); - if (ownerElement && !V8BindingSecurity::allowSettingSrcToJavascriptURL(V8BindingState::Only(), ownerElement, imp->nodeName(), nodeValue)) - return; - } - - ExceptionCode ec = 0; - imp->setTextContent(nodeValue, ec); - if (ec) - throwError(ec); -} - -void V8Node::nodeValueAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) -{ - Node* imp = V8Node::toNative(info.Holder()); - String nodeValue = toWebCoreStringWithNullCheck(value); - - if (imp->nodeType() == Node::ATTRIBUTE_NODE) { - Element * ownerElement = V8Attr::toNative(info.Holder())->ownerElement(); - if (ownerElement && !V8BindingSecurity::allowSettingSrcToJavascriptURL(V8BindingState::Only(), ownerElement, imp->nodeName(), nodeValue)) - return; - } - - ExceptionCode ec = 0; - imp->setNodeValue(nodeValue, ec); - if (ec) - throwError(ec); -} - // This function is customized to take advantage of the optional 4th argument: shouldLazyAttach v8::Handle<v8::Value> V8Node::insertBeforeCallback(const v8::Arguments& args) { INC_STATS("DOM.Node.insertBefore"); v8::Handle<v8::Object> holder = args.Holder(); Node* imp = V8Node::toNative(holder); - - if (imp->nodeType() == Node::ATTRIBUTE_NODE && isFrameSrc(V8Attr::toNative(holder)->ownerElement(), imp->nodeName())) { - V8Proxy::setDOMException(NOT_SUPPORTED_ERR); - return v8::Handle<v8::Value>(); - } - ExceptionCode ec = 0; Node* newChild = V8Node::HasInstance(args[0]) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0; Node* refChild = V8Node::HasInstance(args[1]) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0; @@ -127,12 +82,6 @@ v8::Handle<v8::Value> V8Node::replaceChildCallback(const v8::Arguments& args) INC_STATS("DOM.Node.replaceChild"); v8::Handle<v8::Object> holder = args.Holder(); Node* imp = V8Node::toNative(holder); - - if (imp->nodeType() == Node::ATTRIBUTE_NODE && isFrameSrc(V8Attr::toNative(holder)->ownerElement(), imp->nodeName())) { - V8Proxy::setDOMException(NOT_SUPPORTED_ERR); - return v8::Handle<v8::Value>(); - } - ExceptionCode ec = 0; Node* newChild = V8Node::HasInstance(args[0]) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0; Node* oldChild = V8Node::HasInstance(args[1]) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0; @@ -151,12 +100,6 @@ v8::Handle<v8::Value> V8Node::removeChildCallback(const v8::Arguments& args) INC_STATS("DOM.Node.removeChild"); v8::Handle<v8::Object> holder = args.Holder(); Node* imp = V8Node::toNative(holder); - - if (imp->nodeType() == Node::ATTRIBUTE_NODE && isFrameSrc(V8Attr::toNative(holder)->ownerElement(), imp->nodeName())) { - V8Proxy::setDOMException(NOT_SUPPORTED_ERR); - return v8::Handle<v8::Value>(); - } - ExceptionCode ec = 0; Node* oldChild = V8Node::HasInstance(args[0]) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0; bool success = imp->removeChild(oldChild, ec); @@ -175,12 +118,6 @@ v8::Handle<v8::Value> V8Node::appendChildCallback(const v8::Arguments& args) INC_STATS("DOM.Node.appendChild"); v8::Handle<v8::Object> holder = args.Holder(); Node* imp = V8Node::toNative(holder); - - if (imp->nodeType() == Node::ATTRIBUTE_NODE && isFrameSrc(V8Attr::toNative(holder)->ownerElement(), imp->nodeName())) { - V8Proxy::setDOMException(NOT_SUPPORTED_ERR); - return v8::Handle<v8::Value>(); - } - ExceptionCode ec = 0; Node* newChild = V8Node::HasInstance(args[0]) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0; bool success = imp->appendChild(newChild, ec, true ); |