Commit be8c12a8 authored by Kai Koehne's avatar Kai Koehne
Browse files

Print JS console messages by default


Change the behavior of QWebEnginePage/WebEngineView
to print JavaScript console.warn and console.error messages
by default in a 'js' logging category. This matches also
the behavior for QtQml, where console messages end up in
a 'qml' logging category by default.

So far access to the JavaScript console required either use
of the remote debugging functionality, subclassing of
QWebEnginePage, or implementing a custom handler.
Anyhow, even then writing a seamless forwarding of
the data and metadata to the Qt message handler is
difficult. This patches implements this forwarding by
default.

The behavior can be changed by either setting up rules
for the 'js' category, e.g.

  setFilterRules("js.*=false");

or by implementing onJavaScriptConsoleMessage(),
or overriding QWebEnginePage::javaScriptConsoleMessage.

[ChangeLog] Unhandled JS console messages are now
forwarded to to the Qt message handler inside a 'js'
category.

Change-Id: I5480383a80dcf7a122496f9b7915264ef9036db3
Reviewed-by: default avatarJoerg Bornemann <joerg.bornemann@theqtcompany.com>
Showing with 51 additions and 42 deletions
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment