OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef V8ThrowDOMException_h |
| 6 #define V8ThrowDOMException_h |
| 7 |
| 8 #include "core/CoreExport.h" |
| 9 #include "core/dom/ExceptionCode.h" |
| 10 #include "platform/wtf/Allocator.h" |
| 11 #include "platform/wtf/text/WTFString.h" |
| 12 #include "v8/include/v8.h" |
| 13 |
| 14 namespace blink { |
| 15 |
| 16 // Provides utility functions to create and/or throw DOM Exceptions. |
| 17 class CORE_EXPORT V8ThrowDOMException { |
| 18 STATIC_ONLY(V8ThrowDOMException); |
| 19 |
| 20 public: |
| 21 // Creates and returns an exception object, or returns an empty handle if |
| 22 // failed. |unsanitizedMessage| should not be specified unless it's |
| 23 // SecurityError. |
| 24 static v8::Local<v8::Value> CreateDOMException( |
| 25 v8::Isolate*, |
| 26 ExceptionCode, |
| 27 const String& sanitized_message, |
| 28 const String& unsanitized_message = String()); |
| 29 |
| 30 // Creates and throws an exception object, or does nothing if creation of the |
| 31 // DOMException fails. |unsanitizedMessage| should not be specified unless |
| 32 // it's SecurityError. |
| 33 static void ThrowDOMException(v8::Isolate*, |
| 34 ExceptionCode, |
| 35 const String& sanitized_message, |
| 36 const String& unsanitized_message = String()); |
| 37 }; |
| 38 |
| 39 } // namespace blink |
| 40 |
| 41 #endif // V8ThrowDOMException_h |
OLD | NEW |