@@ -534,14 +534,32 @@ QUnit[ window.console ? "test" : "skip" ]( "jQuery.Deferred.exceptionHook", func
534534 oldWarn = window . console . warn ;
535535
536536 window . console . warn = function ( msg ) {
537- assert . ok ( / b a r f / . test ( msg ) , "Message: " + msg ) ;
537+
538+ // Support: Chrome < 42
539+ // Some Chrome versions newer than 30 but older than 42 display the "undefined is
540+ // not a function" error, not mentioning the function name. This has been fixed
541+ // in Chrome 42. Relax this test there.
542+ // This affects our Android 5.0 & Yandex.Browser testing.
543+ var oldChromium = false ;
544+ if ( / c h r o m e / i. test ( navigator . userAgent ) ) {
545+ oldChromium = parseInt (
546+ navigator . userAgent . match ( / c h r o m e \/ ( \d + ) / i ) [ 1 ] , 10 ) < 42 ;
547+ }
548+ if ( oldChromium ) {
549+ assert . ok ( / (?: b a r f | u n d e f i n e d ) / . test ( msg ) , "Message: " + msg ) ;
550+ } else {
551+ assert . ok ( / b a r f / . test ( msg ) , "Message: " + msg ) ;
552+ }
538553 } ;
539554 jQuery . when (
540555 defer . then ( function ( ) {
556+
541557 // Should get an error
542558 jQuery . barf ( ) ;
543559 } ) . then ( null , jQuery . noop ) ,
560+
544561 defer . then ( function ( ) {
562+
545563 // Should NOT get an error
546564 throw new Error ( "Make me a sandwich" ) ;
547565 } ) . then ( null , jQuery . noop )
@@ -562,6 +580,7 @@ QUnit[ window.console ? "test" : "skip" ]( "jQuery.Deferred.exceptionHook with s
562580 oldWarn = window . console . warn ;
563581
564582 jQuery . Deferred . getStackHook = function ( ) {
583+
565584 // Default exceptionHook assumes the stack is in a form console.warn can log,
566585 // but a custom getStackHook+exceptionHook pair could save a raw form and
567586 // format it to a string only when an exception actually occurs.
@@ -570,7 +589,22 @@ QUnit[ window.console ? "test" : "skip" ]( "jQuery.Deferred.exceptionHook with s
570589 } ;
571590
572591 window . console . warn = function ( msg , stack ) {
573- assert . ok ( / c o u g h _ u p _ h a i r b a l l / . test ( msg ) , "Function mentioned: " + msg ) ;
592+
593+ // Support: Chrome < 42
594+ // Some Chrome versions newer than 30 but older than 42 display the "undefined is
595+ // not a function" error, not mentioning the function name. This has been fixed
596+ // in Chrome 42. Relax this test there.
597+ // This affects our Android 5.0 & Yandex.Browser testing.
598+ var oldChromium = false ;
599+ if ( / c h r o m e / i. test ( navigator . userAgent ) ) {
600+ oldChromium = parseInt (
601+ navigator . userAgent . match ( / c h r o m e \/ ( \d + ) / i ) [ 1 ] , 10 ) < 42 ;
602+ }
603+ if ( oldChromium ) {
604+ assert . ok ( / (?: c o u g h _ u p _ h a i r b a l l | u n d e f i n e d ) / . test ( msg ) , "Function mentioned: " + msg ) ;
605+ } else {
606+ assert . ok ( / c o u g h _ u p _ h a i r b a l l / . test ( msg ) , "Function mentioned: " + msg ) ;
607+ }
574608 assert . ok ( / N O S T A C K F O R Y O U / . test ( stack ) , "Stack trace included: " + stack ) ;
575609 } ;
576610 defer . then ( function ( ) {
0 commit comments