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

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

Issue 181173002: ScriptPromise should check the constructor paraemter. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 6 years, 10 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 | « no previous file | Source/bindings/v8/ScriptPromise.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/v8/ScriptPromise.h
diff --git a/Source/bindings/v8/ScriptPromise.h b/Source/bindings/v8/ScriptPromise.h
index a4fe2bedd55974b31d01a5b1e68e3b76935afccf..13e21ec9f1a5dda222c816d472e12def8d30f563 100644
--- a/Source/bindings/v8/ScriptPromise.h
+++ b/Source/bindings/v8/ScriptPromise.h
@@ -52,17 +52,9 @@ public:
// Constructs an empty promise.
ScriptPromise() { }
- // Constructs a ScriptPromise from |value|.
- // i.e. the constructed ScriptPromise holds |Promise.cast(value)|.
- // Note: if |value| is a non-Promise value, two ScriptPromises constructed
- // with it hold different Promises each other.
- explicit ScriptPromise(const ScriptValue& /* value */);
-
- ScriptPromise(v8::Handle<v8::Value> promise, v8::Isolate* isolate)
- : m_promise(promise, isolate)
- {
- ASSERT(!m_promise.hasNoValue());
- }
+ // Constructs a ScriptPromise from |promise|.
+ // If |promise| is not a Promise object, throws a v8 TypeError.
+ ScriptPromise(v8::Handle<v8::Value> promise, v8::Isolate*);
ScriptPromise then(PassOwnPtr<ScriptFunction> onFulfilled, PassOwnPtr<ScriptFunction> onRejected = PassOwnPtr<ScriptFunction>());
@@ -103,6 +95,10 @@ public:
static ScriptPromise createPending();
static ScriptPromise createPending(ExecutionContext*);
+ // Constructs and returns a ScriptPromise from |value|.
+ // if |value| is not a Promise object, returns a Promise object
+ // resolved with |value|.
+ static ScriptPromise cast(const ScriptValue& /*value*/);
private:
ScriptValue m_promise;
« no previous file with comments | « no previous file | Source/bindings/v8/ScriptPromise.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698