Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(462)

Side by Side Diff: Source/core/dom/Node.cpp

Issue 24469004: Amusingly deprecate the generic version of 'ExceptionState::throwDOMException'. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/NamedNodeMap.cpp ('k') | Source/core/dom/Range.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 } 454 }
455 455
456 return lastChild(); 456 return lastChild();
457 } 457 }
458 458
459 void Node::insertBefore(PassRefPtr<Node> newChild, Node* refChild, ExceptionStat e& es) 459 void Node::insertBefore(PassRefPtr<Node> newChild, Node* refChild, ExceptionStat e& es)
460 { 460 {
461 if (isContainerNode()) 461 if (isContainerNode())
462 toContainerNode(this)->insertBefore(newChild, refChild, es); 462 toContainerNode(this)->insertBefore(newChild, refChild, es);
463 else 463 else
464 es.throwDOMException(HierarchyRequestError); 464 es.throwUninformativeAndGenericDOMException(HierarchyRequestError);
465 } 465 }
466 466
467 void Node::replaceChild(PassRefPtr<Node> newChild, Node* oldChild, ExceptionStat e& es) 467 void Node::replaceChild(PassRefPtr<Node> newChild, Node* oldChild, ExceptionStat e& es)
468 { 468 {
469 if (isContainerNode()) 469 if (isContainerNode())
470 toContainerNode(this)->replaceChild(newChild, oldChild, es); 470 toContainerNode(this)->replaceChild(newChild, oldChild, es);
471 else 471 else
472 es.throwDOMException(HierarchyRequestError); 472 es.throwUninformativeAndGenericDOMException(HierarchyRequestError);
473 } 473 }
474 474
475 void Node::removeChild(Node* oldChild, ExceptionState& es) 475 void Node::removeChild(Node* oldChild, ExceptionState& es)
476 { 476 {
477 if (isContainerNode()) 477 if (isContainerNode())
478 toContainerNode(this)->removeChild(oldChild, es); 478 toContainerNode(this)->removeChild(oldChild, es);
479 else 479 else
480 es.throwDOMException(NotFoundError); 480 es.throwUninformativeAndGenericDOMException(NotFoundError);
481 } 481 }
482 482
483 void Node::appendChild(PassRefPtr<Node> newChild, ExceptionState& es) 483 void Node::appendChild(PassRefPtr<Node> newChild, ExceptionState& es)
484 { 484 {
485 if (isContainerNode()) 485 if (isContainerNode())
486 toContainerNode(this)->appendChild(newChild, es); 486 toContainerNode(this)->appendChild(newChild, es);
487 else 487 else
488 es.throwDOMException(HierarchyRequestError); 488 es.throwUninformativeAndGenericDOMException(HierarchyRequestError);
489 } 489 }
490 490
491 void Node::remove(ExceptionState& es) 491 void Node::remove(ExceptionState& es)
492 { 492 {
493 if (ContainerNode* parent = parentNode()) 493 if (ContainerNode* parent = parentNode())
494 parent->removeChild(this, es); 494 parent->removeChild(this, es);
495 } 495 }
496 496
497 void Node::normalize() 497 void Node::normalize()
498 { 498 {
(...skipping 22 matching lines...) Expand all
521 { 521 {
522 // For nodes other than elements and attributes, the prefix is always null 522 // For nodes other than elements and attributes, the prefix is always null
523 return nullAtom; 523 return nullAtom;
524 } 524 }
525 525
526 void Node::setPrefix(const AtomicString& /*prefix*/, ExceptionState& es) 526 void Node::setPrefix(const AtomicString& /*prefix*/, ExceptionState& es)
527 { 527 {
528 // The spec says that for nodes other than elements and attributes, prefix i s always null. 528 // The spec says that for nodes other than elements and attributes, prefix i s always null.
529 // It does not say what to do when the user tries to set the prefix on anoth er type of 529 // It does not say what to do when the user tries to set the prefix on anoth er type of
530 // node, however Mozilla throws a NamespaceError exception. 530 // node, however Mozilla throws a NamespaceError exception.
531 es.throwDOMException(NamespaceError); 531 es.throwUninformativeAndGenericDOMException(NamespaceError);
532 } 532 }
533 533
534 const AtomicString& Node::localName() const 534 const AtomicString& Node::localName() const
535 { 535 {
536 return nullAtom; 536 return nullAtom;
537 } 537 }
538 538
539 const AtomicString& Node::namespaceURI() const 539 const AtomicString& Node::namespaceURI() const
540 { 540 {
541 return nullAtom; 541 return nullAtom;
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
854 { 854 {
855 rareData()->clearNodeLists(); 855 rareData()->clearNodeLists();
856 } 856 }
857 857
858 void Node::checkSetPrefix(const AtomicString& prefix, ExceptionState& es) 858 void Node::checkSetPrefix(const AtomicString& prefix, ExceptionState& es)
859 { 859 {
860 // Perform error checking as required by spec for setting Node.prefix. Used by 860 // Perform error checking as required by spec for setting Node.prefix. Used by
861 // Element::setPrefix() and Attr::setPrefix() 861 // Element::setPrefix() and Attr::setPrefix()
862 862
863 if (!prefix.isEmpty() && !Document::isValidName(prefix)) { 863 if (!prefix.isEmpty() && !Document::isValidName(prefix)) {
864 es.throwDOMException(InvalidCharacterError); 864 es.throwUninformativeAndGenericDOMException(InvalidCharacterError);
865 return; 865 return;
866 } 866 }
867 867
868 // FIXME: Raise NamespaceError if prefix is malformed per the Namespaces in XML specification. 868 // FIXME: Raise NamespaceError if prefix is malformed per the Namespaces in XML specification.
869 869
870 const AtomicString& nodeNamespaceURI = namespaceURI(); 870 const AtomicString& nodeNamespaceURI = namespaceURI();
871 if (nodeNamespaceURI.isEmpty() && !prefix.isEmpty()) { 871 if (nodeNamespaceURI.isEmpty() && !prefix.isEmpty()) {
872 es.throwDOMException(NamespaceError, ExceptionMessages::failedToSet("pre fix", "Node", "No namespace is set, so a namespace prefix may not be set.")); 872 es.throwDOMException(NamespaceError, ExceptionMessages::failedToSet("pre fix", "Node", "No namespace is set, so a namespace prefix may not be set."));
873 return; 873 return;
874 } 874 }
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
1263 1263
1264 PassRefPtr<RadioNodeList> Node::radioNodeList(const AtomicString& name) 1264 PassRefPtr<RadioNodeList> Node::radioNodeList(const AtomicString& name)
1265 { 1265 {
1266 ASSERT(hasTagName(formTag) || hasTagName(fieldsetTag)); 1266 ASSERT(hasTagName(formTag) || hasTagName(fieldsetTag));
1267 return ensureRareData()->ensureNodeLists()->addCacheWithAtomicName<RadioNode List>(this, RadioNodeListType, name); 1267 return ensureRareData()->ensureNodeLists()->addCacheWithAtomicName<RadioNode List>(this, RadioNodeListType, name);
1268 } 1268 }
1269 1269
1270 PassRefPtr<Element> Node::querySelector(const AtomicString& selectors, Exception State& es) 1270 PassRefPtr<Element> Node::querySelector(const AtomicString& selectors, Exception State& es)
1271 { 1271 {
1272 if (selectors.isEmpty()) { 1272 if (selectors.isEmpty()) {
1273 es.throwDOMException(SyntaxError); 1273 es.throwUninformativeAndGenericDOMException(SyntaxError);
1274 return 0; 1274 return 0;
1275 } 1275 }
1276 1276
1277 SelectorQuery* selectorQuery = document().selectorQueryCache()->add(selector s, document(), es); 1277 SelectorQuery* selectorQuery = document().selectorQueryCache()->add(selector s, document(), es);
1278 if (!selectorQuery) 1278 if (!selectorQuery)
1279 return 0; 1279 return 0;
1280 return selectorQuery->queryFirst(this); 1280 return selectorQuery->queryFirst(this);
1281 } 1281 }
1282 1282
1283 PassRefPtr<NodeList> Node::querySelectorAll(const AtomicString& selectors, Excep tionState& es) 1283 PassRefPtr<NodeList> Node::querySelectorAll(const AtomicString& selectors, Excep tionState& es)
1284 { 1284 {
1285 if (selectors.isEmpty()) { 1285 if (selectors.isEmpty()) {
1286 es.throwDOMException(SyntaxError); 1286 es.throwUninformativeAndGenericDOMException(SyntaxError);
1287 return 0; 1287 return 0;
1288 } 1288 }
1289 1289
1290 SelectorQuery* selectorQuery = document().selectorQueryCache()->add(selector s, document(), es); 1290 SelectorQuery* selectorQuery = document().selectorQueryCache()->add(selector s, document(), es);
1291 if (!selectorQuery) 1291 if (!selectorQuery)
1292 return 0; 1292 return 0;
1293 return selectorQuery->queryAll(this); 1293 return selectorQuery->queryAll(this);
1294 } 1294 }
1295 1295
1296 Document* Node::ownerDocument() const 1296 Document* Node::ownerDocument() const
(...skipping 1358 matching lines...) Expand 10 before | Expand all | Expand 10 after
2655 node->showTreeForThis(); 2655 node->showTreeForThis();
2656 } 2656 }
2657 2657
2658 void showNodePath(const WebCore::Node* node) 2658 void showNodePath(const WebCore::Node* node)
2659 { 2659 {
2660 if (node) 2660 if (node)
2661 node->showNodePathForThis(); 2661 node->showNodePathForThis();
2662 } 2662 }
2663 2663
2664 #endif 2664 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/NamedNodeMap.cpp ('k') | Source/core/dom/Range.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698