File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
src/vs/base/parts/ipc/electron-sandbox Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -13,13 +13,18 @@ interface IMessageChannelResult {
13
13
source : unknown ;
14
14
}
15
15
16
- export async function acquirePort ( requestChannel : string , responseChannel : string ) : Promise < MessagePort > {
17
-
18
- // Ask to create message channel inside the window
19
- // and send over a UUID to correlate the response
16
+ export async function acquirePort ( requestChannel : string | undefined , responseChannel : string ) : Promise < MessagePort > {
20
17
const nonce = generateUuid ( ) ;
18
+
19
+ // Get ready to acquire the message port from the
20
+ // provided `responseChannel` via preload helper.
21
21
ipcMessagePort . acquire ( responseChannel , nonce ) ;
22
- ipcRenderer . send ( requestChannel , nonce ) ;
22
+
23
+ // If a `requestChannel` is provided, we are in charge
24
+ // to trigger acquisition of the message port from main
25
+ if ( typeof requestChannel === 'string' ) {
26
+ ipcRenderer . send ( requestChannel , nonce ) ;
27
+ }
23
28
24
29
// Wait until the main side has returned the `MessagePort`
25
30
// We need to filter by the `nonce` to ensure we listen
You can’t perform that action at this time.
0 commit comments