Web Inspector: Logging a native function to the console, such as `alert`, produces...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 16 Feb 2019 06:41:55 +0000 (06:41 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 16 Feb 2019 06:41:55 +0000 (06:41 +0000)
https://bugs.webkit.org/show_bug.cgi?id=194740

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2019-02-15
Reviewed by Matt Baker.

* UserInterface/Protocol/RemoteObject.js:
(WI.RemoteObject.prototype.findFunctionSourceCodeLocation):
In case of a protocol error (common when attempting to get a location
for a native function) produce the NoSourceFound result.

* UserInterface/Views/ConsoleMessageView.js:
(WI.ConsoleMessageView.prototype._appendLocationLink):
Simplify with an arrow function.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241643 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Protocol/RemoteObject.js
Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.js

index 7c32d0c..0a03199 100644 (file)
@@ -1,5 +1,21 @@
 2019-02-15  Joseph Pecoraro  <pecoraro@apple.com>
 
+        Web Inspector: Logging a native function to the console, such as `alert`, produces unhandled rejection
+        https://bugs.webkit.org/show_bug.cgi?id=194740
+
+        Reviewed by Matt Baker.
+
+        * UserInterface/Protocol/RemoteObject.js:
+        (WI.RemoteObject.prototype.findFunctionSourceCodeLocation):
+        In case of a protocol error (common when attempting to get a location
+        for a native function) produce the NoSourceFound result.
+
+        * UserInterface/Views/ConsoleMessageView.js:
+        (WI.ConsoleMessageView.prototype._appendLocationLink):
+        Simplify with an arrow function.
+
+2019-02-15  Joseph Pecoraro  <pecoraro@apple.com>
+
         Web Inspector: Some timelines views work, show Legacy CPU timeline
         https://bugs.webkit.org/show_bug.cgi?id=194738
 
index 160cc7e..bf2317c 100644 (file)
@@ -610,7 +610,7 @@ WI.RemoteObject = class RemoteObject
 
         this._target.DebuggerAgent.getFunctionDetails(this._objectId, (error, response) => {
             if (error) {
-                result.reject(error);
+                result.resolve(WI.RemoteObject.SourceCodeLocationPromise.NoSourceFound);
                 return;
             }
 
index de6ec24..4cf58fd 100644 (file)
@@ -354,7 +354,7 @@ WI.ConsoleMessageView = class ConsoleMessageView extends WI.Object
         if (this._message.parameters && this._message.parameters.length === 1) {
             var parameter = this._createRemoteObjectIfNeeded(this._message.parameters[0]);
 
-            parameter.findFunctionSourceCodeLocation().then(function(result) {
+            parameter.findFunctionSourceCodeLocation().then((result) => {
                 if (result === WI.RemoteObject.SourceCodeLocationPromise.NoSourceFound || result === WI.RemoteObject.SourceCodeLocationPromise.MissingObjectId)
                     return;
 
@@ -365,7 +365,7 @@ WI.ConsoleMessageView = class ConsoleMessageView extends WI.Object
                     this._element.insertBefore(link, this._element.firstChild);
                 else
                     this._element.appendChild(link);
-            }.bind(this));
+            });
         }
     }