@@ -94,9 +94,7 @@ describe('integration', function() {
94
94
) ;
95
95
} ) ;
96
96
97
- it ( 'should generate a synthetic trace for captureException w/ non-errors' , function (
98
- done
99
- ) {
97
+ it ( 'should generate a synthetic trace for captureException w/ non-errors' , function ( done ) {
100
98
var iframe = this . iframe ;
101
99
iframeExecute (
102
100
iframe ,
@@ -114,9 +112,7 @@ describe('integration', function() {
114
112
) ;
115
113
} ) ;
116
114
117
- it ( 'should capture an Error object passed to Raven.captureException w/ maxMessageLength set (#647)' , function (
118
- done
119
- ) {
115
+ it ( 'should capture an Error object passed to Raven.captureException w/ maxMessageLength set (#647)' , function ( done ) {
120
116
var iframe = this . iframe ;
121
117
iframeExecute (
122
118
iframe ,
@@ -185,9 +181,7 @@ describe('integration', function() {
185
181
) ;
186
182
} ) ;
187
183
188
- it ( 'should not reject back-to-back errors with different stack traces' , function (
189
- done
190
- ) {
184
+ it ( 'should not reject back-to-back errors with different stack traces' , function ( done ) {
191
185
var iframe = this . iframe ;
192
186
iframeExecute (
193
187
iframe ,
@@ -236,9 +230,7 @@ describe('integration', function() {
236
230
) ;
237
231
} ) ;
238
232
239
- it ( 'should reject duplicate, back-to-back messages from captureMessage' , function (
240
- done
241
- ) {
233
+ it ( 'should reject duplicate, back-to-back messages from captureMessage' , function ( done ) {
242
234
var iframe = this . iframe ;
243
235
iframeExecute (
244
236
iframe ,
@@ -435,9 +427,7 @@ describe('integration', function() {
435
427
) ;
436
428
} ) ;
437
429
438
- it ( 'should catch an exception already caught [but rethrown] via Raven.captureException' , function (
439
- done
440
- ) {
430
+ it ( 'should catch an exception already caught [but rethrown] via Raven.captureException' , function ( done ) {
441
431
// unlike Raven.wrap which ALWAYS re-throws, we don't know if the user will
442
432
// re-throw an exception passed to Raven.captureException, and so we cannot
443
433
// automatically suppress the next error caught through window.onerror
@@ -493,9 +483,7 @@ describe('integration', function() {
493
483
) ;
494
484
} ) ;
495
485
496
- it ( 'should transparently remove event listeners from wrapped functions' , function (
497
- done
498
- ) {
486
+ it ( 'should transparently remove event listeners from wrapped functions' , function ( done ) {
499
487
var iframe = this . iframe ;
500
488
501
489
iframeExecute (
@@ -585,9 +573,7 @@ describe('integration', function() {
585
573
) ;
586
574
} ) ;
587
575
588
- it ( 'should capture exceptions from XMLHttpRequest event handlers (e.g. onreadystatechange)' , function (
589
- done
590
- ) {
576
+ it ( 'should capture exceptions from XMLHttpRequest event handlers (e.g. onreadystatechange)' , function ( done ) {
591
577
var iframe = this . iframe ;
592
578
593
579
iframeExecute (
@@ -618,6 +604,103 @@ describe('integration', function() {
618
604
}
619
605
) ;
620
606
} ) ;
607
+
608
+ it ( "should capture built-in's mechanism type as instrument" , function ( done ) {
609
+ var iframe = this . iframe ;
610
+
611
+ iframeExecute (
612
+ iframe ,
613
+ done ,
614
+ function ( ) {
615
+ setTimeout ( function ( ) {
616
+ setTimeout ( done ) ;
617
+ foo ( ) ;
618
+ } , 10 ) ;
619
+ } ,
620
+ function ( ) {
621
+ var ravenData = iframe . contentWindow . ravenData [ 0 ] ;
622
+ assert . deepEqual ( ravenData . exception . mechanism , {
623
+ type : 'instrument' ,
624
+ handled : true ,
625
+ data : { function : 'setTimeout' }
626
+ } ) ;
627
+ }
628
+ ) ;
629
+ } ) ;
630
+
631
+ it ( "should capture built-in's handlers fn name in mechanism data" , function ( done ) {
632
+ var iframe = this . iframe ;
633
+
634
+ iframeExecute (
635
+ iframe ,
636
+ done ,
637
+ function ( ) {
638
+ setTimeout ( done ) ;
639
+
640
+ var div = document . createElement ( 'div' ) ;
641
+ document . body . appendChild ( div ) ;
642
+ div . addEventListener (
643
+ 'click' ,
644
+ function namedFunction ( ) {
645
+ foo ( ) ;
646
+ } ,
647
+ false
648
+ ) ;
649
+
650
+ var click = new MouseEvent ( 'click' ) ;
651
+ div . dispatchEvent ( click ) ;
652
+ } ,
653
+ function ( ) {
654
+ var ravenData = iframe . contentWindow . ravenData [ 0 ] ;
655
+ assert . deepEqual ( ravenData . exception . mechanism , {
656
+ type : 'instrument' ,
657
+ handled : true ,
658
+ data : {
659
+ function : 'addEventListener' ,
660
+ handler : 'namedFunction' ,
661
+ target : 'EventTarget'
662
+ }
663
+ } ) ;
664
+ }
665
+ ) ;
666
+ } ) ;
667
+
668
+ it ( 'should fallback to <anonymous> fn name in mechanism data if one is unavailable' , function ( done ) {
669
+ var iframe = this . iframe ;
670
+
671
+ iframeExecute (
672
+ iframe ,
673
+ done ,
674
+ function ( ) {
675
+ setTimeout ( done ) ;
676
+
677
+ var div = document . createElement ( 'div' ) ;
678
+ document . body . appendChild ( div ) ;
679
+ div . addEventListener (
680
+ 'click' ,
681
+ function ( ) {
682
+ foo ( ) ;
683
+ } ,
684
+ false
685
+ ) ;
686
+
687
+ var click = new MouseEvent ( 'click' ) ;
688
+ div . dispatchEvent ( click ) ;
689
+ } ,
690
+ function ( ) {
691
+ var ravenData = iframe . contentWindow . ravenData [ 0 ] ;
692
+ assert . deepEqual ( ravenData . exception . mechanism , {
693
+ type : 'instrument' ,
694
+ handled : true ,
695
+ data : {
696
+ function : 'addEventListener' ,
697
+ handler : '<anonymous>' ,
698
+ target : 'EventTarget'
699
+ }
700
+ } ) ;
701
+ }
702
+ ) ;
703
+ } ) ;
621
704
} ) ;
622
705
623
706
describe ( 'breadcrumbs' , function ( ) {
@@ -689,9 +772,7 @@ describe('integration', function() {
689
772
) ;
690
773
} ) ;
691
774
692
- it ( 'should NOT denote XMLHttpRequests to the Sentry store endpoint as requiring breadcrumb capture' , function (
693
- done
694
- ) {
775
+ it ( 'should NOT denote XMLHttpRequests to the Sentry store endpoint as requiring breadcrumb capture' , function ( done ) {
695
776
var iframe = this . iframe ;
696
777
iframeExecute (
697
778
iframe ,
@@ -762,9 +843,7 @@ describe('integration', function() {
762
843
) ;
763
844
} ) ;
764
845
765
- it ( 'should record a fetch request with Request obj instead of URL string' , function (
766
- done
767
- ) {
846
+ it ( 'should record a fetch request with Request obj instead of URL string' , function ( done ) {
768
847
var iframe = this . iframe ;
769
848
770
849
iframeExecute (
@@ -864,9 +943,7 @@ describe('integration', function() {
864
943
) ;
865
944
} ) ;
866
945
867
- it ( 'should record a mouse click on element WITH click handler present' , function (
868
- done
869
- ) {
946
+ it ( 'should record a mouse click on element WITH click handler present' , function ( done ) {
870
947
var iframe = this . iframe ;
871
948
872
949
iframeExecute (
@@ -906,9 +983,7 @@ describe('integration', function() {
906
983
) ;
907
984
} ) ;
908
985
909
- it ( 'should record a mouse click on element WITHOUT click handler present' , function (
910
- done
911
- ) {
986
+ it ( 'should record a mouse click on element WITHOUT click handler present' , function ( done ) {
912
987
var iframe = this . iframe ;
913
988
914
989
iframeExecute (
@@ -940,9 +1015,7 @@ describe('integration', function() {
940
1015
) ;
941
1016
} ) ;
942
1017
943
- it ( 'should only record a SINGLE mouse click for a tree of elements with event listeners' , function (
944
- done
945
- ) {
1018
+ it ( 'should only record a SINGLE mouse click for a tree of elements with event listeners' , function ( done ) {
946
1019
var iframe = this . iframe ;
947
1020
948
1021
iframeExecute (
@@ -982,9 +1055,7 @@ describe('integration', function() {
982
1055
) ;
983
1056
} ) ;
984
1057
985
- it ( 'should bail out if accessing the `type` and `target` properties of an event throw an exception' , function (
986
- done
987
- ) {
1058
+ it ( 'should bail out if accessing the `type` and `target` properties of an event throw an exception' , function ( done ) {
988
1059
// see: https://github.com/getsentry/raven-js/issues/768
989
1060
var iframe = this . iframe ;
990
1061
@@ -1019,9 +1090,7 @@ describe('integration', function() {
1019
1090
) ;
1020
1091
} ) ;
1021
1092
1022
- it ( 'should record consecutive keypress events into a single "input" breadcrumb' , function (
1023
- done
1024
- ) {
1093
+ it ( 'should record consecutive keypress events into a single "input" breadcrumb' , function ( done ) {
1025
1094
var iframe = this . iframe ;
1026
1095
1027
1096
iframeExecute (
@@ -1092,9 +1161,7 @@ describe('integration', function() {
1092
1161
) ;
1093
1162
} ) ;
1094
1163
1095
- it ( 'should flush keypress breadcrumb when input event occurs immediately after' , function (
1096
- done
1097
- ) {
1164
+ it ( 'should flush keypress breadcrumb when input event occurs immediately after' , function ( done ) {
1098
1165
var iframe = this . iframe ;
1099
1166
1100
1167
iframeExecute (
@@ -1146,9 +1213,7 @@ describe('integration', function() {
1146
1213
) ;
1147
1214
} ) ;
1148
1215
1149
- it ( 'should record consecutive keypress events in a contenteditable into a single "input" breadcrumb' , function (
1150
- done
1151
- ) {
1216
+ it ( 'should record consecutive keypress events in a contenteditable into a single "input" breadcrumb' , function ( done ) {
1152
1217
var iframe = this . iframe ;
1153
1218
1154
1219
iframeExecute (
@@ -1183,9 +1248,7 @@ describe('integration', function() {
1183
1248
) ;
1184
1249
} ) ;
1185
1250
1186
- it ( 'should record history.[pushState|replaceState] changes as navigation breadcrumbs' , function (
1187
- done
1188
- ) {
1251
+ it ( 'should record history.[pushState|replaceState] changes as navigation breadcrumbs' , function ( done ) {
1189
1252
var iframe = this . iframe ;
1190
1253
1191
1254
iframeExecute (
0 commit comments