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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp

Issue 2441593002: binding: Returns a reject promise when |this| is not of the type. (Closed)
Patch Set: Updated test expectations. Created 4 years, 1 month 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: third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp b/third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp
index 48ff77f002da982cb841cd018538ca80325786dd..8a3df77e4877cf8b074b28d56d9129a3bf447cb8 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp
@@ -358,6 +358,13 @@ void installMethodInternal(v8::Isolate* isolate,
v8::Local<v8::Name> name = method.methodName(isolate);
v8::FunctionCallback callback = method.callbackForWorld(world);
+ // Promise-returning functions need to return a reject promise when
+ // an exception occurs. This includes a case that the receiver object is not
+ // of the type. So, we disable the type check of the receiver object on V8
+ // side so that V8 won't throw. Instead, we do the check on Blink side and
+ // convert an exception to a reject promise.
+ if (method.holderCheckConfiguration == V8DOMConfiguration::DoNotCheckHolder)
+ signature = v8::Local<v8::Signature>();
DCHECK(method.propertyLocationConfiguration);
if (method.propertyLocationConfiguration &
@@ -404,6 +411,13 @@ void installMethodInternal(
v8::Local<v8::Name> name = method.methodName(isolate);
v8::FunctionCallback callback = method.callbackForWorld(world);
+ // Promise-returning functions need to return a reject promise when
+ // an exception occurs. This includes a case that the receiver object is not
+ // of the type. So, we disable the type check of the receiver object on V8
+ // side so that V8 won't throw. Instead, we do the check on Blink side and
+ // convert an exception to a reject promise.
+ if (method.holderCheckConfiguration == V8DOMConfiguration::DoNotCheckHolder)
+ signature = v8::Local<v8::Signature>();
DCHECK(method.propertyLocationConfiguration);
if (method.propertyLocationConfiguration &

Powered by Google App Engine
This is Rietveld 408576698