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

Unified Diff: Source/core/testing/Internals.cpp

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/core/testing/Internals.h ('k') | Source/core/testing/Internals.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/testing/Internals.cpp
diff --git a/Source/core/testing/Internals.cpp b/Source/core/testing/Internals.cpp
index 4445e16ddabe4981f44c797fa74f9ea2bbcdfb86..2d6201d5b01abc6ac2bbb207212e0b1f706e6fce 100644
--- a/Source/core/testing/Internals.cpp
+++ b/Source/core/testing/Internals.cpp
@@ -2182,9 +2182,27 @@ ScriptPromise Internals::createRejectedPromise(ScriptState* scriptState, ScriptV
return promise;
}
-ScriptPromise Internals::addOneToPromise(ExecutionContext* context, ScriptPromise promise)
+ScriptPromise Internals::addOneToPromise(ScriptState* scriptState, ScriptPromise promise)
{
- return promise.then(AddOneFunction::create(context));
+ return promise.then(AddOneFunction::create(scriptState->executionContext()));
+}
+
+ScriptPromise Internals::promiseCheck(ScriptState* scriptState, long arg1, bool arg2, const Dictionary& arg3, const String& arg4, const Vector<String>& arg5, ExceptionState& exceptionState)
+{
+ if (arg2)
+ return ScriptPromise::cast(scriptState, v8String(scriptState->isolate(), "done"));
+ exceptionState.throwDOMException(InvalidStateError, "Thrown from the native implementation.");
+ return ScriptPromise();
+}
+
+ScriptPromise Internals::promiseCheckWithoutExceptionState(ScriptState* scriptState, const Dictionary& arg1, const String& arg2, const Vector<String>& arg3)
+{
+ return ScriptPromise::cast(scriptState, v8String(scriptState->isolate(), "done"));
+}
+
+ScriptPromise Internals::promiseCheckRange(ScriptState* scriptState, long arg1)
+{
+ return ScriptPromise::cast(scriptState, v8String(scriptState->isolate(), "done"));
}
void Internals::trace(Visitor* visitor)
« no previous file with comments | « Source/core/testing/Internals.h ('k') | Source/core/testing/Internals.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698