Bug 964700 - Make the errors logged by Parser.jsm also contain the problematic source url, r=past
☠☠ backed out by 224fceb749a2 ☠ ☠
authorVictor Porof <vporof@mozilla.com>
Tue, 28 Jan 2014 13:24:45 +0200
changeset 165561 a76a4f9219876a3eeded0989d3dddd0432cd6ac9
parent 165560 4ff11d0219ccc1a108eb8512d6760001fde264f4
child 165562 158bd11e115729c44259cf063b5f002aa9d79018
push id26097
push userryanvm@gmail.com
push dateTue, 28 Jan 2014 21:18:27 +0000
treeherdermozilla-central@128c86a925d7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspast
bugs964700
milestone29.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 964700 - Make the errors logged by Parser.jsm also contain the problematic source url, r=past
browser/devtools/shared/Parser.jsm
toolkit/devtools/DevToolsUtils.js
--- a/browser/devtools/shared/Parser.jsm
+++ b/browser/devtools/shared/Parser.jsm
@@ -80,17 +80,17 @@ Parser.prototype = {
           syntaxTrees.push(new SyntaxTree(nodes, aUrl, length, offset));
         } catch (e) {
           this.errors.push(e);
           DevToolsUtils.reportException(aUrl, e);
         }
       }
     }
 
-    let pool = new SyntaxTreesPool(syntaxTrees);
+    let pool = new SyntaxTreesPool(syntaxTrees, aUrl);
 
     // Cache the syntax trees pool by the specified url. This is entirely
     // optional, but it's strongly encouraged to cache ASTs because
     // generating them can be costly with big/complex sources.
     if (aUrl) {
       this._cache.set(aUrl, pool);
     }
 
@@ -118,19 +118,22 @@ Parser.prototype = {
   errors: null
 };
 
 /**
  * A pool handling a collection of AST nodes generated by the reflection API.
  *
  * @param object aSyntaxTrees
  *        A collection of AST nodes generated for a source.
+ * @param string aUrl [optional]
+ *        The source url.
  */
-function SyntaxTreesPool(aSyntaxTrees) {
+function SyntaxTreesPool(aSyntaxTrees, aUrl = "<unknown>") {
   this._trees = aSyntaxTrees;
+  this._url = aUrl;
   this._cache = new Map();
 }
 
 SyntaxTreesPool.prototype = {
   /**
    * @see SyntaxTree.prototype.getIdentifierAt
    */
   getIdentifierAt: function({ line, column, scriptIndex }) {
@@ -210,17 +213,17 @@ SyntaxTreesPool.prototype = {
           parseResults.scriptLength = syntaxTree.length;
           parseResults.scriptOffset = syntaxTree.offset;
           results.push(parseResults);
         }
       } catch (e) {
         // Can't guarantee that the tree traversal logic is forever perfect :)
         // Language features may be added, in which case the recursive methods
         // need to be updated. If an exception is thrown here, file a bug.
-        DevToolsUtils.reportException("syntax tree", e);
+        DevToolsUtils.reportException("Syntax tree visitor for " + aUrl, e);
       }
     }
     this._cache.set(requestId, results);
     return results;
   },
 
   _trees: null,
   _cache: null
--- a/toolkit/devtools/DevToolsUtils.js
+++ b/toolkit/devtools/DevToolsUtils.js
@@ -24,17 +24,17 @@ this.safeErrorString = function safeErro
           let stack = aError.stack.toString();
           if (typeof stack == "string") {
             errorString += "\nStack: " + stack;
           }
         }
       } catch (ee) { }
 
       if (typeof aError.lineNumber == "number" && typeof aError.columnNumber == "number") {
-        errorString += ", line: " + aError.lineNumber + ", column: " + aError.columnNumber;
+        errorString += "Line: " + aError.lineNumber + ", column: " + aError.columnNumber;
       }
 
       return errorString;
     }
   } catch (ee) { }
 
   return "<failed trying to find error description>";
 }