aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorMichał Gołębiowski-Owczarek <m.goleb@gmail.com>2019-10-28 20:27:49 +0100
committerMichał Gołębiowski-Owczarek <m.goleb@gmail.com>2019-10-28 20:43:16 +0100
commit323575fb9bb330a852718d89e323f7ec79549100 (patch)
tree3e8417183ce9aa01755ef0d76a4e68c54660eadd /test/unit
parentbcbcdd2b2c1bb7075f4f73dc89ca7d65db2a09ed (diff)
downloadjquery-323575fb9bb330a852718d89e323f7ec79549100.tar.gz
jquery-323575fb9bb330a852718d89e323f7ec79549100.zip
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 (cherry picked from commit c5b48c8caa58e7b73164ac033bf726a072903708)
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/ajax.js21
1 files changed, 13 insertions, 8 deletions
diff --git a/test/unit/ajax.js b/test/unit/ajax.js
index 23fb0b473..a2cc34e32 100644
--- a/test/unit/ajax.js
+++ b/test/unit/ajax.js
@@ -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 [ {