diff --git a/qutebrowser/browser/tab.py b/qutebrowser/browser/tab.py index 384e38282..e1e6b3092 100644 --- a/qutebrowser/browser/tab.py +++ b/qutebrowser/browser/tab.py @@ -511,6 +511,9 @@ class AbstractTab(QWidget): def run_webaction(self, action): raise NotImplementedError + def set_html(self, html, base_url): + raise NotImplementedError + def __repr__(self): url = utils.elide(self.cur_url.toDisplayString(QUrl.EncodeUnicode), 100) diff --git a/qutebrowser/browser/webengine/webenginetab.py b/qutebrowser/browser/webengine/webenginetab.py index 6543d7c34..5b36e91e2 100644 --- a/qutebrowser/browser/webengine/webenginetab.py +++ b/qutebrowser/browser/webengine/webenginetab.py @@ -159,6 +159,13 @@ class WebEngineViewTab(tab.AbstractTab): def run_webaction(self, action): self._widget.triggerPageAction(action) + def set_html(self, html, base_url): + # FIXME check this and raise an exception if too big: + # Warning: The content will be percent encoded before being sent to the + # renderer via IPC. This may increase its size. The maximum size of the + # percent encoded content is 2 megabytes minus 30 bytes. + self._widget.setHtml(html, base_url) + def _connect_signals(self): view = self._widget page = view.page() diff --git a/qutebrowser/browser/webkit/webkittab.py b/qutebrowser/browser/webkit/webkittab.py index 1ccd1b3fd..255ab7b63 100644 --- a/qutebrowser/browser/webkit/webkittab.py +++ b/qutebrowser/browser/webkit/webkittab.py @@ -502,6 +502,9 @@ class WebViewTab(tab.AbstractTab): def run_webaction(self, action): self._widget.triggerPageAction(action) + def set_html(self, html, base_url): + self._widget.setHtml(html, base_url) + def _connect_signals(self): view = self._widget page = view.page()