Bug 1622153 - Ignore optimized-out scripts for breakpoint processing. r=jlast
authorLogan Smyth <loganfsmyth@gmail.com>
Fri, 13 Mar 2020 15:18:24 +0000
changeset 518881 4c0c09659c77558c85f0539544b8e860b17bb500
parent 518880 a0a22903ead2159fa58985684158462de0a62891
child 518882 5f2127c05157c5a264d4729447c06cd8cea8614d
push id37218
push userrmaries@mozilla.com
push dateMon, 16 Mar 2020 09:28:04 +0000
treeherdermozilla-central@6199f7b91e8b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjlast
bugs1622153
milestone76.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1622153 - Ignore optimized-out scripts for breakpoint processing. r=jlast Differential Revision: https://phabricator.services.mozilla.com/D66707
devtools/server/actors/source.js
--- a/devtools/server/actors/source.js
+++ b/devtools/server/actors/source.js
@@ -478,17 +478,25 @@ const SourceActor = ActorClassWithSpec(s
 
     const rv = [];
     addMatchingScripts(scripts);
     return rv;
 
     function scriptMatches(script) {
       // These tests are approximate, as we can't easily get the script's end
       // column.
-      const lineCount = script.lineCount;
+      let lineCount;
+      try {
+        lineCount = script.lineCount;
+      } catch (err) {
+        // Accessing scripts which were optimized out during parsing can throw
+        // an exception. Tolerate these so that we can still get positions for
+        // other scripts in the source.
+        return false;
+      }
 
       if (
         script.startLine > endLine ||
         script.startLine + lineCount <= startLine ||
         (script.startLine == endLine && script.startColumn > endColumn)
       ) {
         return false;
       }
@@ -517,27 +525,17 @@ const SourceActor = ActorClassWithSpec(s
   getBreakpointPositions: async function(query) {
     const scripts = this._findDebuggeeScripts(
       query,
       /* forBreakpoiontPositions */ true
     );
 
     const positions = [];
     for (const script of scripts) {
-      try {
-        await this._addScriptBreakpointPositions(query, script, positions);
-      } catch (e) {
-        // Accessing scripts which were optimized out during parsing can throw
-        // an exception. Tolerate these so that we can still get positions for
-        // other scripts in the source.
-        reportError(
-          e,
-          "Got an exception during SA_addScriptBreakpointPositions: "
-        );
-      }
+      await this._addScriptBreakpointPositions(query, script, positions);
     }
 
     return (
       positions
         // Sort the items by location.
         .sort((a, b) => {
           const lineDiff = a.line - b.line;
           return lineDiff === 0 ? a.column - b.column : lineDiff;