Description
There are certain scenarios where there was an acceptNavigationRequest call with Qt 5.12 which is now missing with Qt 5.13.0.
Patch simplebrowser to log those calls:
diff --git a/examples/webenginewidgets/simplebrowser/webpage.cpp b/examples/webenginewidgets/simplebrowser/webpage.cpp index 99849c77..3e10ab3c 100644 --- a/examples/webenginewidgets/simplebrowser/webpage.cpp +++ b/examples/webenginewidgets/simplebrowser/webpage.cpp @@ -71,6 +71,12 @@ WebPage::WebPage(QWebEngineProfile *profile, QObject *parent) #endif } +bool WebPage::acceptNavigationRequest(const QUrl &url, NavigationType type, bool isMainFrame) +{ + qDebug() << "navigation request" << url << type << isMainFrame; + return true; +} + bool WebPage::certificateError(const QWebEngineCertificateError &error) { QWidget *mainWindow = view()->window(); diff --git a/examples/webenginewidgets/simplebrowser/webpage.h b/examples/webenginewidgets/simplebrowser/webpage.h index 90829589..e4649fce 100644 --- a/examples/webenginewidgets/simplebrowser/webpage.h +++ b/examples/webenginewidgets/simplebrowser/webpage.h @@ -63,6 +63,7 @@ public: protected: bool certificateError(const QWebEngineCertificateError &error) override; + bool acceptNavigationRequest(const QUrl &url, NavigationType type, bool isMainFrame) override; private slots: void handleAuthenticationRequired(const QUrl &requestUrl, QAuthenticator *auth);
I found two reproducers so far:
Twitter:
- Make sure you get the new Twitter UI. I needed to log in to get it, you might also need to click to click your profile picture and select "Try the new Twitter".
- Open a new tab, type (or paste) https://twitter.com/qtproject
- Observe how no navigation request gets logged, while with Qt 5.12, there is a navigation request.
- Ctrl-Click a tweet to open it in a new background tab.
- Observe how no navigation request gets logged, while with Qt 5.12, there is: navigation request QUrl("https://twitter.com/qtproject/status/1152331022647865344") QWebEnginePage::NavigationTypeLinkClicked true
- Press the reload button
- Observe how no navigation request gets logged.
JuliaLang discourse:
- Go to https://discourse.julialang.org/
- Use "Sign up" -> "with GitHub" to create a new account linked to the GitHub account
- Restart the browser
- Go to the page again, this time, log in via the GitHub authentication
- With Qt 5.12, there are navigation requests for discourse.julialang.org after the log in, but not with Qt 5.13.
Qt 5.12.4:
navigation request QUrl("http://discourse.julialang.org/") QWebEnginePage::NavigationTypeTyped true navigation request QUrl("https://discourse.julialang.org/") QWebEnginePage::NavigationTypeTyped true navigation request QUrl("https://discourse.julialang.org/auth/github") QWebEnginePage::NavigationTypeLinkClicked true navigation request QUrl("https://github.com/login/oauth/authorize?client_id=REDACTED&redirect_uri=https%3A%2F%2Fdiscourse.julialang.org%2Fauth%2Fgithub%2Fcallback&response_type=code&scope=user%3Aemail&state=REDACTED") QWebEnginePage::NavigationTypeLinkClicked true navigation request QUrl("https://github.com/login?client_id=REDACTED&return_to=%2Flogin%2Foauth%2Fauthorize%3Fclient_id%REDACTED%26redirect_uri%3Dhttps%253A%252F%252Fdiscourse.julialang.org%252Fauth%252Fgithub%252Fcallback%26response_type%3Dcode%26scope%3Duser%253Aemail%26state%REDACTED") QWebEnginePage::NavigationTypeLinkClicked true navigation request QUrl("https://github.com/session") QWebEnginePage::NavigationTypeFormSubmitted true navigation request QUrl("https://github.com/sessions/two-factor") QWebEnginePage::NavigationTypeFormSubmitted true navigation request QUrl("https://github.com/sessions/two-factor") QWebEnginePage::NavigationTypeFormSubmitted true navigation request QUrl("https://github.com/login/oauth/authorize?client_id=REDACTED&redirect_uri=https%3A%2F%2Fdiscourse.julialang.org%2Fauth%2Fgithub%2Fcallback&response_type=code&scope=user%3Aemail&state=REDACTED") QWebEnginePage::NavigationTypeFormSubmitted true navigation request QUrl("https://discourse.julialang.org/auth/github/callback?code=REDACTED&state=REDACTED") QWebEnginePage::NavigationTypeOther true navigation request QUrl("https://discourse.julialang.org/") QWebEnginePage::NavigationTypeOther true
5.13.0:
navigation request QUrl("http://discourse.julialang.org/") QWebEnginePage::NavigationTypeTyped true navigation request QUrl("https://discourse.julialang.org/") QWebEnginePage::NavigationTypeTyped true navigation request QUrl("https://github.com/login/oauth/authorize?client_id=REDACTED&redirect_uri=https%3A%2F%2Fdiscourse.julialang.org%2Fauth%2Fgithub%2Fcallback&response_type=code&scope=user%3Aemail&state=REDACTED") QWebEnginePage::NavigationTypeLinkClicked true navigation request QUrl("https://github.com/login?client_id=REDACTED&return_to=%2Flogin%2Foauth%2Fauthorize%3Fclient_id%3DREDACTED_uri%3Dhttps%253A%252F%252Fdiscourse.julialang.org%252Fauth%252Fgithub%252Fcallback%26response_type%3Dcode%26scope%3Duser%253Aemail%26state%3DREDACTED") QWebEnginePage::NavigationTypeLinkClicked true navigation request QUrl("https://github.com/session") QWebEnginePage::NavigationTypeFormSubmitted true navigation request QUrl("https://github.com/sessions/two-factor") QWebEnginePage::NavigationTypeFormSubmitted true navigation request QUrl("https://github.com/sessions/two-factor") QWebEnginePage::NavigationTypeFormSubmitted true navigation request QUrl("https://github.com/login/oauth/authorize?client_id=REDACTED&redirect_uri=https%3A%2F%2Fdiscourse.julialang.org%2Fauth%2Fgithub%2Fcallback&response_type=code&scope=user%3Aemail&state=REDACTED") QWebEnginePage::NavigationTypeFormSubmitted true
(last two lines missing)