1

I'm debugging javascript of a web application in a context where changing the actual javascript code on the server is very time consuming. How can I hack at the javascript code in the browser and have it persist when reloading?

It is not an option to use break points before the changed section and then re-applying the change. The nature of the bug is one of visual timing so I need to debug it visually without breakpoints.

Is there a browser plugin allowing this?

worldsayshi
  • 1,788
  • 15
  • 31
  • You can just edit source code within the source tab of Chrome, it will recompile the code and apply it when you press ctrl+s. However, this will not persist between refreshes. – gpgekko Jan 30 '14 at 13:40
  • visual timing bug as in race condition? If so then this bug might appear differently on different browsers – Huangism Jan 30 '14 at 13:41
  • @gpgekko Yes this is the problem I'm struggling with. I need to reload the page to try the solution. – worldsayshi Jan 30 '14 at 13:43
  • @worldsayshi In that case the code needs to be on the server, there isn't any way (that I know of) to do it differently. – gpgekko Jan 30 '14 at 13:45
  • It seems that the tool I'm looking for is DevTools workspaces. See [here](http://stackoverflow.com/a/16638145/439034) and [here](https://plus.google.com/+AddyOsmani/posts/CYXzDfg3jhC). However, I can't get it to work properly at the moment. The changes persist to disc and it looks as if my local changes are used in the source view, but the execution seems unaffected. – worldsayshi Jan 30 '14 at 14:15
  • Another possible option is [Tincr](https://chrome.google.com/webstore/detail/tincr/lfjbhpnjiajjgnjganiaggebdhhpnbih). I will try them out. – worldsayshi Jan 30 '14 at 14:29
  • Those tools seem to use the files served by the server even though there are local changes (that will show up when viewing the sources), so I gave up using them. – worldsayshi Jan 30 '14 at 16:49

1 Answers1

1

I went with using Fiddler on Windows in a VM. Not the simplest solution but once it was up and running it solved the problem. Fiddler allowed me to swap requested files for my local copies whenever requested.

See here: How to replace Javascript of production website with local Javascript?

Community
  • 1
  • 1
worldsayshi
  • 1,788
  • 15
  • 31