void UrlRequestInterceptor::interceptRequest(QWebEngineUrlRequestInfo &urlRequestInfo)
{
- // Handle the request according to the navigation type.
- switch (urlRequestInfo.navigationType())
- {
- case QWebEngineUrlRequestInfo::NavigationTypeLink:
- case QWebEngineUrlRequestInfo::NavigationTypeTyped:
- case QWebEngineUrlRequestInfo::NavigationTypeBackForward:
- case QWebEngineUrlRequestInfo::NavigationTypeRedirect:
- {
- // Only check the hosts if the main URL is changing.
- if (urlRequestInfo.resourceType() == QWebEngineUrlRequestInfo::ResourceTypeMainFrame)
- {
- // Get the hosts.
- QString requestingHost = urlRequestInfo.initiator().host();
- QString requestedHost = urlRequestInfo.requestUrl().host();
-
- // Reapply the domain settings if the host is changing.
- if (requestingHost != requestedHost)
- emit applyDomainSettings(requestedHost);
- }
-
- break;
- }
-
- default:
- // Do nothing.
- break;
- }
-
// Handle the request according to the resource type.
switch (urlRequestInfo.resourceType())
{
break;
}
}
+
+ // Handle the request according to the navigation type.
+ switch (urlRequestInfo.navigationType())
+ {
+ case QWebEngineUrlRequestInfo::NavigationTypeLink:
+ case QWebEngineUrlRequestInfo::NavigationTypeTyped:
+ case QWebEngineUrlRequestInfo::NavigationTypeBackForward:
+ // case QWebEngineUrlRequestInfo::NavigationTypeReload: This can be uncommented once https://redmine.stoutner.com/issues/821 has been fixed.
+ case QWebEngineUrlRequestInfo::NavigationTypeRedirect:
+ {
+ // Only check the hosts if the main URL is changing.
+ if (urlRequestInfo.resourceType() == QWebEngineUrlRequestInfo::ResourceTypeMainFrame)
+ {
+ // Get the hosts.
+ QString requestingHost = urlRequestInfo.initiator().host();
+ QString requestedHost = urlRequestInfo.requestUrl().host();
+
+ // Reapply the domain settings if the host is changing.
+ if (requestingHost != requestedHost)
+ emit applyDomainSettings(requestedHost);
+ }
+
+ break;
+ }
+
+ default:
+ // Do nothing.
+ break;
+ }
}