Last active
August 28, 2019 14:27
-
-
Save nchevobbe/f26ad17b916d0a36bb1741382619cd02 to your computer and use it in GitHub Desktop.
Get console state from hud
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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