chore: remove unused BrowserWindow.fromDevToolsWebContents (#19090)
This commit is contained in:
		
					parent
					
						
							
								8782d06ed6
							
						
					
				
			
			
				commit
				
					
						d1292833e9
					
				
			
		
					 2 changed files with 0 additions and 27 deletions
				
			
		| 
						 | 
					@ -127,15 +127,6 @@ BrowserWindow.fromBrowserView = (browserView) => {
 | 
				
			||||||
  return null
 | 
					  return null
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
BrowserWindow.fromDevToolsWebContents = (webContents) => {
 | 
					 | 
				
			||||||
  for (const window of BrowserWindow.getAllWindows()) {
 | 
					 | 
				
			||||||
    const { devToolsWebContents } = window
 | 
					 | 
				
			||||||
    if (devToolsWebContents != null && devToolsWebContents.equal(webContents)) {
 | 
					 | 
				
			||||||
      return window
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Helpers.
 | 
					// Helpers.
 | 
				
			||||||
Object.assign(BrowserWindow.prototype, {
 | 
					Object.assign(BrowserWindow.prototype, {
 | 
				
			||||||
  loadURL (...args) {
 | 
					  loadURL (...args) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -233,24 +233,6 @@ describe('BrowserWindow module', () => {
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
  })
 | 
					  })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('BrowserWindow.fromDevToolsWebContents(webContents)', () => {
 | 
					 | 
				
			||||||
    let contents = null
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    beforeEach(() => { contents = webContents.create({}) })
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    afterEach(() => { contents.destroy() })
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    it('returns the window with the webContents', (done) => {
 | 
					 | 
				
			||||||
      w.webContents.once('devtools-opened', () => {
 | 
					 | 
				
			||||||
        expect(BrowserWindow.fromDevToolsWebContents(w.devToolsWebContents).id).to.equal(w.id)
 | 
					 | 
				
			||||||
        expect(BrowserWindow.fromDevToolsWebContents(w.webContents)).to.be.undefined()
 | 
					 | 
				
			||||||
        expect(BrowserWindow.fromDevToolsWebContents(contents)).to.be.undefined()
 | 
					 | 
				
			||||||
        done()
 | 
					 | 
				
			||||||
      })
 | 
					 | 
				
			||||||
      w.webContents.openDevTools()
 | 
					 | 
				
			||||||
    })
 | 
					 | 
				
			||||||
  })
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  describe('BrowserWindow.openDevTools()', () => {
 | 
					  describe('BrowserWindow.openDevTools()', () => {
 | 
				
			||||||
    it('does not crash for frameless window', () => {
 | 
					    it('does not crash for frameless window', () => {
 | 
				
			||||||
      w.destroy()
 | 
					      w.destroy()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue