Title: [253801] trunk/Source/_javascript_Core
Revision
253801
Author
[email protected]
Date
2019-12-19 16:46:59 -0800 (Thu, 19 Dec 2019)

Log Message

Web Inspector: TypeError: InjectedScriptHost.isPromiseRejectedWithNativeGetterTypeError first argument must be a Promise
https://bugs.webkit.org/show_bug.cgi?id=205439

Reviewed by Brian Burg.

Before r244312, we noticed that when Web Inspector would preview native getters that return
a `Promise`, Web Inspector would prevent `rejectionhandled` events from being fired since it
would always add a `.catch(() => {}` to any `Promise` that it was about to instrument in the
Console to avoid errors being added to the Console while expanding/collapsing value previews.
In order to prevent this, logic was added so that the `.catch(() => {})` was only added if
the `Promise` was returned from a native getter, such as from a `PromiseRejectionEvent`.

In r244312, we made it such that this logic _required_ the `Promise` to already be rejected,
which is unnecessarily restrictive and not always the case nowadays. Instead, just check to
see if the result of the `Promise` is a native getter type error.

* inspector/JSInjectedScriptHost.cpp:
(Inspector::JSInjectedScriptHost::isPromiseRejectedWithNativeGetterTypeError):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (253800 => 253801)


--- trunk/Source/_javascript_Core/ChangeLog	2019-12-20 00:32:43 UTC (rev 253800)
+++ trunk/Source/_javascript_Core/ChangeLog	2019-12-20 00:46:59 UTC (rev 253801)
@@ -1,3 +1,24 @@
+2019-12-19  Devin Rousso  <[email protected]>
+
+        Web Inspector: TypeError: InjectedScriptHost.isPromiseRejectedWithNativeGetterTypeError first argument must be a Promise
+        https://bugs.webkit.org/show_bug.cgi?id=205439
+
+        Reviewed by Brian Burg.
+
+        Before r244312, we noticed that when Web Inspector would preview native getters that return
+        a `Promise`, Web Inspector would prevent `rejectionhandled` events from being fired since it
+        would always add a `.catch(() => {}` to any `Promise` that it was about to instrument in the
+        Console to avoid errors being added to the Console while expanding/collapsing value previews.
+        In order to prevent this, logic was added so that the `.catch(() => {})` was only added if
+        the `Promise` was returned from a native getter, such as from a `PromiseRejectionEvent`.
+
+        In r244312, we made it such that this logic _required_ the `Promise` to already be rejected,
+        which is unnecessarily restrictive and not always the case nowadays. Instead, just check to
+        see if the result of the `Promise` is a native getter type error.
+
+        * inspector/JSInjectedScriptHost.cpp:
+        (Inspector::JSInjectedScriptHost::isPromiseRejectedWithNativeGetterTypeError):
+
 2019-12-18  Devin Rousso  <[email protected]>
 
         Web Inspector: Elements: restrict showing paint flashing and compositing borders to the Web Inspector session

Modified: trunk/Source/_javascript_Core/inspector/JSInjectedScriptHost.cpp (253800 => 253801)


--- trunk/Source/_javascript_Core/inspector/JSInjectedScriptHost.cpp	2019-12-20 00:32:43 UTC (rev 253800)
+++ trunk/Source/_javascript_Core/inspector/JSInjectedScriptHost.cpp	2019-12-20 00:46:59 UTC (rev 253801)
@@ -169,8 +169,8 @@
     auto scope = DECLARE_THROW_SCOPE(vm);
 
     auto* promise = jsDynamicCast<JSPromise*>(vm, callFrame->argument(0));
-    if (!promise || promise->status(vm) != JSPromise::Status::Rejected)
-        return throwTypeError(globalObject, scope, "InjectedScriptHost.isPromiseRejectedWithNativeGetterTypeError first argument must be a rejected Promise."_s);
+    if (!promise)
+        return throwTypeError(globalObject, scope, "InjectedScriptHost.isPromiseRejectedWithNativeGetterTypeError first argument must be a Promise."_s);
 
     bool result = false;
     if (auto* errorInstance = jsDynamicCast<ErrorInstance*>(vm, promise->result(vm)))
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to