electron/patches/chromium/blink_local_frame.patch
electron-roller[bot] 55d8b71d72
chore: bump chromium to 141.0.7346.0 (main) (#47983)
* chore: bump chromium in DEPS to 141.0.7341.0

* chore: bump chromium in DEPS to 141.0.7342.0

* chore: update patches

manually resolved conflict in `osr_shared_texture_remove_keyed_mutex_on_win_dxgi.patch` due to https://crrev.com/c/6681354

* 6819541: WebShare: Improve mac share behavior when sharing a URL
https://chromium-review.googlesource.com/c/chromium/src/+/6819541

* Add missing include for SkBitmap

Couldn't quickly find where we lost the full definition in this file's includes. 🤷

* 6771055: [SxS] Move devtools to ContentsContainerView supporting side-by-side.
https://chromium-review.googlesource.com/c/chromium/src/+/6771055

There may be some simplification possible here (set_x, Rect position, ...), but this change is satisfactory to maintain the current behavior.

* 6813689: Switch SystemMemoryInfoKB to use ByteCount
https://chromium-review.googlesource.com/c/chromium/src/+/6813689

* 6818486: Track DevTools feature usage in new badge tracker
https://chromium-review.googlesource.com/c/chromium/src/+/6818486

* chore: bump chromium in DEPS to 141.0.7344.0

* Remove ELECTRON_OZONE_PLATFORM_HINT env var

6819616: Remove OzonePlatformHint | https://chromium-review.googlesource.com/c/chromium/src/+/6819616

See: https://github.com/electron/electron/issues/48001

* chore: update patches

* Add missing include for `base::NumberToString`

* Remove `DESKTOP_STARTUP_ID` code

This was removed upstream in https://chromium-review.googlesource.com/c/chromium/src/+/6819616 and I confirmed with the author that it was an intentional change. Going to mirror upstream and remove it here too.

* chore: bump chromium in DEPS to 141.0.7346.0

* chore: update patches

* 6828465: Reland "Remove BluezDBusThreadManager"
https://chromium-review.googlesource.com/c/chromium/src/+/6828465

* Patch change to Node.js test output

V8 enhanced the stack trace of "thenable" async tasks. A couple of Node.js tests needed to have their snapshots updates to accomodate the extra stack trace frames in the output.

This patch should be upstreamed to Node.js.

See:
6826001: fix thenable async stack trace
https://chromium-review.googlesource.com/c/v8/v8/+/6826001

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: clavin <clavin@electronjs.org>
2025-08-11 12:57:31 +09:00

77 lines
3.5 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Cheng Zhao <zcbenz@gmail.com>
Date: Thu, 20 Sep 2018 17:45:03 -0700
Subject: blink_local_frame.patch
According to electron/electron#3699, it is unreliable to use |unload|
event for process.exit('exit'), so we have to do that in
willReleaseScriptContext.
Refs changes in:
* https://codereview.chromium.org/1657583002
* https://chromium-review.googlesource.com/c/chromium/src/+/2596880
* https://chromium-review.googlesource.com/c/chromium/src/+/2597169
This patch reverts the changes to fix associated crashes in Electron.
diff --git a/third_party/blink/renderer/core/frame/frame.cc b/third_party/blink/renderer/core/frame/frame.cc
index c9f34fa47702504ccdefb8d61c55f5eaae501085..26df03d777c9ea487cae37f3df91d1df233b75e2 100644
--- a/third_party/blink/renderer/core/frame/frame.cc
+++ b/third_party/blink/renderer/core/frame/frame.cc
@@ -134,14 +134,6 @@ bool Frame::Detach(FrameDetachType type) {
DCHECK(!IsDetached());
- // TODO(dcheng): FocusController::FrameDetached() *should* fire JS events,
- // hence the above check for `client_` being null. However, when this was
- // previously placed before the `FrameDetached()` call, nothing crashes, which
- // is suspicious. Investigate if we really don't need to fire JS events--and
- // if we don't, move `forbid_scripts` up to be instantiated sooner and
- // simplify this code.
- ScriptForbiddenScope forbid_scripts;
-
if (type == FrameDetachType::kRemove) {
if (provisional_frame_) {
provisional_frame_->Detach(FrameDetachType::kRemove);
@@ -166,6 +158,14 @@ bool Frame::Detach(FrameDetachType type) {
GetWindowProxyManager()->ClearForSwap();
}
+ // TODO(dcheng): FocusController::FrameDetached() *should* fire JS events,
+ // hence the above check for `client_` being null. However, when this was
+ // previously placed before the `FrameDetached()` call, nothing crashes, which
+ // is suspicious. Investigate if we really don't need to fire JS events--and
+ // if we don't, move `forbid_scripts` up to be instantiated sooner and
+ // simplify this code.
+ ScriptForbiddenScope forbid_scripts;
+
// After this, we must no longer talk to the client since this clears
// its owning reference back to our owning LocalFrame.
client_->Detached(type);
diff --git a/third_party/blink/renderer/core/frame/local_frame.cc b/third_party/blink/renderer/core/frame/local_frame.cc
index f23c955831d9acda8e115e418b0b0f9a29e52d58..dfcc54b3834ca173707bcf97bfa2d72a64638044 100644
--- a/third_party/blink/renderer/core/frame/local_frame.cc
+++ b/third_party/blink/renderer/core/frame/local_frame.cc
@@ -738,10 +738,6 @@ bool LocalFrame::DetachImpl(FrameDetachType type) {
}
DCHECK(!view_ || !view_->IsAttached());
- // This is the earliest that scripting can be disabled:
- // - FrameLoader::Detach() can fire XHR abort events
- // - Document::Shutdown() can dispose plugins which can run script.
- ScriptForbiddenScope forbid_script;
if (!Client())
return false;
@@ -795,6 +791,11 @@ bool LocalFrame::DetachImpl(FrameDetachType type) {
DCHECK(!view_->IsAttached());
Client()->WillBeDetached();
+ // This is the earliest that scripting can be disabled:
+ // - FrameLoader::Detach() can fire XHR abort events
+ // - Document::Shutdown() can dispose plugins which can run script.
+ ScriptForbiddenScope forbid_script;
+
// TODO(crbug.com/729196): Trace why LocalFrameView::DetachFromLayout crashes.
CHECK(!view_->IsAttached());
SetView(nullptr);