Bug 1446833: Part 3 - Match more common head.js filename patterns when filtering assertion stack frames. r?florian draft
authorKris Maglione <maglione.k@gmail.com>
Sun, 18 Mar 2018 15:32:47 -0700
changeset 769191 a65cfa697c4537872b50d6cbbe0f49dae4c16b63
parent 769190 7fd21a311567e1979e73494cc26b6ba04a36cf2b
child 769192 484948a133f9402850ee9d4ea40877bf8acdd7ed
push id103063
push usermaglione.k@gmail.com
push dateSun, 18 Mar 2018 23:28:42 +0000
reviewersflorian
bugs1446833
milestone61.0a1
Bug 1446833: Part 3 - Match more common head.js filename patterns when filtering assertion stack frames. r?florian The xpcshell harness tries to filter out head.js stack frames when reporting errors. When it fails, it tends to report strange error locations, with the name of a unit test file, but the line number of a line in a head file. This changes the filter to match more common head.js files, such as head_addons.js. MozReview-Commit-ID: FASWNSR0Noc
testing/xpcshell/head.js
--- a/testing/xpcshell/head.js
+++ b/testing/xpcshell/head.js
@@ -779,17 +779,17 @@ function do_note_exception(ex, text) {
   _testLogger.info(text + "Swallowed exception " + _exception_message(ex),
                    {
                      source_file: filename,
                      stack: _format_stack(ex.stack)
                    });
 }
 
 function do_report_result(passed, text, stack, todo) {
-  while (stack.filename.includes("head.js") && stack.caller) {
+  while (/(\/head(_.+)?|head)\.js$/.test(stack.filename) && stack.caller) {
     stack = stack.caller;
   }
 
   let name = _gRunningTest ? _gRunningTest.name : stack.name;
   let message;
   if (name) {
      message = "[" + name + " : " + stack.lineNumber + "] " + text;
   } else {