Changeset View
Changeset View
Standalone View
Standalone View
webenginepart/src/webenginepage.cpp
Show All 23 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 | const bool actionRequestsNewTab = m_type == QWebEnginePage::WebBrowserBackgroundTab || | ||||
776 | m_type == QWebEnginePage::WebBrowserTab; | ||||
775 | 777 | | |||
776 | if (actionRequestedByUser) { | 778 | if (actionRequestedByUser && !actionRequestsNewTab) { | ||
777 | if (!part() && !isMainFrame) { | 779 | if (!part() && !isMainFrame) { | ||
778 | return false; | 780 | return false; | ||
dfaure: coding style: spaces around `!=` | |||||
779 | } | 781 | } | ||
780 | const KParts::HtmlSettingsInterface::JSWindowOpenPolicy policy = WebEngineSettings::self()->windowOpenPolicy(reqUrl.host()); | 782 | const KParts::HtmlSettingsInterface::JSWindowOpenPolicy policy = WebEngineSettings::self()->windowOpenPolicy(reqUrl.host()); | ||
781 | switch (policy) { | 783 | switch (policy) { | ||
782 | case KParts::HtmlSettingsInterface::JSWindowOpenDeny: | 784 | case KParts::HtmlSettingsInterface::JSWindowOpenDeny: | ||
783 | // TODO: Implement support for dealing with blocked pop up windows. | 785 | // TODO: Implement support for dealing with blocked pop up windows. | ||
784 | this->deleteLater(); | 786 | this->deleteLater(); | ||
785 | return false; | 787 | return false; | ||
786 | case KParts::HtmlSettingsInterface::JSWindowOpenAsk: { | 788 | case KParts::HtmlSettingsInterface::JSWindowOpenAsk: { | ||
Show All 22 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.