fix: destroy WebContents synchronously on shutdown (#15541)
This commit is contained in:
		
					parent
					
						
							
								6162d9090d
							
						
					
				
			
			
				commit
				
					
						746beb0d8b
					
				
			
		
					 12 changed files with 122 additions and 13 deletions
				
			
		|  | @ -1,6 +1,7 @@ | |||
| 'use strict' | ||||
| 
 | ||||
| const assert = require('assert') | ||||
| const ChildProcess = require('child_process') | ||||
| const fs = require('fs') | ||||
| const http = require('http') | ||||
| const path = require('path') | ||||
|  | @ -697,6 +698,16 @@ describe('webContents module', () => { | |||
|     }) | ||||
|   }) | ||||
| 
 | ||||
|   describe('create()', () => { | ||||
|     it('does not crash on exit', async () => { | ||||
|       const appPath = path.join(__dirname, 'fixtures', 'api', 'leak-exit-webcontents.js') | ||||
|       const electronPath = remote.getGlobal('process').execPath | ||||
|       const appProcess = ChildProcess.spawn(electronPath, [appPath]) | ||||
|       const [code] = await emittedOnce(appProcess, 'close') | ||||
|       expect(code).to.equal(0) | ||||
|     }) | ||||
|   }) | ||||
| 
 | ||||
|   // Destroying webContents in its event listener is going to crash when
 | ||||
|   // Electron is built in Debug mode.
 | ||||
|   xdescribe('destroy()', () => { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Cheng Zhao
				Cheng Zhao