mozilla / scanjs

[DEPRECATED] Static analysis tool for javascript code.
Other
429 stars 38 forks source link

include http server vs. using file:// #37

Closed pwnetrationguru closed 10 years ago

pwnetrationguru commented 10 years ago

We need to switch to providing a lightweight HTTP server so a user can go to http://localhost:9999/scanjs/client vs file:///Users/rfletcher/work/scanjs/scanjs/client/index.html

Right now, in Chrome, we have cross-origin loading errors. More importantly, we use relative file paths throughout the code. This is presenting problems and isn't really how we should be doing it.

For example: scanjs/client/index.html and scanjs/tests/run-tests.html include scanjs/client/js/initTern.js. scanjs/client/js/initTern.js attempts to load the file js/lib/tern/defs/browser.json.

This means index.html is looking for file js/lib/tern/defs/browser.json inside scanjs/client while run-tests.html is looking for js/lib/tern/defs/browser.json inside of scanjs/tests/

If we had a lightweight HTTP server, initTern.js could simply do a getJSON('browser', '/scanjs/client/js/lib/tern/defs/browser.json');

pauljt commented 10 years ago

Good stuff - FWIW I was already testing on a web server locally, but this makes it easier.