Changeset View
Changeset View
Standalone View
Standalone View
webenginepart/src/webenginepage.cpp
Show All 22 Lines | |||||
766 | } | 766 | } | ||
767 | 767 | | |||
768 | bool NewWindowPage::acceptNavigationRequest(const QUrl &url, NavigationType type, bool isMainFrame) | 768 | bool NewWindowPage::acceptNavigationRequest(const QUrl &url, NavigationType type, bool isMainFrame) | ||
769 | { | 769 | { | ||
770 | //qCDebug(WEBENGINEPART_LOG) << "url:" << url << ", type:" << type << ", isMainFrame:" << isMainFrame << "m_createNewWindow=" << m_createNewWindow; | 770 | //qCDebug(WEBENGINEPART_LOG) << "url:" << url << ", type:" << type << ", isMainFrame:" << isMainFrame << "m_createNewWindow=" << m_createNewWindow; | ||
771 | if (m_createNewWindow) { | 771 | if (m_createNewWindow) { | ||
772 | const QUrl reqUrl (url); | 772 | const QUrl reqUrl (url); | ||
773 | 773 | | |||
774 | const bool actionRequestedByUser = type != QWebEnginePage::NavigationTypeOther; | 774 | const bool actionRequestedByUser = type != QWebEnginePage::NavigationTypeOther; | ||
dfaure: I think you want to edit this condition instead. The point of this bool is "this action was… | |||||
marten: See update diff comment | |||||
775 | 775 | | |||
776 | if (actionRequestedByUser) { | 776 | if (actionRequestedByUser && | ||
777 | m_type != QWebEnginePage::WebBrowserBackgroundTab && | ||||
778 | m_type != QWebEnginePage::WebBrowserTab) { | ||||
779 | | ||||
777 | if (!part() && !isMainFrame) { | 780 | if (!part() && !isMainFrame) { | ||
dfaure: coding style: spaces around `!=` | |||||
778 | return false; | 781 | return false; | ||
779 | } | 782 | } | ||
780 | const KParts::HtmlSettingsInterface::JSWindowOpenPolicy policy = WebEngineSettings::self()->windowOpenPolicy(reqUrl.host()); | 783 | const KParts::HtmlSettingsInterface::JSWindowOpenPolicy policy = WebEngineSettings::self()->windowOpenPolicy(reqUrl.host()); | ||
781 | switch (policy) { | 784 | switch (policy) { | ||
782 | case KParts::HtmlSettingsInterface::JSWindowOpenDeny: | 785 | case KParts::HtmlSettingsInterface::JSWindowOpenDeny: | ||
783 | // TODO: Implement support for dealing with blocked pop up windows. | 786 | // TODO: Implement support for dealing with blocked pop up windows. | ||
784 | this->deleteLater(); | 787 | this->deleteLater(); | ||
785 | return false; | 788 | return false; | ||
Show All 23 Lines |
I think you want to edit this condition instead. The point of this bool is "this action was requested by the user". If the condition is incorrect, this is where it should be fixed.