Skip to content

Commit 39f657b

Browse files
authored
Ignore chrome extension iframes (#106)
1 parent 41990d9 commit 39f657b

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"permissions": ["activeTab", "storage", "notifications"],
3232
"host_permissions": ["http://*/*", "https://*/*"],
3333
"update_url": "http://clients2.google.com/service/update2/crx",
34-
"version":"2.0.4",
34+
"version":"2.0.5",
3535
"options_page": "assets/options.html",
3636
"icons": {
3737
"16": "assets/icon-16.png",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "search_and_replace",
3-
"version": "2.0.4",
3+
"version": "2.0.5",
44
"resolutions": {
55
"author": "Chris Taylor <cjtaylor38@gmail.com>"
66
},

src/elements.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,13 @@ export function isBlobIframe(el: Element) {
2020

2121
export function getIframeElements(document: Document, blob = false): HTMLIFrameElement[] {
2222
return Array.from(<NodeListOf<HTMLIFrameElement>>document.querySelectorAll('iframe')).filter(
23-
(iframe) => iframe.src.length && (blob ? isBlobIframe(iframe) : !isBlobIframe(iframe))
23+
(iframe) =>
24+
// We don't want empty iframes
25+
iframe.src.length &&
26+
// We don't want to count iframes injected by other chrome extensions
27+
!iframe.src.startsWith('chrome-extension://') &&
28+
// We may or may not want blob iframes
29+
(blob ? isBlobIframe(iframe) : !isBlobIframe(iframe))
2430
)
2531
}
2632

0 commit comments

Comments
 (0)