Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
f6b6a03
Add optional support for `activeTab` injection
fregante Jan 8, 2023
b87056d
Merge remote-tracking branch 'origin/main' into active-tab
fregante Jan 8, 2023
c1570ed
Build and naming fixes
fregante Jan 8, 2023
709af77
Enable automatic registration
fregante Jan 8, 2023
c742434
Reduce duplicate injection
fregante Jan 8, 2023
e23697b
Merge remote-tracking branch 'origin/main' into active-tab
fregante Jan 8, 2023
f6783e0
Drop wrong comment
fregante Jan 8, 2023
4bfab3f
9.1.0-0
fregante Jan 8, 2023
88cdeb9
Fix file build
fregante Jan 8, 2023
1c33cd4
9.1.0-1
fregante Jan 8, 2023
193680a
Flip incorrect logic
fregante Jan 9, 2023
72041ae
Switch to new ephiframe
fregante Jan 9, 2023
4485d04
Merge remote-tracking branch 'origin/main' into active-tab
fregante Jan 9, 2023
49a0a22
Don't attempt injection on non-HTTP/s URLs
fregante Jan 9, 2023
bc27900
9.1.0-2
fregante Jan 9, 2023
bd57a1a
Merge remote-tracking branch 'origin/main' into pr/44
fregante Jan 17, 2023
7a422a6
Track frames
fregante Jan 17, 2023
39060dd
9.1.1-0
fregante Jan 17, 2023
4459d8c
Fix test
fregante Jan 17, 2023
c63951e
Cleanup
fregante Jan 17, 2023
0b5c10a
Block import outside the background page
fregante Jan 17, 2023
2ca4f19
9.2.0-0
fregante Jan 17, 2023
659c6a5
Logic
fregante Jan 17, 2023
fa28c6b
9.2.0-1
fregante Jan 17, 2023
844e78e
Include scriptable check on frame
fregante Jan 17, 2023
152f2b7
9.2.0-2
fregante Jan 17, 2023
f24ad93
Improve support for frames in onActiveTab
fregante Jan 17, 2023
5913126
9.2.0-3
fregante Jan 17, 2023
d2f135d
Add an origin check before injecting, user might have navigated away
fregante Jan 17, 2023
79b141f
9.3.0-0
fregante Jan 17, 2023
aaa5ee7
Cross-origin frames do not receive activeTab
fregante Jan 17, 2023
c9afc38
9.2.0-4
fregante Jan 17, 2023
2309481
Fix logic, add debugging
fregante Jan 17, 2023
32578d9
9.2.0-5
fregante Jan 17, 2023
f68d540
9.2.0-6
fregante Jan 17, 2023
c9bf3ff
s/onActiveTab/addActiveTabListener/
fregante Jan 18, 2023
77b191a
Meta fixes
fregante Jan 18, 2023
6f70164
Test updates
fregante Jan 18, 2023
ebac6cc
Revert some changes
fregante Jan 18, 2023
7e9ed58
Logging cleanup
fregante Jan 18, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/*
!/distribution/*
*.test.*
!/utils.*
!/including-active-tab.*
2 changes: 2 additions & 0 deletions including-active-tab.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Temporary entry point until the `exports` key is added to the package.json
export {};
2 changes: 2 additions & 0 deletions including-active-tab.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Temporary entry point until the `exports` key is added to the package.json
import './distribution/including-active-tab.js';
218 changes: 15 additions & 203 deletions package-lock.json

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

19 changes: 8 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "webext-dynamic-content-scripts",
"version": "9.1.0",
"description": "WebExtension module: Automatically registers your `content_scripts` on domains added via `permission.request`",
"version": "9.2.0-6",
"description": "WebExtension module: Automatically registers your `content_scripts` on domains added via `permission.request` or on `activeTab`",
"keywords": [
"contentscript",
"register",
Expand All @@ -10,21 +10,18 @@
"request",
"optional_permissions",
"manifest",
"new hosts",
"chrome",
"firefox",
"browser",
"activetab",
"extension"
],
"repository": "fregante/webext-dynamic-content-scripts",
"funding": "https://github.com/sponsors/fregante",
"license": "MIT",
"author": "Federico Brigante <[email protected]> (https://fregante.com)",
"module": "distribution/index.js",
"files": [
"distribution",
"utils.js",
"utils.d.ts"
],
"scripts": {
"build": "tsc",
"demo:build": "parcel build --no-cache",
Expand Down Expand Up @@ -67,7 +64,9 @@
"content-scripts-register-polyfill": "^3.2.2",
"webext-additional-permissions": "^2.3.0",
"webext-content-scripts": "^2.4.0",
"webext-patterns": "^1.2.0"
"webext-detect-page": "^4.0.1",
"webext-patterns": "^1.2.0",
"webext-polyfill-kinda": "^0.10.0"
},
"devDependencies": {
"@parcel/config-webextension": "^2.8.2",
Expand All @@ -88,7 +87,7 @@
"alias": {
"these-are-just-mocks-for-parcel-tests": "yolo",
"webext-additional-permissions": "./test/demo-extension/webext-additional-permissions.js",
"webext-dynamic-content-scripts": "./source/index.ts",
"webext-dynamic-content-scripts": "./source/",
"./source/*.js": "./source/$1.ts"
},
"targets": {
Expand Down Expand Up @@ -124,8 +123,6 @@
"https://extra-ephiframe.vercel.app/Inject-via-context-menu-please",
"https://extra-ephiframe.vercel.app/Inject-via-context-menu-please?iframe=https://static-ephiframe.vercel.app/Static-inner",
"https://extra-ephiframe.vercel.app/Inject-via-context-menu-please?iframe=https://dynamic-ephiframe.vercel.app/Dynamic-inner",
"https://static-ephiframe.vercel.app/Static?iframe=https://extra-ephiframe.vercel.app/Inject-via-context-menu-please",
"https://dynamic-ephiframe.vercel.app/Dynamic?iframe=https://extra-ephiframe.vercel.app/Inject-via-context-menu-please",
"chrome://extensions/"
]
}
Expand Down
8 changes: 8 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ navigator.importScripts('webext-dynamic-content-scripts.js');
}
```

### `activeTab` tracking

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.**

```js
import 'webext-dynamic-content-scripts/including-active-tab.js';
```

### Additional APIs

#### `isContentScriptRegistered(url)`
Expand Down
Loading