Skip to content

Instantly share code, notes, and snippets.

@jorendorff
Forked from fflorent/gist:5155923
Last active December 14, 2015 22:09
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 jorendorff/5156063 to your computer and use it in GitHub Desktop.
Save jorendorff/5156063 to your computer and use it in GitHub Desktop.
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 (this works too!)
var _console = dglobal.makeDebuggeeValue({
info: function(){ alert('info'); },
log: function() { alert('log'); },
__exposedProps__: {info: 'r', log: 'r'}
});
// horrible wacky hack
commandLine.console = dglobal.evalInGlobalWithBindings(
"({info: function () { _console.info(); })",
{_console: _console});
resObj = dglobal.evalInGlobalWithBindings(expr, commandLine);
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment