feat: promisify debugger.sendCommand() (#16861)
* remove duplicate entry for desktopCapturer.getSources * feat: promisify debugger.sendCommand
This commit is contained in:
parent
ee4c9aa3d0
commit
1f458eb177
7 changed files with 101 additions and 47 deletions
|
@ -1515,11 +1515,7 @@ describe('font fallback', () => {
|
|||
try {
|
||||
await w.loadURL(`data:text/html,${html}`)
|
||||
w.webContents.debugger.attach()
|
||||
const sendCommand = (...args) => new Promise((resolve, reject) => {
|
||||
w.webContents.debugger.sendCommand(...args, (e, r) => {
|
||||
if (e) { reject(e) } else { resolve(r) }
|
||||
})
|
||||
})
|
||||
const sendCommand = (...args) => w.webContents.debugger.sendCommand(...args)
|
||||
const { nodeId } = (await sendCommand('DOM.getDocument')).root.children[0]
|
||||
await sendCommand('CSS.enable')
|
||||
const { fonts } = await sendCommand('CSS.getPlatformFontsForNode', { nodeId })
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue