diff options
-rw-r--r-- | DEPS | 2 | ||||
-rw-r--r-- | webkit/build/KJSBindings/KJSBindings.vcproj | 16 | ||||
-rw-r--r-- | webkit/build/V8Bindings/V8Bindings.vcproj | 8 | ||||
-rw-r--r-- | webkit/build/port/port.vcproj | 4 | ||||
-rw-r--r-- | webkit/pending/ExceptionContext.h | 29 | ||||
-rw-r--r-- | webkit/pending/NodeFilter.cpp | 3 | ||||
-rw-r--r-- | webkit/pending/NodeIterator.cpp | 6 | ||||
-rw-r--r-- | webkit/pending/TreeWalker.cpp | 42 | ||||
-rw-r--r-- | webkit/pending/TreeWalker.h | 14 | ||||
-rw-r--r-- | webkit/port/bridge/ExceptionContextV8.cpp | 24 |
10 files changed, 112 insertions, 36 deletions
@@ -12,7 +12,7 @@ deps = { "http://googletest.googlecode.com/svn/trunk@63", "src/third_party/WebKit": - "/trunk/deps/third_party/WebKit@3170", + "/trunk/deps/third_party/WebKit@3216", "src/third_party/cygwin": "/trunk/deps/third_party/cygwin@3248", diff --git a/webkit/build/KJSBindings/KJSBindings.vcproj b/webkit/build/KJSBindings/KJSBindings.vcproj index c1f5a21..2d72867 100644 --- a/webkit/build/KJSBindings/KJSBindings.vcproj +++ b/webkit/build/KJSBindings/KJSBindings.vcproj @@ -1922,6 +1922,22 @@ > </File> <File + RelativePath="..\..\..\third_party\WebKit\WebCore\bindings\js\ExceptionContext.cpp" + > + </File> + <File + RelativePath="..\..\pending\ExceptionContext.h" + > + </File> + <File + RelativePath="..\..\..\third_party\WebKit\WebCore\bindings\js\ExceptionContext.cpp" + > + </File> + <File + RelativePath="..\..\pending\ExceptionContext.h" + > + </File> + <File RelativePath="..\..\..\third_party\WebKit\WebCore\bindings\js\ScriptControllerWin.cpp" > </File> diff --git a/webkit/build/V8Bindings/V8Bindings.vcproj b/webkit/build/V8Bindings/V8Bindings.vcproj index 4e660d4..ad604a2 100644 --- a/webkit/build/V8Bindings/V8Bindings.vcproj +++ b/webkit/build/V8Bindings/V8Bindings.vcproj @@ -2393,6 +2393,14 @@ > </File> <File + RelativePath="..\..\pending\ExceptionContext.h" + > + </File> + <File + RelativePath="..\..\pending\ExceptionContext.h" + > + </File> + <File RelativePath="..\..\port\bridge\ExceptionContextV8.cpp" > </File> diff --git a/webkit/build/port/port.vcproj b/webkit/build/port/port.vcproj index 9f0805b..4aa94d7 100644 --- a/webkit/build/port/port.vcproj +++ b/webkit/build/port/port.vcproj @@ -1208,10 +1208,6 @@ Name="bridge" > <File - RelativePath="..\..\pending\ExceptionContext.h" - > - </File> - <File RelativePath="..\..\port\bridge\FrameWin.cpp" > </File> diff --git a/webkit/pending/ExceptionContext.h b/webkit/pending/ExceptionContext.h index 7b6c1b4..529b8f3 100644 --- a/webkit/pending/ExceptionContext.h +++ b/webkit/pending/ExceptionContext.h @@ -35,6 +35,13 @@ #include <wtf/Noncopyable.h> #include "ScriptController.h" +#if USE(JSC) +namespace KJS { +class ExecState; +} +#endif + + namespace WebCore { class Node; @@ -47,26 +54,30 @@ class ExceptionCatcher; // by the ExceptionCatcher. class ExceptionContext : Noncopyable { public: + ExceptionContext(Node*); +#if USE(V8) ExceptionContext(); - ~ExceptionContext(); +#elif USE(JSC) + ExceptionContext(KJS::ExecState* exec) : m_exec(exec) {} + KJS::ExecState* exec() const { return m_exec; } +#endif + ~ExceptionContext() {} bool hadException(); - JSException exception() const { return m_exception; } - - static ExceptionContext* createFromNode(Node*); + JSException exception() const; // Returns a non-exception code object. - static JSException NoException(); + static JSException noException(); private: - void setException(JSException exception) { m_exception = exception; } - - JSException m_exception; - #if USE(V8) friend class ExceptionCatcher; + void setException(JSException exception) { m_exception = exception; } void setExceptionCatcher(ExceptionCatcher*); + JSException m_exception; ExceptionCatcher* m_exceptionCatcher; +#elif USE(JSC) + KJS::ExecState* m_exec; #endif }; diff --git a/webkit/pending/NodeFilter.cpp b/webkit/pending/NodeFilter.cpp index 08ffe86..7e0fb50 100644 --- a/webkit/pending/NodeFilter.cpp +++ b/webkit/pending/NodeFilter.cpp @@ -38,7 +38,8 @@ short NodeFilter::acceptNode(ExceptionContext* exec, Node* node) const short NodeFilter::acceptNode(Node* node) const { - return acceptNode(ExceptionContext::createFromNode(node), node); + ExceptionContext context(node); + return acceptNode(&context, node); } } // namespace WebCore diff --git a/webkit/pending/NodeIterator.cpp b/webkit/pending/NodeIterator.cpp index 2d9a7fe3..ede32d0 100644 --- a/webkit/pending/NodeIterator.cpp +++ b/webkit/pending/NodeIterator.cpp @@ -226,12 +226,14 @@ void NodeIterator::updateForNodeRemoval(Node* removedNode, NodePointer& referenc PassRefPtr<Node> NodeIterator::nextNode(ExceptionCode& ec) { - return nextNode(ExceptionContext::createFromNode(referenceNode()), ec); + ExceptionContext context(referenceNode()); + return nextNode(&context, ec); } PassRefPtr<Node> NodeIterator::previousNode(ExceptionCode& ec) { - return previousNode(ExceptionContext::createFromNode(referenceNode()), ec); + ExceptionContext context(referenceNode()); + return previousNode(&context, ec); } } // namespace WebCore diff --git a/webkit/pending/TreeWalker.cpp b/webkit/pending/TreeWalker.cpp index 716c167..32e4a37 100644 --- a/webkit/pending/TreeWalker.cpp +++ b/webkit/pending/TreeWalker.cpp @@ -274,4 +274,46 @@ Children: return 0; } +Node* TreeWalker::parentNode() +{ + ExceptionContext context(m_current.get()); + return parentNode(&context); +} + +Node* TreeWalker::firstChild() +{ + ExceptionContext context(m_current.get()); + return firstChild(&context); +} + +Node* TreeWalker::lastChild() +{ + ExceptionContext context(m_current.get()); + return lastChild(&context); +} + +Node* TreeWalker::previousSibling() +{ + ExceptionContext context(m_current.get()); + return previousSibling(&context); +} + +Node* TreeWalker::nextSibling() +{ + ExceptionContext context(m_current.get()); + return nextSibling(&context); +} + +Node* TreeWalker::previousNode() +{ + ExceptionContext context(m_current.get()); + return previousNode(&context); +} + +Node* TreeWalker::nextNode() +{ + ExceptionContext context(m_current.get()); + return nextNode(&context); +} + } // namespace WebCore diff --git a/webkit/pending/TreeWalker.h b/webkit/pending/TreeWalker.h index 89ee977..5cc5f25 100644 --- a/webkit/pending/TreeWalker.h +++ b/webkit/pending/TreeWalker.h @@ -54,13 +54,13 @@ namespace WebCore { Node* nextNode(ExceptionContext*); // For non-JS bindings. Silently ignores the JavaScript exception if any. - Node* parentNode() { return parentNode(ExceptionContext::createFromNode(m_current.get())); } - Node* firstChild() { return firstChild(ExceptionContext::createFromNode(m_current.get())); } - Node* lastChild() { return lastChild(ExceptionContext::createFromNode(m_current.get())); } - Node* previousSibling() { return previousSibling(ExceptionContext::createFromNode(m_current.get())); } - Node* nextSibling() { return nextSibling(ExceptionContext::createFromNode(m_current.get())); } - Node* previousNode() { return previousNode(ExceptionContext::createFromNode(m_current.get())); } - Node* nextNode() { return nextNode(ExceptionContext::createFromNode(m_current.get())); } + Node* parentNode(); + Node* firstChild(); + Node* lastChild(); + Node* previousSibling(); + Node* nextSibling(); + Node* previousNode(); + Node* nextNode(); private: TreeWalker(PassRefPtr<Node>, unsigned whatToShow, PassRefPtr<NodeFilter>, bool expandEntityReferences); diff --git a/webkit/port/bridge/ExceptionContextV8.cpp b/webkit/port/bridge/ExceptionContextV8.cpp index 7301522..9b14d76 100644 --- a/webkit/port/bridge/ExceptionContextV8.cpp +++ b/webkit/port/bridge/ExceptionContextV8.cpp @@ -34,13 +34,17 @@ namespace WebCore { -ExceptionContext::ExceptionContext() - : m_exception() - , m_exceptionCatcher(0) +// Unlike JSC, which stores exceptions in ExecState that is accessible from +// ScriptController that is retrievable from Node*, V8 uses static chain of +// handlers (encapsulated as v8::TryCatch and here as ExceptionCatcher) +// to track exceptions, so it has no need for Node*. +ExceptionContext::ExceptionContext(Node* node) { } -ExceptionContext::~ExceptionContext() +ExceptionContext::ExceptionContext() + : m_exception() + , m_exceptionCatcher(0) { } @@ -60,16 +64,12 @@ bool ExceptionContext::hadException() return !m_exception.IsEmpty(); } -ExceptionContext* ExceptionContext::createFromNode(Node*) +JSException ExceptionContext::exception() const { - // Unlike JSC, which stores exceptions in ExecState that is accessible from - // ScriptController that is retrievable from Node*, V8 uses static chain of - // handlers (encapsulated as v8::TryCatch and here as ExceptionCatcher) - // to track exceptions, so it has no need for Node*. - return new ExceptionContext(); + return m_exception; } -JSException ExceptionContext::NoException() +JSException ExceptionContext::noException() { return v8::Local<v8::Value>(); } @@ -93,7 +93,7 @@ void ExceptionCatcher::updateContext() if (m_catcher.HasCaught()) m_context->setException(m_catcher.Exception()); else - m_context->setException(ExceptionContext::NoException()); + m_context->setException(ExceptionContext::noException()); } ExceptionCatcher::~ExceptionCatcher() |