You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some userscripts have a return statement in top level code, which gives a warning in the Firefox error console.
Is it possible to add a line number where the offending piece of return is located?
I have a few huge scripts (developed by others) with ~20k lines of source and can't find what triggers this error message.
in greasemonkey.js:
function runScriptInSandbox(script, sandbox) {
// Eval the code, with anonymous wrappers when/if appropriate.
function evalWithWrapper(code, fileName) {
try {
Components.utils.evalInSandbox(code, sandbox, gMaxJSVersion, fileName, 1);
} catch (e) {
if ("return not in function" == e.message) {
// See #1592; we never anon wrap anymore, unless forced to by a return
// not in a function.
GM_util.logError(
gStringBundle.GetStringFromName('return-not-in-func-deprecated'),
true // is a warning
--> maybe add fileName and e.lineNumber here?
);
Components.utils.evalInSandbox(
GM_util.anonWrap(code), sandbox, gMaxJSVersion, fileName, 1);
} else {
// Otherwise raise.
throw e;
}
}
}
Not sure know how to patch this, but looking at evalWithCatch() seems to suggest it's easily done.
The text was updated successfully, but these errors were encountered:
Some userscripts have a return statement in top level code, which gives a warning in the Firefox error console.
Is it possible to add a line number where the offending piece of return is located?
I have a few huge scripts (developed by others) with ~20k lines of source and can't find what triggers this error message.
in greasemonkey.js:
Not sure know how to patch this, but looking at evalWithCatch() seems to suggest it's easily done.
The text was updated successfully, but these errors were encountered: