prevent hanging when parent frame is absent
This commit is contained in:
parent
a3962b7adf
commit
bc2da3f66a
|
@ -141,13 +141,10 @@ global updateIcon
|
||||||
|
|
||||||
function getFrameUrl(frame, frames) {
|
function getFrameUrl(frame, frames) {
|
||||||
while (frame.url === 'about:blank' && frame.frameId > 0) {
|
while (frame.url === 'about:blank' && frame.frameId > 0) {
|
||||||
for (const f of frames) {
|
const parent = frames.find(f => f.frameId === frame.parentFrameId);
|
||||||
if (f.frameId === frame.parentFrameId) {
|
if (!parent) break;
|
||||||
frame.url = f.url;
|
frame.url = parent.url;
|
||||||
frame = f;
|
frame = parent;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return (frame || frames[0]).url;
|
return (frame || frames[0]).url;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user