I was testing how stactraces are returned for the same bug given that the user encountered it on a refresh of the page or on ajax navigate. I found that when using ajax navigation the part of the code that was loaded using ajax is not available in the stacktrace, even though a lot of the time it is the most important part where the exception actually happens.
I found out that we need to load javascript the old fashioned way by appending script tags into the head of the page. And we have to do it manually using regular javascript because for some reason jquery intercepts attempts injections of script elements and tries to load them using "evalScript routine" as shown here [0].
I looked at the AJAX class and how it handles script loading and figured out I can easily change the old way of loading scripts from getScript to appending script elements. The problem is when to call the "done" function.
While there are some callbacks that get called when a script is loaded, they are not consistent and are sometimes different among browsers specifically IE. Another way is using a function call in the get_scripts.js.php output. I can append the line AJAX.scriptHandler.done(); at the end to call the done function. I think this is the best way to go.
I am writing this to tell you about this change since this is a major change in how scripts are loaded and to ask if anyone thinks there is a problem with my line of thought or if you have a better idea. I will do this change and add it to the change log and it should be merged when I merge the rest of my code for GSoC.
[0] http://stackoverflow.com/a/3603496/1369210