Add a spec for the "renderer window closed" error.
This commit is contained in:
		
					parent
					
						
							
								a0b24bd155
							
						
					
				
			
			
				commit
				
					
						b04db2e546
					
				
			
		
					 2 changed files with 29 additions and 0 deletions
				
			
		|  | @ -494,6 +494,18 @@ describe('ipc module', function () { | |||
|       w.removeListener('test', listener) | ||||
|       assert.equal(w.listenerCount('test'), 0) | ||||
|     }) | ||||
| 
 | ||||
|     it('throws an error when a function is called in a destroyed renderer', (done) => { | ||||
|       w = new BrowserWindow({ | ||||
|         show: false | ||||
|       }) | ||||
|       w.loadURL('file://' + path.join(fixtures, 'api', 'reload-page.html')) | ||||
|       setTimeout(() => { | ||||
|         assert.throws(() => w.webContents.emit('remote-handler'), | ||||
|           /Attempting to call a function in a renderer window that has been closed or released./) | ||||
|         done() | ||||
|       }, 400) | ||||
|     }) | ||||
|   }) | ||||
| 
 | ||||
|   it('throws an error when removing all the listeners', () => { | ||||
|  |  | |||
							
								
								
									
										17
									
								
								spec/fixtures/api/reload-page.html
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								spec/fixtures/api/reload-page.html
									
										
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,17 @@ | |||
| <!DOCTYPE html> | ||||
| <html> | ||||
|   <head> | ||||
|     <meta charset="utf-8"> | ||||
|     <title></title> | ||||
|     <script> | ||||
|       const {remote} = require('electron') | ||||
|       const browserWindow = remote.getCurrentWindow() | ||||
| 
 | ||||
|       browserWindow.webContents.on('remote-handler', () => { }) | ||||
|       browserWindow.reload() | ||||
|     </script> | ||||
|   </head> | ||||
|   <body> | ||||
| 
 | ||||
|   </body> | ||||
| </html> | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Charlie Hess
				Charlie Hess