Skip to content

Commit 388255d

Browse files
authored
Improve support for frames in Firefox (#285)
1 parent 2874463 commit 388255d

File tree

4 files changed

+103
-5
lines changed

4 files changed

+103
-5
lines changed

package-lock.json

Lines changed: 86 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"@parcel/config-webextension": "^2.8.3",
4040
"dot-json": "^1.2.2",
4141
"parcel": "^2.8.3",
42+
"webext-domain-permission-toggle": "^4.0.1",
4243
"xo": "^0.53.1"
4344
},
4445
"engines": {

source/background.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,20 @@
1+
import addDomainPermissionToggle from 'webext-domain-permission-toggle';
12
import browser from 'webextension-polyfill';
23
import oneEvent from 'one-event';
34
import optionsStorage from './options-storage.js';
45

6+
// Firefox hates iframes on activeTab
7+
// https://bugzilla.mozilla.org/show_bug.cgi?id=1653408
8+
// https://github.com/fregante/GhostText/pull/285
9+
if (navigator.userAgent.includes('Firefox/')) {
10+
// eslint-disable-next-line unicorn/prefer-top-level-await -- I specifically want to not stop the extension in case of errors
11+
(async () => {
12+
addDomainPermissionToggle({
13+
title: 'Grant access to iframes',
14+
});
15+
})();
16+
}
17+
518
function stopGT(tab) {
619
chrome.tabs.executeScript(tab.id, {
720
code: 'stopGT()',

source/manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
"http://localhost/",
2020
"storage"
2121
],
22+
"optional_permissions": [
23+
"*://*/*"
24+
],
2225
"applications": {
2326
"gecko": {
2427

0 commit comments

Comments
 (0)