summaryrefslogtreecommitdiffstats
path: root/webkit/pending
diff options
context:
space:
mode:
authordglazkov@google.com <dglazkov@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-13 18:12:00 +0000
committerdglazkov@google.com <dglazkov@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-13 18:12:00 +0000
commit628da89f7ff111bd9937ee93544866f5d076298a (patch)
treec9b6da7200f47ccdae800adda1d568c4a578a098 /webkit/pending
parent5a179bcc5dace716b7bf87622ac1cac960c2ad9b (diff)
downloadchromium_src-628da89f7ff111bd9937ee93544866f5d076298a.zip
chromium_src-628da89f7ff111bd9937ee93544866f5d076298a.tar.gz
chromium_src-628da89f7ff111bd9937ee93544866f5d076298a.tar.bz2
Second attempt at introducing cross-platform ExceptionContext in the midst of unforking.
This time I also made changes to files in pending, to temporarily keep them in sync until they are removed and avoid ambiguitiy due to include search path order. Review URL: http://codereview.chromium.org/7267 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3296 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/pending')
-rw-r--r--webkit/pending/ExceptionContext.h29
-rw-r--r--webkit/pending/NodeFilter.cpp3
-rw-r--r--webkit/pending/NodeIterator.cpp6
-rw-r--r--webkit/pending/TreeWalker.cpp42
-rw-r--r--webkit/pending/TreeWalker.h14
5 files changed, 75 insertions, 19 deletions
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);