- Notifications
You must be signed in to change notification settings - Fork20.6k
Commit7b0864d
authored
Tests: Fix flakiness in the "jQuery.ajax() - JSONP - Same Domain" test
The "jQuery.ajax() - JSONP - Same Domain" test is firing a request witha 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 jsonpaction in the mock server handled situations like that. The PHP implementationwas using the latest parameter while the Node.js one was turning it into anarray but the code didn't handle this situation. Because of how JavaScriptstringifies arrays, while the PHP implementation injected the following code:```jsjQuery_2(payload)```the Node.js one was injecting the following one:```jsjQuery_1,jQuery_2(payload)```This is a comma expression in JavaScript; it so turned out that in the majorityof cases both callbacks were identical so it was more like:```jsjQuery_1,jQuery_1(payload)```which evaluates to `jQuery_1(payload)` when `jQuery_1` is defined, making thetest go as expected. In many cases, though, especially on Travis, the callbackswere different, triggering an `Uncaught ReferenceError` error & requiringfrequent manual re-runs of Travis builds.This commit fixes the logic in the mock Node.js server, adding special handlingfor arrays.Closesgh-46871 parenta62309e commit7b0864d
1 file changed
+3
-1
lines changedLines changed: 3 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
93 | 93 |
| |
94 | 94 |
| |
95 | 95 |
| |
96 |
| - | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
97 | 99 |
| |
98 | 100 |
| |
99 | 101 |
| |
|
0 commit comments
Comments
(0)