aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/ajax.js
diff options
context:
space:
mode:
authorMichał Gołębiowski-Owczarek <m.goleb@gmail.com>2021-04-29 18:27:58 +0200
committerGitHub <noreply@github.com>2021-04-29 18:27:58 +0200
commitacb7c49c8d42f601fa347661b1118959079f6b52 (patch)
tree7eabd86077b9517481b8f3f508a415e753966398 /test/unit/ajax.js
parentb14ce54334a568eaaa107be4c441660a57c3db24 (diff)
downloadjquery-2.2-stable.tar.gz
jquery-2.2-stable.zip
Tests: Strip untypical callback parameter characters from PHP files2.2-stable
Only allow alphanumeric characters & underscores for callback parameters. This is only test code so we're not fixing any security issue but it happens often enough that the whole jQuery repository directory structure is deployed onto the server with PHP enabled that it makes is easy to introduce security issues if this cleanup is not done. This is a 1.x/2.x version of PR gh-4871. The change doesn't require a release; it's meant at installations testing the latest state of `1.12-stable` & `2.2-stable` branches. This change also fixes testing on Travis & on Chrome/Firefox. Closes gh-4875 Ref gh-4764 Ref gh-4871
Diffstat (limited to 'test/unit/ajax.js')
-rw-r--r--test/unit/ajax.js22
1 files changed, 14 insertions, 8 deletions
diff --git a/test/unit/ajax.js b/test/unit/ajax.js
index 8b46c57c2..d05d54a65 100644
--- a/test/unit/ajax.js
+++ b/test/unit/ajax.js
@@ -1758,14 +1758,20 @@ if ( typeof window.ArrayBuffer === "undefined" || typeof new XMLHttpRequest().re
};
} );
- testIframeWithCallback(
- "#14379 - jQuery.ajax() on unload",
- "ajax/onunload.html",
- function( status, assert ) {
- 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
+ // Safari 13 did similar changes. The below check will catch them both.
+ if ( !/safari/i.test( navigator.userAgent ) ) {
+ testIframeWithCallback(
+ "#14379 - jQuery.ajax() on unload",
+ "ajax/onunload.html",
+ function( status, assert ) {
+ 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 [ {