diff --git a/atom/browser/api/atom_api_desktop_capturer.cc b/atom/browser/api/atom_api_desktop_capturer.cc index fa49b51f9815..daf291e7f958 100644 --- a/atom/browser/api/atom_api_desktop_capturer.cc +++ b/atom/browser/api/atom_api_desktop_capturer.cc @@ -69,7 +69,7 @@ void StartHandlingTask(bool capture_window, capture_screen ? content::desktop_capture::CreateScreenCapturer() : nullptr); std::unique_ptr window_capturer( - capture_window ? content::desktop_capture::CreateScreenCapturer() + capture_window ? content::desktop_capture::CreateWindowCapturer() : nullptr); cap->media_list_.reset(new NativeDesktopMediaList( std::move(screen_capturer), std::move(window_capturer))); diff --git a/spec/api-desktop-capturer-spec.js b/spec/api-desktop-capturer-spec.js index 19f06182b070..339d9756e40f 100644 --- a/spec/api-desktop-capturer-spec.js +++ b/spec/api-desktop-capturer-spec.js @@ -69,7 +69,11 @@ describe('desktopCapturer', () => { return done() } + const { BrowserWindow } = remote + const w = new BrowserWindow({ width: 200, height: 200 }) + desktopCapturer.getSources({types: ['window']}, (error, sources) => { + w.destroy() expect(error).to.be.null() expect(sources).to.be.an('array').that.is.not.empty() for (const {display_id: displayId} of sources) {