Don't log javascript console messages by default.

This commit is contained in:
Florian Bruhin 2015-02-09 07:46:31 +01:00
parent 0f48ea62c1
commit 4704e81b41
3 changed files with 18 additions and 1 deletions

View File

@ -19,6 +19,7 @@
|<<general-site-specific-quirks,site-specific-quirks>>|Enable workarounds for broken sites. |<<general-site-specific-quirks,site-specific-quirks>>|Enable workarounds for broken sites.
|<<general-default-encoding,default-encoding>>|Default encoding to use for websites. |<<general-default-encoding,default-encoding>>|Default encoding to use for websites.
|<<general-new-instance-open-target,new-instance-open-target>>|How to open links in an existing instance if a new one is launched. |<<general-new-instance-open-target,new-instance-open-target>>|How to open links in an existing instance if a new one is launched.
|<<general-log-javascript-console,log-javascript-console>>|Whether to log javascript console messages.
|============== |==============
.Quick reference for section ``ui'' .Quick reference for section ``ui''
@ -371,6 +372,17 @@ Valid values:
Default: +pass:[window]+ Default: +pass:[window]+
[[general-log-javascript-console]]
=== log-javascript-console
Whether to log javascript console messages.
Valid values:
* +true+
* +false+
Default: +pass:[false]+
== ui == ui
General options related to the user interface. General options related to the user interface.

View File

@ -310,7 +310,8 @@ class BrowserPage(QWebPage):
def javaScriptConsoleMessage(self, msg, line, source): def javaScriptConsoleMessage(self, msg, line, source):
"""Override javaScriptConsoleMessage to use debug log.""" """Override javaScriptConsoleMessage to use debug log."""
log.js.debug("[{}:{}] {}".format(source, line, msg)) if config.get('general', 'log-javascript-console'):
log.js.debug("[{}:{}] {}".format(source, line, msg))
def chooseFile(self, _frame, suggested_file): def chooseFile(self, _frame, suggested_file):
"""Override QWebPage's chooseFile to be able to chose a file to upload. """Override QWebPage's chooseFile to be able to chose a file to upload.

View File

@ -189,6 +189,10 @@ DATA = collections.OrderedDict([
SettingValue(typ.NewInstanceOpenTarget(), 'window'), SettingValue(typ.NewInstanceOpenTarget(), 'window'),
"How to open links in an existing instance if a new one is " "How to open links in an existing instance if a new one is "
"launched."), "launched."),
('log-javascript-console',
SettingValue(typ.Bool(), 'false'),
"Whether to log javascript console messages."),
)), )),
('ui', sect.KeyValue( ('ui', sect.KeyValue(