"did-finish-load" should only emit for main frame, fixes #385.
authorCheng Zhao <zcbenz@gmail.com>
Mon, 9 Jun 2014 04:03:19 +0000 (12:03 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Mon, 9 Jun 2014 04:03:19 +0000 (12:03 +0800)
atom/browser/api/atom_api_web_contents.cc
docs/api/browser-window.md

index 3de4088..9877dc8 100644 (file)
@@ -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) {
index 8624bc3..5678fd5 100644 (file)
@@ -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'