inject: do not crash on bad nav

This commit is contained in:
CanadaHonk 2023-04-06 22:46:08 +01:00
parent b33b645107
commit 0183dd9fc0

View File

@ -61,7 +61,8 @@ export default async (CDP, proc, injectionType = 'browser', { dataPath, browserN
// CDP.sendMessage('Page.navigate', { url: 'about:blank' }, sessionId);
const history = await CDP.sendMessage('Page.getNavigationHistory', {}, sessionId);
let oldUrl = history.entries[history.currentIndex - 1].url;
let oldUrl = history.entries[history.currentIndex - 1]?.url;
if (!oldUrl) return;
// if (oldUrl === 'about:blank') oldUrl = history.entries[history.currentIndex - 2].url;
CDP.sendMessage('Page.navigate', {