No, this will allow you to retrieve the contents of any URL, which violates some security policies. (This will be the equivalent of an ajax get request without checks on the same domain.)
However, since foo.js is in the same domain as the page, you can get it using an ajax request. JQuery example:
$.get('foo.js', function(source_code) { alert('foo.js contains ' + source_code); });
arnaud576875
source share