Skip to content

Commit da9e6e0

Browse files
authored
Merge pull request #9427 from jrafanie/document-why-we-have-two-script-converters
Explain why we have two script text converters
2 parents 46325d7 + e91e594 commit da9e6e0

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

app/javascript/oldjs/jquery_overrides.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,19 @@ jQuery.jsonPayload = function(text, fallback) {
2424
};
2525

2626
$.ajaxSetup({
27+
/* Define two script converters:
28+
29+
1) script - This is the original converter to evaluate scripts for successful responses.
30+
2) miq_script - Define a duplicate but differently named script converter whose purpose is to
31+
evaluate scripts for unsuccessful ajax responses. jQuery 3.5.0 changed the behavior of the script
32+
converter, replacing it with a no-op converter for scripts found in unsuccessful ajax responses.
33+
Successful responses would continue to be evaluated as previously.
34+
See: https://github.com/jquery/jquery/commit/da3dd85b63c4e3a6a768132c2a83a1a6eec24840
35+
36+
Due to this change starting in 3.5.0, we define a new type of script we can set as the dataType
37+
so it's evaluated in the event of unsuccessful responses such as the SSO 401 unauthorized
38+
issue we attempted to fix in #9410 and subsequently completed in #9426.
39+
*/
2740
accepts: {
2841
json: 'text/javascript, application/javascript, application/ecmascript, application/x-ecmascript',
2942
},

0 commit comments

Comments
 (0)