File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,11 @@ var stringify = require('../vendor/json-stringify-safe/stringify');
33var _window =
44 typeof window !== 'undefined'
55 ? window
6- : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : { } ;
6+ : typeof global !== 'undefined'
7+ ? global
8+ : typeof self !== 'undefined'
9+ ? self
10+ : { } ;
711
812function isObject ( what ) {
913 return typeof what === 'object' && what !== null ;
@@ -417,6 +421,9 @@ function isSameStacktrace(stack1, stack2) {
417421 var frames1 = stack1 . frames ;
418422 var frames2 = stack2 . frames ;
419423
424+ // Exit early if stacktrace is malformed
425+ if ( frames1 === undefined || frames2 === undefined ) return false ;
426+
420427 // Exit early if frame count differs
421428 if ( frames1 . length !== frames2 . length ) return false ;
422429
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ var truncate = utils.truncate;
2525var urlencode = utils . urlencode ;
2626var htmlTreeAsString = utils . htmlTreeAsString ;
2727var htmlElementAsString = utils . htmlElementAsString ;
28+ var isSameStacktrace = utils . isSameStacktrace ;
2829var parseUrl = utils . parseUrl ;
2930var safeJoin = utils . safeJoin ;
3031var serializeException = utils . serializeException ;
@@ -357,6 +358,17 @@ describe('utils', function() {
357358 } ) ;
358359 } ) ;
359360
361+ describe ( 'isSameStacktrace' , function ( ) {
362+ it ( 'does not fail if frames are not present' , function ( ) {
363+ var validStack = { frames : [ ] } ;
364+ var invalidStack = { } ;
365+ var invalidResult = isSameStacktrace ( validStack , invalidStack ) ;
366+ assert . equal ( invalidResult , false ) ;
367+ invalidResult = isSameStacktrace ( invalidStack , validStack ) ;
368+ assert . equal ( invalidResult , false ) ;
369+ } ) ;
370+ } ) ;
371+
360372 describe ( 'parseUrl' , function ( ) {
361373 it ( 'should parse fully qualified URLs' , function ( ) {
362374 assert . deepEqual ( parseUrl ( 'http://example.com/foo' ) , {
You can’t perform that action at this time.
0 commit comments