Changeset 35054 in webkit
- Timestamp:
- Jul 7, 2008 8:19:30 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r35052 r35054 1 2008-07-07 Simon Fraser <simon.fraser@apple.com> 2 3 Reviewed by Darin. 4 5 Tests for https://bugs.webkit.org/show_bug.cgi?id=19933 6 nodeIterator with filter fails on documents not in a frame 7 8 * traversal/node-iterator-009-expected.txt: Added. 9 * traversal/node-iterator-009.html: Added. 10 * traversal/tree-walker-006-expected.txt: Added. 11 * traversal/tree-walker-006.html: Added. 12 1 13 2008-07-07 Adele Peterson <adele@apple.com> 2 14 -
trunk/WebCore/ChangeLog
r35052 r35054 1 2008-07-07 Simon Fraser <simon.fraser@apple.com> 2 3 Reviewed by Darin. 4 5 Fix for https://bugs.webkit.org/show_bug.cgi?id=19933 6 nodeIterator with filter fails on documents not in a frame 7 8 Tests: traversal/node-iterator-009.html 9 traversal/tree-walker-006.html 10 11 * bindings/js/JSNodeFilterCondition.cpp: 12 * bindings/js/JSNodeFilterCondition.h: 13 * bindings/js/JSNodeFilterCustom.cpp: 14 * bindings/js/JSNodeIteratorCustom.cpp: 15 * bindings/js/JSTreeWalkerCustom.cpp: 16 * bindings/objc/DOM.mm: 17 * dom/NodeFilter.cpp: 18 * dom/NodeFilter.h: 19 * dom/NodeFilterCondition.cpp: 20 * dom/NodeFilterCondition.h: 21 * dom/NodeIterator.cpp: 22 * dom/NodeIterator.h: 23 * dom/Traversal.cpp: 24 * dom/Traversal.h: 25 * dom/TreeWalker.cpp: 26 * dom/TreeWalker.h: 27 1 28 2008-07-07 Adele Peterson <adele@apple.com> 2 29 -
trunk/WebCore/bindings/js/JSNodeFilterCondition.cpp
r34947 r35054 21 21 #include "JSNodeFilterCondition.h" 22 22 23 #include "Document.h"24 #include "Frame.h"25 23 #include "JSNode.h" 26 24 #include "JSNodeFilter.h" 27 25 #include "NodeFilter.h" 28 #include "ScriptController.h"29 26 #include <kjs/JSLock.h> 30 27 … … 32 29 33 30 using namespace KJS; 34 35 // FIXME: Add takeException as a member of ExecState?36 static JSValue* takeException(ExecState* exec)37 {38 JSValue* exception = exec->exception();39 exec->clearException();40 return exception;41 }42 31 43 32 JSNodeFilterCondition::JSNodeFilterCondition(JSValue* filter) … … 52 41 } 53 42 54 short JSNodeFilterCondition::acceptNode( Node* filterNode, JSValue*& exception) const43 short JSNodeFilterCondition::acceptNode(KJS::ExecState* exec, Node* filterNode) const 55 44 { 56 // FIXME: It makes no sense for this to depend on the document being in a frame!57 Frame* frame = filterNode->document()->frame();58 if (!frame)59 return NodeFilter::FILTER_REJECT;60 61 45 JSLock lock(false); 62 46 … … 66 50 return NodeFilter::FILTER_ACCEPT; 67 51 68 ExecState* exec = frame->script()->globalObject()->globalExec(); 52 // The exec argument here should only be null if this was called from a 53 // non-JavaScript language, and this is a JavaScript filter, and the document 54 // in question is not associated with the frame. In that case, we're going to 55 // behave incorrectly, and just reject nodes instead of calling the filter function. 56 // To fix that we'd need to come up with a way to find a suitable JavaScript 57 // execution context for the filter function to run in. 58 if (!exec) 59 return NodeFilter::FILTER_REJECT; 60 69 61 ArgList args; 70 62 args.append(toJS(exec, filterNode)); 71 if (exec->hadException()) { 72 exception = takeException(exec); 63 if (exec->hadException()) 73 64 return NodeFilter::FILTER_REJECT; 74 } 65 75 66 JSValue* result = call(exec, m_filter, callType, callData, m_filter, args); 76 if (exec->hadException()) { 77 exception = takeException(exec); 67 if (exec->hadException()) 78 68 return NodeFilter::FILTER_REJECT; 79 } 69 80 70 int intResult = result->toInt32(exec); 81 if (exec->hadException()) { 82 exception = takeException(exec); 71 if (exec->hadException()) 83 72 return NodeFilter::FILTER_REJECT; 84 } 73 85 74 return intResult; 86 75 } -
trunk/WebCore/bindings/js/JSNodeFilterCondition.h
r34754 r35054 42 42 JSNodeFilterCondition(KJS::JSValue* filter); 43 43 44 virtual short acceptNode( Node*, KJS::JSValue*& exception) const;44 virtual short acceptNode(KJS::ExecState*, Node*) const; 45 45 virtual void mark(); 46 46 -
trunk/WebCore/bindings/js/JSNodeFilterCustom.cpp
r34754 r35054 44 44 JSValue* JSNodeFilter::acceptNode(ExecState* exec, const ArgList& args) 45 45 { 46 JSValue* exception = 0; 47 short result = impl()->acceptNode(toNode(args[0]), exception); 48 if (exception) 49 exec->setException(exception); 50 return jsNumber(exec, result); 46 return jsNumber(exec, impl()->acceptNode(exec, toNode(args[0]))); 51 47 } 52 48 -
trunk/WebCore/bindings/js/JSNodeIteratorCustom.cpp
r34587 r35054 41 41 { 42 42 ExceptionCode ec = 0; 43 JSValue* exception = 0; 44 RefPtr<Node> node = impl()->nextNode(ec, exception); 43 RefPtr<Node> node = impl()->nextNode(exec, ec); 45 44 if (ec) { 46 45 setDOMException(exec, ec); 47 46 return jsUndefined(); 48 47 } 49 if (exception) { 50 exec->setException(exception);48 49 if (exec->hadException()) 51 50 return jsUndefined(); 52 } 51 53 52 return toJS(exec, node.get()); 54 53 } … … 57 56 { 58 57 ExceptionCode ec = 0; 59 JSValue* exception = 0; 60 RefPtr<Node> node = impl()->previousNode(ec, exception); 58 RefPtr<Node> node = impl()->previousNode(exec, ec); 61 59 if (ec) { 62 60 setDOMException(exec, ec); 63 61 return jsUndefined(); 64 62 } 65 if (exception) { 66 exec->setException(exception);63 64 if (exec->hadException()) 67 65 return jsUndefined(); 68 } 66 69 67 return toJS(exec, node.get()); 70 68 } -
trunk/WebCore/bindings/js/JSTreeWalkerCustom.cpp
r34587 r35054 40 40 JSValue* JSTreeWalker::parentNode(ExecState* exec, const ArgList& args) 41 41 { 42 JSValue* exception = 0; 43 Node* node = impl()->parentNode(exception); 44 if (exception) { 45 exec->setException(exception); 42 Node* node = impl()->parentNode(exec); 43 if (exec->hadException()) 46 44 return jsUndefined(); 47 }48 45 return toJS(exec, node); 49 46 } … … 51 48 JSValue* JSTreeWalker::firstChild(ExecState* exec, const ArgList& args) 52 49 { 53 JSValue* exception = 0; 54 Node* node = impl()->firstChild(exception); 55 if (exception) { 56 exec->setException(exception); 50 Node* node = impl()->firstChild(exec); 51 if (exec->hadException()) 57 52 return jsUndefined(); 58 }59 53 return toJS(exec, node); 60 54 } … … 62 56 JSValue* JSTreeWalker::lastChild(ExecState* exec, const ArgList& args) 63 57 { 64 JSValue* exception = 0; 65 Node* node = impl()->lastChild(exception); 66 if (exception) { 67 exec->setException(exception); 58 Node* node = impl()->lastChild(exec); 59 if (exec->hadException()) 68 60 return jsUndefined(); 69 }70 61 return toJS(exec, node); 71 62 } … … 73 64 JSValue* JSTreeWalker::nextSibling(ExecState* exec, const ArgList& args) 74 65 { 75 JSValue* exception = 0; 76 Node* node = impl()->nextSibling(exception); 77 if (exception) { 78 exec->setException(exception); 66 Node* node = impl()->nextSibling(exec); 67 if (exec->hadException()) 79 68 return jsUndefined(); 80 }81 69 return toJS(exec, node); 82 70 } … … 84 72 JSValue* JSTreeWalker::previousSibling(ExecState* exec, const ArgList& args) 85 73 { 86 JSValue* exception = 0; 87 Node* node = impl()->previousSibling(exception); 88 if (exception) { 89 exec->setException(exception); 74 Node* node = impl()->previousSibling(exec); 75 if (exec->hadException()) 90 76 return jsUndefined(); 91 }92 77 return toJS(exec, node); 93 78 } … … 95 80 JSValue* JSTreeWalker::previousNode(ExecState* exec, const ArgList& args) 96 81 { 97 JSValue* exception = 0; 98 Node* node = impl()->previousNode(exception); 99 if (exception) { 100 exec->setException(exception); 82 Node* node = impl()->previousNode(exec); 83 if (exec->hadException()) 101 84 return jsUndefined(); 102 }103 85 return toJS(exec, node); 104 86 } … … 106 88 JSValue* JSTreeWalker::nextNode(ExecState* exec, const ArgList& args) 107 89 { 108 JSValue* exception = 0; 109 Node* node = impl()->nextNode(exception); 110 if (exception) { 111 exec->setException(exception); 90 Node* node = impl()->nextNode(exec); 91 if (exec->hadException()) 112 92 return jsUndefined(); 113 }114 93 return toJS(exec, node); 115 94 } -
trunk/WebCore/bindings/objc/DOM.mm
r34641 r35054 698 698 } 699 699 700 virtual short acceptNode( Node*, JSValue*& exception) const;700 virtual short acceptNode(ExecState*, Node*) const; 701 701 702 702 private: … … 709 709 }; 710 710 711 short ObjCNodeFilterCondition::acceptNode( Node* node, JSValue*&) const711 short ObjCNodeFilterCondition::acceptNode(ExecState*, Node* node) const 712 712 { 713 713 if (!node) -
trunk/WebCore/dom/NodeFilter.cpp
r30089 r35054 26 26 #include "NodeFilter.h" 27 27 28 #include "Document.h" 29 #include "Frame.h" 30 #include "Node.h" 31 #include "ScriptController.h" 32 28 33 using namespace KJS; 29 34 30 35 namespace WebCore { 31 36 32 short NodeFilter::acceptNode( Node* node, JSValue*& exception) const37 short NodeFilter::acceptNode(ExecState* exec, Node* node) const 33 38 { 34 39 // cast to short silences "enumeral and non-enumeral types in return" warning 35 return m_condition ? m_condition->acceptNode( node, exception) : static_cast<short>(FILTER_ACCEPT);40 return m_condition ? m_condition->acceptNode(exec, node) : static_cast<short>(FILTER_ACCEPT); 36 41 } 37 42 43 ExecState* NodeFilter::execStateFromNode(Node* node) 44 { 45 if (!node) 46 return 0; 47 Document* document = node->document(); 48 if (!document) 49 return 0; 50 Frame* frame = document->frame(); 51 if (!frame) 52 return 0; 53 54 if (!frame->script()->isEnabled()) 55 return 0; 56 57 return frame->script()->globalObject()->globalExec(); 58 } 59 60 38 61 } // namespace WebCore -
trunk/WebCore/dom/NodeFilter.h
r34641 r35054 71 71 } 72 72 73 short acceptNode( Node*, KJS::JSValue*& exception) const;73 short acceptNode(KJS::ExecState*, Node*) const; 74 74 void mark() { m_condition->mark(); }; 75 75 76 76 // For non-JS bindings. Silently ignores the JavaScript exception if any. 77 short acceptNode(Node* node) const { KJS::JSValue* exception; return acceptNode(node, exception); } 77 short acceptNode(Node* node) const { return acceptNode(execStateFromNode(node), node); } 78 79 public: 80 static KJS::ExecState* execStateFromNode(Node*); 78 81 79 82 private: 80 83 NodeFilter(PassRefPtr<NodeFilterCondition> condition) : m_condition(condition) { } 84 81 85 RefPtr<NodeFilterCondition> m_condition; 82 86 }; -
trunk/WebCore/dom/NodeFilterCondition.cpp
r30089 r35054 32 32 namespace WebCore { 33 33 34 short NodeFilterCondition::acceptNode( Node*, JSValue*&) const34 short NodeFilterCondition::acceptNode(ExecState*, Node*) const 35 35 { 36 36 return NodeFilter::FILTER_ACCEPT; -
trunk/WebCore/dom/NodeFilterCondition.h
r34432 r35054 29 29 30 30 namespace KJS { 31 class JSValue;31 class ExecState; 32 32 } 33 33 … … 39 39 public: 40 40 virtual ~NodeFilterCondition() { } 41 virtual short acceptNode( Node*, KJS::JSValue*& exception) const = 0;41 virtual short acceptNode(KJS::ExecState*, Node*) const = 0; 42 42 virtual void mark() { } 43 43 }; -
trunk/WebCore/dom/NodeIterator.cpp
r31303 r35054 26 26 #include "NodeIterator.h" 27 27 28 #include <kjs/ExecState.h> 28 29 #include "Document.h" 29 30 #include "ExceptionCode.h" … … 86 87 } 87 88 88 PassRefPtr<Node> NodeIterator::nextNode(Ex ceptionCode& ec, JSValue*& exception)89 PassRefPtr<Node> NodeIterator::nextNode(ExecState* exec, ExceptionCode& ec) 89 90 { 90 91 if (m_detached) { … … 100 101 // In other words, FILTER_REJECT does not pass over descendants 101 102 // of the rejected node. Hence, FILTER_REJECT is the same as FILTER_SKIP. 102 exception = 0;103 103 RefPtr<Node> provisionalResult = m_candidateNode.node; 104 bool nodeWasAccepted = acceptNode( provisionalResult.get(), exception) == NodeFilter::FILTER_ACCEPT;105 if (ex ception)104 bool nodeWasAccepted = acceptNode(exec, provisionalResult.get()) == NodeFilter::FILTER_ACCEPT; 105 if (exec && exec->hadException()) 106 106 break; 107 107 if (nodeWasAccepted) { … … 116 116 } 117 117 118 PassRefPtr<Node> NodeIterator::previousNode(Ex ceptionCode& ec, JSValue*& exception)118 PassRefPtr<Node> NodeIterator::previousNode(ExecState* exec, ExceptionCode& ec) 119 119 { 120 120 if (m_detached) { … … 130 130 // In other words, FILTER_REJECT does not pass over descendants 131 131 // of the rejected node. Hence, FILTER_REJECT is the same as FILTER_SKIP. 132 exception = 0;133 132 RefPtr<Node> provisionalResult = m_candidateNode.node; 134 bool nodeWasAccepted = acceptNode( provisionalResult.get(), exception) == NodeFilter::FILTER_ACCEPT;135 if (ex ception)133 bool nodeWasAccepted = acceptNode(exec, provisionalResult.get()) == NodeFilter::FILTER_ACCEPT; 134 if (exec && exec->hadException()) 136 135 break; 137 136 if (nodeWasAccepted) { … … 228 227 } 229 228 229 230 230 } // namespace WebCore -
trunk/WebCore/dom/NodeIterator.h
r34754 r35054 26 26 #define NodeIterator_h 27 27 28 #include "NodeFilter.h" 28 29 #include "Traversal.h" 29 30 #include <wtf/PassRefPtr.h> … … 42 43 ~NodeIterator(); 43 44 44 PassRefPtr<Node> nextNode( ExceptionCode&, KJS::JSValue*& exception);45 PassRefPtr<Node> previousNode( ExceptionCode&, KJS::JSValue*& exception);45 PassRefPtr<Node> nextNode(KJS::ExecState*, ExceptionCode&); 46 PassRefPtr<Node> previousNode(KJS::ExecState*, ExceptionCode&); 46 47 void detach(); 47 48 … … 53 54 54 55 // For non-JS bindings. Silently ignores the JavaScript exception if any. 55 PassRefPtr<Node> nextNode(ExceptionCode& ec) { KJS::JSValue* exception; return nextNode(ec, exception); }56 PassRefPtr<Node> previousNode(ExceptionCode& ec) { KJS::JSValue* exception; return previousNode(ec, exception); }56 PassRefPtr<Node> nextNode(ExceptionCode& ec) { return nextNode(NodeFilter::execStateFromNode(referenceNode()), ec); } 57 PassRefPtr<Node> previousNode(ExceptionCode& ec) { return previousNode(NodeFilter::execStateFromNode(referenceNode()), ec); } 57 58 58 59 private: -
trunk/WebCore/dom/Traversal.cpp
r34754 r35054 41 41 } 42 42 43 short Traversal::acceptNode( Node* node, JSValue*& exception) const43 short Traversal::acceptNode(ExecState* exec, Node* node) const 44 44 { 45 45 // FIXME: To handle XML properly we would have to check m_expandEntityReferences. 46 46 47 // The bi dtwiddling here is done to map DOM node types, which are given as integers from47 // The bit twiddling here is done to map DOM node types, which are given as integers from 48 48 // 1 through 12, to whatToShow bit masks. 49 49 if (!(((1 << (node->nodeType() - 1)) & m_whatToShow))) … … 51 51 if (!m_filter) 52 52 return NodeFilter::FILTER_ACCEPT; 53 return m_filter->acceptNode( node, exception);53 return m_filter->acceptNode(exec, node); 54 54 } 55 55 -
trunk/WebCore/dom/Traversal.h
r34754 r35054 31 31 namespace KJS { 32 32 class JSValue; 33 class ExecState; 33 34 } 34 35 … … 47 48 protected: 48 49 Traversal(PassRefPtr<Node>, unsigned whatToShow, PassRefPtr<NodeFilter>, bool expandEntityReferences); 49 short acceptNode( Node*, KJS::JSValue*& jsException) const;50 short acceptNode(KJS::ExecState*, Node*) const; 50 51 51 52 private: -
trunk/WebCore/dom/TreeWalker.cpp
r30089 r35054 26 26 #include "TreeWalker.h" 27 27 28 #include <kjs/ExecState.h> 28 29 #include "ExceptionCode.h" 29 30 #include "Node.h" … … 56 57 } 57 58 58 Node* TreeWalker::parentNode(JSValue*& exception) 59 { 60 exception = 0; 59 Node* TreeWalker::parentNode(ExecState* exec) 60 { 61 61 RefPtr<Node> node = m_current; 62 62 while (node != root()) { … … 64 64 if (!node) 65 65 return 0; 66 short acceptNodeResult = acceptNode(node.get(), exception); 67 if (exception) 68 return 0; 69 if (acceptNodeResult == NodeFilter::FILTER_ACCEPT) 70 return setCurrent(node.release()); 71 } 72 return 0; 73 } 74 75 Node* TreeWalker::firstChild(JSValue*& exception) 76 { 77 exception = 0; 66 short acceptNodeResult = acceptNode(exec, node.get()); 67 if (exec && exec->hadException()) 68 return 0; 69 if (acceptNodeResult == NodeFilter::FILTER_ACCEPT) 70 return setCurrent(node.release()); 71 } 72 return 0; 73 } 74 75 Node* TreeWalker::firstChild(ExecState* exec) 76 { 78 77 for (RefPtr<Node> node = m_current->firstChild(); node; ) { 79 short acceptNodeResult = acceptNode( node.get(), exception);80 if (ex ception)78 short acceptNodeResult = acceptNode(exec, node.get()); 79 if (exec && exec->hadException()) 81 80 return 0; 82 81 switch (acceptNodeResult) { … … 107 106 } 108 107 109 Node* TreeWalker::lastChild(JSValue*& exception) 110 { 111 exception = 0; 108 Node* TreeWalker::lastChild(ExecState* exec) 109 { 112 110 for (RefPtr<Node> node = m_current->lastChild(); node; ) { 113 short acceptNodeResult = acceptNode( node.get(), exception);114 if (ex ception)111 short acceptNodeResult = acceptNode(exec, node.get()); 112 if (exec && exec->hadException()) 115 113 return 0; 116 114 switch (acceptNodeResult) { … … 141 139 } 142 140 143 Node* TreeWalker::previousSibling(JSValue*& exception) 144 { 145 exception = 0; 141 Node* TreeWalker::previousSibling(ExecState* exec) 142 { 146 143 RefPtr<Node> node = m_current; 147 144 if (node == root()) … … 149 146 while (1) { 150 147 for (RefPtr<Node> sibling = node->previousSibling(); sibling; ) { 151 short acceptNodeResult = acceptNode( sibling.get(), exception);152 if (ex ception)148 short acceptNodeResult = acceptNode(exec, sibling.get()); 149 if (exec && exec->hadException()) 153 150 return 0; 154 151 switch (acceptNodeResult) { … … 170 167 if (!node || node == root()) 171 168 return 0; 172 short acceptNodeResult = acceptNode(node.get(), exception); 173 if (exception) 174 return 0; 175 if (acceptNodeResult == NodeFilter::FILTER_ACCEPT) 176 return 0; 177 } 178 } 179 180 Node* TreeWalker::nextSibling(JSValue*& exception) 181 { 182 exception = 0; 169 short acceptNodeResult = acceptNode(exec, node.get()); 170 if (exec && exec->hadException()) 171 return 0; 172 if (acceptNodeResult == NodeFilter::FILTER_ACCEPT) 173 return 0; 174 } 175 } 176 177 Node* TreeWalker::nextSibling(ExecState* exec) 178 { 183 179 RefPtr<Node> node = m_current; 184 180 if (node == root()) … … 186 182 while (1) { 187 183 for (RefPtr<Node> sibling = node->nextSibling(); sibling; ) { 188 short acceptNodeResult = acceptNode( sibling.get(), exception);189 if (ex ception)184 short acceptNodeResult = acceptNode(exec, sibling.get()); 185 if (exec && exec->hadException()) 190 186 return 0; 191 187 switch (acceptNodeResult) { … … 207 203 if (!node || node == root()) 208 204 return 0; 209 short acceptNodeResult = acceptNode(node.get(), exception); 210 if (exception) 211 return 0; 212 if (acceptNodeResult == NodeFilter::FILTER_ACCEPT) 213 return 0; 214 } 215 } 216 217 Node* TreeWalker::previousNode(JSValue*& exception) 218 { 219 exception = 0; 205 short acceptNodeResult = acceptNode(exec, node.get()); 206 if (exec && exec->hadException()) 207 return 0; 208 if (acceptNodeResult == NodeFilter::FILTER_ACCEPT) 209 return 0; 210 } 211 } 212 213 Node* TreeWalker::previousNode(ExecState* exec) 214 { 220 215 RefPtr<Node> node = m_current; 221 216 while (node != root()) { 222 217 while (Node* previousSibling = node->previousSibling()) { 223 218 node = previousSibling; 224 short acceptNodeResult = acceptNode( node.get(), exception);225 if (ex ception)219 short acceptNodeResult = acceptNode(exec, node.get()); 220 if (exec && exec->hadException()) 226 221 return 0; 227 222 if (acceptNodeResult == NodeFilter::FILTER_REJECT) … … 229 224 while (Node* lastChild = node->lastChild()) { 230 225 node = lastChild; 231 acceptNodeResult = acceptNode( node.get(), exception);232 if (ex ception)226 acceptNodeResult = acceptNode(exec, node.get()); 227 if (exec && exec->hadException()) 233 228 return 0; 234 229 if (acceptNodeResult == NodeFilter::FILTER_ACCEPT) … … 246 241 return 0; 247 242 node = parent; 248 short acceptNodeResult = acceptNode(node.get(), exception); 249 if (exception) 250 return 0; 251 if (acceptNodeResult == NodeFilter::FILTER_ACCEPT) 252 return setCurrent(node.release()); 253 } 254 return 0; 255 } 256 257 Node* TreeWalker::nextNode(JSValue*& exception) 258 { 259 exception = 0; 243 short acceptNodeResult = acceptNode(exec, node.get()); 244 if (exec && exec->hadException()) 245 return 0; 246 if (acceptNodeResult == NodeFilter::FILTER_ACCEPT) 247 return setCurrent(node.release()); 248 } 249 return 0; 250 } 251 252 Node* TreeWalker::nextNode(ExecState* exec) 253 { 260 254 RefPtr<Node> node = m_current; 261 255 Children: 262 256 while (Node* firstChild = node->firstChild()) { 263 257 node = firstChild; 264 short acceptNodeResult = acceptNode( node.get(), exception);265 if (ex ception)258 short acceptNodeResult = acceptNode(exec, node.get()); 259 if (exec && exec->hadException()) 266 260 return 0; 267 261 if (acceptNodeResult == NodeFilter::FILTER_ACCEPT) … … 272 266 while (Node* nextSibling = node->traverseNextSibling(root())) { 273 267 node = nextSibling; 274 short acceptNodeResult = acceptNode( node.get(), exception);275 if (ex ception)268 short acceptNodeResult = acceptNode(exec, node.get()); 269 if (exec && exec->hadException()) 276 270 return 0; 277 271 if (acceptNodeResult == NodeFilter::FILTER_ACCEPT) -
trunk/WebCore/dom/TreeWalker.h
r34754 r35054 26 26 #define TreeWalker_h 27 27 28 #include "NodeFilter.h" 28 29 #include "Traversal.h" 29 30 #include <wtf/PassRefPtr.h> … … 44 45 void setCurrentNode(PassRefPtr<Node>, ExceptionCode&); 45 46 46 Node* parentNode(KJS:: JSValue*& exception);47 Node* firstChild(KJS:: JSValue*& exception);48 Node* lastChild(KJS:: JSValue*& exception);49 Node* previousSibling(KJS:: JSValue*& exception);50 Node* nextSibling(KJS:: JSValue*& exception);51 Node* previousNode(KJS:: JSValue*& exception);52 Node* nextNode(KJS:: JSValue*& exception);47 Node* parentNode(KJS::ExecState*); 48 Node* firstChild(KJS::ExecState*); 49 Node* lastChild(KJS::ExecState*); 50 Node* previousSibling(KJS::ExecState*); 51 Node* nextSibling(KJS::ExecState*); 52 Node* previousNode(KJS::ExecState*); 53 Node* nextNode(KJS::ExecState*); 53 54 54 55 // For non-JS bindings. Silently ignores the JavaScript exception if any. 55 Node* parentNode() { KJS::JSValue* exception; return parentNode(exception); }56 Node* firstChild() { KJS::JSValue* exception; return firstChild(exception); }57 Node* lastChild() { KJS::JSValue* exception; return lastChild(exception); }58 Node* previousSibling() { KJS::JSValue* exception; return previousSibling(exception); }59 Node* nextSibling() { KJS::JSValue* exception; return nextSibling(exception); }60 Node* previousNode() { KJS::JSValue* exception; return previousNode(exception); }61 Node* nextNode() { KJS::JSValue* exception; return nextNode(exception); }56 Node* parentNode() { return parentNode(NodeFilter::execStateFromNode(m_current.get())); } 57 Node* firstChild() { return firstChild(NodeFilter::execStateFromNode(m_current.get())); } 58 Node* lastChild() { return lastChild(NodeFilter::execStateFromNode(m_current.get())); } 59 Node* previousSibling() { return previousSibling(NodeFilter::execStateFromNode(m_current.get())); } 60 Node* nextSibling() { return nextSibling(NodeFilter::execStateFromNode(m_current.get())); } 61 Node* previousNode() { return previousNode(NodeFilter::execStateFromNode(m_current.get())); } 62 Node* nextNode() { return nextNode(NodeFilter::execStateFromNode(m_current.get())); } 62 63 63 64 private:
Note: See TracChangeset
for help on using the changeset viewer.