webext-schema 5.2.10 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/modules/browser.js +38 -0
- package/package.json +8 -8
- package/schemas/central/webext.json +16 -3
- package/schemas/mail/mailext.json +17 -0
- package/types/modules/browser.d.ts +1 -0
package/modules/browser.js
CHANGED
|
@@ -989,6 +989,44 @@ export const warmupTab = async tabId => {
|
|
|
989
989
|
}
|
|
990
990
|
};
|
|
991
991
|
|
|
992
|
+
/**
|
|
993
|
+
* capture visible tab
|
|
994
|
+
* @param {number} windowId - window ID
|
|
995
|
+
* @param {object} opt - options
|
|
996
|
+
* @returns {Promise.<?string>} - data URL
|
|
997
|
+
*/
|
|
998
|
+
export const captureVisibleTab = async (windowId, opt) => {
|
|
999
|
+
const info = await runtime.getBrowserInfo();
|
|
1000
|
+
let isGranted;
|
|
1001
|
+
if (info.vender === 'Mozilla') {
|
|
1002
|
+
const browserVersion = parseFloat(info.version);
|
|
1003
|
+
isGranted = (browserVersion >= 126 && await isPermissionGranted({
|
|
1004
|
+
permissions: ['activeTab']
|
|
1005
|
+
})) || await isPermissionGranted({
|
|
1006
|
+
origins: ['<all_urls>']
|
|
1007
|
+
});
|
|
1008
|
+
} else {
|
|
1009
|
+
isGranted = await isPermissionGranted({
|
|
1010
|
+
permissions: ['activeTab']
|
|
1011
|
+
}) || await isPermissionGranted({
|
|
1012
|
+
origins: ['<all_urls>']
|
|
1013
|
+
});
|
|
1014
|
+
}
|
|
1015
|
+
let url;
|
|
1016
|
+
if (isGranted) {
|
|
1017
|
+
if (!Number.isInteger(windowId)) {
|
|
1018
|
+
windowId = windows.WINDOW_ID_CURRENT;
|
|
1019
|
+
}
|
|
1020
|
+
if (!opt) {
|
|
1021
|
+
opt = {
|
|
1022
|
+
format: 'png'
|
|
1023
|
+
};
|
|
1024
|
+
}
|
|
1025
|
+
url = await tabs.captureVisibleTab(windowId, opt);
|
|
1026
|
+
}
|
|
1027
|
+
return url ?? null;
|
|
1028
|
+
};
|
|
1029
|
+
|
|
992
1030
|
/**
|
|
993
1031
|
* is tab
|
|
994
1032
|
* @param {*} tabId - tab ID
|
package/package.json
CHANGED
|
@@ -21,20 +21,20 @@
|
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@types/firefox-webext-browser": "^120.0.3",
|
|
24
|
-
"@types/node": "^20.
|
|
24
|
+
"@types/node": "^20.12.7",
|
|
25
25
|
"@types/sinon": "^17.0.3",
|
|
26
26
|
"c8": "^9.1.0",
|
|
27
27
|
"chai": "^5.1.0",
|
|
28
28
|
"eslint": "^8.57.0",
|
|
29
29
|
"eslint-config-standard": "^17.1.0",
|
|
30
30
|
"eslint-plugin-import": "^2.29.1",
|
|
31
|
-
"eslint-plugin-jsdoc": "^48.2.
|
|
32
|
-
"eslint-plugin-regexp": "^2.
|
|
33
|
-
"eslint-plugin-unicorn": "^
|
|
34
|
-
"mocha": "^10.
|
|
31
|
+
"eslint-plugin-jsdoc": "^48.2.3",
|
|
32
|
+
"eslint-plugin-regexp": "^2.5.0",
|
|
33
|
+
"eslint-plugin-unicorn": "^52.0.0",
|
|
34
|
+
"mocha": "^10.4.0",
|
|
35
35
|
"npm-run-all": "^4.1.5",
|
|
36
|
-
"typescript": "^5.4.
|
|
37
|
-
"undici": "^6.
|
|
36
|
+
"typescript": "^5.4.5",
|
|
37
|
+
"undici": "^6.13.0"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"build": "npm run tsc && npm run lint && npm run test",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"update-mail": "node index update --channel=mail -i",
|
|
55
55
|
"update-release": "node index update --channel=release -i"
|
|
56
56
|
},
|
|
57
|
-
"version": "5.
|
|
57
|
+
"version": "5.3.0"
|
|
58
58
|
}
|
|
@@ -915,6 +915,12 @@
|
|
|
915
915
|
{
|
|
916
916
|
"name": "command",
|
|
917
917
|
"type": "string"
|
|
918
|
+
},
|
|
919
|
+
{
|
|
920
|
+
"name": "tab",
|
|
921
|
+
"$ref": "tags.Tab",
|
|
922
|
+
"optional": true,
|
|
923
|
+
"description": "Details of the $(ref:tabs.Tab) where the command was activated."
|
|
918
924
|
}
|
|
919
925
|
]
|
|
920
926
|
},
|
|
@@ -5613,9 +5619,10 @@
|
|
|
5613
5619
|
{
|
|
5614
5620
|
"name": "captureVisibleTab",
|
|
5615
5621
|
"type": "function",
|
|
5616
|
-
"description": "Captures an area of the currently active tab in the specified window. You must have
|
|
5622
|
+
"description": "Captures an area of the currently active tab in the specified window. You must have <all_urls> or activeTab permission to use this method.",
|
|
5617
5623
|
"permissions": [
|
|
5618
|
-
"<all_urls>"
|
|
5624
|
+
"<all_urls>",
|
|
5625
|
+
"activeTab"
|
|
5619
5626
|
],
|
|
5620
5627
|
"async": "callback",
|
|
5621
5628
|
"parameters": [
|
|
@@ -13476,6 +13483,11 @@
|
|
|
13476
13483
|
],
|
|
13477
13484
|
"optional": true
|
|
13478
13485
|
},
|
|
13486
|
+
"options_page": {
|
|
13487
|
+
"$ref": "ExtensionURL",
|
|
13488
|
+
"optional": true,
|
|
13489
|
+
"description": "Alias property for options_ui.page, ignored when options_ui.page is set. When using this property the options page is always opened in a new tab."
|
|
13490
|
+
},
|
|
13479
13491
|
"options_ui": {
|
|
13480
13492
|
"type": "object",
|
|
13481
13493
|
"optional": true,
|
|
@@ -19710,6 +19722,7 @@
|
|
|
19710
19722
|
"type": "string",
|
|
19711
19723
|
"enum": [
|
|
19712
19724
|
"webRequest",
|
|
19725
|
+
"webRequestAuthProvider",
|
|
19713
19726
|
"webRequestBlocking",
|
|
19714
19727
|
"webRequestFilterResponse",
|
|
19715
19728
|
"webRequestFilterResponse.serviceWorkerScript"
|
|
@@ -19800,7 +19813,7 @@
|
|
|
19800
19813
|
"blocking",
|
|
19801
19814
|
"asyncBlocking"
|
|
19802
19815
|
],
|
|
19803
|
-
"postprocess": "
|
|
19816
|
+
"postprocess": "webRequestBlockingOrAuthProviderPermissionRequired"
|
|
19804
19817
|
},
|
|
19805
19818
|
{
|
|
19806
19819
|
"id": "OnResponseStartedOptions",
|
|
@@ -109,6 +109,12 @@
|
|
|
109
109
|
{
|
|
110
110
|
"name": "command",
|
|
111
111
|
"type": "string"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"name": "tab",
|
|
115
|
+
"$ref": "tags.Tab",
|
|
116
|
+
"optional": true,
|
|
117
|
+
"description": "Details of the $(ref:tabs.Tab) where the command was activated."
|
|
112
118
|
}
|
|
113
119
|
]
|
|
114
120
|
},
|
|
@@ -7596,6 +7602,17 @@
|
|
|
7596
7602
|
"items": {
|
|
7597
7603
|
"$ref": "extensionTypes.ExtensionFileOrCode"
|
|
7598
7604
|
}
|
|
7605
|
+
},
|
|
7606
|
+
"runAt": {
|
|
7607
|
+
"type": "string",
|
|
7608
|
+
"optional": true,
|
|
7609
|
+
"default": "document_idle",
|
|
7610
|
+
"enum": [
|
|
7611
|
+
"document_start",
|
|
7612
|
+
"document_end",
|
|
7613
|
+
"document_idle"
|
|
7614
|
+
],
|
|
7615
|
+
"description": "Determines when the files specified in css and js are injected. The states directly correspond to <code>Document.readyState</code>: <value>loading</value>, <value>interactive</value> and <value>complete</value>"
|
|
7599
7616
|
}
|
|
7600
7617
|
}
|
|
7601
7618
|
},
|
|
@@ -50,6 +50,7 @@ export function reloadTab(tabId: number, opt: object): Promise<void>;
|
|
|
50
50
|
export function removeTab(arg: number | any[]): Promise<void>;
|
|
51
51
|
export function updateTab(tabId: number, opt: object): Promise<object>;
|
|
52
52
|
export function warmupTab(tabId: number): Promise<void>;
|
|
53
|
+
export function captureVisibleTab(windowId: number, opt: object): Promise<string | null>;
|
|
53
54
|
export function isTab(tabId: any): Promise<boolean>;
|
|
54
55
|
export function getCurrentTheme(windowId?: number): Promise<object>;
|
|
55
56
|
export function createNewWindow(opt: object): Promise<object>;
|