@@ -590,6 +590,52 @@ describe('integration', function () {
590590 ) ;
591591 } ) ;
592592
593+ // doesn't work in PhantomJS
594+ if ( ! / P h a n t o m J S / . test ( window . navigator . userAgent ) ) {
595+ it ( 'should bail out if accessing the `type` and `target` properties of an event throw an exception' , function ( done ) {
596+ // see: https://github.com/getsentry/raven-js/issues/768
597+ var iframe = this . iframe ;
598+
599+ iframeExecute ( iframe , done ,
600+ function ( ) {
601+ setTimeout ( done ) ;
602+
603+ // some browsers trigger onpopstate for load / reset breadcrumb state
604+ Raven . _breadcrumbs = [ ] ;
605+
606+ // click <input/>
607+ var evt = document . createEvent ( 'MouseEvent' ) ;
608+ evt . initMouseEvent ( evt ,
609+ "click" ,
610+ true /* bubble */ ,
611+ true /* cancelable */ ,
612+ window ,
613+ null ,
614+ 0 , 0 , 0 , 0 , /* coordinates */
615+ false , false , false , false , /* modifier keys */
616+ 0 /*left*/ ,
617+ null
618+ ) ;
619+
620+ function kaboom ( ) { throw new Error ( 'lol' ) ; } ;
621+ Object . defineProperty ( evt , 'type' , { get : kaboom } ) ;
622+ Object . defineProperty ( evt , 'target' , { get : kaboom } ) ;
623+
624+ var input = document . querySelector ( '.a' ) ; // leaf node
625+ input . dispatchEvent ( evt ) ;
626+ } ,
627+ function ( ) {
628+ var Raven = iframe . contentWindow . Raven ,
629+ breadcrumbs = Raven . _breadcrumbs ;
630+
631+ assert . equal ( breadcrumbs . length , 1 ) ;
632+ assert . equal ( breadcrumbs [ 0 ] . category , 'ui.click' ) ;
633+ assert . equal ( breadcrumbs [ 0 ] . message , '<unknown>' ) ;
634+ }
635+ ) ;
636+ } ) ;
637+ } // if PhantomJS
638+
593639 it ( 'should record consecutive keypress events into a single "input" breadcrumb' , function ( done ) {
594640 var iframe = this . iframe ;
595641
0 commit comments