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:
parent
7d4f202c1c
commit
05dfd14913
19 changed files with 72 additions and 89 deletions
|
@ -18,7 +18,6 @@
|
|||
#include "shell/browser/javascript_environment.h"
|
||||
#include "shell/common/gin_converters/value_converter.h"
|
||||
#include "shell/common/gin_helper/promise.h"
|
||||
#include "shell/common/node_includes.h"
|
||||
|
||||
using content::DevToolsAgentHost;
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#include "shell/common/gin_converters/gurl_converter.h"
|
||||
#include "shell/common/gin_helper/dictionary.h"
|
||||
#include "shell/common/gin_helper/object_template_builder.h"
|
||||
#include "shell/common/node_includes.h"
|
||||
#include "url/gurl.h"
|
||||
|
||||
namespace gin {
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include "shell/browser/net/system_network_context_manager.h"
|
||||
#include "shell/common/gin_converters/file_path_converter.h"
|
||||
#include "shell/common/gin_helper/dictionary.h"
|
||||
#include "shell/common/node_includes.h"
|
||||
|
||||
namespace gin {
|
||||
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
#include "shell/common/gin_helper/object_template_builder.h"
|
||||
#include "shell/common/gin_helper/promise.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 "url/url_util.h"
|
||||
|
||||
namespace {
|
||||
|
@ -256,12 +256,11 @@ bool Protocol::IsProtocolIntercepted(const std::string& scheme) {
|
|||
|
||||
v8::Local<v8::Promise> Protocol::IsProtocolHandled(const std::string& scheme,
|
||||
gin::Arguments* args) {
|
||||
node::Environment* env = node::Environment::GetCurrent(args->isolate());
|
||||
EmitWarning(env,
|
||||
"The protocol.isProtocolHandled API is deprecated, use "
|
||||
"protocol.isProtocolRegistered or protocol.isProtocolIntercepted "
|
||||
"instead.",
|
||||
"ProtocolDeprecateIsProtocolHandled");
|
||||
util::EmitWarning(args->isolate(),
|
||||
"The protocol.isProtocolHandled API is deprecated, "
|
||||
"use protocol.isProtocolRegistered "
|
||||
"or protocol.isProtocolIntercepted instead.",
|
||||
"ProtocolDeprecateIsProtocolHandled");
|
||||
return gin_helper::Promise<bool>::ResolvedPromise(
|
||||
args->isolate(),
|
||||
IsProtocolRegistered(scheme) || IsProtocolIntercepted(scheme) ||
|
||||
|
@ -279,9 +278,8 @@ void Protocol::HandleOptionalCallback(gin::Arguments* args,
|
|||
ProtocolError error) {
|
||||
base::RepeatingCallback<void(v8::Local<v8::Value>)> callback;
|
||||
if (args->GetNext(&callback)) {
|
||||
node::Environment* env = node::Environment::GetCurrent(args->isolate());
|
||||
EmitWarning(
|
||||
env,
|
||||
util::EmitWarning(
|
||||
args->isolate(),
|
||||
"The callback argument of protocol module APIs is no longer needed.",
|
||||
"ProtocolDeprecateCallback");
|
||||
if (error == ProtocolError::kOK)
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "shell/common/gin_converters/gurl_converter.h"
|
||||
#include "shell/common/gin_converters/value_converter.h"
|
||||
#include "shell/common/gin_helper/dictionary.h"
|
||||
#include "shell/common/node_includes.h"
|
||||
|
||||
namespace electron::api {
|
||||
|
||||
|
|
|
@ -87,8 +87,8 @@
|
|||
#include "shell/common/gin_helper/object_template_builder.h"
|
||||
#include "shell/common/gin_helper/promise.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 "third_party/blink/public/common/storage_key/storage_key.h"
|
||||
#include "third_party/blink/public/mojom/mediastream/media_stream.mojom.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
|
@ -1111,11 +1111,9 @@ v8::Local<v8::Promise> Session::LoadExtension(
|
|||
const extensions::Extension* extension,
|
||||
const std::string& error_msg) {
|
||||
if (extension) {
|
||||
if (!error_msg.empty()) {
|
||||
node::Environment* env =
|
||||
node::Environment::GetCurrent(promise.isolate());
|
||||
EmitWarning(env, error_msg, "ExtensionLoadWarning");
|
||||
}
|
||||
if (!error_msg.empty())
|
||||
util::EmitWarning(promise.isolate(), error_msg,
|
||||
"ExtensionLoadWarning");
|
||||
promise.Resolve(extension);
|
||||
} else {
|
||||
promise.RejectWithErrorMessage(error_msg);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue