diff --git a/doc/help/settings.asciidoc b/doc/help/settings.asciidoc index ea0f542bc..9a4abb113 100644 --- a/doc/help/settings.asciidoc +++ b/doc/help/settings.asciidoc @@ -19,6 +19,7 @@ |<>|Enable workarounds for broken sites. |<>|Default encoding to use for websites. |<>|How to open links in an existing instance if a new one is launched. +|<>|Whether to log javascript console messages. |============== .Quick reference for section ``ui'' @@ -371,6 +372,17 @@ Valid values: Default: +pass:[window]+ +[[general-log-javascript-console]] +=== log-javascript-console +Whether to log javascript console messages. + +Valid values: + + * +true+ + * +false+ + +Default: +pass:[false]+ + == ui General options related to the user interface. diff --git a/qutebrowser/browser/webpage.py b/qutebrowser/browser/webpage.py index 9c7eb6864..dbfee1830 100644 --- a/qutebrowser/browser/webpage.py +++ b/qutebrowser/browser/webpage.py @@ -310,7 +310,8 @@ class BrowserPage(QWebPage): def javaScriptConsoleMessage(self, msg, line, source): """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): """Override QWebPage's chooseFile to be able to chose a file to upload. diff --git a/qutebrowser/config/configdata.py b/qutebrowser/config/configdata.py index ac7e4770c..3bd724d8f 100644 --- a/qutebrowser/config/configdata.py +++ b/qutebrowser/config/configdata.py @@ -189,6 +189,10 @@ DATA = collections.OrderedDict([ SettingValue(typ.NewInstanceOpenTarget(), 'window'), "How to open links in an existing instance if a new one is " "launched."), + + ('log-javascript-console', + SettingValue(typ.Bool(), 'false'), + "Whether to log javascript console messages."), )), ('ui', sect.KeyValue(