Skip to content

Commit

Permalink
Tests: Don't test synchronous XHR on unload in Chrome
Browse files Browse the repository at this point in the history
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

(cherry picked from commit c5b48c8)
  • Loading branch information
mgol committed Oct 28, 2019
1 parent bcbcdd2 commit 323575f
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions test/unit/ajax.js
Expand Up @@ -2085,14 +2085,19 @@ if ( typeof window.ArrayBuffer === "undefined" || typeof new XMLHttpRequest().re
};
} );

testIframe(
"#14379 - jQuery.ajax() on unload",
"ajax/onunload.html",
function( assert, jQuery, window, document, status ) {
assert.expect( 1 );
assert.strictEqual( status, "success", "Request completed" );
}
);
// 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
if ( !/chrome/i.test( navigator.userAgent ) ) {
testIframe(
"#14379 - jQuery.ajax() on unload",
"ajax/onunload.html",
function( assert, jQuery, window, document, status ) {
assert.expect( 1 );
assert.strictEqual( status, "success", "Request completed" );
}
);
}

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

0 comments on commit 323575f

Please sign in to comment.