Skip to content

Instantly share code, notes, and snippets.

@fflorent
Last active December 14, 2015 22:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save fflorent/5155923 to your computer and use it in GitHub Desktop.
Save fflorent/5155923 to your computer and use it in GitHub Desktop.
Create console object as binding object
function evaluate(context, expr, origExpr, onSuccess, onError)
{
var result;
var commandLine = createFirebugCommandLine(context, win);
// gets the debuggee object:
var dglobal = DebuggerLib.getDebuggeeGlobal(context.window, context);
var resObj;
// that works:
commandLine.someFunction = dglobal.makeDebuggeeValue(function()
{
Firebug.Console.log("ok");
});
// simulates the console object creation:
// nor console.info nor console.log work
commandLine.console = dglobal.makeDebuggeeValue({
info: dglobal.makeDebuggeeValue(function(){ alert('info'); })
});
commandLine.console.log = dglobal.makeDebuggeeValue(function(){ alert('log'); });
resObj = dglobal.evalInGlobalWithBindings(expr, commandLine);
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment