Skip to content

Commit 6f1fd26

Browse files
authored
Drop activeTab support (#78)
1 parent 84eefe7 commit 6f1fd26

File tree

12 files changed

+11
-263
lines changed

12 files changed

+11
-263
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ jobs:
3333
- run: npm run vitest
3434

3535
Test:
36-
runs-on: ubuntu-latest
36+
# https://github.com/puppeteer/puppeteer/issues/12818#issuecomment-2415915338
37+
runs-on: ubuntu-22.04
3738
strategy:
3839
fail-fast: false
3940
matrix:

.github/workflows/esm-lint.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
needs: Pack
5959
steps:
6060
- uses: actions/download-artifact@v4
61-
- run: npm install --omit=dev ./artifact rollup@2 @rollup/plugin-node-resolve
61+
- run: npm install --omit=dev ./artifact rollup@4 @rollup/plugin-node-resolve
6262
- run: echo "$IMPORT_STATEMENT" > index.js
6363
- run: npx rollup -p node-resolve index.js
6464
Vite:
@@ -84,10 +84,11 @@ jobs:
8484
needs: Pack
8585
steps:
8686
- uses: actions/download-artifact@v4
87+
- run: echo '{"type":"module"}' > package.json
8788
- run: npm install --omit=dev ./artifact @sindresorhus/tsconfig
88-
- run: echo "$IMPORT_STATEMENT" > index.ts
89+
- run: echo "$IMPORT_STATEMENT" > index.mts
8990
- run: >
90-
echo '{"extends":"@sindresorhus/tsconfig","files":["index.ts"]}' >
91+
echo '{"extends":"@sindresorhus/tsconfig","files":["index.mts"]}' >
9192
tsconfig.json
9293
- run: npx --package typescript -- tsc
93-
- run: cat distribution/index.js
94+
- run: cat distribution/index.mjs

.npmignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@
22
!/distribution/*
33
*.test.*
44
!/utils.*
5-
!/including-active-tab.*

package.json

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "webext-dynamic-content-scripts",
33
"version": "10.0.4",
4-
"description": "WebExtension module: Automatically registers your `content_scripts` on domains added via `permission.request` or on `activeTab`",
4+
"description": "WebExtension module: Automatically registers your `content_scripts` on domains added via `permission.request`",
55
"keywords": [
66
"contentscript",
77
"register",
@@ -14,7 +14,6 @@
1414
"chrome",
1515
"firefox",
1616
"browser",
17-
"activetab",
1817
"extension"
1918
],
2019
"repository": "fregante/webext-dynamic-content-scripts",
@@ -27,10 +26,6 @@
2726
"types": "./distribution/index.d.ts",
2827
"default": "./distribution/index.js"
2928
},
30-
"./including-active-tab.js": {
31-
"types": "./distribution/including-active-tab.d.ts",
32-
"default": "./distribution/including-active-tab.js"
33-
},
3429
"./utils.js": {
3530
"types": "./distribution/utils.d.ts",
3631
"default": "./distribution/utils.js"
@@ -137,9 +132,6 @@
137132
"https://dynamic-ephiframe.vercel.app/Dynamic?iframe=./Inner",
138133
"https://dynamic-ephiframe.vercel.app/Dynamic?iframe=https://static-ephiframe.vercel.app/Static-inner",
139134
"https://static-ephiframe.vercel.app/Static?iframe=https://dynamic-ephiframe.vercel.app/Dynamic-inner",
140-
"https://extra-ephiframe.vercel.app/Inject-via-context-menu-please",
141-
"https://extra-ephiframe.vercel.app/Inject-via-context-menu-please?iframe=https://static-ephiframe.vercel.app/Static-inner",
142-
"https://extra-ephiframe.vercel.app/Inject-via-context-menu-please?iframe=https://dynamic-ephiframe.vercel.app/Dynamic-inner",
143135
"chrome://extensions/"
144136
]
145137
}

readme.md

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -59,19 +59,6 @@ navigator.importScripts('webext-dynamic-content-scripts.js');
5959
}
6060
```
6161

62-
### `activeTab` tracking
63-
64-
By default, the module will only inject the content scripts into newly-permitted hosts, but it will ignore temporary permissions like `activeTab`. If you also want to automatically inject the content scripts into every frame of tabs as soon as they receive the `activeTab` permission, import a different entry point **instead of the default one.**
65-
66-
```js
67-
import 'webext-dynamic-content-scripts/including-active-tab.js';
68-
```
69-
70-
> **Note**
71-
> This does not work well in Firefox because of some compounding bugs:
72-
> - `activeTab` seems to be lost after a reload
73-
> - further `contextMenu` clicks receive a moz-extension URL rather than the current page’s URL
74-
7562
### Additional APIs
7663

7764
#### `isContentScriptRegistered(url)`

source/active-tab.ts

Lines changed: 0 additions & 88 deletions
This file was deleted.

source/including-active-tab.ts

Lines changed: 0 additions & 74 deletions
This file was deleted.

source/simple-event-target.ts

Lines changed: 0 additions & 44 deletions
This file was deleted.
Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,3 @@
1-
import 'webext-dynamic-content-scripts/including-active-tab.ts';
2-
3-
chrome.contextMenus.create({
4-
title: 'Enable activeTab permission',
5-
}, () => {
6-
if (chrome.runtime.lastError) {
7-
// Shush
8-
}
9-
});
10-
11-
chrome.contextMenus.onClicked.addListener(() => {
12-
console.log('Context menu clicked');
13-
});
1+
import 'webext-dynamic-content-scripts';
142

153
console.log('Background loaded');

test/demo-extension/mv2/manifest.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
"version": "0.0.0",
44
"manifest_version": 2,
55
"permissions": [
6-
"activeTab",
76
"webNavigation",
8-
"contextMenus",
97
"https://dynamic-ephiframe.vercel.app/*",
108
"https://accepted-ephiframe.vercel.app/*"
119
],

0 commit comments

Comments
 (0)