Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: promisify debugger.sendCommand() #16861

Merged
merged 2 commits into from Feb 13, 2019
Merged

Conversation

miniak
Copy link
Contributor

@miniak miniak commented Feb 9, 2019

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
atom/browser/api/atom_api_debugger.cc Outdated Show resolved Hide resolved
atom/browser/api/atom_api_debugger.cc Outdated Show resolved Hide resolved
@miniak miniak force-pushed the miniak/promisify-debugger branch 3 times, most recently from 236e700 to a4e1ba5 Compare February 13, 2019 09:12
@jkleinsc jkleinsc merged commit 1f458eb into master Feb 13, 2019
@release-clerk
Copy link

release-clerk bot commented Feb 13, 2019

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
Member

/trop run backport-to 5-0-x

@trop
Copy link
Contributor

trop bot commented Feb 13, 2019

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
Copy link
Contributor

trop bot commented Feb 13, 2019

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

w.webContents.debugger.attach()

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

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.

if (e) { reject(e) } else { resolve(r) }
})
})
const sendCommand = (...args) => w.webContents.debugger.sendCommand(...args)
Copy link
Member

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(...)

@sofianguy sofianguy added this to 5.0.0-beta.3 in 5.0.x Feb 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
5.0.x
Fixed in 5.0.0-beta.3
Development

Successfully merging this pull request may close these issues.

None yet

4 participants