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

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, 5 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: Source/bindings/core/v8/ScriptPromise.h
diff --git a/Source/bindings/core/v8/ScriptPromise.h b/Source/bindings/core/v8/ScriptPromise.h
index 8d87a4dc78e0264cc07218146176f13d26762606..c912661f62053b0beb08c71102ab45fbcd013de7 100644
--- a/Source/bindings/core/v8/ScriptPromise.h
+++ b/Source/bindings/core/v8/ScriptPromise.h
@@ -33,14 +33,17 @@
#include "bindings/core/v8/ScriptFunction.h"
#include "bindings/core/v8/ScriptValue.h"
+#include "bindings/core/v8/V8ThrowException.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 +118,23 @@ public:
static ScriptPromise rejectWithDOMException(ScriptState*, PassRefPtrWillBeRawPtr<DOMException>);
+ // static functions each of which returns a ScriptPromise rejected with
haraken 2014/08/01 17:04:24 Add a FIXME to remove these functions.
yhirano 2014/08/04 01:42:08 Done.
+ // the given error.
+ // They coresspond to functions in V8Binding.h, such as throwError,
+ // throwTypeError, etc.
+ static ScriptPromise rejectWithError(ScriptState*, V8ErrorType, const String&);
+ 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 {

Powered by Google App Engine
This is Rietveld 408576698