From 39f657b72aea8a050dc7d19f562f6c1fa432eba0 Mon Sep 17 00:00:00 2001 From: Chris Date: Thu, 25 Jan 2024 16:29:05 +0000 Subject: [PATCH] Ignore chrome extension iframes (#106) --- manifest.json | 2 +- package.json | 2 +- src/elements.ts | 8 +++++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/manifest.json b/manifest.json index 448762d..30252fc 100644 --- a/manifest.json +++ b/manifest.json @@ -31,7 +31,7 @@ "permissions": ["activeTab", "storage", "notifications"], "host_permissions": ["http://*/*", "https://*/*"], "update_url": "http://clients2.google.com/service/update2/crx", - "version":"2.0.4", + "version":"2.0.5", "options_page": "assets/options.html", "icons": { "16": "assets/icon-16.png", diff --git a/package.json b/package.json index bd4ff6b..9b4152e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "search_and_replace", - "version": "2.0.4", + "version": "2.0.5", "resolutions": { "author": "Chris Taylor " }, diff --git a/src/elements.ts b/src/elements.ts index 1f1e682..8fa20d9 100644 --- a/src/elements.ts +++ b/src/elements.ts @@ -20,7 +20,13 @@ export function isBlobIframe(el: Element) { export function getIframeElements(document: Document, blob = false): HTMLIFrameElement[] { return Array.from(>document.querySelectorAll('iframe')).filter( - (iframe) => iframe.src.length && (blob ? isBlobIframe(iframe) : !isBlobIframe(iframe)) + (iframe) => + // We don't want empty iframes + iframe.src.length && + // We don't want to count iframes injected by other chrome extensions + !iframe.src.startsWith('chrome-extension://') && + // We may or may not want blob iframes + (blob ? isBlobIframe(iframe) : !isBlobIframe(iframe)) ) }