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

Side by Side Diff: third_party/WebKit/Source/core/dom/DOMException.cpp

Issue 1854423002: ASSERT -> {DCHECK|DCHECK_XX}, ENABLE(ASSERT) -> DCHECK_IS_ON() in dom (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mark svg/as-image/svg-nested.html crash on win Created 4 years, 8 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 { 102 {
103 for (const CoreException& entry : coreExceptions) { 103 for (const CoreException& entry : coreExceptions) {
104 if (entry.name == name) 104 if (entry.name == name)
105 return entry.code; 105 return entry.code;
106 } 106 }
107 return 0; 107 return 0;
108 } 108 }
109 109
110 DOMException::DOMException(unsigned short code, const String& name, const String & sanitizedMessage, const String& unsanitizedMessage) 110 DOMException::DOMException(unsigned short code, const String& name, const String & sanitizedMessage, const String& unsanitizedMessage)
111 { 111 {
112 ASSERT(name); 112 DCHECK(name);
113 m_code = code; 113 m_code = code;
114 m_name = name; 114 m_name = name;
115 m_sanitizedMessage = sanitizedMessage; 115 m_sanitizedMessage = sanitizedMessage;
116 m_unsanitizedMessage = unsanitizedMessage; 116 m_unsanitizedMessage = unsanitizedMessage;
117 } 117 }
118 118
119 DOMException* DOMException::create(ExceptionCode ec, const String& sanitizedMess age, const String& unsanitizedMessage) 119 DOMException* DOMException::create(ExceptionCode ec, const String& sanitizedMess age, const String& unsanitizedMessage)
120 { 120 {
121 const CoreException* entry = getErrorEntry(ec); 121 const CoreException* entry = getErrorEntry(ec);
122 ASSERT(entry); 122 DCHECK(entry);
123 return new DOMException(entry->code, 123 return new DOMException(entry->code,
124 entry->name ? entry->name : "Error", 124 entry->name ? entry->name : "Error",
125 sanitizedMessage.isNull() ? String(entry->message) : sanitizedMessage, 125 sanitizedMessage.isNull() ? String(entry->message) : sanitizedMessage,
126 unsanitizedMessage); 126 unsanitizedMessage);
127 } 127 }
128 128
129 DOMException* DOMException::create(const String& message, const String& name) 129 DOMException* DOMException::create(const String& message, const String& name)
130 { 130 {
131 return new DOMException(getErrorCode(name), name, message, message); 131 return new DOMException(getErrorCode(name), name, message, message);
132 } 132 }
133 133
134 String DOMException::toString() const 134 String DOMException::toString() const
135 { 135 {
136 return name() + ": " + message(); 136 return name() + ": " + message();
137 } 137 }
138 138
139 String DOMException::toStringForConsole() const 139 String DOMException::toStringForConsole() const
140 { 140 {
141 return name() + ": " + messageForConsole(); 141 return name() + ": " + messageForConsole();
142 } 142 }
143 143
144 String DOMException::getErrorName(ExceptionCode ec) 144 String DOMException::getErrorName(ExceptionCode ec)
145 { 145 {
146 const CoreException* entry = getErrorEntry(ec); 146 const CoreException* entry = getErrorEntry(ec);
147 ASSERT(entry); 147 DCHECK(entry);
148 if (!entry) 148 if (!entry)
149 return "UnknownError"; 149 return "UnknownError";
150 150
151 return entry->name; 151 return entry->name;
152 } 152 }
153 153
154 String DOMException::getErrorMessage(ExceptionCode ec) 154 String DOMException::getErrorMessage(ExceptionCode ec)
155 { 155 {
156 const CoreException* entry = getErrorEntry(ec); 156 const CoreException* entry = getErrorEntry(ec);
157 ASSERT(entry); 157 DCHECK(entry);
158 if (!entry) 158 if (!entry)
159 return "Unknown error."; 159 return "Unknown error.";
160 160
161 return entry->message; 161 return entry->message;
162 } 162 }
163 163
164 } // namespace blink 164 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/DOMDataView.cpp ('k') | third_party/WebKit/Source/core/dom/DOMImplementation.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698