From d674db6606032eaee53dc4112ad6c20a25628916 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Tue, 12 Jan 2016 21:15:12 +0800 Subject: [PATCH] spec: Calling methods of destroyed webContents should not crash --- spec/api-browser-window-spec.coffee | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spec/api-browser-window-spec.coffee b/spec/api-browser-window-spec.coffee index 38c8217041e7..724f149cd9e5 100644 --- a/spec/api-browser-window-spec.coffee +++ b/spec/api-browser-window-spec.coffee @@ -55,6 +55,12 @@ describe 'browser-window module', -> done() w.loadURL 'file://' + path.join(fixtures, 'api', 'close-beforeunload-false.html') + describe 'BrowserWindow.destroy()', -> + it 'prevents users to access methods of webContents', -> + webContents = w.webContents + w.destroy() + assert.throws (-> webContents.getId()), /Object has been destroyed/ + describe 'BrowserWindow.loadURL(url)', -> it 'should emit did-start-loading event', (done) -> w.webContents.on 'did-start-loading', ->