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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/V8ThrowException.h

Issue 2209203002: binding: Always throws an exception in the current realm. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed review comments. Created 4 years, 4 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/V8ThrowException.h
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8ThrowException.h b/third_party/WebKit/Source/bindings/core/v8/V8ThrowException.h
index 2eaaa25d3cac5c81acee15188612f80af3a10f7b..5f2f8785420bdb8cfb84768002e57b96b49caaa1 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8ThrowException.h
+++ b/third_party/WebKit/Source/bindings/core/v8/V8ThrowException.h
@@ -26,34 +26,40 @@
#define V8ThrowException_h
#include "core/CoreExport.h"
+#include "core/dom/ExceptionCode.h"
#include "wtf/Allocator.h"
#include "wtf/text/WTFString.h"
#include <v8.h>
namespace blink {
+// Provides utility functions to create and/or throw a V8 exception.
+// Mostly a set of wrapper functions for v8::Exception class.
class CORE_EXPORT V8ThrowException {
STATIC_ONLY(V8ThrowException);
public:
+ // Creates and returns an exception object, or returns an empty handle if
+ // failed. |unsanitizedMessage| should not be specified unless it's
+ // SecurityError.
+ static v8::Local<v8::Value> createDOMException(v8::Isolate*, ExceptionCode, const String& sanitizedMessage, const String& unsanitizedMessage = String());
- static v8::Local<v8::Value> createDOMException(v8::Isolate* isolate, int ec, const String& message, const v8::Local<v8::Object>& creationContext)
+ static void throwException(v8::Isolate* isolate, v8::Local<v8::Value> exception)
{
- return createDOMException(isolate, ec, message, String(), creationContext);
+ if (!isolate->IsExecutionTerminating())
+ isolate->ThrowException(exception);
}
- static v8::Local<v8::Value> createDOMException(v8::Isolate*, int, const String& sanitizedMessage, const String& unsanitizedMessage, const v8::Local<v8::Object>& creationContext);
-
- static v8::Local<v8::Value> throwException(v8::Local<v8::Value>, v8::Isolate*);
-
- static v8::Local<v8::Value> createGeneralError(v8::Isolate*, const String&);
- static v8::Local<v8::Value> throwGeneralError(v8::Isolate*, const String&);
- static v8::Local<v8::Value> createTypeError(v8::Isolate*, const String&);
- static v8::Local<v8::Value> throwTypeError(v8::Isolate*, const String&);
- static v8::Local<v8::Value> createRangeError(v8::Isolate*, const String&);
- static v8::Local<v8::Value> throwRangeError(v8::Isolate*, const String&);
- static v8::Local<v8::Value> createSyntaxError(v8::Isolate*, const String&);
- static v8::Local<v8::Value> throwSyntaxError(v8::Isolate*, const String&);
- static v8::Local<v8::Value> createReferenceError(v8::Isolate*, const String&);
- static v8::Local<v8::Value> throwReferenceError(v8::Isolate*, const String&);
+
+ static v8::Local<v8::Value> createGeneralError(v8::Isolate*, const String& message);
+ static v8::Local<v8::Value> createRangeError(v8::Isolate*, const String& message);
+ static v8::Local<v8::Value> createReferenceError(v8::Isolate*, const String& message);
+ static v8::Local<v8::Value> createSyntaxError(v8::Isolate*, const String& message);
+ static v8::Local<v8::Value> createTypeError(v8::Isolate*, const String& message);
+
+ static void throwGeneralError(v8::Isolate*, const String& message);
+ static void throwRangeError(v8::Isolate*, const String& message);
+ static void throwReferenceError(v8::Isolate*, const String& message);
+ static void throwSyntaxError(v8::Isolate*, const String& message);
+ static void throwTypeError(v8::Isolate*, const String& message);
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698