chore: surface webcontents load error more readily (#22824)

This commit is contained in:
loc 2021-01-13 01:01:51 -08:00 committed by GitHub
parent 9deae1c3c4
commit ceda33dd5e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -118,6 +118,7 @@
#include "shell/common/mouse_util.h" #include "shell/common/mouse_util.h"
#include "shell/common/node_includes.h" #include "shell/common/node_includes.h"
#include "shell/common/options_switches.h" #include "shell/common/options_switches.h"
#include "shell/common/process_util.h"
#include "shell/common/v8_value_serializer.h" #include "shell/common/v8_value_serializer.h"
#include "storage/browser/file_system/isolated_context.h" #include "storage/browser/file_system/isolated_context.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.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); frame_process_id, frame_routing_id);
// Do not emit "did-fail-load" for canceled requests. // 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, Emit("did-fail-load", code, description, url, is_main_frame,
frame_process_id, frame_routing_id); frame_process_id, frame_routing_id);
}
} }
} }