Skip to content

feat: promisify debugger.sendCommand() - #16861

Merged
jkleinsc merged 2 commits into
masterfrom
miniak/promisify-debugger
Feb 13, 2019
Merged

jkleinsc merged 2 commits into
masterfrom
miniak/promisify-debugger

Conversation

@miniak

@miniak miniak commented Feb 9, 2019 •

Copy link
Copy Markdown
Contributor

Description of Change

This PR promisifies debugger.sendCommand()

/cc @codebytere

Checklist

Release Notes

Notes: Converted debugger.sendCommand() to return a Promise instead of taking a callback.

@miniak
miniak requested review from a team and codebytere February 9, 2019 22:10
@miniak miniak self-assigned this Feb 9, 2019
Comment thread atom/browser/api/atom_api_debugger.cc Resolved
Comment thread atom/browser/api/atom_api_debugger.cc Resolved
@miniak
miniak force-pushed the miniak/promisify-debugger branch 3 times, most recently from 236e700 to a4e1ba5 Compare February 13, 2019 09:12
@miniak
miniak force-pushed the miniak/promisify-debugger branch from a4e1ba5 to a5fd283 Compare February 13, 2019 09:12
@jkleinsc
jkleinsc merged commit 1f458eb into master Feb 13, 2019
@release-clerk

release-clerk Bot commented Feb 13, 2019

Copy link
Copy Markdown

Release Notes Persisted

Converted debugger.sendCommand() to return a Promise instead of taking a callback.

@jkleinsc
jkleinsc deleted the miniak/promisify-debugger branch February 13, 2019 17:23
@codebytere

Copy link
Copy Markdown
Member

/trop run backport-to 5-0-x

@trop

trop Bot commented Feb 13, 2019

Copy link
Copy Markdown
Contributor

The backport process for this PR has been manually initiated,
sending your 1's and 0's to "5-0-x" here we go! :D

@trop

trop Bot commented Feb 13, 2019

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "5-0-x", please check out #16931

Comment thread spec/api-debugger-spec.js
w.webContents.debugger.attach()

w.webContents.openDevTools()
await emittedOnce(w.webContents, 'devtools-opened')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 FLAKE ALERT 🚨

you need to call emittedOnce before you call openDevTools. As written this is a race condition and will result in a flaky test.

Comment thread spec/chromium-spec.js
if (e) { reject(e) } else { resolve(r) }
})
})
const sendCommand = (...args) => w.webContents.debugger.sendCommand(...args)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can probably just call w.webContents.debugger.sendCommand directly, or if that's too verbose then const {debugger} = w.webContents; debugger.sendCommand(...)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants