Skip to content

Instantly share code, notes, and snippets.

@nchevobbe
Last active August 28, 2019 14:27
Show Gist options
  • Save nchevobbe/f26ad17b916d0a36bb1741382619cd02 to your computer and use it in GitHub Desktop.
Save nchevobbe/f26ad17b916d0a36bb1741382619cd02 to your computer and use it in GitHub Desktop.
Get console state from hud
// With the console open, in the browser console:
async function getOpenedConsoleReference() {
var loader = Cu.import("resource://devtools/shared/Loader.jsm", {});
var {gDevTools} = loader.require("devtools/client/framework/devtools");
var target = await gDevTools.getTargetForTab(gBrowser.selectedTab);
var toolbox = gDevTools.getToolbox(target);
return toolbox.getCurrentPanel();
}
async function getConsoleStore() {
const {hud} = await getOpenedConsoleReference();
return hud.ui.wrapper.getStore();
}
async function getConsoleState() {
const store = await getConsoleStore();
return store.getState();
}
await getConsoleState();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment