1

I've lookup how to intercept an AJAX call and found the same code on multiple different threads: here and here, for instance.

I've modified the code like so:

(function(open) {
    XMLHttpRequest.prototype.open = function(method, url, async, user, pass) {
        console.log("URL: ", url);
        open.call(this, method, url, async, user, pass);
    };
})(XMLHttpRequest.prototype.open);

All I'm trying to do is log the URLs of the AJAX requests on a given page.

Unfortunately, once I inject this code into Facebook, the entire screen freezes. It works on all other websites. Why is this messing up on Facebook?

Community
  • 1
  • 1
user3757174
  • 483
  • 2
  • 8
  • 17
  • quite possibly they have their own overload – charlietfl May 06 '15 at 02:39
  • I mean that it's possible they did something like move it off of window or renamed it or something like that anticipating people wanting to do exactly what you are doing Does the object exist? – charlietfl May 06 '15 at 02:49
  • Why would that freeze the tab, though? – user3757174 May 06 '15 at 02:54
  • Do errors get thrown? Have you tried wrapping a try/catch around it and see what gets returned to catch? – charlietfl May 06 '15 at 02:56
  • No errors get thrown. The only thing I see are two warnings: `Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check http://xhr.spec.whatwg.org/. OahVtjWtI-Q.js:7 Setting 'XMLHttpRequest.withCredentials' for synchronous requests is deprecated.` – user3757174 May 07 '15 at 01:25
  • then there is a synchronous request being made...and those block the UI until completed. No events will fire and no script. Somehow Facebook knows you are tampering with the ajax and are doing that to you I suspect – charlietfl May 07 '15 at 01:37

0 Answers0