webext-schema 3.0.2 → 4.1.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.
@@ -346,8 +346,9 @@ export const createNotification = async (id, opt) => {
346
346
  let func;
347
347
  if (isGranted) {
348
348
  const { notifications } = browser;
349
- !notifications.onClosed.hasListener(clearNotification) &&
349
+ if (!notifications.onClosed.hasListener(clearNotification)) {
350
350
  notifications.onClosed.addListener(clearNotification);
351
+ }
351
352
  func = notifications.create(id, opt);
352
353
  }
353
354
  return func || null;
@@ -411,6 +412,16 @@ export const getManifestIcons = () => {
411
412
  return icons;
412
413
  };
413
414
 
415
+ /**
416
+ * get manifest version
417
+ *
418
+ * @returns {number} - version
419
+ */
420
+ export const getManifestVersion = () => {
421
+ const { manifest_version: version } = runtime.getManifest();
422
+ return version;
423
+ };
424
+
414
425
  /**
415
426
  * get OS
416
427
  *
@@ -424,8 +435,8 @@ export const getOs = async () => {
424
435
  /**
425
436
  * make a connection
426
437
  *
427
- * @param {number|string} [id] - tab ID / extension ID
428
- * @param {object} [info] - info
438
+ * @param {number|string} [id] - tab ID / extension ID / host name
439
+ * @param {object|boolean} [info] - connection info / connect to native app
429
440
  * @returns {object} - runtime.Port
430
441
  */
431
442
  export const makeConnection = async (id, info) => {
@@ -437,7 +448,9 @@ export const makeConnection = async (id, info) => {
437
448
  port = await tabs.connect(id);
438
449
  }
439
450
  } else if (isString(id)) {
440
- if (isObjectNotEmpty(info)) {
451
+ if (info && getType(info) === 'Boolean') {
452
+ port = await runtime.connectNative(id);
453
+ } else if (isObjectNotEmpty(info)) {
441
454
  port = await runtime.connect(id, info);
442
455
  } else {
443
456
  port = await runtime.connect(id);
@@ -455,7 +468,7 @@ export const makeConnection = async (id, info) => {
455
468
  /**
456
469
  * send message
457
470
  *
458
- * @param {number|string} id - tabId or extension ID
471
+ * @param {number|string} id - tab ID / extension ID
459
472
  * @param {*} msg - message
460
473
  * @param {object} opt - options
461
474
  * @returns {?Function} - tabs.sendMessage() | runtime.sendMessage()
@@ -979,7 +992,9 @@ export const warmupTab = async tabId => {
979
992
  if (!Number.isInteger(tabId)) {
980
993
  throw new TypeError(`Expected Number but got ${getType(tabId)}.`);
981
994
  }
982
- typeof tabs.warmup === 'function' && await tabs.warmup(tabId);
995
+ if (typeof tabs.warmup === 'function') {
996
+ await tabs.warmup(tabId);
997
+ }
983
998
  };
984
999
 
985
1000
  /**
@@ -1081,7 +1096,7 @@ export const getWindow = async (windowId, opt) => {
1081
1096
  export const checkIncognitoWindowExists = async () => {
1082
1097
  const arr = await getAllNormalWindows();
1083
1098
  let bool;
1084
- if (arr && arr.length) {
1099
+ if (arr?.length) {
1085
1100
  for (const win of arr) {
1086
1101
  bool = win.incognito;
1087
1102
  if (bool) {
package/modules/update.js CHANGED
@@ -15,7 +15,7 @@ import process from 'process';
15
15
  /* constants */
16
16
  const DIR_CWD = process.cwd();
17
17
  const PERM_FILE = 0o644;
18
- export const ESR_VER = 91;
18
+ export const ESR_VER = 102;
19
19
 
20
20
  /**
21
21
  * fetch text
package/package.json CHANGED
@@ -29,24 +29,24 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "camelize": "^1.0.0",
32
- "commander": "^9.2.0",
32
+ "commander": "^9.3.0",
33
33
  "decamelize": "^6.0.0",
34
34
  "json5": "^2.2.1",
35
- "node-fetch": "^3.2.4",
35
+ "node-fetch": "^3.2.6",
36
36
  "sinon": "^14.0.0"
37
37
  },
38
38
  "devDependencies": {
39
39
  "c8": "^7.11.3",
40
40
  "chai": "^4.3.6",
41
- "eslint": "^8.16.0",
41
+ "eslint": "^8.17.0",
42
42
  "eslint-config-standard": "^17.0.0",
43
43
  "eslint-plugin-import": "^2.26.0",
44
44
  "eslint-plugin-jsdoc": "^39.3.2",
45
45
  "eslint-plugin-node": "^11.1.0",
46
46
  "eslint-plugin-promise": "^6.0.0",
47
47
  "mocha": "^10.0.0",
48
- "nock": "^13.2.4",
48
+ "nock": "^13.2.6",
49
49
  "npm-run-all": "^4.1.5"
50
50
  },
51
- "version": "3.0.2"
51
+ "version": "4.1.0"
52
52
  }
@@ -3066,7 +3066,7 @@
3066
3066
  "namespace": "manifest",
3067
3067
  "types": [
3068
3068
  {
3069
- "$extend": "PermissionNoPrompt",
3069
+ "$extend": "PermissionPrivileged",
3070
3070
  "choices": [
3071
3071
  {
3072
3072
  "type": "string",
@@ -6430,7 +6430,7 @@
6430
6430
  "namespace": "manifest",
6431
6431
  "types": [
6432
6432
  {
6433
- "$extend": "PermissionNoPrompt",
6433
+ "$extend": "PermissionPrivileged",
6434
6434
  "choices": [
6435
6435
  {
6436
6436
  "type": "string",
@@ -7275,7 +7275,7 @@
7275
7275
  "namespace": "manifest",
7276
7276
  "types": [
7277
7277
  {
7278
- "$extend": "PermissionNoPrompt",
7278
+ "$extend": "PermissionPrivileged",
7279
7279
  "choices": [
7280
7280
  {
7281
7281
  "type": "string",
@@ -10910,7 +10910,8 @@
10910
10910
  "additionalProperties": {
10911
10911
  "$ref": "experiments.ExperimentAPI"
10912
10912
  },
10913
- "optional": true
10913
+ "optional": true,
10914
+ "privileged": true
10914
10915
  }
10915
10916
  }
10916
10917
  }
@@ -11761,7 +11762,8 @@
11761
11762
  "items": {
11762
11763
  "type": "string"
11763
11764
  },
11764
- "optional": true
11765
+ "optional": true,
11766
+ "privileged": true
11765
11767
  }
11766
11768
  }
11767
11769
  }
@@ -13089,17 +13091,30 @@
13089
13091
  }
13090
13092
  ]
13091
13093
  },
13094
+ {
13095
+ "id": "PermissionPrivileged",
13096
+ "choices": [
13097
+ {
13098
+ "type": "string",
13099
+ "enum": [
13100
+ "mozillaAddons"
13101
+ ]
13102
+ }
13103
+ ]
13104
+ },
13092
13105
  {
13093
13106
  "id": "PermissionNoPrompt",
13094
13107
  "choices": [
13095
13108
  {
13096
- "$ref": "OptionalPermission"
13109
+ "$ref": "OptionalPermissionNoPrompt"
13110
+ },
13111
+ {
13112
+ "$ref": "PermissionPrivileged"
13097
13113
  },
13098
13114
  {
13099
13115
  "type": "string",
13100
13116
  "enum": [
13101
13117
  "alarms",
13102
- "mozillaAddons",
13103
13118
  "storage",
13104
13119
  "unlimitedStorage"
13105
13120
  ]
@@ -13443,7 +13458,7 @@
13443
13458
  "namespace": "manifest",
13444
13459
  "types": [
13445
13460
  {
13446
- "$extend": "PermissionNoPrompt",
13461
+ "$extend": "PermissionPrivileged",
13447
13462
  "choices": [
13448
13463
  {
13449
13464
  "type": "string",
@@ -14865,7 +14880,8 @@
14865
14880
  "type": "boolean",
14866
14881
  "optional": true,
14867
14882
  "default": false,
14868
- "description": "Whether to create all cookies as nonPersistent (i.e., session) cookies."
14883
+ "description": "Whether to create all cookies as nonPersistent (i.e., session) cookies.",
14884
+ "deprecated": "This property has no effect anymore and its value is always <code>false<code>."
14869
14885
  }
14870
14886
  }
14871
14887
  }
@@ -15720,8 +15736,7 @@
15720
15736
  "type": "string",
15721
15737
  "enum": [
15722
15738
  "scripting"
15723
- ],
15724
- "min_manifest_version": 3
15739
+ ]
15725
15740
  }
15726
15741
  ]
15727
15742
  }
@@ -15733,7 +15748,6 @@
15733
15748
  "permissions": [
15734
15749
  "scripting"
15735
15750
  ],
15736
- "min_manifest_version": 3,
15737
15751
  "types": [
15738
15752
  {
15739
15753
  "id": "ScriptInjection",
@@ -16635,7 +16649,7 @@
16635
16649
  }
16636
16650
  },
16637
16651
  {
16638
- "$extend": "PermissionNoPrompt",
16652
+ "$extend": "PermissionPrivileged",
16639
16653
  "choices": [
16640
16654
  {
16641
16655
  "type": "string",