From 818031a86beb99cbf4bf923664bc3445351bac87 Mon Sep 17 00:00:00 2001 From: tophf Date: Fri, 24 Sep 2021 11:05:55 +0300 Subject: [PATCH] preserve iframe's sender.url --- background/style-manager.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/background/style-manager.js b/background/style-manager.js index 936800aa..53923466 100644 --- a/background/style-manager.js +++ b/background/style-manager.js @@ -142,12 +142,12 @@ const styleMan = (() => { if (isInitialApply && prefs.get('disableAll')) { return {disableAll: true}; } - if (CHROME && this && this.sender) { + const sender = CHROME && this && this.sender || {}; + if (sender.frameId === 0) { /* Chrome hides text frament from location.href of the page e.g. #:~:text=foo so we'll use the real URL reported by webNavigation API. TODO: if FF will do the same, this won't work as is: FF reports onCommitted too late */ - const {tab, frameId} = this.sender; - url = tab && tabMan.get(tab.id, 'url', frameId) || url; + url = tabMan.get(sender.tab.id, 'url', 0) || url; } let cache = cachedStyleForUrl.get(url); if (!cache) {