Remove forwarding of SafeWebview console messages

Change-type: patch
Signed-off-by: Lorenzo Alberto Maria Ambrosi <lorenzoa@balena.io>
This commit is contained in:
Lorenzo Alberto Maria Ambrosi 2018-12-18 15:14:21 +01:00
parent 9077c95cdd
commit 87533f4417

View File

@ -101,8 +101,7 @@ class SafeWebview extends react.PureComponent {
this.eventTuples = [ this.eventTuples = [
[ 'did-fail-load', this.didFailLoad ], [ 'did-fail-load', this.didFailLoad ],
[ 'did-get-response-details', this.didGetResponseDetails ], [ 'did-get-response-details', this.didGetResponseDetails ],
[ 'new-window', this.constructor.newWindow ], [ 'new-window', this.constructor.newWindow ]
[ 'console-message', this.constructor.consoleMessage ]
] ]
// Make a persistent electron session for the webview // Make a persistent electron session for the webview
@ -226,38 +225,6 @@ class SafeWebview extends react.PureComponent {
electron.shell.openExternal(url.href) electron.shell.openExternal(url.href)
} }
} }
/**
* @summary Forward specially-formatted console messages from the webview
* @param {Event} event - event object
*
* @example
*
* // In the webview
* console.log('Good night!')
*/
static consoleMessage (event) {
if (_.isNil(event.message)) {
return
}
let message = event.message
try {
message = JSON.parse(event.message)
} catch (error) {
// Ignore
}
if (message.command === 'error') {
analytics.logException(message.data)
} else {
analytics.logEvent('SafeWebview console message', {
message,
applicationSessionUuid: store.getState().toJS().applicationSessionUuid,
flashingWorkflowUuid: store.getState().toJS().flashingWorkflowUuid
})
}
}
} }
SafeWebview.propTypes = { SafeWebview.propTypes = {