From bc2da3f66a6cc1d0397b3637ff5364603456eaad Mon Sep 17 00:00:00 2001 From: tophf Date: Sat, 20 Jan 2018 02:28:20 +0300 Subject: [PATCH] prevent hanging when parent frame is absent --- background/refresh-all-tabs.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/background/refresh-all-tabs.js b/background/refresh-all-tabs.js index c649019a..12829795 100644 --- a/background/refresh-all-tabs.js +++ b/background/refresh-all-tabs.js @@ -141,13 +141,10 @@ global updateIcon function getFrameUrl(frame, frames) { while (frame.url === 'about:blank' && frame.frameId > 0) { - for (const f of frames) { - if (f.frameId === frame.parentFrameId) { - frame.url = f.url; - frame = f; - break; - } - } + const parent = frames.find(f => f.frameId === frame.parentFrameId); + if (!parent) break; + frame.url = parent.url; + frame = parent; } return (frame || frames[0]).url; }