diff options
author | Sean Robinson <sean.robinson@scottsdalecc.edu> | 2019-04-26 07:25:08 -0700 |
---|---|---|
committer | Michał Gołębiowski-Owczarek <m.goleb@gmail.com> | 2019-09-26 02:43:30 +0200 |
commit | 50871a5a85cc802421b40cc67e2830601968affe (patch) | |
tree | 2c8ad39a147d2a52b0e979b408e8a764f5773da9 /test/data/mock.php | |
parent | 9df4f1de12728b44a4b0f91748f12421008d9079 (diff) | |
download | jquery-50871a5a85cc802421b40cc67e2830601968affe.tar.gz jquery-50871a5a85cc802421b40cc67e2830601968affe.zip |
Ajax: Do not execute scripts for unsuccessful HTTP responses
The script transport used to evaluate fetched script sources which is
undesirable for unsuccessful HTTP responses. This is different to other data
types where such a convention was fine (e.g. in case of JSON).
Fixes gh-4250
Closes gh-4379
Diffstat (limited to 'test/data/mock.php')
-rw-r--r-- | test/data/mock.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/data/mock.php b/test/data/mock.php index ba1930415..5b56d02c7 100644 --- a/test/data/mock.php +++ b/test/data/mock.php @@ -216,6 +216,19 @@ QUnit.assert.ok( true, "mock executed");'; unlink( $this->cspFile ); } + protected function errorWithScript( $req ) { + header( 'HTTP/1.0 404 Not Found' ); + if ( isset( $req->query['withScriptContentType'] ) ) { + header( 'Content-Type: application/javascript' ); + } + if ( isset( $req->query['callback'] ) ) { + $callback = $req->query['callback']; + echo $callback . '( {"status": 404, "msg": "Not Found"} )'; + } else { + echo 'QUnit.assert.ok( false, "Mock return erroneously executed" );'; + } + } + public function __construct() { $this->cspFile = __DIR__ . '/support/csp.log'; } |