Question: I'm looking for a browser extension (Firefox, Chrome) allowing to replace a Javascript file on a live Web site to do some testing/hacking.

Basically, it should take a URL and load another one instead (locally or on a HTTP development server).

Any idea?

Answer: 
Alternatives:

* Using chrome you can change code on the fly (Developer tools -> Sources tab) and just save it (command + s)
* Use the LiveReload app that actually attaches an extension (that kind of does what you want) <http://livereload.com/>

This may not be the "exact" answer to your question, yet I almost sure one of those will do what you want to do.
ColBeseder correctly brings up Fiddler (http://www.fiddler2.com/fiddler2/version.asp) as a solution to your issue. 

Fiddler is perfectly capable of handling and decrypting HTTPS traffic as well - see the documentation on the page for how to configure it. 

To directly answer the OP question, you can use the autoresponder feature in Fiddler to hack your production JS for testing. 

Enable the autoresponder tab in Fiddler, making sure to leave pass through for unmatched requests checked, entering the URL of the JS files you want to substitute as the pattern. Select the response file from your local filesystem, and go to town!

See <http://yuiblog.com/blog/2008/06/27/fiddler/> (bottom of article is most relevant) for an example.