From ceda33dd5ed633d47cbe30b003aa356c327e7c0c Mon Sep 17 00:00:00 2001 From: loc Date: Wed, 13 Jan 2021 01:01:51 -0800 Subject: [PATCH] chore: surface webcontents load error more readily (#22824) --- shell/browser/api/electron_api_web_contents.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/shell/browser/api/electron_api_web_contents.cc b/shell/browser/api/electron_api_web_contents.cc index a1b50478a59..007f19677a9 100644 --- a/shell/browser/api/electron_api_web_contents.cc +++ b/shell/browser/api/electron_api_web_contents.cc @@ -118,6 +118,7 @@ #include "shell/common/mouse_util.h" #include "shell/common/node_includes.h" #include "shell/common/options_switches.h" +#include "shell/common/process_util.h" #include "shell/common/v8_value_serializer.h" #include "storage/browser/file_system/isolated_context.h" #include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h" @@ -1656,9 +1657,15 @@ void WebContents::DidFinishNavigation( frame_process_id, frame_routing_id); // Do not emit "did-fail-load" for canceled requests. - if (code != net::ERR_ABORTED) + if (code != net::ERR_ABORTED) { + EmitWarning( + node::Environment::GetCurrent(JavascriptEnvironment::GetIsolate()), + "Failed to load URL: " + url.possibly_invalid_spec() + + " with error: " + description, + "electron"); Emit("did-fail-load", code, description, url, is_main_frame, frame_process_id, frame_routing_id); + } } }