This is more a workaround, but it can help. The idea is that we will replace files coming from the server by files on your machine.
This will work with any browser.
It takes a bit of setup the first time (15 minutes maybe), but then it can be very convenient.
It can also helps testing your bug-fixes in a live/prod environment.
- Get Fiddler (it's a web debugging proxy), install it, run it.
http://www.fiddler2.com/fiddler2/
(Restart browser after install to get the Fiddler extension)
- If you debug an HTTPS website, check this first:
http://www.fiddler2.com/Fiddler/help/httpsdecryption.asp
- From now on, you should see in Fiddler ("Web Sessions" pane on the left) all downloads made by your browser, including JS files.
If not, check this : Fiddler not displaying sessions
- Find the file you want to debug in the list (Ctrl+F works)
- Click on the file. Then either:
- get the file content from the inspectors pane (textView tab), beautify it, save to a file on your local computer
- or have access to a file which contains the source code (ex: from your source control)
- Go to AutoResponder tab (top left pane).
Select "Enable automatic responses" checkbox.
Select "Unmatched requests passthrough" checkbox.
- Drag your file from left pane to right pane (prefills rule editor at the bottom)
- Set the other field with the path of your local file
- Click the Save button
- Reload the page and enjoy your debugging session.
Fiddler can do many more things, but this use-case answers the initial question.