From 7d38fe61d28694390ca110230a1084f9f69eaf90 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 9 Jun 2014 12:03:19 +0800 Subject: [PATCH] "did-finish-load" should only emit for main frame, fixes #385. --- atom/browser/api/atom_api_web_contents.cc | 7 ++++++- docs/api/browser-window.md | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index 3de4088f715c..9877dc8b3eb2 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -38,7 +38,12 @@ void WebContents::DidFinishLoad(int64 frame_id, const GURL& validated_url, bool is_main_frame, content::RenderViewHost* render_view_host) { - Emit("did-finish-load"); + base::ListValue args; + args.AppendBoolean(is_main_frame); + Emit("did-frame-finish-load", args); + + if (is_main_frame) + Emit("did-finish-load"); } void WebContents::DidStartLoading(content::RenderViewHost* render_view_host) { diff --git a/docs/api/browser-window.md b/docs/api/browser-window.md index 8624bc360aa0..5678fd586c56 100644 --- a/docs/api/browser-window.md +++ b/docs/api/browser-window.md @@ -448,6 +448,13 @@ Emitted when the renderer process is crashed. Emitted when the navigation is done, i.e. the spinner of the tab will stop spinning, and the onload event was dispatched. +### Event: 'did-frame-finish-load' + +* `event` Event +* `isMainFrame` Boolean + +Emitted when a frame has done navigation. + ### Event: 'did-start-loading' ### Event: 'did-stop-loading'