Use the fileName / lineNumber parameters to evalInSandbox() #1404

arantius opened this Issue Aug 22, 2011 · 4 comments


None yet

1 participant


From: #1396
See: #1396 (comment)

Couldn't we use the last two arguments for Components.utils.evalInSandbox detailed here?

So the call in modules/runScript.js would look something like:

Components.utils.evalInSandbox(code, sandbox, maxJSVersion, filename, 1);

We could loop through all the @requires and eval each one individually, that way those filenames and line numbers are preserved as well. Then finally we would eval the script. Is there some reason this wouldn't work?


This would probably involve un-doing the "first line eval" module I added in #1396, because it would be obsolete.


First attempt:

Promising, but currently failing bad in Firefox 3.



A test script that just triggers a variety of error conditions. Feedback please if you know of other failure modes, especially ones that are handled poorly by current error reporting logic. In Firefox 4+ my existing branch seems to handle all these cases. Including (quite surprisingly) the old "var sidebar;" thing that made us keep wrapper functions last time.


This may be obsoleted by webby execution mode (see 1.0 milestone).

@arantius arantius added a commit that closed this issue Jul 16, 2012
@arantius arantius Report errors correctly.
Pass file name and line number to evalInSandbox, just catch and fix in-line errors.

Fixes #1404
@arantius arantius closed this in a2e5f15 Jul 16, 2012
@arantius arantius added a commit to arantius/greasemonkey that referenced this issue Jul 16, 2012
@arantius arantius Fix anonymous wrapping injection.
Broke with the previous error reporting tweak.

Refs #1404
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment