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

Side by Side Diff: Source/core/dom/NamedNodeMap.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/MutationObserver.cpp ('k') | Source/core/dom/Node.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 Peter Kelly (pmk@post.com) 4 * (C) 2001 Peter Kelly (pmk@post.com)
5 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights reserved.
7 * (C) 2007 Eric Seidel (eric@webkit.org) 7 * (C) 2007 Eric Seidel (eric@webkit.org)
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 57
58 PassRefPtr<Node> NamedNodeMap::getNamedItemNS(const AtomicString& namespaceURI, const AtomicString& localName) const 58 PassRefPtr<Node> NamedNodeMap::getNamedItemNS(const AtomicString& namespaceURI, const AtomicString& localName) const
59 { 59 {
60 return m_element->getAttributeNodeNS(namespaceURI, localName); 60 return m_element->getAttributeNodeNS(namespaceURI, localName);
61 } 61 }
62 62
63 PassRefPtr<Node> NamedNodeMap::removeNamedItem(const AtomicString& name, Excepti onState& es) 63 PassRefPtr<Node> NamedNodeMap::removeNamedItem(const AtomicString& name, Excepti onState& es)
64 { 64 {
65 size_t index = m_element->hasAttributes() ? m_element->getAttributeItemIndex (name, shouldIgnoreAttributeCase(m_element)) : kNotFound; 65 size_t index = m_element->hasAttributes() ? m_element->getAttributeItemIndex (name, shouldIgnoreAttributeCase(m_element)) : kNotFound;
66 if (index == kNotFound) { 66 if (index == kNotFound) {
67 es.throwDOMException(NotFoundError); 67 es.throwUninformativeAndGenericDOMException(NotFoundError);
68 return 0; 68 return 0;
69 } 69 }
70 return m_element->detachAttribute(index); 70 return m_element->detachAttribute(index);
71 } 71 }
72 72
73 PassRefPtr<Node> NamedNodeMap::removeNamedItemNS(const AtomicString& namespaceUR I, const AtomicString& localName, ExceptionState& es) 73 PassRefPtr<Node> NamedNodeMap::removeNamedItemNS(const AtomicString& namespaceUR I, const AtomicString& localName, ExceptionState& es)
74 { 74 {
75 size_t index = m_element->hasAttributes() ? m_element->getAttributeItemIndex (QualifiedName(nullAtom, localName, namespaceURI)) : kNotFound; 75 size_t index = m_element->hasAttributes() ? m_element->getAttributeItemIndex (QualifiedName(nullAtom, localName, namespaceURI)) : kNotFound;
76 if (index == kNotFound) { 76 if (index == kNotFound) {
77 es.throwDOMException(NotFoundError); 77 es.throwUninformativeAndGenericDOMException(NotFoundError);
78 return 0; 78 return 0;
79 } 79 }
80 return m_element->detachAttribute(index); 80 return m_element->detachAttribute(index);
81 } 81 }
82 82
83 PassRefPtr<Node> NamedNodeMap::setNamedItem(Node* node, ExceptionState& es) 83 PassRefPtr<Node> NamedNodeMap::setNamedItem(Node* node, ExceptionState& es)
84 { 84 {
85 if (!node) { 85 if (!node) {
86 es.throwDOMException(NotFoundError); 86 es.throwUninformativeAndGenericDOMException(NotFoundError);
87 return 0; 87 return 0;
88 } 88 }
89 89
90 // Not mentioned in spec: throw a HIERARCHY_REQUEST_ERROR if the user passes in a non-attribute node 90 // Not mentioned in spec: throw a HIERARCHY_REQUEST_ERROR if the user passes in a non-attribute node
91 if (!node->isAttributeNode()) { 91 if (!node->isAttributeNode()) {
92 es.throwDOMException(HierarchyRequestError); 92 es.throwUninformativeAndGenericDOMException(HierarchyRequestError);
93 return 0; 93 return 0;
94 } 94 }
95 95
96 return m_element->setAttributeNode(toAttr(node), es); 96 return m_element->setAttributeNode(toAttr(node), es);
97 } 97 }
98 98
99 PassRefPtr<Node> NamedNodeMap::setNamedItemNS(Node* node, ExceptionState& es) 99 PassRefPtr<Node> NamedNodeMap::setNamedItemNS(Node* node, ExceptionState& es)
100 { 100 {
101 return setNamedItem(node, es); 101 return setNamedItem(node, es);
102 } 102 }
103 103
104 PassRefPtr<Node> NamedNodeMap::item(unsigned index) const 104 PassRefPtr<Node> NamedNodeMap::item(unsigned index) const
105 { 105 {
106 if (index >= length()) 106 if (index >= length())
107 return 0; 107 return 0;
108 return m_element->ensureAttr(m_element->attributeItem(index)->name()); 108 return m_element->ensureAttr(m_element->attributeItem(index)->name());
109 } 109 }
110 110
111 size_t NamedNodeMap::length() const 111 size_t NamedNodeMap::length() const
112 { 112 {
113 if (!m_element->hasAttributes()) 113 if (!m_element->hasAttributes())
114 return 0; 114 return 0;
115 return m_element->attributeCount(); 115 return m_element->attributeCount();
116 } 116 }
117 117
118 } // namespace WebCore 118 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/MutationObserver.cpp ('k') | Source/core/dom/Node.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698