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

Unified Diff: Source/core/dom/Document.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, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/dom/DOMTokenList.cpp ('k') | Source/core/dom/Element.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Document.cpp
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index 5e13ba84982fb71c85894e137d9bf50ff64fad9f..e5361736faf8576307d060c1939d4e46c2e49b76 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -690,7 +690,7 @@ void Document::childrenChanged(bool changedByParser, Node* beforeChange, Node* a
PassRefPtr<Element> Document::createElement(const AtomicString& name, ExceptionState& es)
{
if (!isValidName(name)) {
- es.throwDOMException(InvalidCharacterError);
+ es.throwUninformativeAndGenericDOMException(InvalidCharacterError);
return 0;
}
@@ -703,7 +703,7 @@ PassRefPtr<Element> Document::createElement(const AtomicString& name, ExceptionS
PassRefPtr<Element> Document::createElement(const AtomicString& localName, const AtomicString& typeExtension, ExceptionState& es)
{
if (!isValidName(localName)) {
- es.throwDOMException(InvalidCharacterError);
+ es.throwUninformativeAndGenericDOMException(InvalidCharacterError);
return 0;
}
@@ -728,7 +728,7 @@ PassRefPtr<Element> Document::createElementNS(const AtomicString& namespaceURI,
QualifiedName qName(prefix, localName, namespaceURI);
if (!hasValidNamespaceForElements(qName)) {
- es.throwDOMException(NamespaceError);
+ es.throwUninformativeAndGenericDOMException(NamespaceError);
return 0;
}
@@ -752,7 +752,7 @@ ScriptValue Document::registerElement(WebCore::ScriptState* state, const AtomicS
ScriptValue Document::registerElement(WebCore::ScriptState* state, const AtomicString& name, const Dictionary& options, ExceptionState& es, CustomElement::NameSet validNames)
{
if (!registrationContext()) {
- es.throwDOMException(NotSupportedError);
+ es.throwUninformativeAndGenericDOMException(NotSupportedError);
return ScriptValue();
}
@@ -795,7 +795,7 @@ PassRefPtr<Comment> Document::createComment(const String& data)
PassRefPtr<CDATASection> Document::createCDATASection(const String& data, ExceptionState& es)
{
if (isHTMLDocument()) {
- es.throwDOMException(NotSupportedError);
+ es.throwUninformativeAndGenericDOMException(NotSupportedError);
return 0;
}
if (data.find("]]>") != WTF::kNotFound) {
@@ -808,11 +808,11 @@ PassRefPtr<CDATASection> Document::createCDATASection(const String& data, Except
PassRefPtr<ProcessingInstruction> Document::createProcessingInstruction(const String& target, const String& data, ExceptionState& es)
{
if (!isValidName(target)) {
- es.throwDOMException(InvalidCharacterError);
+ es.throwUninformativeAndGenericDOMException(InvalidCharacterError);
return 0;
}
if (isHTMLDocument()) {
- es.throwDOMException(NotSupportedError);
+ es.throwUninformativeAndGenericDOMException(NotSupportedError);
return 0;
}
return ProcessingInstruction::create(*this, target, data);
@@ -831,7 +831,7 @@ PassRefPtr<CSSStyleDeclaration> Document::createCSSStyleDeclaration()
PassRefPtr<Node> Document::importNode(Node* importedNode, bool deep, ExceptionState& es)
{
if (!importedNode) {
- es.throwDOMException(NotSupportedError);
+ es.throwUninformativeAndGenericDOMException(NotSupportedError);
return 0;
}
@@ -849,7 +849,7 @@ PassRefPtr<Node> Document::importNode(Node* importedNode, bool deep, ExceptionSt
// FIXME: The following check might be unnecessary. Is it possible that
// oldElement has mismatched prefix/namespace?
if (!hasValidNamespaceForElements(oldElement->tagQName())) {
- es.throwDOMException(NamespaceError);
+ es.throwUninformativeAndGenericDOMException(NamespaceError);
return 0;
}
RefPtr<Element> newElement = createElement(oldElement->tagQName(), false);
@@ -901,14 +901,14 @@ PassRefPtr<Node> Document::importNode(Node* importedNode, bool deep, ExceptionSt
case XPATH_NAMESPACE_NODE:
break;
}
- es.throwDOMException(NotSupportedError);
+ es.throwUninformativeAndGenericDOMException(NotSupportedError);
return 0;
}
PassRefPtr<Node> Document::adoptNode(PassRefPtr<Node> source, ExceptionState& es)
{
if (!source) {
- es.throwDOMException(NotSupportedError);
+ es.throwUninformativeAndGenericDOMException(NotSupportedError);
return 0;
}
@@ -920,7 +920,7 @@ PassRefPtr<Node> Document::adoptNode(PassRefPtr<Node> source, ExceptionState& es
case DOCUMENT_NODE:
case DOCUMENT_TYPE_NODE:
case XPATH_NAMESPACE_NODE:
- es.throwDOMException(NotSupportedError);
+ es.throwUninformativeAndGenericDOMException(NotSupportedError);
return 0;
case ATTRIBUTE_NODE: {
Attr* attr = toAttr(source.get());
@@ -932,14 +932,14 @@ PassRefPtr<Node> Document::adoptNode(PassRefPtr<Node> source, ExceptionState& es
default:
if (source->isShadowRoot()) {
// ShadowRoot cannot disconnect itself from the host node.
- es.throwDOMException(HierarchyRequestError);
+ es.throwUninformativeAndGenericDOMException(HierarchyRequestError);
return 0;
}
if (source->isFrameOwnerElement()) {
HTMLFrameOwnerElement* frameOwnerElement = toHTMLFrameOwnerElement(source.get());
if (frame() && frame()->tree()->isDescendantOf(frameOwnerElement->contentFrame())) {
- es.throwDOMException(HierarchyRequestError);
+ es.throwUninformativeAndGenericDOMException(HierarchyRequestError);
return 0;
}
}
@@ -1047,7 +1047,7 @@ PassRefPtr<Element> Document::createElementNS(const String& namespaceURI, const
QualifiedName qName(prefix, localName, namespaceURI);
if (!hasValidNamespaceForElements(qName)) {
- es.throwDOMException(NamespaceError);
+ es.throwUninformativeAndGenericDOMException(NamespaceError);
return 0;
}
@@ -1136,12 +1136,12 @@ void Document::setContentLanguage(const String& language)
void Document::setXMLVersion(const String& version, ExceptionState& es)
{
if (!implementation()->hasFeature("XML", String())) {
- es.throwDOMException(NotSupportedError);
+ es.throwUninformativeAndGenericDOMException(NotSupportedError);
return;
}
if (!XMLDocumentParser::supportsXMLVersion(version)) {
- es.throwDOMException(NotSupportedError);
+ es.throwUninformativeAndGenericDOMException(NotSupportedError);
return;
}
@@ -1151,7 +1151,7 @@ void Document::setXMLVersion(const String& version, ExceptionState& es)
void Document::setXMLStandalone(bool standalone, ExceptionState& es)
{
if (!implementation()->hasFeature("XML", String())) {
- es.throwDOMException(NotSupportedError);
+ es.throwUninformativeAndGenericDOMException(NotSupportedError);
return;
}
@@ -1452,7 +1452,7 @@ PassRefPtr<NodeIterator> Document::createNodeIterator(Node* root, ExceptionState
{
// FIXME: Probably this should be handled within the bindings layer and TypeError should be thrown.
if (!root) {
- es.throwDOMException(NotSupportedError);
+ es.throwUninformativeAndGenericDOMException(NotSupportedError);
return 0;
}
return NodeIterator::create(root, NodeFilter::SHOW_ALL, PassRefPtr<NodeFilter>());
@@ -1461,7 +1461,7 @@ PassRefPtr<NodeIterator> Document::createNodeIterator(Node* root, ExceptionState
PassRefPtr<NodeIterator> Document::createNodeIterator(Node* root, unsigned whatToShow, ExceptionState& es)
{
if (!root) {
- es.throwDOMException(NotSupportedError);
+ es.throwUninformativeAndGenericDOMException(NotSupportedError);
return 0;
}
// FIXME: It might be a good idea to emit a warning if |whatToShow| contains a bit that is not defined in
@@ -1472,7 +1472,7 @@ PassRefPtr<NodeIterator> Document::createNodeIterator(Node* root, unsigned whatT
PassRefPtr<NodeIterator> Document::createNodeIterator(Node* root, unsigned whatToShow, PassRefPtr<NodeFilter> filter, ExceptionState& es)
{
if (!root) {
- es.throwDOMException(NotSupportedError);
+ es.throwUninformativeAndGenericDOMException(NotSupportedError);
return 0;
}
// FIXME: Ditto.
@@ -1482,7 +1482,7 @@ PassRefPtr<NodeIterator> Document::createNodeIterator(Node* root, unsigned whatT
PassRefPtr<NodeIterator> Document::createNodeIterator(Node* root, unsigned whatToShow, PassRefPtr<NodeFilter> filter, bool expandEntityReferences, ExceptionState& es)
{
if (!root) {
- es.throwDOMException(NotSupportedError);
+ es.throwUninformativeAndGenericDOMException(NotSupportedError);
return 0;
}
// FIXME: Warn if |expandEntityReferences| is specified. This optional argument is deprecated in DOM4.
@@ -1493,7 +1493,7 @@ PassRefPtr<NodeIterator> Document::createNodeIterator(Node* root, unsigned whatT
PassRefPtr<TreeWalker> Document::createTreeWalker(Node* root, ExceptionState& es)
{
if (!root) {
- es.throwDOMException(NotSupportedError);
+ es.throwUninformativeAndGenericDOMException(NotSupportedError);
return 0;
}
return TreeWalker::create(root, NodeFilter::SHOW_ALL, PassRefPtr<NodeFilter>());
@@ -1502,7 +1502,7 @@ PassRefPtr<TreeWalker> Document::createTreeWalker(Node* root, ExceptionState& es
PassRefPtr<TreeWalker> Document::createTreeWalker(Node* root, unsigned whatToShow, ExceptionState& es)
{
if (!root) {
- es.throwDOMException(NotSupportedError);
+ es.throwUninformativeAndGenericDOMException(NotSupportedError);
return 0;
}
return TreeWalker::create(root, whatToShow, PassRefPtr<NodeFilter>());
@@ -1511,7 +1511,7 @@ PassRefPtr<TreeWalker> Document::createTreeWalker(Node* root, unsigned whatToSho
PassRefPtr<TreeWalker> Document::createTreeWalker(Node* root, unsigned whatToShow, PassRefPtr<NodeFilter> filter, ExceptionState& es)
{
if (!root) {
- es.throwDOMException(NotSupportedError);
+ es.throwUninformativeAndGenericDOMException(NotSupportedError);
return 0;
}
return TreeWalker::create(root, whatToShow, filter);
@@ -1521,7 +1521,7 @@ PassRefPtr<TreeWalker> Document::createTreeWalker(Node* root, unsigned whatToSho
{
UNUSED_PARAM(expandEntityReferences);
if (!root) {
- es.throwDOMException(NotSupportedError);
+ es.throwUninformativeAndGenericDOMException(NotSupportedError);
return 0;
}
return TreeWalker::create(root, whatToShow, filter);
@@ -2260,12 +2260,12 @@ void Document::setBody(PassRefPtr<HTMLElement> prpNewBody, ExceptionState& es)
RefPtr<HTMLElement> newBody = prpNewBody;
if (!newBody || !documentElement()) {
- es.throwDOMException(HierarchyRequestError);
+ es.throwUninformativeAndGenericDOMException(HierarchyRequestError);
return;
}
if (!newBody->hasTagName(bodyTag) && !newBody->hasTagName(framesetTag)) {
- es.throwDOMException(HierarchyRequestError);
+ es.throwUninformativeAndGenericDOMException(HierarchyRequestError);
return;
}
@@ -3743,7 +3743,7 @@ PassRefPtr<Event> Document::createEvent(const String& eventType, ExceptionState&
if (event)
return event.release();
- es.throwDOMException(NotSupportedError);
+ es.throwUninformativeAndGenericDOMException(NotSupportedError);
return 0;
}
@@ -4038,7 +4038,7 @@ static bool parseQualifiedNameInternal(const String& qualifiedName, const CharTy
U16_NEXT(characters, i, length, c)
if (c == ':') {
if (sawColon) {
- es.throwDOMException(NamespaceError);
+ es.throwUninformativeAndGenericDOMException(NamespaceError);
return false; // multiple colons: not allowed
}
nameStart = true;
@@ -4046,13 +4046,13 @@ static bool parseQualifiedNameInternal(const String& qualifiedName, const CharTy
colonPos = i - 1;
} else if (nameStart) {
if (!isValidNameStart(c)) {
- es.throwDOMException(InvalidCharacterError);
+ es.throwUninformativeAndGenericDOMException(InvalidCharacterError);
return false;
}
nameStart = false;
} else {
if (!isValidNamePart(c)) {
- es.throwDOMException(InvalidCharacterError);
+ es.throwUninformativeAndGenericDOMException(InvalidCharacterError);
return false;
}
}
@@ -4064,14 +4064,14 @@ static bool parseQualifiedNameInternal(const String& qualifiedName, const CharTy
} else {
prefix = qualifiedName.substring(0, colonPos);
if (prefix.isEmpty()) {
- es.throwDOMException(NamespaceError);
+ es.throwUninformativeAndGenericDOMException(NamespaceError);
return false;
}
localName = qualifiedName.substring(colonPos + 1);
}
if (localName.isEmpty()) {
- es.throwDOMException(NamespaceError);
+ es.throwUninformativeAndGenericDOMException(NamespaceError);
return false;
}
@@ -4083,7 +4083,7 @@ bool Document::parseQualifiedName(const String& qualifiedName, String& prefix, S
unsigned length = qualifiedName.length();
if (!length) {
- es.throwDOMException(InvalidCharacterError);
+ es.throwUninformativeAndGenericDOMException(InvalidCharacterError);
return false;
}
@@ -4318,7 +4318,7 @@ PassRefPtr<Attr> Document::createAttributeNS(const String& namespaceURI, const S
QualifiedName qName(prefix, localName, namespaceURI);
if (!shouldIgnoreNamespaceChecks && !hasValidNamespaceForAttributes(qName)) {
- es.throwDOMException(NamespaceError);
+ es.throwUninformativeAndGenericDOMException(NamespaceError);
return 0;
}
« no previous file with comments | « Source/core/dom/DOMTokenList.cpp ('k') | Source/core/dom/Element.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698