javascript - mozrepl: go to the context of the browser window when entering in a new opened window -
my problem can not ascend browser window context after creating , entering new window using mozrepl, how it?
ubugnu@spin-foam:~$ telnet localhost 4242 | tee -a .repl_log trying 127.0.0.1... connected localhost. escape character '^]'. welcome mozrepl. - if stuck @ "...>" prompt, enter semicolon (;) @ beginning of line force evaluation. - if errors after every character type, see http://github.com/bard/mozrepl/wikis/troubleshooting (short version: stop using microsoft telnet, use netcat or putty instead) current working context: chrome://browser/content/browser.xul current input mode: syntax repl> repl.print(document.getelementbyid('toolbar-menubar')) [object xulelement] repl> win = open() [object window] - {window: {...}, document: {...}, external: {...}, getinterface: function() {...}, console: {...}, sidebar: {...}, performance: {...}, ...} repl> repl.enter(win) [object window] - {window: {...}, document: {...}, installtrigger: {...}, external: {...}, webkitnotifications: {...}, getinterface: function() {...}, console: {...}, ...} repl> repl.print(document.getelementbyid('toolbar-menubar')) repl> repl.print("how ascend browser window context?") how ascend browser window context? repl> ?
i'm not familiar mozrepl @ all. see in code, perhaps try win.opener
access opener of current window you're in. like:
repl.enter(win.opener);
alternatively try access recent window of type "navigator:browser", if can access components (cc,ci,cu):
var window=cc["@mozilla.org/appshell/window-mediator;1"].getservice(ci.nsiwindowmediator).getmostrecentwindow("navigator:browser");
Comments
Post a Comment