diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index 4003820b6296..b579d935c9a7 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -197,6 +197,15 @@ void WebContents::DidFinishLoad(content::RenderFrameHost* render_frame_host, Emit("did-finish-load"); } +// this error occurs when host could not be found +void WebContents::DidFailProvisionalLoad( + content::RenderFrameHost* render_frame_host, + const GURL& validated_url, + int error_code, + const base::string16& error_description) { + Emit("did-fail-load", error_code, error_description); +} + void WebContents::DidFailLoad(content::RenderFrameHost* render_frame_host, const GURL& validated_url, int error_code, diff --git a/atom/browser/api/atom_api_web_contents.h b/atom/browser/api/atom_api_web_contents.h index 75714306684c..2e5e0118e81b 100644 --- a/atom/browser/api/atom_api_web_contents.h +++ b/atom/browser/api/atom_api_web_contents.h @@ -154,6 +154,10 @@ class WebContents : public mate::EventEmitter, const GURL& validated_url, int error_code, const base::string16& error_description) override; + void DidFailProvisionalLoad(content::RenderFrameHost* render_frame_host, + const GURL& validated_url, + int error_code, + const base::string16& error_description) override; void DidStartLoading(content::RenderViewHost* render_view_host) override; void DidStopLoading(content::RenderViewHost* render_view_host) override; void DidGetRedirectForResourceRequest( diff --git a/spec/api-browser-window-spec.coffee b/spec/api-browser-window-spec.coffee index caf23b96e660..67f4c9b7c5b8 100644 --- a/spec/api-browser-window-spec.coffee +++ b/spec/api-browser-window-spec.coffee @@ -58,6 +58,11 @@ describe 'browser-window module', -> done() w.loadUrl 'about:blank' + it 'should emit did-fail-load event', (done) -> + w.webContents.on 'did-fail-load', -> + done() + w.loadUrl 'file://a.txt' + describe 'BrowserWindow.show()', -> it 'should focus on window', -> return if isCI