Skip to content

Commit c5b48c8

Browse files
authored
Tests: Don't test synchronous XHR on unload in Chrome
Chrome 78 dropped support for synchronous XHR requests inside of beforeunload, unload, pagehide, and visibilitychange event handlers. See https://bugs.chromium.org/p/chromium/issues/detail?id=952452 Closes gh-4536
1 parent 471b004 commit c5b48c8

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

‎test/unit/ajax.js

+13-8
Original file line numberDiff line numberDiff line change
@@ -2001,14 +2001,19 @@ if ( typeof window.ArrayBuffer === "undefined" || typeof new XMLHttpRequest().re
20012001
};
20022002
} );
20032003

2004-
testIframe(
2005-
"#14379 - jQuery.ajax() on unload",
2006-
"ajax/onunload.html",
2007-
function( assert, jQuery, window, document, status ) {
2008-
assert.expect( 1 );
2009-
assert.strictEqual( status, "success", "Request completed" );
2010-
}
2011-
);
2004+
// Chrome 78 dropped support for synchronous XHR requests inside of
2005+
// beforeunload, unload, pagehide, and visibilitychange event handlers.
2006+
// See https://bugs.chromium.org/p/chromium/issues/detail?id=952452
2007+
if ( !/chrome/i.test( navigator.userAgent ) ) {
2008+
testIframe(
2009+
"#14379 - jQuery.ajax() on unload",
2010+
"ajax/onunload.html",
2011+
function( assert, jQuery, window, document, status ) {
2012+
assert.expect( 1 );
2013+
assert.strictEqual( status, "success", "Request completed" );
2014+
}
2015+
);
2016+
}
20122017

20132018
ajaxTest( "#14683 - jQuery.ajax() - Exceptions thrown synchronously by xhr.send should be caught", 4, function( assert ) {
20142019
return [ {

0 commit comments

Comments
 (0)