feat: add --enable-api-filtering-logging commandline switch (#20335)

This commit is contained in:
Milan Burda 2019-10-04 19:49:09 +02:00 committed by Jeremy Apthorp
parent e1eb9519f5
commit ccff140046
15 changed files with 85 additions and 29 deletions

View file

@ -23,6 +23,12 @@ const emitCustomEvent = function (contents, eventName, ...args) {
return event
}
const logStack = function (contents, code, stack) {
if (stack) {
console.warn(`WebContents (${contents.id}): ${code}`, stack)
}
}
// Implements window.close()
ipcMainInternal.on('ELECTRON_BROWSER_WINDOW_CLOSE', function (event) {
const window = event.sender.getOwnerBrowserWindow()
@ -63,7 +69,8 @@ ipcMainUtils.handleSync('ELECTRON_BROWSER_CLIPBOARD', function (event, method, .
if (features.isDesktopCapturerEnabled()) {
const desktopCapturer = require('@electron/internal/browser/desktop-capturer')
ipcMainInternal.handle('ELECTRON_BROWSER_DESKTOP_CAPTURER_GET_SOURCES', function (event, ...args) {
ipcMainInternal.handle('ELECTRON_BROWSER_DESKTOP_CAPTURER_GET_SOURCES', function (event, options, stack) {
logStack(event.sender, 'desktopCapturer.getSources()', stack)
const customEvent = emitCustomEvent(event.sender, 'desktop-capturer-get-sources')
if (customEvent.defaultPrevented) {
@ -71,7 +78,7 @@ if (features.isDesktopCapturerEnabled()) {
return []
}
return desktopCapturer.getSources(event, ...args)
return desktopCapturer.getSources(event, options)
})
}