From 493c5e5638a79b4d5886171867a06275cc703b00 Mon Sep 17 00:00:00 2001 From: Alex Kotliarskyi Date: Thu, 16 Apr 2015 10:51:12 -0700 Subject: [PATCH] Add support for JavaScriptCore --- lib/stacktrace-parser.js | 2 +- test/stacktrace_parser_test.js | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/lib/stacktrace-parser.js b/lib/stacktrace-parser.js index 6698638..1453f95 100644 --- a/lib/stacktrace-parser.js +++ b/lib/stacktrace-parser.js @@ -9,7 +9,7 @@ var StackTraceParser = { */ parse: function(stackString) { var chrome = /^\s*at (?:(?:(?:Anonymous function)?|((?:\[object object\])?\S+(?: \[as \S+\])?)) )?\(?((?:file|http|https):.*?):(\d+)(?::(\d+))?\)?\s*$/i, - gecko = /^(?:\s*(\S*)(?:\((.*?)\))?@)?((?:file|http|https).*?):(\d+)(?::(\d+))?\s*$/i, + gecko = /^(?:\s*(\S*)(?:\((.*?)\))?@)?((?:\w).*?):(\d+)(?::(\d+))?\s*$/i, node = /^\s*at (?:((?:\[object object\])?\S+(?: \[as \S+\])?) )?\(?(.*?):(\d+)(?::(\d+))?\)?\s*$/i, lines = stackString.split('\n'), stack = [], diff --git a/test/stacktrace_parser_test.js b/test/stacktrace_parser_test.js index 8a43680..8696870 100644 --- a/test/stacktrace_parser_test.js +++ b/test/stacktrace_parser_test.js @@ -157,6 +157,30 @@ describe('StackTraceParser', function() { column: 580 } ] } ], + 'JavaScriptCore': [ + { + from: "timeoutWithName@stack_traces/test:83:55\nwrapped@bandage.js:51:30", + to: [ { file: 'stack_traces/test', + methodName: 'timeoutWithName', + lineNumber: 83, + column: 55 }, + { file: 'bandage.js', + methodName: 'wrapped', + lineNumber: 51, + column: 30 } ] + }, + { + from: "timeoutWithName@stack_traces/test:83:55\nwrapped@42start-with-number.js:51:30", + to: [ { file: 'stack_traces/test', + methodName: 'timeoutWithName', + lineNumber: 83, + column: 55 }, + { file: '42start-with-number.js', + methodName: 'wrapped', + lineNumber: 51, + column: 30 } ] + } + ], 'Internet Explorer': [ { from: "Error: with timeout and named func\n at timeoutWithName (http://bandage.jaz-lounge.com/stack_traces/test:83:9)\n at wrapped (http://bandage.jaz-lounge.com/bandage.js:51:13)",