From: Cheng Zhao Date: Tue, 12 Jan 2016 13:15:12 +0000 (+0800) Subject: spec: Calling methods of destroyed webContents should not crash X-Git-Tag: v0.36.4~16^2 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=d674db6606032eaee53dc4112ad6c20a25628916;p=electron.git spec: Calling methods of destroyed webContents should not crash --- diff --git a/spec/api-browser-window-spec.coffee b/spec/api-browser-window-spec.coffee index 38c82170..724f149c 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', ->