linkedin/inject — pull request #112 by brikis98 (2012-05-10 07:10:17+00:00)
Title: Using a script tag instead of eval provides better line number reporting in FF and Chrome

Here's a prototype solution that shows line numbers in error messages for Chrome and FF. This is accomplished by putting the code into a script tag instead of using eval and catching errors with window.onerror.

The good news:

* FF shows the correct error message and line numbers
* Chrome shows the correct error message and is off by one on line numbers

TODO

* You get two errors in the console for each actual error, probably one from each appendChild call.
* Instead of using a self-calling function in `commonJsHeader`/`commonJsFooter`, we could create a named function in the `Inject` namespace. If the function is created without `window.onerror` being called, this means there are no syntax errors. At this point, you can just execute the named function in a `try/catch` block and most likely get the full stack trace in case of any reference/execution/null/etc errors.
* Test in IE, Safari, etc