fix(browser): optimize request interceptor

This commit is contained in:
Oleg Shparber 2023-09-17 03:31:12 -04:00
parent e80badd0cb
commit dcf6016bb8

View File

@ -47,14 +47,14 @@ void UrlRequestInterceptor::interceptRequest(QWebEngineUrlRequestInfo &info)
return; return;
} }
bool isFirstPartyUrlLocal = Core::NetworkAccessManager::isLocalUrl(firstPartyUrl);
bool isRequestUrlLocal = Core::NetworkAccessManager::isLocalUrl(requestUrl);
// Direct links are controlled in the WebPage // Direct links are controlled in the WebPage
if (info.resourceType() == QWebEngineUrlRequestInfo::ResourceTypeMainFrame) { if (info.resourceType() == QWebEngineUrlRequestInfo::ResourceTypeMainFrame) {
return; return;
} }
bool isFirstPartyUrlLocal = Core::NetworkAccessManager::isLocalUrl(firstPartyUrl);
bool isRequestUrlLocal = Core::NetworkAccessManager::isLocalUrl(requestUrl);
// Allow local resources on local pages and external resources on external pages. // Allow local resources on local pages and external resources on external pages.
if (isFirstPartyUrlLocal == isRequestUrlLocal) { if (isFirstPartyUrlLocal == isRequestUrlLocal) {
return; return;