1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 09:32:12 +01:00

Fix crash when restoring history of internal pages with QtWebEngine 5.8

Closes #2302
This commit is contained in:
David Rosca 2017-04-08 16:44:41 +02:00
parent 0148b7aaff
commit 8e16efc1bf
4 changed files with 12 additions and 15 deletions

View File

@ -258,12 +258,6 @@ QRect WebView::scrollBarGeometry(Qt::Orientation orientation) const
return s && s->isVisible() ? s->geometry() : QRect(); return s && s->isVisible() ? s->geometry() : QRect();
} }
void WebView::restoreHistory(const QByteArray &data)
{
QDataStream stream(data);
stream >> *history();
}
QWidget *WebView::inputWidget() const QWidget *WebView::inputWidget() const
{ {
return m_rwhvqt ? m_rwhvqt : const_cast<WebView*>(this); return m_rwhvqt ? m_rwhvqt : const_cast<WebView*>(this);

View File

@ -60,8 +60,6 @@ public:
QPointF mapToViewport(const QPointF &pos) const; QPointF mapToViewport(const QPointF &pos) const;
QRect scrollBarGeometry(Qt::Orientation orientation) const; QRect scrollBarGeometry(Qt::Orientation orientation) const;
void restoreHistory(const QByteArray &data);
void addNotification(QWidget* notif); void addNotification(QWidget* notif);
bool eventFilter(QObject *obj, QEvent *event); bool eventFilter(QObject *obj, QEvent *event);

View File

@ -300,11 +300,6 @@ void WebTab::attach(BrowserWindow* window)
m_tabIcon->updateIcon(); m_tabIcon->updateIcon();
} }
void WebTab::setHistoryData(const QByteArray &data)
{
m_webView->restoreHistory(data);
}
QByteArray WebTab::historyData() const QByteArray WebTab::historyData() const
{ {
if (isRestored()) { if (isRestored()) {
@ -413,7 +408,18 @@ void WebTab::restoreTab(const WebTab::SavedTab &tab)
void WebTab::p_restoreTab(const QUrl &url, const QByteArray &history, int zoomLevel) void WebTab::p_restoreTab(const QUrl &url, const QByteArray &history, int zoomLevel)
{ {
m_webView->load(url); m_webView->load(url);
m_webView->restoreHistory(history);
// Restoring history of internal pages crashes QtWebEngine 5.8
static const QStringList blacklistedSchemes = {
QSL("view-source"),
QSL("chrome")
};
if (!blacklistedSchemes.contains(url.scheme())) {
QDataStream stream(history);
stream >> *m_webView->history();
}
m_webView->setZoomLevel(zoomLevel); m_webView->setZoomLevel(zoomLevel);
m_webView->setFocus(); m_webView->setFocus();
} }

View File

@ -73,7 +73,6 @@ public:
void detach(); void detach();
void attach(BrowserWindow* window); void attach(BrowserWindow* window);
void setHistoryData(const QByteArray &data);
QByteArray historyData() const; QByteArray historyData() const;
void stop(); void stop();