refactor: don't send ipcRenderer.sendSync() returnValue as an array (#26178)
This commit is contained in:
		
					parent
					
						
							
								83747ad21c
							
						
					
				
			
			
				commit
				
					
						0c2e2bca92
					
				
			
		
					 4 changed files with 4 additions and 4 deletions
				
			
		|  | @ -457,7 +457,7 @@ const addReplyInternalToEvent = (event: any) => { | ||||||
| 
 | 
 | ||||||
| const addReturnValueToEvent = (event: any) => { | const addReturnValueToEvent = (event: any) => { | ||||||
|   Object.defineProperty(event, 'returnValue', { |   Object.defineProperty(event, 'returnValue', { | ||||||
|     set: (value) => event.sendReply([value]), |     set: (value) => event.sendReply(value), | ||||||
|     get: () => {} |     get: () => {} | ||||||
|   }); |   }); | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | @ -10,7 +10,7 @@ ipcRenderer.send = function (channel, ...args) { | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| ipcRenderer.sendSync = function (channel, ...args) { | ipcRenderer.sendSync = function (channel, ...args) { | ||||||
|   return ipc.sendSync(internal, channel, args)[0]; |   return ipc.sendSync(internal, channel, args); | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| ipcRenderer.sendToHost = function (channel, ...args) { | ipcRenderer.sendToHost = function (channel, ...args) { | ||||||
|  |  | ||||||
|  | @ -10,7 +10,7 @@ ipcRendererInternal.send = function (channel, ...args) { | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| ipcRendererInternal.sendSync = function (channel, ...args) { | ipcRendererInternal.sendSync = function (channel, ...args) { | ||||||
|   return ipc.sendSync(internal, channel, args)[0]; |   return ipc.sendSync(internal, channel, args); | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| ipcRendererInternal.sendTo = function (webContentsId, channel, ...args) { | ipcRendererInternal.sendTo = function (webContentsId, channel, ...args) { | ||||||
|  |  | ||||||
|  | @ -790,7 +790,7 @@ describe('chromium features', () => { | ||||||
|         }); |         }); | ||||||
|         expect(await w.webContents.executeJavaScript(`(${function () { |         expect(await w.webContents.executeJavaScript(`(${function () { | ||||||
|           const { ipc } = process._linkedBinding('electron_renderer_ipc'); |           const { ipc } = process._linkedBinding('electron_renderer_ipc'); | ||||||
|           return ipc.sendSync(true, 'GUEST_WINDOW_MANAGER_WINDOW_OPEN', ['', '', ''])[0]; |           return ipc.sendSync(true, 'GUEST_WINDOW_MANAGER_WINDOW_OPEN', ['', '', '']); | ||||||
|         }})()`)).to.be.null();
 |         }})()`)).to.be.null();
 | ||||||
|         const exception = await uncaughtException; |         const exception = await uncaughtException; | ||||||
|         expect(exception.message).to.match(/denied: expected native window\.open/); |         expect(exception.message).to.match(/denied: expected native window\.open/); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Milan Burda
				Milan Burda