|
211 | 211 | ipcMessagePort: {
|
212 | 212 |
|
213 | 213 | /**
|
214 |
| - * @param {string} channelResponse |
215 |
| - * @param {string} requestNonce |
| 214 | + * @param {string} responseChannel |
| 215 | + * @param {string} nonce |
216 | 216 | */
|
217 |
| - acquire(channelResponse, requestNonce) { |
218 |
| - if (validateIPC(channelResponse)) { |
| 217 | + acquire(responseChannel, nonce) { |
| 218 | + if (validateIPC(responseChannel)) { |
219 | 219 | const responseListener = (/** @type {IpcRendererEvent} */ e, /** @type {string} */ responseNonce) => {
|
220 | 220 | // validate that the nonce from the response is the same
|
221 | 221 | // as when requested. and if so, use `postMessage` to
|
222 | 222 | // send the `MessagePort` safely over, even when context
|
223 | 223 | // isolation is enabled
|
224 |
| - if (requestNonce === responseNonce) { |
225 |
| - ipcRenderer.off(channelResponse, responseListener); |
226 |
| - window.postMessage(requestNonce, '*', e.ports); |
| 224 | + if (nonce === responseNonce) { |
| 225 | + ipcRenderer.off(responseChannel, responseListener); |
| 226 | + window.postMessage(nonce, '*', e.ports); |
227 | 227 | }
|
228 | 228 | };
|
229 | 229 |
|
230 | 230 | // handle reply from main
|
231 |
| - ipcRenderer.on(channelResponse, responseListener); |
| 231 | + ipcRenderer.on(responseChannel, responseListener); |
232 | 232 | }
|
233 | 233 | }
|
234 | 234 | },
|
|
0 commit comments