Skip to content

Instantly share code, notes, and snippets.

@tsukkee
Created January 20, 2009 02:30
Show Gist options
  • Save tsukkee/49287 to your computer and use it in GitHub Desktop.
Save tsukkee/49287 to your computer and use it in GitHub Desktop.
js <<EOM
commands.addUserCommand(["javascriptincontent", "jsc"],
"Run a JavaScript command in content context",
function (args)
{
try
{
let s = new Components.utils.Sandbox(buffer.URL);
s.window = content.window;
s.document = content.document;
// s.__proto__ = content.window.wrappedJSObject;
return Components.utils.evalInSandbox(args.string, s);
}
catch (e)
{
liberator.echoerr(e);
}
},
{
completer: function (context) completion.javascript(context),
hereDoc: true,
literal: 0
});
EOM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment