launcher: clean up allowRedirects
This commit is contained in:
parent
11c5abe4f3
commit
58e2ed219b
@ -44,8 +44,7 @@ export default async (CDP, proc, injectionType = 'browser', { dataPath, browserN
|
|||||||
let newUrl = msg.params?.frame?.url ?? msg.params?.url;
|
let newUrl = msg.params?.frame?.url ?? msg.params?.url;
|
||||||
if (allowRedirects === true) return;
|
if (allowRedirects === true) return;
|
||||||
if (allowRedirects === 'same-origin' && new URL(newUrl).origin === new URL(url).origin) return;
|
if (allowRedirects === 'same-origin' && new URL(newUrl).origin === new URL(url).origin) return;
|
||||||
|
if (allowRedirects === false && newUrl === url) return;
|
||||||
console.log(url, new URL(url).origin);
|
|
||||||
|
|
||||||
CDP.sendMessage('Page.stopLoading', {}, sessionId);
|
CDP.sendMessage('Page.stopLoading', {}, sessionId);
|
||||||
|
|
||||||
@ -53,7 +52,8 @@ export default async (CDP, proc, injectionType = 'browser', { dataPath, browserN
|
|||||||
CDP.sendMessage('Page.navigate', { url: 'about:blank' }, sessionId);
|
CDP.sendMessage('Page.navigate', { url: 'about:blank' }, sessionId);
|
||||||
|
|
||||||
const history = await CDP.sendMessage('Page.getNavigationHistory', {}, sessionId);
|
const history = await CDP.sendMessage('Page.getNavigationHistory', {}, sessionId);
|
||||||
const oldUrl = history.entries[history.currentIndex - 1].url;
|
let oldUrl = history.entries[history.currentIndex - 1].url;
|
||||||
|
if (oldUrl === 'about:blank') oldUrl = history.entries[history.currentIndex - 2].url;
|
||||||
|
|
||||||
CDP.sendMessage('Page.navigate', {
|
CDP.sendMessage('Page.navigate', {
|
||||||
url: oldUrl,
|
url: oldUrl,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user