mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
7b0864d053
The "jQuery.ajax() - JSONP - Same Domain" test is firing a request with a duplicate "callback" parameter, something like (simplified): ``` mock.php?action=jsonp&callback=jQuery_1&callback=jQuery_2 ``` There was a difference in how the PHP & Node.js implementations of the jsonp action in the mock server handled situations like that. The PHP implementation was using the latest parameter while the Node.js one was turning it into an array but the code didn't handle this situation. Because of how JavaScript stringifies arrays, while the PHP implementation injected the following code: ```js jQuery_2(payload) ``` the Node.js one was injecting the following one: ```js jQuery_1,jQuery_2(payload) ``` This is a comma expression in JavaScript; it so turned out that in the majority of cases both callbacks were identical so it was more like: ```js jQuery_1,jQuery_1(payload) ``` which evaluates to `jQuery_1(payload)` when `jQuery_1` is defined, making the test go as expected. In many cases, though, especially on Travis, the callbacks were different, triggering an `Uncaught ReferenceError` error & requiring frequent manual re-runs of Travis builds. This commit fixes the logic in the mock Node.js server, adding special handling for arrays. Closes gh-4687 |
||
---|---|---|
.. | ||
data | ||
integration | ||
node_smoke_tests | ||
promises_aplus_adapters | ||
unit | ||
.eslintrc.json | ||
delegatetest.html | ||
hovertest.html | ||
index.html | ||
jquery.js | ||
karma.context.html | ||
karma.debug.html | ||
localfile.html | ||
middleware-mockserver.js | ||
networkerror.html | ||
xhtml.php |