mirror of
https://github.com/electron/electron.git
synced 2026-01-08 23:18:06 -05:00
chore: bump chromium to 141.0.7390.7 (main) (#48212)
* chore: bump chromium in DEPS to 141.0.7381.3 * chore: update patches * chore: bump chromium in DEPS to 141.0.7382.0 * chore: update patches * chore: bump chromium in DEPS to 141.0.7384.0 * chore: bump chromium in DEPS to 141.0.7386.0 * [Extensions] Move devtools_page and chrome_url_overrides handlers Refs https://chromium-review.googlesource.com/c/chromium/src/+/6862700 * Reland "[api] Advance deprecation of GetIsolate" Refs https://chromium-review.googlesource.com/c/v8/v8/+/6875273 * Move "system integrated UI" concept out of NativeTheme. Refs https://chromium-review.googlesource.com/c/chromium/src/+/6867375 * chore: update patches * Reland "[PermissionOptions] Return PermissionResult in callback for requests" Refs https://chromium-review.googlesource.com/c/chromium/src/+/6851838 * Reland "[exit-time-destructors] Enable by default" Refs https://chromium-review.googlesource.com/c/chromium/src/+/6859042 * chore: update patches * [FSA] Revoke Read access after removing file via FileSystemAccess API Refs https://chromium-review.googlesource.com/c/chromium/src/+/6677249 * chore: IWYU * [DevToolsUIBindings] Accept an object for `dispatchHttpRequest` params Refs https://chromium-review.googlesource.com/c/chromium/src/+/6877528 * chore: IWYU * Pass navigation UI parameters on EnterFullscreen in EAM Refs https://chromium-review.googlesource.com/c/chromium/src/+/6874923 * chore: rm band-aid_over_an_issue_with_using_deprecated_nsopenpanel_api.patch * Remove unused PreHandleMouseEvent Refs https://chromium-review.googlesource.com/c/chromium/src/+/6880411 * 6878583: siso: update to version 1.4.1 https://chromium-review.googlesource.com/c/chromium/src/+/6878583 * Fold native_theme_browser into native_theme. https://chromium-review.googlesource.com/c/chromium/src/+/6882627 * fixup: Reland "[exit-time-destructors] Enable by default https://chromium-review.googlesource.com/c/chromium/src/+/6859042 * chore: update filenames.libcxx.gni * chore: IWYU * fixup: chore: IWYU * fixup: Reland "[exit-time-destructors] Enable by default * fixup: Reland "[exit-time-destructors] Enable by default * Remove common_theme.*; place its method in NativeTheme instead. https://chromium-review.googlesource.com/c/chromium/src/+/6886029 * fixup: Reland "[exit-time-destructors] Enable by default * Better track when WebPreferences need updates for color-related changes. Refs https://chromium-review.googlesource.com/c/chromium/src/+/6886797 * chore: bump chromium in DEPS to 141.0.7390.7 * 6904664: Reland "Make BrowserContext::GetPath() const" https://chromium-review.googlesource.com/c/chromium/src/+/6904664 * Restore read access after certain file modification operations https://chromium-review.googlesource.com/c/chromium/src/+/6861041 * fixup: Move "system integrated UI" concept out of NativeTheme. * fixup: Reland "[exit-time-destructors] Enable by default * chore: update patches * 6906096: Remove GetSysSkColor(). https://chromium-review.googlesource.com/c/chromium/src/+/6906096 * Inline implementation of SysColorChangeListener into the lone user. https://chromium-review.googlesource.com/c/chromium/src/+/6905083 Also 6906096: Remove GetSysSkColor(). | https://chromium-review.googlesource.com/c/chromium/src/+/6906096 * fixup: 6906096: Remove GetSysSkColor() --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: deepak1556 <hop2deep@gmail.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
This commit is contained in:
committed by
GitHub
parent
1f322ebce3
commit
793565e4be
@@ -269,10 +269,11 @@ v8::MaybeLocal<v8::Value> PassValueToOtherContextInner(
|
||||
v8::TryCatch try_catch(isolate);
|
||||
v8::Local<v8::Context> source_context =
|
||||
global_source_context.Get(isolate);
|
||||
val = PassValueToOtherContext(
|
||||
source_context, global_destination_context.Get(isolate), result,
|
||||
source_context->Global(), false,
|
||||
BridgeErrorTarget::kDestination);
|
||||
val =
|
||||
PassValueToOtherContext(isolate, source_context, isolate,
|
||||
global_destination_context.Get(isolate),
|
||||
result, source_context->Global(), false,
|
||||
BridgeErrorTarget::kDestination);
|
||||
if (try_catch.HasCaught()) {
|
||||
if (try_catch.Message().IsEmpty()) {
|
||||
proxied_promise->RejectWithErrorMessage(
|
||||
@@ -316,10 +317,11 @@ v8::MaybeLocal<v8::Value> PassValueToOtherContextInner(
|
||||
v8::TryCatch try_catch(isolate);
|
||||
v8::Local<v8::Context> source_context =
|
||||
global_source_context.Get(isolate);
|
||||
val = PassValueToOtherContext(
|
||||
source_context, global_destination_context.Get(isolate), result,
|
||||
source_context->Global(), false,
|
||||
BridgeErrorTarget::kDestination);
|
||||
val =
|
||||
PassValueToOtherContext(isolate, source_context, isolate,
|
||||
global_destination_context.Get(isolate),
|
||||
result, source_context->Global(), false,
|
||||
BridgeErrorTarget::kDestination);
|
||||
if (try_catch.HasCaught()) {
|
||||
if (try_catch.Message().IsEmpty()) {
|
||||
proxied_promise->RejectWithErrorMessage(
|
||||
@@ -419,10 +421,10 @@ v8::MaybeLocal<v8::Value> PassValueToOtherContextInner(
|
||||
|
||||
// Custom logic to "clone" VideoFrame references
|
||||
blink::VideoFrame* video_frame =
|
||||
blink::V8VideoFrame::ToWrappable(source_context->GetIsolate(), value);
|
||||
blink::V8VideoFrame::ToWrappable(source_isolate, value);
|
||||
if (video_frame != nullptr) {
|
||||
blink::ScriptState* script_state = blink::ScriptState::ForCurrentRealm(
|
||||
destination_context->GetIsolate());
|
||||
blink::ScriptState* script_state =
|
||||
blink::ScriptState::ForCurrentRealm(destination_isolate);
|
||||
return v8::MaybeLocal<v8::Value>(
|
||||
blink::ToV8Traits<blink::VideoFrame>::ToV8(script_state,
|
||||
video_frame));
|
||||
@@ -467,7 +469,9 @@ v8::MaybeLocal<v8::Value> PassValueToOtherContextInner(
|
||||
}
|
||||
|
||||
v8::MaybeLocal<v8::Value> PassValueToOtherContext(
|
||||
v8::Isolate* source_isolate,
|
||||
v8::Local<v8::Context> source_context,
|
||||
v8::Isolate* destination_isolate,
|
||||
v8::Local<v8::Context> destination_context,
|
||||
v8::Local<v8::Value> value,
|
||||
v8::Local<v8::Value> parent_value,
|
||||
@@ -484,9 +488,9 @@ v8::MaybeLocal<v8::Value> PassValueToOtherContext(
|
||||
blink::ExecutionContext::From(source_context);
|
||||
DCHECK(source_execution_context);
|
||||
return PassValueToOtherContextInner(
|
||||
source_context->GetIsolate(), source_context, source_execution_context,
|
||||
destination_context->GetIsolate(), destination_context, value,
|
||||
parent_value, object_cache, support_dynamic_properties, 0, error_target);
|
||||
source_isolate, source_context, source_execution_context,
|
||||
destination_isolate, destination_context, value, parent_value,
|
||||
object_cache, support_dynamic_properties, 0, error_target);
|
||||
}
|
||||
|
||||
void ProxyFunctionWrapper(const v8::FunctionCallbackInfo<v8::Value>& info) {
|
||||
@@ -529,7 +533,7 @@ void ProxyFunctionWrapper(const v8::FunctionCallbackInfo<v8::Value>& info) {
|
||||
|
||||
for (auto value : original_args) {
|
||||
auto arg = PassValueToOtherContext(
|
||||
calling_context, func_owning_context, value,
|
||||
isolate, calling_context, isolate, func_owning_context, value,
|
||||
calling_context->Global(), support_dynamic_properties,
|
||||
BridgeErrorTarget::kSource, &object_cache);
|
||||
if (arg.IsEmpty())
|
||||
@@ -597,7 +601,7 @@ void ProxyFunctionWrapper(const v8::FunctionCallbackInfo<v8::Value>& info) {
|
||||
{
|
||||
v8::TryCatch try_catch(isolate);
|
||||
ret = PassValueToOtherContext(
|
||||
func_owning_context, calling_context,
|
||||
isolate, func_owning_context, isolate, calling_context,
|
||||
maybe_return_value.ToLocalChecked(), func_owning_context->Global(),
|
||||
support_dynamic_properties, BridgeErrorTarget::kDestination);
|
||||
if (try_catch.HasCaught()) {
|
||||
@@ -732,14 +736,14 @@ namespace {
|
||||
|
||||
void ExposeAPI(v8::Isolate* isolate,
|
||||
v8::Local<v8::Context> source_context,
|
||||
v8::Isolate* target_isolate,
|
||||
v8::Local<v8::Context> target_context,
|
||||
const std::string& key,
|
||||
v8::Local<v8::Value> api,
|
||||
gin_helper::Arguments* args) {
|
||||
DCHECK(!target_context.IsEmpty());
|
||||
v8::Context::Scope target_context_scope(target_context);
|
||||
gin_helper::Dictionary global(target_context->GetIsolate(),
|
||||
target_context->Global());
|
||||
gin_helper::Dictionary global(target_isolate, target_context->Global());
|
||||
|
||||
if (global.Has(key)) {
|
||||
args->ThrowError(
|
||||
@@ -749,8 +753,8 @@ void ExposeAPI(v8::Isolate* isolate,
|
||||
}
|
||||
|
||||
v8::MaybeLocal<v8::Value> maybe_proxy = PassValueToOtherContext(
|
||||
source_context, target_context, api, source_context->Global(), false,
|
||||
BridgeErrorTarget::kSource);
|
||||
isolate, source_context, target_isolate, target_context, api,
|
||||
source_context->Global(), false, BridgeErrorTarget::kSource);
|
||||
if (maybe_proxy.IsEmpty())
|
||||
return;
|
||||
auto proxy = maybe_proxy.ToLocalChecked();
|
||||
@@ -773,7 +777,8 @@ void ExposeAPI(v8::Isolate* isolate,
|
||||
// world ID. For service workers, Electron only supports one isolated
|
||||
// context and the main worker context. Anything else is invalid.
|
||||
v8::MaybeLocal<v8::Context> GetTargetContext(v8::Isolate* isolate,
|
||||
const int world_id) {
|
||||
const int world_id,
|
||||
v8::Isolate* target_isolate) {
|
||||
v8::Local<v8::Context> source_context = isolate->GetCurrentContext();
|
||||
v8::MaybeLocal<v8::Context> maybe_target_context;
|
||||
|
||||
@@ -795,8 +800,8 @@ v8::MaybeLocal<v8::Context> GetTargetContext(v8::Isolate* isolate,
|
||||
isolate, "Isolated worlds are not supported in preload realms.")));
|
||||
return maybe_target_context;
|
||||
}
|
||||
maybe_target_context =
|
||||
electron::preload_realm::GetInitiatorContext(source_context);
|
||||
maybe_target_context = electron::preload_realm::GetInitiatorContext(
|
||||
source_context, target_isolate);
|
||||
} else {
|
||||
NOTREACHED();
|
||||
}
|
||||
@@ -814,12 +819,14 @@ void ExposeAPIInWorld(v8::Isolate* isolate,
|
||||
"worldId", world_id);
|
||||
v8::Local<v8::Context> source_context = isolate->GetCurrentContext();
|
||||
CHECK(!source_context.IsEmpty());
|
||||
v8::Isolate* target_isolate = isolate;
|
||||
v8::MaybeLocal<v8::Context> maybe_target_context =
|
||||
GetTargetContext(isolate, world_id);
|
||||
if (maybe_target_context.IsEmpty())
|
||||
GetTargetContext(isolate, world_id, target_isolate);
|
||||
if (maybe_target_context.IsEmpty() || !target_isolate)
|
||||
return;
|
||||
v8::Local<v8::Context> target_context = maybe_target_context.ToLocalChecked();
|
||||
ExposeAPI(isolate, source_context, target_context, key, api, args);
|
||||
ExposeAPI(isolate, source_context, target_isolate, target_context, key, api,
|
||||
args);
|
||||
}
|
||||
|
||||
gin_helper::Dictionary TraceKeyPath(const gin_helper::Dictionary& start,
|
||||
@@ -844,8 +851,7 @@ void OverrideGlobalValueFromIsolatedWorld(
|
||||
auto* frame = render_frame->GetWebFrame();
|
||||
CHECK(frame);
|
||||
v8::Local<v8::Context> main_context = frame->MainWorldScriptContext();
|
||||
gin_helper::Dictionary global(main_context->GetIsolate(),
|
||||
main_context->Global());
|
||||
gin_helper::Dictionary global(isolate, main_context->Global());
|
||||
|
||||
const std::string final_key = key_path[key_path.size() - 1];
|
||||
gin_helper::Dictionary target_object = TraceKeyPath(global, key_path);
|
||||
@@ -855,8 +861,9 @@ void OverrideGlobalValueFromIsolatedWorld(
|
||||
v8::Local<v8::Context> source_context =
|
||||
value->GetCreationContextChecked(isolate);
|
||||
v8::MaybeLocal<v8::Value> maybe_proxy = PassValueToOtherContext(
|
||||
source_context, main_context, value, source_context->Global(),
|
||||
support_dynamic_properties, BridgeErrorTarget::kSource);
|
||||
isolate, source_context, isolate, main_context, value,
|
||||
source_context->Global(), support_dynamic_properties,
|
||||
BridgeErrorTarget::kSource);
|
||||
DCHECK(!maybe_proxy.IsEmpty());
|
||||
auto proxy = maybe_proxy.ToLocalChecked();
|
||||
|
||||
@@ -878,8 +885,7 @@ bool OverrideGlobalPropertyFromIsolatedWorld(
|
||||
auto* frame = render_frame->GetWebFrame();
|
||||
CHECK(frame);
|
||||
v8::Local<v8::Context> main_context = frame->MainWorldScriptContext();
|
||||
gin_helper::Dictionary global(main_context->GetIsolate(),
|
||||
main_context->Global());
|
||||
gin_helper::Dictionary global(isolate, main_context->Global());
|
||||
|
||||
const std::string final_key = key_path[key_path.size() - 1];
|
||||
v8::Local<v8::Object> target_object =
|
||||
@@ -894,8 +900,8 @@ bool OverrideGlobalPropertyFromIsolatedWorld(
|
||||
v8::Local<v8::Context> source_context =
|
||||
getter->GetCreationContextChecked(isolate);
|
||||
v8::MaybeLocal<v8::Value> maybe_getter_proxy = PassValueToOtherContext(
|
||||
source_context, main_context, getter, source_context->Global(), false,
|
||||
BridgeErrorTarget::kSource);
|
||||
isolate, source_context, isolate, main_context, getter,
|
||||
source_context->Global(), false, BridgeErrorTarget::kSource);
|
||||
DCHECK(!maybe_getter_proxy.IsEmpty());
|
||||
getter_proxy = maybe_getter_proxy.ToLocalChecked();
|
||||
}
|
||||
@@ -903,8 +909,8 @@ bool OverrideGlobalPropertyFromIsolatedWorld(
|
||||
v8::Local<v8::Context> source_context =
|
||||
getter->GetCreationContextChecked(isolate);
|
||||
v8::MaybeLocal<v8::Value> maybe_setter_proxy = PassValueToOtherContext(
|
||||
source_context, main_context, setter, source_context->Global(), false,
|
||||
BridgeErrorTarget::kSource);
|
||||
isolate, source_context, isolate, main_context, setter,
|
||||
source_context->Global(), false, BridgeErrorTarget::kSource);
|
||||
DCHECK(!maybe_setter_proxy.IsEmpty());
|
||||
setter_proxy = maybe_setter_proxy.ToLocalChecked();
|
||||
}
|
||||
@@ -966,8 +972,9 @@ v8::Local<v8::Value> ExecuteInWorld(v8::Isolate* isolate,
|
||||
}
|
||||
|
||||
// Get the target context
|
||||
v8::Isolate* target_isolate = isolate;
|
||||
v8::MaybeLocal<v8::Context> maybe_target_context =
|
||||
GetTargetContext(isolate, world_id);
|
||||
GetTargetContext(isolate, world_id, target_isolate);
|
||||
v8::Local<v8::Context> target_context;
|
||||
if (!maybe_target_context.ToLocal(&target_context)) {
|
||||
isolate->ThrowException(v8::Exception::Error(gin::StringToV8(
|
||||
@@ -1053,9 +1060,9 @@ v8::Local<v8::Value> ExecuteInWorld(v8::Isolate* isolate,
|
||||
}
|
||||
|
||||
auto proxied_arg = PassValueToOtherContext(
|
||||
source_context, target_context, arg, source_context->Global(),
|
||||
support_dynamic_properties, BridgeErrorTarget::kSource,
|
||||
&object_cache);
|
||||
isolate, source_context, target_isolate, target_context, arg,
|
||||
source_context->Global(), support_dynamic_properties,
|
||||
BridgeErrorTarget::kSource, &object_cache);
|
||||
if (proxied_arg.IsEmpty()) {
|
||||
gin_helper::ErrorThrower(isolate).ThrowError(
|
||||
absl::StrFormat("Failed to proxy argument at index %d", i));
|
||||
@@ -1100,8 +1107,8 @@ v8::Local<v8::Value> ExecuteInWorld(v8::Isolate* isolate,
|
||||
v8::TryCatch try_catch(isolate);
|
||||
// Pass value from target context back to source context
|
||||
maybe_cloned_result = PassValueToOtherContext(
|
||||
target_context, source_context, result, target_context->Global(),
|
||||
false, BridgeErrorTarget::kSource);
|
||||
target_isolate, target_context, isolate, source_context, result,
|
||||
target_context->Global(), false, BridgeErrorTarget::kSource);
|
||||
if (try_catch.HasCaught()) {
|
||||
v8::String::Utf8Value utf8(isolate, try_catch.Exception());
|
||||
error_message = *utf8 ? *utf8 : "Unknown error cloning result";
|
||||
|
||||
@@ -31,7 +31,9 @@ enum class BridgeErrorTarget {
|
||||
};
|
||||
|
||||
v8::MaybeLocal<v8::Value> PassValueToOtherContext(
|
||||
v8::Isolate* source_isolate,
|
||||
v8::Local<v8::Context> source_context,
|
||||
v8::Isolate* destination_isolate,
|
||||
v8::Local<v8::Context> destination_context,
|
||||
v8::Local<v8::Value> value,
|
||||
/**
|
||||
|
||||
@@ -221,10 +221,10 @@ class IPCRenderFrame : public IPCBase<IPCRenderFrame>,
|
||||
|
||||
void OnDestruct() override { electron_ipc_remote_.reset(); }
|
||||
|
||||
void WillReleaseScriptContext(v8::Local<v8::Context> context,
|
||||
void WillReleaseScriptContext(v8::Isolate* const isolate,
|
||||
v8::Local<v8::Context> context,
|
||||
int32_t world_id) override {
|
||||
if (weak_context_.IsEmpty() ||
|
||||
weak_context_.Get(context->GetIsolate()) == context) {
|
||||
if (weak_context_.IsEmpty() || weak_context_.Get(isolate) == context) {
|
||||
OnDestruct();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
#include "base/containers/span.h"
|
||||
#include "base/memory/memory_pressure_listener.h"
|
||||
#include "base/no_destructor.h"
|
||||
#include "base/strings/strcat.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "components/spellcheck/renderer/spellcheck.h"
|
||||
@@ -107,6 +108,13 @@ namespace api {
|
||||
|
||||
namespace {
|
||||
|
||||
class SpellCheckerHolder;
|
||||
|
||||
std::set<SpellCheckerHolder*>& GetSpellCheckerHolderInstances() {
|
||||
static base::NoDestructor<std::set<SpellCheckerHolder*>> instances;
|
||||
return *instances;
|
||||
}
|
||||
|
||||
#if BUILDFLAG(ENABLE_BUILTIN_SPELLCHECKER)
|
||||
|
||||
bool SpellCheckWord(content::RenderFrame* render_frame,
|
||||
@@ -160,8 +168,8 @@ class ScriptExecutionCallback {
|
||||
v8::Local<v8::Context> source_context =
|
||||
result->GetCreationContextChecked(isolate);
|
||||
maybe_result = PassValueToOtherContext(
|
||||
source_context, promise_.GetContext(), result,
|
||||
source_context->Global(), false, BridgeErrorTarget::kSource);
|
||||
isolate, source_context, promise_.isolate(), promise_.GetContext(),
|
||||
result, source_context->Global(), false, BridgeErrorTarget::kSource);
|
||||
if (maybe_result.IsEmpty() || try_catch.HasCaught()) {
|
||||
success = false;
|
||||
}
|
||||
@@ -282,7 +290,7 @@ class SpellCheckerHolder final : private content::RenderFrameObserver {
|
||||
// Find existing holder for the |render_frame|.
|
||||
static SpellCheckerHolder* FromRenderFrame(
|
||||
content::RenderFrame* render_frame) {
|
||||
for (auto* holder : instances_) {
|
||||
for (auto* holder : GetSpellCheckerHolderInstances()) {
|
||||
if (holder->render_frame() == render_frame)
|
||||
return holder;
|
||||
}
|
||||
@@ -294,10 +302,10 @@ class SpellCheckerHolder final : private content::RenderFrameObserver {
|
||||
: content::RenderFrameObserver(render_frame),
|
||||
spell_check_client_(std::move(spell_check_client)) {
|
||||
DCHECK(!FromRenderFrame(render_frame));
|
||||
instances_.insert(this);
|
||||
GetSpellCheckerHolderInstances().insert(this);
|
||||
}
|
||||
|
||||
~SpellCheckerHolder() final { instances_.erase(this); }
|
||||
~SpellCheckerHolder() final { GetSpellCheckerHolderInstances().erase(this); }
|
||||
|
||||
void UnsetAndDestroy() {
|
||||
FrameSetSpellChecker set_spell_checker(nullptr, render_frame());
|
||||
@@ -319,7 +327,8 @@ class SpellCheckerHolder final : private content::RenderFrameObserver {
|
||||
delete this;
|
||||
}
|
||||
|
||||
void WillReleaseScriptContext(v8::Local<v8::Context> context,
|
||||
void WillReleaseScriptContext(v8::Isolate* const isolate,
|
||||
v8::Local<v8::Context> context,
|
||||
int world_id) final {
|
||||
// Unset spell checker when the script context is going to be released, as
|
||||
// the spell check implementation lives there.
|
||||
@@ -327,8 +336,6 @@ class SpellCheckerHolder final : private content::RenderFrameObserver {
|
||||
}
|
||||
|
||||
private:
|
||||
static std::set<SpellCheckerHolder*> instances_;
|
||||
|
||||
std::unique_ptr<SpellCheckClient> spell_check_client_;
|
||||
};
|
||||
|
||||
@@ -941,9 +948,6 @@ class WebFrameRenderer final
|
||||
gin::DeprecatedWrapperInfo WebFrameRenderer::kWrapperInfo = {
|
||||
gin::kEmbedderNativeGin};
|
||||
|
||||
// static
|
||||
std::set<SpellCheckerHolder*> SpellCheckerHolder::instances_;
|
||||
|
||||
} // namespace api
|
||||
|
||||
} // namespace electron
|
||||
|
||||
@@ -120,7 +120,7 @@ void ElectronApiServiceImpl::ReceivePostMessage(
|
||||
for (auto& port : message.ports) {
|
||||
ports.emplace_back(
|
||||
blink::WebMessagePortConverter::EntangleAndInjectMessagePortChannel(
|
||||
context, std::move(port)));
|
||||
isolate, context, std::move(port)));
|
||||
}
|
||||
|
||||
std::vector<v8::Local<v8::Value>> args = {message_value};
|
||||
|
||||
@@ -148,11 +148,11 @@ void ElectronRenderFrameObserver::DidInstallConditionalFeatures(
|
||||
}
|
||||
|
||||
void ElectronRenderFrameObserver::WillReleaseScriptContext(
|
||||
v8::Isolate* const isolate,
|
||||
v8::Local<v8::Context> context,
|
||||
int world_id) {
|
||||
if (ShouldNotifyClient(world_id))
|
||||
renderer_client_->WillReleaseScriptContext(context->GetIsolate(), context,
|
||||
render_frame_);
|
||||
renderer_client_->WillReleaseScriptContext(isolate, context, render_frame_);
|
||||
}
|
||||
|
||||
void ElectronRenderFrameObserver::OnDestruct() {
|
||||
|
||||
@@ -31,7 +31,8 @@ class ElectronRenderFrameObserver : private content::RenderFrameObserver {
|
||||
void DidClearWindowObject() override;
|
||||
void DidInstallConditionalFeatures(v8::Local<v8::Context> context,
|
||||
int world_id) override;
|
||||
void WillReleaseScriptContext(v8::Local<v8::Context> context,
|
||||
void WillReleaseScriptContext(v8::Isolate* const isolate,
|
||||
v8::Local<v8::Context> context,
|
||||
int world_id) override;
|
||||
void OnDestruct() override;
|
||||
void DidMeaningfulLayout(blink::WebMeaningfulLayout layout_type) override;
|
||||
|
||||
@@ -172,19 +172,18 @@ void ElectronSandboxedRendererClient::EmitProcessEvent(
|
||||
|
||||
void ElectronSandboxedRendererClient::WillEvaluateServiceWorkerOnWorkerThread(
|
||||
blink::WebServiceWorkerContextProxy* context_proxy,
|
||||
v8::Isolate* const v8_isolate,
|
||||
v8::Local<v8::Context> v8_context,
|
||||
int64_t service_worker_version_id,
|
||||
const GURL& service_worker_scope,
|
||||
const GURL& script_url,
|
||||
const blink::ServiceWorkerToken& service_worker_token) {
|
||||
RendererClientBase::WillEvaluateServiceWorkerOnWorkerThread(
|
||||
context_proxy, v8_context, service_worker_version_id,
|
||||
context_proxy, v8_isolate, v8_context, service_worker_version_id,
|
||||
service_worker_scope, script_url, service_worker_token);
|
||||
|
||||
auto* command_line = base::CommandLine::ForCurrentProcess();
|
||||
if (command_line->HasSwitch(switches::kServiceWorkerPreload)) {
|
||||
v8::Isolate* const v8_isolate = v8_context->GetIsolate();
|
||||
|
||||
if (!service_worker_data) {
|
||||
service_worker_data = new ServiceWorkerData{
|
||||
context_proxy, service_worker_version_id, v8_isolate, v8_context};
|
||||
|
||||
@@ -47,6 +47,7 @@ class ElectronSandboxedRendererClient : public RendererClientBase {
|
||||
void RunScriptsAtDocumentEnd(content::RenderFrame* render_frame) override;
|
||||
void WillEvaluateServiceWorkerOnWorkerThread(
|
||||
blink::WebServiceWorkerContextProxy* context_proxy,
|
||||
v8::Isolate* const isolate,
|
||||
v8::Local<v8::Context> v8_context,
|
||||
int64_t service_worker_version_id,
|
||||
const GURL& service_worker_scope,
|
||||
|
||||
@@ -98,6 +98,12 @@ class PreloadRealmLifetimeController
|
||||
: v8::MaybeLocal<v8::Context>();
|
||||
}
|
||||
|
||||
v8::Isolate* GetInitiatorIsolate() {
|
||||
return initiator_script_state_->ContextIsValid()
|
||||
? initiator_script_state_->GetIsolate()
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
electron::ServiceWorkerData* service_worker_data() {
|
||||
return service_worker_data_;
|
||||
}
|
||||
@@ -199,16 +205,19 @@ class PreloadRealmLifetimeController
|
||||
|
||||
} // namespace
|
||||
|
||||
v8::MaybeLocal<v8::Context> GetInitiatorContext(
|
||||
v8::Local<v8::Context> context) {
|
||||
v8::MaybeLocal<v8::Context> GetInitiatorContext(v8::Local<v8::Context> context,
|
||||
v8::Isolate* target_isolate) {
|
||||
DCHECK(!context.IsEmpty());
|
||||
DCHECK(target_isolate);
|
||||
blink::ExecutionContext* execution_context =
|
||||
blink::ExecutionContext::From(context);
|
||||
if (!execution_context->IsShadowRealmGlobalScope())
|
||||
return v8::MaybeLocal<v8::Context>();
|
||||
auto* controller = PreloadRealmLifetimeController::From(context);
|
||||
if (controller)
|
||||
if (controller) {
|
||||
target_isolate = controller->GetInitiatorIsolate();
|
||||
return controller->GetInitiatorContext();
|
||||
}
|
||||
return v8::MaybeLocal<v8::Context>();
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,8 @@ class ServiceWorkerData;
|
||||
namespace electron::preload_realm {
|
||||
|
||||
// Get initiator context given the preload context.
|
||||
v8::MaybeLocal<v8::Context> GetInitiatorContext(v8::Local<v8::Context> context);
|
||||
v8::MaybeLocal<v8::Context> GetInitiatorContext(v8::Local<v8::Context> context,
|
||||
v8::Isolate* target_isolate);
|
||||
|
||||
// Get the preload context given the initiator context.
|
||||
v8::MaybeLocal<v8::Context> GetPreloadRealmContext(
|
||||
|
||||
@@ -489,6 +489,7 @@ void RendererClientBase::DidInitializeServiceWorkerContextOnWorkerThread(
|
||||
|
||||
void RendererClientBase::WillEvaluateServiceWorkerOnWorkerThread(
|
||||
blink::WebServiceWorkerContextProxy* context_proxy,
|
||||
v8::Isolate* const v8_isolate,
|
||||
v8::Local<v8::Context> v8_context,
|
||||
int64_t service_worker_version_id,
|
||||
const GURL& service_worker_scope,
|
||||
@@ -497,7 +498,7 @@ void RendererClientBase::WillEvaluateServiceWorkerOnWorkerThread(
|
||||
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
||||
extensions_renderer_client_->dispatcher()
|
||||
->WillEvaluateServiceWorkerOnWorkerThread(
|
||||
context_proxy, v8_context, service_worker_version_id,
|
||||
context_proxy, v8_isolate, v8_context, service_worker_version_id,
|
||||
service_worker_scope, script_url, service_worker_token);
|
||||
#endif
|
||||
}
|
||||
@@ -591,8 +592,8 @@ void RendererClientBase::SetupMainWorldOverrides(
|
||||
v8::Local<v8::Value> guest_view_internal;
|
||||
if (global.GetHidden("guestViewInternal", &guest_view_internal)) {
|
||||
auto result = api::PassValueToOtherContext(
|
||||
source_context, context, guest_view_internal, source_context->Global(),
|
||||
false, api::BridgeErrorTarget::kSource);
|
||||
isolate, source_context, isolate, context, guest_view_internal,
|
||||
source_context->Global(), false, api::BridgeErrorTarget::kSource);
|
||||
if (!result.IsEmpty()) {
|
||||
isolated_api.Set("guestViewInternal", result.ToLocalChecked());
|
||||
}
|
||||
|
||||
@@ -124,6 +124,7 @@ class RendererClientBase : public content::ContentRendererClient
|
||||
const GURL& script_url) override;
|
||||
void WillEvaluateServiceWorkerOnWorkerThread(
|
||||
blink::WebServiceWorkerContextProxy* context_proxy,
|
||||
v8::Isolate* const isolate,
|
||||
v8::Local<v8::Context> v8_context,
|
||||
int64_t service_worker_version_id,
|
||||
const GURL& service_worker_scope,
|
||||
|
||||
Reference in New Issue
Block a user