Skip to content

Instantly share code, notes, and snippets.

@harthur

harthur/debug-devtools.js

Last active Dec 16, 2015
Embed
What would you like to do?
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

This comment has been minimized.

Copy link
Owner Author

@harthur 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

This comment has been minimized.

Copy link

@bgrins 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