Catch console log messages from SafeWebView

This simplifies debugging of the content loaded by Etcher,
including analysis of loaded analytics libraries.

Changelog-entry: Catch console log messages from SafeWebView
Change-type: patch
Signed-off-by: Roman Mazur <roman@balena.io>
This commit is contained in:
Roman Mazur 2019-10-14 09:43:19 +03:00 committed by Roman Mazur
parent bde9a97b17
commit 5151d751a3
No known key found for this signature in database
GPG Key ID: 9459886EFE6EE2F6

View File

@ -107,9 +107,14 @@ class SafeWebview extends react.PureComponent {
this.didFailLoad = _.bind(this.didFailLoad, this)
this.didGetResponseDetails = _.bind(this.didGetResponseDetails, this)
const logWebViewMessage = (event) => {
console.log('Message from SafeWebview:', event.message);
};
this.eventTuples = [
[ 'did-fail-load', this.didFailLoad ],
[ 'new-window', this.constructor.newWindow ]
[ 'new-window', this.constructor.newWindow ],
[ 'console-message', logWebViewMessage ]
]
// Make a persistent electron session for the webview