Provide invalid default URL for jQuery Ajax calls

What does this MR do?

It sets an (invalid) default URL for jQuery Ajax calls to prevent jQuery from using location.href.

Are there points in the code the reviewer needs to double check?

Unsure—all jQuery Ajax calls? Namely $.ajax, .get/.getJSON and $.post.

Why was this MR needed?

The default behavior of jQuery is to fall back to location.href if no URL is passed to an Ajax call. However, this can happen unintentionally when a passed URL parameter is undefined. That case is hard to track down (compare #17264 (closed) and #17365 (closed)) as the request succeeds but leads to an unexpected response.

In my opinion, the case where no URL is passed and location.href is wanted is neglectable. The benefit of having a traceable error in the log in cases where an URL should have been passed outweighs those corner-cases.

Note, that jQuery discourages the use of ajaxSetup.

What are the relevant issue numbers?

#17264 (closed), #17365 (closed), more yet to come... 😉

This is a followup of !4630 (merged).


Merge request reports