Title: [246667] trunk/Source/WebInspectorUI
Revision
246667
Author
drou...@apple.com
Date
2019-06-20 18:21:08 -0700 (Thu, 20 Jun 2019)

Log Message

Web Inspector: Error "null is not an object (evaluating 'syntaxTree.containersOfPosition')" when setting a breakpoint
https://bugs.webkit.org/show_bug.cgi?id=199082

Reviewed by Matt Baker.

* UserInterface/Views/SourceCodeTextEditor.js:
(WI.SourceCodeTextEditor.prototype.textEditorExecutionHighlightRange):
The script syntax tree may be fetched even if the resource hasn't finished parsing (or had
a syntax error), so it's possible for it to be `null`.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (246666 => 246667)


--- trunk/Source/WebInspectorUI/ChangeLog	2019-06-21 00:54:10 UTC (rev 246666)
+++ trunk/Source/WebInspectorUI/ChangeLog	2019-06-21 01:21:08 UTC (rev 246667)
@@ -1,5 +1,17 @@
 2019-06-20  Devin Rousso  <drou...@apple.com>
 
+        Web Inspector: Error "null is not an object (evaluating 'syntaxTree.containersOfPosition')" when setting a breakpoint
+        https://bugs.webkit.org/show_bug.cgi?id=199082
+
+        Reviewed by Matt Baker.
+
+        * UserInterface/Views/SourceCodeTextEditor.js:
+        (WI.SourceCodeTextEditor.prototype.textEditorExecutionHighlightRange):
+        The script syntax tree may be fetched even if the resource hasn't finished parsing (or had
+        a syntax error), so it's possible for it to be `null`.
+
+2019-06-20  Devin Rousso  <drou...@apple.com>
+
         Web Inspector: Dark Mode: inactive tab bar item should get darker on hover
         https://bugs.webkit.org/show_bug.cgi?id=199022
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js (246666 => 246667)


--- trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js	2019-06-21 00:54:10 UTC (rev 246666)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js	2019-06-21 01:21:08 UTC (rev 246667)
@@ -1437,6 +1437,12 @@
         };
 
         script.requestScriptSyntaxTree((syntaxTree) => {
+            // After requesting the tree, we still might get a null tree from a parse error.
+            if (!syntaxTree) {
+                callback(null);
+                return;
+            }
+
             // Convert to the position within the inline script before querying the AST.
             position = toInlineScriptPosition(position);
             let nodes = syntaxTree.containersOfPosition(position);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to