Skip to content

Commit

Permalink
Work around broken error pages on Debian
Browse files Browse the repository at this point in the history
  • Loading branch information
The-Compiler committed Nov 9, 2019
1 parent e926436 commit d741bdf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions doc/changelog.asciidoc
Expand Up @@ -52,6 +52,7 @@ Fixed
- Downloads are now hidden properly when the browser is in fullscreen mode.
- Crash when setting `colors.webpage.bg` to an empty value with QtWebKit.
- Crash when the history database file is not a proper sqlite database.
- Workaround for missing/broken error pages on Debian.
v1.8.1 (2019-09-27)
-------------------
Expand Down
16 changes: 12 additions & 4 deletions qutebrowser/browser/webengine/webenginetab.py
Expand Up @@ -1357,13 +1357,22 @@ def _on_render_process_terminated(self, status, exitcode):
def _error_page_workaround(self, html):
"""Check if we're displaying a Chromium error page.
This gets only called if we got loadFinished(False) without JavaScript,
so we can display at least some error page.
This gets called if we got a loadFinished(False), so we can display at
least some error page in situations where Chromium's can't be
displayed.
WORKAROUND for https://bugreports.qt.io/browse/QTBUG-66643
WORKAROUND for https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=882805
Needs to check the page content as a WORKAROUND for
https://bugreports.qt.io/browse/QTBUG-66661
"""
js_enabled = self.settings.test_attribute('content.javascript.enabled')
missing_jst = 'jstProcess(' in html and 'jstProcess=' not in html

if js_enabled and not missing_jst:
return

match = re.search(r'"errorCode":"([^"]*)"', html)
if match is None:
return
Expand Down Expand Up @@ -1393,8 +1402,7 @@ def _on_load_finished(self, ok: bool) -> None:
else:
self._update_load_status(ok)

js_enabled = self.settings.test_attribute('content.javascript.enabled')
if not ok and not js_enabled:
if not ok:
self.dump_async(self._error_page_workaround)

if ok and self._reload_url is not None:
Expand Down

0 comments on commit d741bdf

Please sign in to comment.