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

Unified Diff: Source/bindings/core/v8/ScriptPromise.h

Issue 232563003: API functions returning Promises should not throw exceptions. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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
« no previous file with comments | « Source/bindings/core/v8/ExceptionState.cpp ('k') | Source/bindings/core/v8/ScriptPromise.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/core/v8/ScriptPromise.h
diff --git a/Source/bindings/core/v8/ScriptPromise.h b/Source/bindings/core/v8/ScriptPromise.h
index 8d87a4dc78e0264cc07218146176f13d26762606..a7cc4f63481b63198868bc615d736fc4343c2e82 100644
--- a/Source/bindings/core/v8/ScriptPromise.h
+++ b/Source/bindings/core/v8/ScriptPromise.h
@@ -33,14 +33,18 @@
#include "bindings/core/v8/ScriptFunction.h"
#include "bindings/core/v8/ScriptValue.h"
+#include "bindings/core/v8/V8ThrowException.h"
+#include "core/dom/ExceptionCode.h"
#include "platform/heap/Handle.h"
#include "wtf/PassOwnPtr.h"
#include "wtf/PassRefPtr.h"
+#include "wtf/text/WTFString.h"
#include <v8.h>
namespace blink {
class DOMException;
+class ExceptionState;
// ScriptPromise is the class for representing Promise values in C++ world.
// ScriptPromise holds a Promise.
@@ -115,6 +119,23 @@ public:
static ScriptPromise rejectWithDOMException(ScriptState*, PassRefPtrWillBeRawPtr<DOMException>);
+ // static functions each of which returns a ScriptPromise rejected with
+ // the given error.
+ // They coresspond to functions in V8Binding.h, such as throwError,
+ // throwTypeError, etc.
+ // FIXME: Remove these functions.
+ static ScriptPromise rejectWithTypeError(ScriptState*, const String&);
+ static ScriptPromise rejectWithArityTypeErrorForMethod(ScriptState*, const char* method, const char* type, const char* valid, unsigned provided);
+ static ScriptPromise rejectWithArityTypeErrorForConstructor(ScriptState*, const char* type, const char* valid, unsigned provided);
+ static ScriptPromise rejectWithArityTypeError(ScriptState*, ExceptionState&, const char* valid, unsigned provided);
+ static ScriptPromise rejectWithMinimumArityTypeErrorForMethod(
+ ScriptState*, const char* method, const char* type, unsigned expected, unsigned providedLeastNumMandatoryParams);
+ static ScriptPromise rejectWithMinimumArityTypeErrorForConstructor(
+ ScriptState*, const char* type, unsigned expected, unsigned providedLeastNumMandatoryParams);
+ static ScriptPromise rejectWithMinimumArityTypeError(ScriptState*, ExceptionState&, unsigned expected, unsigned providedLeastNumMandatoryParams);
+
+ static v8::Local<v8::Promise> rejectRaw(v8::Isolate*, v8::Handle<v8::Value>);
+
// This is a utility class intended to be used internally.
// ScriptPromiseResolver is for general purpose.
class InternalResolver FINAL {
« no previous file with comments | « Source/bindings/core/v8/ExceptionState.cpp ('k') | Source/bindings/core/v8/ScriptPromise.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698