refactor: add EmitWarning(v8::Isolate*) helper (#43722)

* refactor: add EmitWarning(Isolate*, ...) warning

* chore: remove EmitWarning(node::Environment*, ...)

* chore: add code comments

* fixup! refactor: add EmitWarning(Isolate*, ...) warning

* chore: remove unused node #includes
This commit is contained in:
Charles Kerr 2024-09-16 15:53:04 -05:00 committed by GitHub
parent 7d4f202c1c
commit 05dfd14913
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 72 additions and 89 deletions

View file

@ -21,6 +21,7 @@
#include "base/files/file_util.h"
#include "base/json/json_reader.h"
#include "base/no_destructor.h"
#include "base/strings/strcat.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/current_thread.h"
#include "base/threading/scoped_blocking_call.h"
@ -129,8 +130,8 @@
#include "shell/common/gin_helper/promise.h"
#include "shell/common/language_util.h"
#include "shell/common/node_includes.h"
#include "shell/common/node_util.h"
#include "shell/common/options_switches.h"
#include "shell/common/process_util.h"
#include "shell/common/thread_restrictions.h"
#include "shell/common/v8_value_serializer.h"
#include "storage/browser/file_system/isolated_context.h"
@ -2113,10 +2114,9 @@ void WebContents::DidFinishNavigation(
// Do not emit "did-fail-load" for canceled requests.
if (code != net::ERR_ABORTED) {
EmitWarning(
node::Environment::GetCurrent(JavascriptEnvironment::GetIsolate()),
"Failed to load URL: " + url.possibly_invalid_spec() +
" with error: " + description,
util::EmitWarning(
base::StrCat({"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);