Skip to content

Instantly share code, notes, and snippets.

@Gozala
Created August 29, 2013 09:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Gozala/6376195 to your computer and use it in GitHub Desktop.
Save Gozala/6376195 to your computer and use it in GitHub Desktop.
Reproducible scenario
var x = {
a: 1,
b 2
}
let sandbox = Cu.Sandbox("http://example.com")
let { loadSubScript } = Cc['@mozilla.org/moz/jssubscript-loader;1'].
getService(Ci.mozIJSSubScriptLoader);
function load(uri) {
try {
loadSubScript(uri, sandbox)
} catch (error) {
return error
}
}
let error = load("file:///path/to/buggy.js")
error.lineNumber // => 3
error.fileName // => Scratchpad/2 -> file:///Users/gozala/buggy.js
error.stack // => ""
// Stack should contain path to error.fileName and error.lineNumber
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment