Skip to content

Commit

Permalink
Ignore chrome extension iframes (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
forgetso authored Jan 25, 2024
1 parent 41990d9 commit 39f657b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "search_and_replace",
"version": "2.0.4",
"version": "2.0.5",
"resolutions": {
"author": "Chris Taylor <[email protected]>"
},
Expand Down
8 changes: 7 additions & 1 deletion src/elements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@ export function isBlobIframe(el: Element) {

export function getIframeElements(document: Document, blob = false): HTMLIFrameElement[] {
return Array.from(<NodeListOf<HTMLIFrameElement>>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))
)
}

Expand Down

0 comments on commit 39f657b

Please sign in to comment.