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

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

Issue 2834463002: Move CreateDOMException out of V8ThrowException (Closed)
Patch Set: Add comments Created 3 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/bindings/core/v8/V8ThrowDOMException.h
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8ThrowDOMException.h b/third_party/WebKit/Source/bindings/core/v8/V8ThrowDOMException.h
new file mode 100644
index 0000000000000000000000000000000000000000..fa7740e08cc61bad29a21141a946f994f3625b65
--- /dev/null
+++ b/third_party/WebKit/Source/bindings/core/v8/V8ThrowDOMException.h
@@ -0,0 +1,41 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef V8ThrowDOMException_h
+#define V8ThrowDOMException_h
+
+#include "core/CoreExport.h"
+#include "core/dom/ExceptionCode.h"
+#include "platform/wtf/Allocator.h"
+#include "platform/wtf/text/WTFString.h"
+#include "v8/include/v8.h"
+
+namespace blink {
+
+// Provides utility functions to create and/or throw DOM Exceptions.
+class CORE_EXPORT V8ThrowDOMException {
+ STATIC_ONLY(V8ThrowDOMException);
+
+ 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& sanitized_message,
+ const String& unsanitized_message = String());
+
+ // Creates and throws an exception object, or does nothing if creation of the
+ // DOMException fails. |unsanitizedMessage| should not be specified unless
+ // it's SecurityError.
+ static void ThrowDOMException(v8::Isolate*,
+ ExceptionCode,
+ const String& sanitized_message,
+ const String& unsanitized_message = String());
+};
+
+} // namespace blink
+
+#endif // V8ThrowDOMException_h

Powered by Google App Engine
This is Rietveld 408576698