Index: third_party/WebKit/Source/bindings/core/v8/ExceptionState.cpp |
diff --git a/third_party/WebKit/Source/bindings/core/v8/ExceptionState.cpp b/third_party/WebKit/Source/bindings/core/v8/ExceptionState.cpp |
index 191f03d3b479194f68f80f5fbf6397e7c662c34c..6538e0f626b3769748737ba61683648c3d01c420 100644 |
--- a/third_party/WebKit/Source/bindings/core/v8/ExceptionState.cpp |
+++ b/third_party/WebKit/Source/bindings/core/v8/ExceptionState.cpp |
@@ -58,12 +58,12 @@ void ExceptionState::reject(ScriptPromiseResolver* resolver) |
void ExceptionState::throwDOMException(const ExceptionCode& ec, const String& message) |
{ |
- ASSERT(ec); |
- ASSERT(m_isolate); |
- ASSERT(!m_creationContext.IsEmpty()); |
+ DCHECK(ec); |
+ DCHECK(m_isolate); |
+ DCHECK(!m_creationContext.IsEmpty()); |
// SecurityError is thrown via ::throwSecurityError, and _careful_ consideration must be given to the data exposed to JavaScript via the 'sanitizedMessage'. |
- ASSERT(ec != SecurityError); |
+ DCHECK(ec != SecurityError); |
m_code = ec; |
String processedMessage = addExceptionContext(message); |
@@ -73,8 +73,8 @@ void ExceptionState::throwDOMException(const ExceptionCode& ec, const String& me |
void ExceptionState::throwSecurityError(const String& sanitizedMessage, const String& unsanitizedMessage) |
{ |
- ASSERT(m_isolate); |
- ASSERT(!m_creationContext.IsEmpty()); |
+ DCHECK(m_isolate); |
+ DCHECK(!m_creationContext.IsEmpty()); |
m_code = SecurityError; |
String finalSanitized = addExceptionContext(sanitizedMessage); |
m_message = finalSanitized; |
@@ -96,21 +96,29 @@ void ExceptionState::setException(v8::Local<v8::Value> exception) |
void ExceptionState::throwException() |
{ |
- ASSERT(!m_exception.isEmpty()); |
+ DCHECK(!m_exception.isEmpty()); |
V8ThrowException::throwException(m_exception.newLocal(m_isolate), m_isolate); |
} |
void ExceptionState::throwTypeError(const String& message) |
{ |
- ASSERT(m_isolate); |
+ DCHECK(m_isolate); |
m_code = V8TypeError; |
m_message = message; |
setException(V8ThrowException::createTypeError(m_isolate, addExceptionContext(message))); |
} |
+void ExceptionState::throwSyntaxError(const String& message) |
+{ |
+ DCHECK(m_isolate); |
+ m_code = V8SyntaxError; |
+ m_message = message; |
+ setException(V8ThrowException::createSyntaxError(m_isolate, addExceptionContext(message))); |
+} |
+ |
void ExceptionState::throwRangeError(const String& message) |
{ |
- ASSERT(m_isolate); |
+ DCHECK(m_isolate); |
m_code = V8RangeError; |
m_message = message; |
setException(V8ThrowException::createRangeError(m_isolate, addExceptionContext(message))); |
@@ -118,28 +126,35 @@ void ExceptionState::throwRangeError(const String& message) |
void NonThrowableExceptionState::throwDOMException(const ExceptionCode& ec, const String& message) |
{ |
- ASSERT_NOT_REACHED(); |
+ NOTREACHED(); |
m_code = ec; |
m_message = message; |
} |
void NonThrowableExceptionState::throwTypeError(const String& message) |
{ |
- ASSERT_NOT_REACHED(); |
+ NOTREACHED(); |
m_code = V8TypeError; |
m_message = message; |
} |
void NonThrowableExceptionState::throwSecurityError(const String& sanitizedMessage, const String&) |
{ |
- ASSERT_NOT_REACHED(); |
+ NOTREACHED(); |
m_code = SecurityError; |
m_message = sanitizedMessage; |
} |
+void NonThrowableExceptionState::throwSyntaxError(const String& message) |
+{ |
+ NOTREACHED(); |
+ m_code = V8SyntaxError; |
+ m_message = message; |
+} |
+ |
void NonThrowableExceptionState::throwRangeError(const String& message) |
{ |
- ASSERT_NOT_REACHED(); |
+ NOTREACHED(); |
m_code = V8RangeError; |
m_message = message; |
} |
@@ -162,6 +177,12 @@ void TrackExceptionState::throwSecurityError(const String& sanitizedMessage, con |
m_message = sanitizedMessage; |
} |
+void TrackExceptionState::throwSyntaxError(const String& message) |
+{ |
+ m_code = V8SyntaxError; |
+ m_message = message; |
+} |
+ |
void TrackExceptionState::throwRangeError(const String& message) |
{ |
m_code = V8RangeError; |