*Only add to navigation queue right before dns lookup

This commit is contained in:
Derrick Hammer 2022-08-14 14:42:18 -04:00
parent d485116f89
commit f1cba065cb
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 9 additions and 12 deletions

View File

@ -221,15 +221,6 @@ export default class WebEngine {
return; return;
} }
let resolveRequest: any, rejectRequest: any;
let promise = new Promise((resolve, reject) => {
resolveRequest = resolve;
rejectRequest = reject;
});
this.navigations.set(this.getNavigationId(details), promise);
let queriedUrl = originalUrl.searchParams.get("q") as string; let queriedUrl = originalUrl.searchParams.get("q") as string;
let queriedHost = queriedUrl; let queriedHost = queriedUrl;
try { try {
@ -238,21 +229,27 @@ export default class WebEngine {
} catch {} } catch {}
if (tldEnum.list.includes(getTld(queriedHost))) { if (tldEnum.list.includes(getTld(queriedHost))) {
resolveRequest();
return false; return false;
} }
if (isIp(queriedHost)) { if (isIp(queriedHost)) {
resolveRequest();
return; return;
} }
if (/[\s_]/.test(queriedHost)) { if (/[\s_]/.test(queriedHost)) {
resolveRequest();
return; return;
} }
let dns; let dns;
let resolveRequest: any, rejectRequest: any;
let promise = new Promise((resolve, reject) => {
resolveRequest = resolve;
rejectRequest = reject;
});
this.navigations.set(this.getNavigationId(details), promise);
try { try {
dns = await resolve(queriedHost, {}); dns = await resolve(queriedHost, {});
} catch (e) { } catch (e) {