Skip to content

Instantly share code, notes, and snippets.

@harthur
Last active December 16, 2015 14:19
Show Gist options
  • Save harthur/5447846 to your computer and use it in GitHub Desktop.
Save harthur/5447846 to your computer and use it in GitHub Desktop.
Open a Firefox devtools window that's debugging the devtools window that's debugging the currently selected tab.
/*
* Running this scratchpad in chrome mode will open a devtools window that's debugging
* the devtools window that's debugging the currently selected tab.
*/
let {devtools} = Components.utils.import("resource:///modules/devtools/gDevTools.jsm", {});
let tabTarget = devtools.TargetFactory.forTab(gBrowser.selectedTab);
let toolbox = gDevTools.getToolbox(tabTarget);
let win = toolbox._host.frame.contentWindow;
let target = devtools.TargetFactory.forWindow(win);
let toolbox = gDevTools.showToolbox(target, "styleeditor", "window");
@harthur
Copy link
Author

harthur commented Apr 23, 2013

To run this, first enable chrome debugging:

  1. Open 'about:config' in the url bar
  2. Toggle the "devtools.chrome.enabled" to true

Then open a scratchpad:

  1. Tools > Web Developer > Scratchpad
  2. Set the scratchpad to "chrome" mode with Environment > Browser
  3. Copy the above code into the scratchpad and run it (Cmd-R / Ctrl-R)

@bgrins
Copy link

bgrins commented Apr 28, 2013

In nightly, can run this command by:

  1. Tools > Web Developer > Browser Console
  2. Copy script above and press enter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment