OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 else if (m_context == IndexedGetterContext) | 137 else if (m_context == IndexedGetterContext) |
138 processedMessage = | 138 processedMessage = |
139 ExceptionMessages::failedToGetIndexed(interfaceName(), message); | 139 ExceptionMessages::failedToGetIndexed(interfaceName(), message); |
140 else if (m_context == IndexedSetterContext) | 140 else if (m_context == IndexedSetterContext) |
141 processedMessage = | 141 processedMessage = |
142 ExceptionMessages::failedToSetIndexed(interfaceName(), message); | 142 ExceptionMessages::failedToSetIndexed(interfaceName(), message); |
143 } | 143 } |
144 return processedMessage; | 144 return processedMessage; |
145 } | 145 } |
146 | 146 |
| 147 NonThrowableExceptionState::NonThrowableExceptionState() |
| 148 : ExceptionState(nullptr, ExceptionState::UnknownContext, nullptr, nullptr), |
| 149 m_file(""), |
| 150 m_line(0) {} |
| 151 |
| 152 NonThrowableExceptionState::NonThrowableExceptionState(const char* file, |
| 153 int line) |
| 154 : ExceptionState(nullptr, ExceptionState::UnknownContext, nullptr, nullptr), |
| 155 m_file(file), |
| 156 m_line(line) {} |
| 157 |
147 void NonThrowableExceptionState::throwDOMException(ExceptionCode ec, | 158 void NonThrowableExceptionState::throwDOMException(ExceptionCode ec, |
148 const String& message) { | 159 const String& message) { |
149 NOTREACHED(); | 160 DCHECK_AT(false, m_file, m_line) << "DOMExeption should not be thrown."; |
150 } | 161 } |
151 | 162 |
152 void NonThrowableExceptionState::throwRangeError(const String& message) { | 163 void NonThrowableExceptionState::throwRangeError(const String& message) { |
153 NOTREACHED(); | 164 DCHECK_AT(false, m_file, m_line) << "RangeError should not be thrown."; |
154 } | 165 } |
155 | 166 |
156 void NonThrowableExceptionState::throwSecurityError( | 167 void NonThrowableExceptionState::throwSecurityError( |
157 const String& sanitizedMessage, | 168 const String& sanitizedMessage, |
158 const String&) { | 169 const String&) { |
159 NOTREACHED(); | 170 DCHECK_AT(false, m_file, m_line) << "SecurityError should not be thrown."; |
160 } | 171 } |
161 | 172 |
162 void NonThrowableExceptionState::throwTypeError(const String& message) { | 173 void NonThrowableExceptionState::throwTypeError(const String& message) { |
163 NOTREACHED(); | 174 DCHECK_AT(false, m_file, m_line) << "TypeError should not be thrown."; |
164 } | 175 } |
165 | 176 |
166 void NonThrowableExceptionState::rethrowV8Exception(v8::Local<v8::Value>) { | 177 void NonThrowableExceptionState::rethrowV8Exception(v8::Local<v8::Value>) { |
167 NOTREACHED(); | 178 DCHECK_AT(false, m_file, m_line) << "An exception should not be rethrown."; |
168 } | 179 } |
169 | 180 |
170 void DummyExceptionStateForTesting::throwDOMException(ExceptionCode ec, | 181 void DummyExceptionStateForTesting::throwDOMException(ExceptionCode ec, |
171 const String& message) { | 182 const String& message) { |
172 setException(ec, message, v8::Local<v8::Value>()); | 183 setException(ec, message, v8::Local<v8::Value>()); |
173 } | 184 } |
174 | 185 |
175 void DummyExceptionStateForTesting::throwRangeError(const String& message) { | 186 void DummyExceptionStateForTesting::throwRangeError(const String& message) { |
176 setException(V8RangeError, message, v8::Local<v8::Value>()); | 187 setException(V8RangeError, message, v8::Local<v8::Value>()); |
177 } | 188 } |
178 | 189 |
179 void DummyExceptionStateForTesting::throwSecurityError( | 190 void DummyExceptionStateForTesting::throwSecurityError( |
180 const String& sanitizedMessage, | 191 const String& sanitizedMessage, |
181 const String&) { | 192 const String&) { |
182 setException(SecurityError, sanitizedMessage, v8::Local<v8::Value>()); | 193 setException(SecurityError, sanitizedMessage, v8::Local<v8::Value>()); |
183 } | 194 } |
184 | 195 |
185 void DummyExceptionStateForTesting::throwTypeError(const String& message) { | 196 void DummyExceptionStateForTesting::throwTypeError(const String& message) { |
186 setException(V8TypeError, message, v8::Local<v8::Value>()); | 197 setException(V8TypeError, message, v8::Local<v8::Value>()); |
187 } | 198 } |
188 | 199 |
189 void DummyExceptionStateForTesting::rethrowV8Exception(v8::Local<v8::Value>) { | 200 void DummyExceptionStateForTesting::rethrowV8Exception(v8::Local<v8::Value>) { |
190 setException(kRethrownException, String(), v8::Local<v8::Value>()); | 201 setException(kRethrownException, String(), v8::Local<v8::Value>()); |
191 } | 202 } |
192 | 203 |
193 } // namespace blink | 204 } // namespace blink |
OLD | NEW |