No more need to delay did-fail-load event
authorCheng Zhao <zcbenz@gmail.com>
Wed, 13 Apr 2016 10:33:59 +0000 (19:33 +0900)
committerCheng Zhao <zcbenz@gmail.com>
Wed, 13 Apr 2016 10:33:59 +0000 (19:33 +0900)
atom/browser/api/atom_api_web_contents.cc
lib/browser/api/web-contents.js

index 985c541..81e2423 100644 (file)
@@ -547,28 +547,21 @@ void WebContents::DidFinishLoad(content::RenderFrameHost* render_frame_host,
 void WebContents::DidFailProvisionalLoad(
     content::RenderFrameHost* render_frame_host,
     const GURL& url,
-    int error_code,
-    const base::string16& error_description,
+    int code,
+    const base::string16& description,
     bool was_ignored_by_handler) {
   bool is_main_frame = !render_frame_host->GetParent();
-  Emit("did-fail-provisional-load",
-       error_code,
-       error_description,
-       url,
-       is_main_frame);
+  Emit("did-fail-provisional-load", code, description, url, is_main_frame);
+  Emit("did-fail-load", code, description, url, is_main_frame);
 }
 
 void WebContents::DidFailLoad(content::RenderFrameHost* render_frame_host,
-                              const GURL& validated_url,
+                              const GURL& url,
                               int error_code,
                               const base::string16& error_description,
                               bool was_ignored_by_handler) {
   bool is_main_frame = !render_frame_host->GetParent();
-  Emit("did-fail-load",
-       error_code,
-       error_description,
-       validated_url,
-       is_main_frame);
+  Emit("did-fail-load", error_code, error_description, url, is_main_frame);
 }
 
 void WebContents::DidStartLoading() {
index bc32161..40efa77 100644 (file)
@@ -146,15 +146,6 @@ let wrapWebContents = function (webContents) {
     return menu.popup(params.x, params.y)
   })
 
-  // This error occurs when host could not be found.
-  webContents.on('did-fail-provisional-load', function (...args) {
-    // Calling loadURL during this event might cause crash, so delay the event
-    // until next tick.
-    setImmediate(() => {
-      this.emit.apply(this, ['did-fail-load'].concat(args))
-    })
-  })
-
   // The devtools requests the webContents to reload.
   webContents.on('devtools-reload-page', function () {
     webContents.reload()