Bug 964700 - Make the errors logged by Parser.jsm also contain the problematic source url, r=past
authorVictor Porof <vporof@mozilla.com>
Tue, 28 Jan 2014 12:31:51 +0200
changeset 165577 e24712ca61f0d76a05ee1531dd454aaae3c57261
parent 165576 bd1aa4c7fbb5157fb209c7918debbe85e8744192
child 165578 dc2496527dd5d0b6b23c2f3715c403e52d9198d8
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>";
 }