Web Inspector: Uncaught Exception: TypeError: null is not an object (evaluating ...
authordrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Aug 2019 04:24:50 +0000 (04:24 +0000)
committerdrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Aug 2019 04:24:50 +0000 (04:24 +0000)
https://bugs.webkit.org/show_bug.cgi?id=200296

Reviewed by Joseph Pecoraro.

When fetching all `WI.IssueMessage`s for a given `WI.SourceCode`, the `WI.IssueMessage` may
be associated in a different way (e.g. by url, instead of `WI.SourceCodeLocation`). As such,
we should pass the `WI.SourceCode` along, and use it when adding the `WI.IssueTreeElement`.

* UserInterface/Views/DebuggerSidebarPanel.js:
(WI.DebuggerSidebarPanel.prototype._addIssuesForSourceCode):
(WI.DebuggerSidebarPanel.prototype._addIssue):

* UserInterface/Views/SourcesNavigationSidebarPanel.js:
(WI.SourcesNavigationSidebarPanel.prototype._addIssue):
(WI.SourcesNavigationSidebarPanel.prototype._addIssuesForSourceCode):

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

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js
Source/WebInspectorUI/UserInterface/Views/SourcesNavigationSidebarPanel.js

index 104a4be..5cce5a8 100644 (file)
@@ -1,5 +1,24 @@
 2019-07-31  Devin Rousso  <drousso@apple.com>
 
+        Web Inspector: Uncaught Exception: TypeError: null is not an object (evaluating 'issueMessage.sourceCodeLocation.sourceCode')
+        https://bugs.webkit.org/show_bug.cgi?id=200296
+
+        Reviewed by Joseph Pecoraro.
+
+        When fetching all `WI.IssueMessage`s for a given `WI.SourceCode`, the `WI.IssueMessage` may
+        be associated in a different way (e.g. by url, instead of `WI.SourceCodeLocation`). As such,
+        we should pass the `WI.SourceCode` along, and use it when adding the `WI.IssueTreeElement`.
+
+        * UserInterface/Views/DebuggerSidebarPanel.js:
+        (WI.DebuggerSidebarPanel.prototype._addIssuesForSourceCode):
+        (WI.DebuggerSidebarPanel.prototype._addIssue):
+
+        * UserInterface/Views/SourcesNavigationSidebarPanel.js:
+        (WI.SourcesNavigationSidebarPanel.prototype._addIssue):
+        (WI.SourcesNavigationSidebarPanel.prototype._addIssuesForSourceCode):
+
+2019-07-31  Devin Rousso  <drousso@apple.com>
+
         Web Inspector: DOM: provide a way to disable/breakpoint all event listeners for a given DOM node or event type
         https://bugs.webkit.org/show_bug.cgi?id=200233
 
index 3b0ba74..8ff67fa 100644 (file)
@@ -584,7 +584,7 @@ WI.DebuggerSidebarPanel = class DebuggerSidebarPanel extends WI.NavigationSideba
     {
         var issues = WI.consoleManager.issuesForSourceCode(sourceCode);
         for (var issue of issues)
-            this._addIssue(issue);
+            this._addIssue(issue, sourceCode);
     }
 
     _addTreeElementForSourceCodeToTreeOutline(sourceCode, treeOutline)
@@ -1397,13 +1397,14 @@ WI.DebuggerSidebarPanel = class DebuggerSidebarPanel extends WI.NavigationSideba
         this._pauseReasonLinkContainerElement.appendChild(linkElement);
     }
 
-    _addIssue(issueMessage)
+    _addIssue(issueMessage, sourceCode)
     {
         let issueTreeElement = this._scriptsContentTreeOutline.findTreeElement(issueMessage);
         if (issueTreeElement)
             return issueTreeElement;
 
-        let parentTreeElement = this._addTreeElementForSourceCodeToTreeOutline(issueMessage.sourceCodeLocation.sourceCode, this._scriptsContentTreeOutline);
+        console.assert(sourceCode || (issueMessage.sourceCodeLocation && issueMessage.sourceCodeLocation.sourceCode));
+        let parentTreeElement = this._addTreeElementForSourceCodeToTreeOutline(sourceCode || issueMessage.sourceCodeLocation.sourceCode, this._scriptsContentTreeOutline);
         if (!parentTreeElement)
             return null;
 
index e950b3f..28e3725 100644 (file)
@@ -1025,11 +1025,12 @@ WI.SourcesNavigationSidebarPanel = class SourcesNavigationSidebarPanel extends W
         return breakpoints;
     }
 
-    _addIssue(issueMessage)
+    _addIssue(issueMessage, sourceCode)
     {
         let issueTreeElement = this._resourcesTreeOutline.findTreeElement(issueMessage);
         if (!issueTreeElement) {
-            let parentTreeElement = this._resourcesTreeOutline.findTreeElement(issueMessage.sourceCodeLocation.sourceCode);
+            console.assert(sourceCode || (issueMessage.sourceCodeLocation && issueMessage.sourceCodeLocation.sourceCode));
+            let parentTreeElement = this._resourcesTreeOutline.findTreeElement(sourceCode || issueMessage.sourceCodeLocation.sourceCode);
             if (!parentTreeElement)
                 return null;
 
@@ -1068,7 +1069,7 @@ WI.SourcesNavigationSidebarPanel = class SourcesNavigationSidebarPanel extends W
     _addIssuesForSourceCode(sourceCode)
     {
         for (let issue of WI.consoleManager.issuesForSourceCode(sourceCode))
-            this._addIssue(issue);
+            this._addIssue(issue, sourceCode);
     }
 
     _updateTemporarilyDisabledBreakpointsButtons()