Skip to content

Commit

Permalink
Improve support for frames in Firefox (#285)
Browse files Browse the repository at this point in the history
  • Loading branch information
fregante committed May 16, 2023
1 parent 2874463 commit 388255d
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 5 deletions.
91 changes: 86 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"@parcel/config-webextension": "^2.8.3",
"dot-json": "^1.2.2",
"parcel": "^2.8.3",
"webext-domain-permission-toggle": "^4.0.1",
"xo": "^0.53.1"
},
"engines": {
Expand Down
13 changes: 13 additions & 0 deletions source/background.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
import addDomainPermissionToggle from 'webext-domain-permission-toggle';
import browser from 'webextension-polyfill';
import oneEvent from 'one-event';
import optionsStorage from './options-storage.js';

// Firefox hates iframes on activeTab
// https://bugzilla.mozilla.org/show_bug.cgi?id=1653408
// https://github.com/fregante/GhostText/pull/285
if (navigator.userAgent.includes('Firefox/')) {
// eslint-disable-next-line unicorn/prefer-top-level-await -- I specifically want to not stop the extension in case of errors
(async () => {
addDomainPermissionToggle({
title: 'Grant access to iframes',
});
})();
}

function stopGT(tab) {
chrome.tabs.executeScript(tab.id, {
code: 'stopGT()',
Expand Down
3 changes: 3 additions & 0 deletions source/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
"http://localhost/",
"storage"
],
"optional_permissions": [
"*://*/*"
],
"applications": {
"gecko": {
"id": "ghosttext@bfred.it",
Expand Down

0 comments on commit 388255d

Please sign in to comment.