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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/ExceptionState.cpp

Issue 1952893003: Implement custom element construction and some 'define' checks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use DCHECK, revert RuntimeEnabledFeatures.in. Created 4 years, 7 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
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;

Powered by Google App Engine
This is Rietveld 408576698