@@ -24,52 +24,9 @@ function createIframe(done) {
24
24
}
25
25
26
26
describe ( 'integration' , function ( ) {
27
- var timeoutStackDepth = 0 ;
28
- var eventHandlerStackDepth = 0 ;
29
-
30
- before ( function ( done ) {
31
- // Before running any tests, throw/catch a known error
32
- // inside setTimeout to get a baseline expected stack
33
- // depth for future errors (this is different in every
34
- // browser).
35
- var iframe = createIframe ( function ( ) {
36
- iframe . contentWindow . setTimeout ( function ( ) {
37
- try {
38
- iframe . contentWindow . foo ( ) ;
39
- } catch ( e ) {
40
- var trace = Raven . TraceKit . computeStackTrace ( e ) ;
41
- timeoutStackDepth = trace . stack . length ;
42
- }
43
-
44
- var doc = iframe . contentWindow . document ;
45
- var div = doc . createElement ( 'div' ) ;
46
- doc . body . appendChild ( div ) ;
47
- div . addEventListener ( 'click' , function ( ) {
48
- try {
49
- foo ( ) ;
50
- } catch ( e ) {
51
- var trace = Raven . TraceKit . computeStackTrace ( e ) ;
52
- eventHandlerStackDepth = trace . stack . length ;
53
- }
54
- } , false ) ;
55
-
56
- var evt ;
57
- if ( doc . createEvent ) {
58
- evt = doc . createEvent ( 'MouseEvents' ) ;
59
- evt . initEvent ( 'click' , true , false ) ;
60
- div . dispatchEvent ( evt ) ;
61
- } else if ( doc . createEventObject ) {
62
- div . fireEvent ( 'onclick' ) ;
63
- }
64
-
65
- document . body . removeChild ( iframe ) ;
66
- done ( ) ;
67
- } ) ;
68
- } ) ;
69
- } ) ;
70
27
71
28
beforeEach ( function ( done ) {
72
- var iframe = this . iframe = createIframe ( done ) ;
29
+ this . iframe = createIframe ( done ) ;
73
30
} ) ;
74
31
75
32
afterEach ( function ( ) {
@@ -136,7 +93,7 @@ describe('integration', function () {
136
93
} ,
137
94
function ( ) {
138
95
var ravenData = iframe . contentWindow . ravenData ;
139
- assert . equal ( ravenData . exception . values [ 0 ] . stacktrace . frames . length , eventHandlerStackDepth + 1 ) ;
96
+ assert . isAbove ( ravenData . exception . values [ 0 ] . stacktrace . frames . length , 2 ) ;
140
97
}
141
98
) ;
142
99
} ) ;
@@ -182,7 +139,7 @@ describe('integration', function () {
182
139
} ,
183
140
function ( ) {
184
141
var ravenData = iframe . contentWindow . ravenData ;
185
- assert . equal ( ravenData . exception . values [ 0 ] . stacktrace . frames . length , timeoutStackDepth ) ;
142
+ assert . isAbove ( ravenData . exception . values [ 0 ] . stacktrace . frames . length , 2 ) ;
186
143
}
187
144
) ;
188
145
} ) ;
@@ -200,7 +157,7 @@ describe('integration', function () {
200
157
} ,
201
158
function ( ) {
202
159
var ravenData = iframe . contentWindow . ravenData ;
203
- assert . equal ( ravenData . exception . values [ 0 ] . stacktrace . frames . length , timeoutStackDepth ) ;
160
+ assert . isAbove ( ravenData . exception . values [ 0 ] . stacktrace . frames . length , 2 ) ;
204
161
}
205
162
) ;
206
163
} ) ;
@@ -219,7 +176,7 @@ describe('integration', function () {
219
176
} ,
220
177
function ( ) {
221
178
var ravenData = iframe . contentWindow . ravenData ;
222
- assert . equal ( ravenData . exception . values [ 0 ] . stacktrace . frames . length , timeoutStackDepth ) ;
179
+ assert . isAbove ( ravenData . exception . values [ 0 ] . stacktrace . frames . length , 2 ) ;
223
180
}
224
181
) ;
225
182
} ) ;
@@ -241,7 +198,7 @@ describe('integration', function () {
241
198
var ravenData = iframe . contentWindow . ravenData ;
242
199
console . log ( ravenData ) ;
243
200
// # of frames alter significantly between chrome/firefox & safari
244
- assert . isTrue ( ravenData . exception . values [ 0 ] . stacktrace . frames . length >= 4 ) ;
201
+ assert . isAbove ( ravenData . exception . values [ 0 ] . stacktrace . frames . length , 2 ) ;
245
202
}
246
203
) ;
247
204
} ) ;
0 commit comments