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

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 the test expectation. Created 4 years, 2 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: 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 1f7d79ad77138ed6a703d0afcebaaea6af7ebb0f..9da0f711e995627fb3472eb62a45ed2a77e69a57 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp
@@ -305,6 +305,13 @@ void installMethodInternal(v8::Isolate* isolate,
v8::Local<v8::Name> name = method.methodName(isolate);
v8::FunctionCallback callback = method.callbackForWorld(world);
+ // Promise-returning DOM operations 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 &
@@ -351,6 +358,13 @@ void installMethodInternal(
v8::Local<v8::Name> name = method.methodName(isolate);
v8::FunctionCallback callback = method.callbackForWorld(world);
+ // Promise-returning DOM operations 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