From 6044fb6a7384aec85906949835ef9a58114896ce Mon Sep 17 00:00:00 2001 From: =?utf8?q?Micha=C5=82=20Go=C5=82e=CC=A8biowski?= Date: Mon, 5 May 2014 20:04:03 +0200 Subject: [PATCH] Ajax: Account for Android 2.3 not firing window.onerror on script errors Android 2.3 doesn't fire the window.onerror handler, just accept the reality there and skip the test. Refs gh-1573 Refs gh-1786 Refs jquery/jquery.com#108 Closes gh-2458 --- test/unit/ajax.js | 9 +++++++++ test/unit/manipulation.js | 11 +++++++++++ 2 files changed, 20 insertions(+) diff --git a/test/unit/ajax.js b/test/unit/ajax.js index 359fa9d81..e216f34a2 100644 --- a/test/unit/ajax.js +++ b/test/unit/ajax.js @@ -1450,6 +1450,15 @@ module( "ajax", { }); asyncTest( "#11743 - jQuery.ajax() - script, throws exception", 1, function() { + // Support: Android 2.3 only + // Android 2.3 doesn't fire the window.onerror handler, just accept the reality there. + if ( /android 2\.3/i.test( navigator.userAgent ) ) { + ok( true, "Test skipped, Android 2.3 doesn't fire window.onerror for " + + "errors in dynamically included scripts" ); + start(); + return; + } + var onerror = window.onerror; window.onerror = function() { ok( true, "Exception thrown" ); diff --git a/test/unit/manipulation.js b/test/unit/manipulation.js index 5a8452011..c1dac6993 100644 --- a/test/unit/manipulation.js +++ b/test/unit/manipulation.js @@ -2241,6 +2241,17 @@ test( "Ensure oldIE creates a new set on appendTo (#8894)", function() { }); asyncTest( "html() - script exceptions bubble (#11743)", 2, function() { + // Support: Android 2.3 only + // Android 2.3 doesn't fire the window.onerror handler, just accept the reality there. + if ( /android 2\.3/i.test( navigator.userAgent ) ) { + ok( true, "Test skipped, Android 2.3 doesn't fire window.onerror for " + + "errors in dynamically included scripts" ); + ok( true, "Test skipped, Android 2.3 doesn't fire window.onerror for " + + "errors in dynamically included scripts" ); + start(); + return; + } + var onerror = window.onerror; setTimeout(function() { -- 2.39.5