summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorOskar Nyberg <oskar@mullvad.net>2022-10-17 17:21:55 +0200
committerOskar Nyberg <oskar@mullvad.net>2022-10-17 17:21:55 +0200
commit4f442798935846f3d55f541fe810ce2474e0dffd (patch)
tree6f4a183ee1ef8ac151a271bb074e874e3c3538ff
parente8a328034d72c56db3a2202fa990d70b5e4ea6bd (diff)
parent0e9745bcc3b2513e54aeeb7899156dca24b62f44 (diff)
downloadmullvadvpn-4f442798935846f3d55f541fe810ce2474e0dffd.tar.xz
mullvadvpn-4f442798935846f3d55f541fe810ce2474e0dffd.zip
Merge branch 'update-to-electron-21'
-rw-r--r--CHANGELOG.md3
-rw-r--r--gui/package-lock.json214
-rw-r--r--gui/package.json10
-rw-r--r--gui/src/main/ipc-event-channel.ts44
-rw-r--r--gui/src/main/user-interface.ts4
-rw-r--r--gui/src/shared/ipc-helpers.ts29
6 files changed, 174 insertions, 130 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 595def98f1..485f6a6988 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -33,6 +33,9 @@ Line wrap the file at 100 chars. Th
#### Linux
- Don't prevent early boot service from running if logging to a file fails.
+### Changed
+- Update Electron from 19.0.13 to 21.1.1.
+
### Security
#### Windows
- DNS loopback traffic is no longer blocked. Note that local resolvers are still unable to forward
diff --git a/gui/package-lock.json b/gui/package-lock.json
index 903b6482c6..1112de2e1f 100644
--- a/gui/package-lock.json
+++ b/gui/package-lock.json
@@ -36,7 +36,7 @@
"@types/google-protobuf": "^3.15.6",
"@types/history": "^4.7.11",
"@types/mocha": "^10.0.0",
- "@types/node": "^16.11.26",
+ "@types/node": "^16.11.65",
"@types/node-gettext": "^3.0.3",
"@types/rbush": "^3.0.0",
"@types/react": "^18.0.21",
@@ -54,7 +54,7 @@
"chai-as-promised": "^7.1.1",
"chai-spies": "^1.0.0",
"cross-env": "^7.0.3",
- "electron": "^19.0.13",
+ "electron": "^21.1.1",
"electron-builder": "^23.3.3",
"electron-devtools-installer": "^3.2.0",
"electron-mocha": "^11.0.2",
@@ -85,7 +85,7 @@
},
"optionalDependencies": {
"grpc-tools": "^1.11.3",
- "nseventmonitor": "^1.0.2"
+ "nseventmonitor": "^1.0.3"
}
},
"node_modules/@babel/code-frame": {
@@ -1395,9 +1395,9 @@
"dev": true
},
"node_modules/@types/node": {
- "version": "16.11.26",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.26.tgz",
- "integrity": "sha512-GZ7bu5A6+4DtG7q9GsoHXy3ALcgeIHP4NnL0Vv2wu0uUB/yQex26v0tf6/na1mm0+bS9Uw+0DFex7aaKr2qawQ=="
+ "version": "16.11.65",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.65.tgz",
+ "integrity": "sha512-Vfz7wGMOr4jbQGiQHVJm8VjeQwM9Ya7mHe9LtQ264/Epf5n1KiZShOFqk++nBzw6a/ubgYdB9Od7P+MH/LjoWw=="
},
"node_modules/@types/node-gettext": {
"version": "3.0.3",
@@ -1553,6 +1553,16 @@
"integrity": "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==",
"dev": true
},
+ "node_modules/@types/yauzl": {
+ "version": "2.10.0",
+ "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.0.tgz",
+ "integrity": "sha512-Cn6WYCm0tXv8p6k+A8PvbDG763EDpBoTzHdA+Q/MF6H3sapGjCm9NzoaJncJS9tUKSuCoDs9XHxYYsQDgxR6kw==",
+ "dev": true,
+ "optional": true,
+ "dependencies": {
+ "@types/node": "*"
+ }
+ },
"node_modules/@typescript-eslint/eslint-plugin": {
"version": "5.39.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.39.0.tgz",
@@ -3251,7 +3261,7 @@
"node_modules/buffer-crc32": {
"version": "0.2.13",
"resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz",
- "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=",
+ "integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==",
"dev": true,
"engines": {
"node": "*"
@@ -3500,18 +3510,6 @@
"node": ">=8"
}
},
- "node_modules/cacheable-request/node_modules/get-stream": {
- "version": "5.1.0",
- "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.1.0.tgz",
- "integrity": "sha512-EXr1FOzrzTfGeL0gQdeFEvOMm2mzMOglyiOXSTpPC+iAjAKftbr3jpCMWynogwYnM+eSj9sHGc6wjIcDvYiygw==",
- "dev": true,
- "dependencies": {
- "pump": "^3.0.0"
- },
- "engines": {
- "node": ">=8"
- }
- },
"node_modules/cacheable-request/node_modules/lowercase-keys": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz",
@@ -4876,21 +4874,21 @@
}
},
"node_modules/electron": {
- "version": "19.0.13",
- "resolved": "https://registry.npmjs.org/electron/-/electron-19.0.13.tgz",
- "integrity": "sha512-11Ne0VJy8L1GU7sGcbJHhkAz73szR27uP4vmfUVGlppC/ipA39AUkdzqiQoPC/F1EJdjEOBvHySG8K8Xe9yETA==",
+ "version": "21.1.1",
+ "resolved": "https://registry.npmjs.org/electron/-/electron-21.1.1.tgz",
+ "integrity": "sha512-EM2hvRJtiS3n54yx25Z0Qv54t3LGG+WjUHf1AOl+PKjQj+fmXnjIgVeIF9pM21kP1BTcyjrgvN6Sff0A45OB6A==",
"dev": true,
"hasInstallScript": true,
"dependencies": {
"@electron/get": "^1.14.1",
"@types/node": "^16.11.26",
- "extract-zip": "^1.0.3"
+ "extract-zip": "^2.0.1"
},
"bin": {
"electron": "cli.js"
},
"engines": {
- "node": ">= 8.6"
+ "node": ">= 10.17.0"
}
},
"node_modules/electron-builder": {
@@ -6315,20 +6313,48 @@
}
},
"node_modules/extract-zip": {
- "version": "1.7.0",
- "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.7.0.tgz",
- "integrity": "sha512-xoh5G1W/PB0/27lXgMQyIhP5DSY/LhoCsOyZgb+6iMmRtCwVBo55uKaMoEYrDCKQhWvqEip5ZPKAc6eFNyf/MA==",
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz",
+ "integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==",
"dev": true,
"dependencies": {
- "concat-stream": "^1.6.2",
- "debug": "^2.6.9",
- "mkdirp": "^0.5.4",
+ "debug": "^4.1.1",
+ "get-stream": "^5.1.0",
"yauzl": "^2.10.0"
},
"bin": {
"extract-zip": "cli.js"
+ },
+ "engines": {
+ "node": ">= 10.17.0"
+ },
+ "optionalDependencies": {
+ "@types/yauzl": "^2.9.1"
+ }
+ },
+ "node_modules/extract-zip/node_modules/debug": {
+ "version": "4.3.4",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
+ "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
+ "dev": true,
+ "dependencies": {
+ "ms": "2.1.2"
+ },
+ "engines": {
+ "node": ">=6.0"
+ },
+ "peerDependenciesMeta": {
+ "supports-color": {
+ "optional": true
+ }
}
},
+ "node_modules/extract-zip/node_modules/ms": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
+ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
+ "dev": true
+ },
"node_modules/extsprintf": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.4.1.tgz",
@@ -6482,7 +6508,7 @@
"node_modules/fd-slicer": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz",
- "integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=",
+ "integrity": "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==",
"dev": true,
"dependencies": {
"pend": "~1.2.0"
@@ -6854,6 +6880,21 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/get-stream": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz",
+ "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==",
+ "dev": true,
+ "dependencies": {
+ "pump": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
"node_modules/get-symbol-description": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz",
@@ -10009,9 +10050,9 @@
}
},
"node_modules/nan": {
- "version": "2.15.0",
- "resolved": "https://registry.npmjs.org/nan/-/nan-2.15.0.tgz",
- "integrity": "sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ==",
+ "version": "2.17.0",
+ "resolved": "https://registry.npmjs.org/nan/-/nan-2.17.0.tgz",
+ "integrity": "sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ==",
"optional": true
},
"node_modules/nanoid": {
@@ -10196,9 +10237,9 @@
}
},
"node_modules/nseventmonitor": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/nseventmonitor/-/nseventmonitor-1.0.2.tgz",
- "integrity": "sha512-iiBYqjB0iNTWO4aVPKM7oFuI6qz6zeOwu8IezLa82ClnKRpJTQnOieezjzIFTibzBtRffmgy+a3KlJ1HkfiTng==",
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/nseventmonitor/-/nseventmonitor-1.0.3.tgz",
+ "integrity": "sha512-Sz0S1senUbTRAsLWdZG6yvNatipWRfI2xu+s35uIpn2lEmpxBvXVLomb8fWzbGAtld4MJvjK7ZYtaQiohWYxPw==",
"hasInstallScript": true,
"optional": true,
"os": [
@@ -10206,7 +10247,7 @@
],
"dependencies": {
"@mapbox/node-pre-gyp": "^1.0.8",
- "nan": "^2.15"
+ "nan": "^2.17.0"
}
},
"node_modules/number-is-nan": {
@@ -10772,7 +10813,7 @@
"node_modules/pend": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz",
- "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=",
+ "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==",
"dev": true
},
"node_modules/picocolors": {
@@ -14223,7 +14264,7 @@
"node_modules/yauzl": {
"version": "2.10.0",
"resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz",
- "integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=",
+ "integrity": "sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==",
"dev": true,
"dependencies": {
"buffer-crc32": "~0.2.3",
@@ -15330,9 +15371,9 @@
"dev": true
},
"@types/node": {
- "version": "16.11.26",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.26.tgz",
- "integrity": "sha512-GZ7bu5A6+4DtG7q9GsoHXy3ALcgeIHP4NnL0Vv2wu0uUB/yQex26v0tf6/na1mm0+bS9Uw+0DFex7aaKr2qawQ=="
+ "version": "16.11.65",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.65.tgz",
+ "integrity": "sha512-Vfz7wGMOr4jbQGiQHVJm8VjeQwM9Ya7mHe9LtQ264/Epf5n1KiZShOFqk++nBzw6a/ubgYdB9Od7P+MH/LjoWw=="
},
"@types/node-gettext": {
"version": "3.0.3",
@@ -15488,6 +15529,16 @@
"integrity": "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==",
"dev": true
},
+ "@types/yauzl": {
+ "version": "2.10.0",
+ "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.0.tgz",
+ "integrity": "sha512-Cn6WYCm0tXv8p6k+A8PvbDG763EDpBoTzHdA+Q/MF6H3sapGjCm9NzoaJncJS9tUKSuCoDs9XHxYYsQDgxR6kw==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "@types/node": "*"
+ }
+ },
"@typescript-eslint/eslint-plugin": {
"version": "5.39.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.39.0.tgz",
@@ -16828,7 +16879,7 @@
"buffer-crc32": {
"version": "0.2.13",
"resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz",
- "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=",
+ "integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==",
"dev": true
},
"buffer-equal": {
@@ -17026,15 +17077,6 @@
"responselike": "^1.0.2"
},
"dependencies": {
- "get-stream": {
- "version": "5.1.0",
- "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.1.0.tgz",
- "integrity": "sha512-EXr1FOzrzTfGeL0gQdeFEvOMm2mzMOglyiOXSTpPC+iAjAKftbr3jpCMWynogwYnM+eSj9sHGc6wjIcDvYiygw==",
- "dev": true,
- "requires": {
- "pump": "^3.0.0"
- }
- },
"lowercase-keys": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz",
@@ -18181,14 +18223,14 @@
}
},
"electron": {
- "version": "19.0.13",
- "resolved": "https://registry.npmjs.org/electron/-/electron-19.0.13.tgz",
- "integrity": "sha512-11Ne0VJy8L1GU7sGcbJHhkAz73szR27uP4vmfUVGlppC/ipA39AUkdzqiQoPC/F1EJdjEOBvHySG8K8Xe9yETA==",
+ "version": "21.1.1",
+ "resolved": "https://registry.npmjs.org/electron/-/electron-21.1.1.tgz",
+ "integrity": "sha512-EM2hvRJtiS3n54yx25Z0Qv54t3LGG+WjUHf1AOl+PKjQj+fmXnjIgVeIF9pM21kP1BTcyjrgvN6Sff0A45OB6A==",
"dev": true,
"requires": {
"@electron/get": "^1.14.1",
"@types/node": "^16.11.26",
- "extract-zip": "^1.0.3"
+ "extract-zip": "^2.0.1"
}
},
"electron-builder": {
@@ -19309,15 +19351,32 @@
}
},
"extract-zip": {
- "version": "1.7.0",
- "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.7.0.tgz",
- "integrity": "sha512-xoh5G1W/PB0/27lXgMQyIhP5DSY/LhoCsOyZgb+6iMmRtCwVBo55uKaMoEYrDCKQhWvqEip5ZPKAc6eFNyf/MA==",
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz",
+ "integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==",
"dev": true,
"requires": {
- "concat-stream": "^1.6.2",
- "debug": "^2.6.9",
- "mkdirp": "^0.5.4",
+ "@types/yauzl": "^2.9.1",
+ "debug": "^4.1.1",
+ "get-stream": "^5.1.0",
"yauzl": "^2.10.0"
+ },
+ "dependencies": {
+ "debug": {
+ "version": "4.3.4",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
+ "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
+ "dev": true,
+ "requires": {
+ "ms": "2.1.2"
+ }
+ },
+ "ms": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
+ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
+ "dev": true
+ }
}
},
"extsprintf": {
@@ -19448,7 +19507,7 @@
"fd-slicer": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz",
- "integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=",
+ "integrity": "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==",
"dev": true,
"requires": {
"pend": "~1.2.0"
@@ -19750,6 +19809,15 @@
"has-symbols": "^1.0.3"
}
},
+ "get-stream": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz",
+ "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==",
+ "dev": true,
+ "requires": {
+ "pump": "^3.0.0"
+ }
+ },
"get-symbol-description": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz",
@@ -22168,9 +22236,9 @@
"dev": true
},
"nan": {
- "version": "2.15.0",
- "resolved": "https://registry.npmjs.org/nan/-/nan-2.15.0.tgz",
- "integrity": "sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ==",
+ "version": "2.17.0",
+ "resolved": "https://registry.npmjs.org/nan/-/nan-2.17.0.tgz",
+ "integrity": "sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ==",
"optional": true
},
"nanoid": {
@@ -22321,13 +22389,13 @@
}
},
"nseventmonitor": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/nseventmonitor/-/nseventmonitor-1.0.2.tgz",
- "integrity": "sha512-iiBYqjB0iNTWO4aVPKM7oFuI6qz6zeOwu8IezLa82ClnKRpJTQnOieezjzIFTibzBtRffmgy+a3KlJ1HkfiTng==",
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/nseventmonitor/-/nseventmonitor-1.0.3.tgz",
+ "integrity": "sha512-Sz0S1senUbTRAsLWdZG6yvNatipWRfI2xu+s35uIpn2lEmpxBvXVLomb8fWzbGAtld4MJvjK7ZYtaQiohWYxPw==",
"optional": true,
"requires": {
"@mapbox/node-pre-gyp": "^1.0.8",
- "nan": "^2.15"
+ "nan": "^2.17.0"
}
},
"number-is-nan": {
@@ -22765,7 +22833,7 @@
"pend": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz",
- "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=",
+ "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==",
"dev": true
},
"picocolors": {
@@ -25527,7 +25595,7 @@
"yauzl": {
"version": "2.10.0",
"resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz",
- "integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=",
+ "integrity": "sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==",
"dev": true,
"requires": {
"buffer-crc32": "~0.2.3",
diff --git a/gui/package.json b/gui/package.json
index 636e9594c2..360875ae06 100644
--- a/gui/package.json
+++ b/gui/package.json
@@ -30,7 +30,7 @@
},
"optionalDependencies": {
"grpc-tools": "^1.11.3",
- "nseventmonitor": "^1.0.2"
+ "nseventmonitor": "^1.0.3"
},
"devDependencies": {
"@playwright/test": "^1.26.1",
@@ -42,7 +42,7 @@
"@types/google-protobuf": "^3.15.6",
"@types/history": "^4.7.11",
"@types/mocha": "^10.0.0",
- "@types/node": "^16.11.26",
+ "@types/node": "^16.11.65",
"@types/node-gettext": "^3.0.3",
"@types/rbush": "^3.0.0",
"@types/react": "^18.0.21",
@@ -60,7 +60,7 @@
"chai-as-promised": "^7.1.1",
"chai-spies": "^1.0.0",
"cross-env": "^7.0.3",
- "electron": "^19.0.13",
+ "electron": "^21.1.1",
"electron-builder": "^23.3.3",
"electron-devtools-installer": "^3.2.0",
"electron-mocha": "^11.0.2",
@@ -109,7 +109,7 @@
"npm": ">=8.3"
},
"volta": {
- "node": "16.13.2",
- "npm": "8.7.0"
+ "node": "16.16.0",
+ "npm": "8.19.2"
}
}
diff --git a/gui/src/main/ipc-event-channel.ts b/gui/src/main/ipc-event-channel.ts
index bae499910d..80fed8a034 100644
--- a/gui/src/main/ipc-event-channel.ts
+++ b/gui/src/main/ipc-event-channel.ts
@@ -1,48 +1,12 @@
import { ipcMain, WebContents } from 'electron';
-import { createIpcMain, IpcMain, Notifier, Schema } from '../shared/ipc-helpers';
+import { createIpcMain } from '../shared/ipc-helpers';
import { ipcSchema } from '../shared/ipc-schema';
-// Type where the notify functions have been replaced with either `undefined` if no `WebContents` is
-// available, or with the function curried with the `WebContents`.
-type IpcMainBootstrappedWithWebContents<S extends Schema> = {
- [GK in keyof IpcMain<S>]: {
- [CK in keyof IpcMain<S>[GK]]: IpcMain<S>[GK][CK] extends Notifier<infer T>
- ? undefined | ((arg: T) => ReturnType<IpcMain<S>[GK][CK]>)
- : IpcMain<S>[GK][CK];
- };
-};
-
-const ipcMainFromSchema = createIpcMain(ipcSchema, ipcMain);
// eslint-disable-next-line @typescript-eslint/naming-convention
-export let IpcMainEventChannel = bootstrapIpcMainWithWebContents();
-
-// Curries all notify functions with `WebContents` if it's not `undefined`. If it is `undefined`
-// then the whole function will be replaced with `undefined`.
-function bootstrapIpcMainWithWebContents(
- webContents?: WebContents,
-): IpcMainBootstrappedWithWebContents<typeof ipcSchema> {
- return Object.fromEntries(
- Object.entries(ipcMainFromSchema).map(([groupKey, group]) => {
- const newGroup = Object.fromEntries(
- Object.entries(group).map(([callKey, call]) => {
- if (callKey.startsWith('notify')) {
- const newCall = webContents
- ? (arg: Parameters<typeof call>[1]) => call(webContents, arg)
- : undefined;
- return [callKey, newCall];
- } else {
- return [callKey, call];
- }
- }),
- );
-
- return [groupKey, newGroup];
- }),
- ) as IpcMainBootstrappedWithWebContents<typeof ipcSchema>;
-}
+export let IpcMainEventChannel = createIpcMain(ipcSchema, ipcMain, undefined);
// Change the `IpcMainEventChannel` for a new one with a new `WebContents`.
-export function changeIpcWebContents(webContents?: WebContents) {
- IpcMainEventChannel = bootstrapIpcMainWithWebContents(webContents);
+export function changeIpcWebContents(webContents: WebContents | undefined) {
+ IpcMainEventChannel = createIpcMain(ipcSchema, ipcMain, webContents);
}
diff --git a/gui/src/main/user-interface.ts b/gui/src/main/user-interface.ts
index 4d56d95eac..ae9e9c8592 100644
--- a/gui/src/main/user-interface.ts
+++ b/gui/src/main/user-interface.ts
@@ -48,7 +48,11 @@ export default class UserInterface implements WindowControllerDelegate {
private navigationResetDisabled: boolean,
) {
const window = this.createWindow();
+
changeIpcWebContents(window.webContents);
+ window.webContents.on('destroyed', () => {
+ changeIpcWebContents(undefined);
+ });
this.windowController = this.createWindowController(window);
this.tray = this.createTray();
diff --git a/gui/src/shared/ipc-helpers.ts b/gui/src/shared/ipc-helpers.ts
index fda5c2d3b5..27ad17e22a 100644
--- a/gui/src/shared/ipc-helpers.ts
+++ b/gui/src/shared/ipc-helpers.ts
@@ -5,14 +5,12 @@ import { capitalize } from './string-helpers';
type Handler<T, R> = (callback: (arg: T) => R) => void;
type Sender<T, R> = (arg: T) => R;
-// Remove export after upgrading to Electron 21+ and removal of code to curry notifiers with
-// webContents in ../main/ipc-event-channel.ts.
-export type Notifier<T> = (webContents: WebContents | undefined, arg: T) => void;
+type Notifier<T> = ((arg: T) => void) | undefined;
type Listener<T> = (callback: (arg: T) => void) => void;
interface MainToRenderer<T> {
direction: 'main-to-renderer';
- send: (event: string, ipcMain: EIpcMain) => Notifier<T>;
+ send: (event: string, webContents: WebContents) => Notifier<T>;
receive: (event: string, ipcRenderer: EIpcRenderer) => Listener<T>;
}
@@ -64,15 +62,22 @@ export type IpcRenderer<S extends Schema> = {
};
// Preforms the transformation of the main event channel in accordance with the above types.
-export function createIpcMain<S extends Schema>(schema: S, ipcMain: EIpcMain): IpcMain<S> {
+export function createIpcMain<S extends Schema>(
+ schema: S,
+ ipcMain: EIpcMain,
+ webContents: WebContents | undefined,
+): IpcMain<S> {
return createIpc(schema, (event, key, spec) => {
const capitalizedKey = capitalize(key);
const newKey =
spec.direction === 'main-to-renderer' ? `notify${capitalizedKey}` : `handle${capitalizedKey}`;
- const newValue =
- spec.direction === 'main-to-renderer'
- ? spec.send(event, ipcMain)
- : spec.receive(event, ipcMain);
+
+ let newValue;
+ if (spec.direction === 'main-to-renderer') {
+ newValue = webContents ? spec.send(event, webContents) : undefined;
+ } else {
+ newValue = spec.receive(event, ipcMain);
+ }
return [newKey, newValue];
});
@@ -154,9 +159,9 @@ export function notifyRenderer<T>(): MainToRenderer<T> {
};
}
-function notifyRendererImpl<T>(event: string, _ipcMain: EIpcMain): Notifier<T> {
- return (webContents, value) => {
- if (webContents === undefined) {
+function notifyRendererImpl<T>(event: string, webContents: WebContents): Notifier<T> {
+ return (value) => {
+ if (webContents === undefined || webContents.isDestroyed() || webContents.isCrashed()) {
log.error(`sender(${event}): webContents is already destroyed!`);
} else {
webContents.send(event, value);