Compare commits

...

8 Commits

Author SHA1 Message Date
Keeley Hammond
574879fa40 chore: remove focus ring patch (#42189) 2024-05-15 10:18:48 +02:00
trop[bot]
05ae671d83 fix: webContents.navigationHistory should be enumerable (#42181)
fix: webContents.navigationHistory should be enumerable

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2024-05-14 17:46:59 -07:00
trop[bot]
220166419f fix: restore non-panel focus behavior (#42187)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Samuel Attard <marshallofsound@electronjs.org>
2024-05-14 17:44:27 -07:00
trop[bot]
60f48e1753 fix: fix cast in ElectronDesktopWindowTreeHostLinux (#42185)
Fix cast in ElectronDesktopWindowTreeHostLinux

The frame view of the widget is an `ClientFrameViewLinux` instance only
when both `frame` and `client_frame` booleans are set to `true`.
Otherwise it is an instance of a different class and thus casting to
`ClientFrameViewLinux` is incorrect and leads to crashes.

Fix: #41839

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Fedor Indutny <indutny@signal.org>
2024-05-14 16:14:45 -07:00
Keeley Hammond
c0e5ef40cc chore: cherry-pick b3c01ac1e60a from v8 (#42174)
* chore: cherry-pick b3c01ac1e60a from v8

* chore: update patches

---------

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2024-05-14 15:55:59 -07:00
Shelley Vohr
842aa02179 fix: setTitleBarOverlay should be implemented on BaseWindow (#42151) 2024-05-14 16:31:41 -04:00
Samuel Attard
40450d0a0e build: ignore node version mismatch for electron 30 tests (#42177) 2024-05-14 16:02:55 -04:00
electron-roller[bot]
526e2f8916 chore: bump chromium to 124.0.6367.207 (30-x-y) (#42166)
* chore: bump chromium in DEPS to 124.0.6367.207

* chore: update patches

* chore: update docker container version to fix broken testing

https://github.com/electron/electron/runs/24917447946

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2024-05-14 16:02:39 -04:00
16 changed files with 165 additions and 174 deletions

View File

@@ -56,7 +56,7 @@ executors:
# 2xlarge should not be used directly, use the pipeline param instead
enum: ["medium", "electronjs/aks-linux-medium", "xlarge", "electronjs/aks-linux-large", "2xlarge"]
docker:
- image: ghcr.io/electron/build:e6bebd08a51a0d78ec23e5b3fd7e7c0846412328
- image: ghcr.io/electron/build:9a43c14f5c19be0359843299f79e736521373adc
resource_class: << parameters.size >>
macos:

2
DEPS
View File

@@ -2,7 +2,7 @@ gclient_gn_args_from = 'src'
vars = {
'chromium_version':
'124.0.6367.201',
'124.0.6367.207',
'node_version':
'v20.11.1',
'nan_version':

View File

@@ -539,7 +539,8 @@ WebContents.prototype._init = function () {
length: this._historyLength.bind(this),
getEntryAtIndex: this._getNavigationEntryAtIndex.bind(this)
},
writable: false
writable: false,
enumerable: true
});
// Dispatch IPC messages to the ipc module.

View File

@@ -132,4 +132,3 @@ fix_add_support_for_skipping_first_2_no-op_refreshes_in_thumb_cap.patch
refactor_expose_file_system_access_blocklist.patch
cherry-pick-013961609785.patch
feat_add_support_for_missing_dialog_features_to_shell_dialogs.patch
fix_partially_revert_invalidate_focusring.patch

View File

@@ -1,53 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: VerteDinde <keeleymhammond@gmail.com>
Date: Mon, 6 May 2024 11:03:08 -0700
Subject: fix: partially revert views invalidate FocusRing when its host is
invalidated
This reverts commit f425c438dfb11fb714655c999ba8c74b58393425. This
commit seems to be causing a sporadic crash on Ubuntu and other Linux
distros. This patch can be reverted when the issue is fixed upstream, or
when the crash is addressed.
diff --git a/ui/views/view.cc b/ui/views/view.cc
index 81109f7679aaef16f3045f61e349af42e7464a03..c734f8522d2912210f04ecb8f2bba2f904c53535 100644
--- a/ui/views/view.cc
+++ b/ui/views/view.cc
@@ -929,11 +929,6 @@ void View::Layout(PassKey) {
}
void View::InvalidateLayout() {
- if (invalidating_) {
- return;
- }
-
- base::AutoReset<bool> invalidating(&invalidating_, true);
// We should never need to invalidate during a layout call; this tracks
// how many times that is happening.
++invalidates_during_layout_;
@@ -941,11 +936,6 @@ void View::InvalidateLayout() {
// Always invalidate up. This is needed to handle the case of us already being
// valid, but not our parent.
needs_layout_ = true;
-
- for (ViewObserver& observer : observers_) {
- observer.OnViewLayoutInvalidated(this);
- }
-
if (HasLayoutManager()) {
GetLayoutManager()->InvalidateLayout();
}
diff --git a/ui/views/view.h b/ui/views/view.h
index 6cca6e9e7627d8495128d42887b0c950ee85d1d7..69ab9fa2b82848fdf49d8cf099ddad224460312a 100644
--- a/ui/views/view.h
+++ b/ui/views/view.h
@@ -2350,9 +2350,6 @@ class VIEWS_EXPORT View : public ui::LayerDelegate,
// it is happening.
int invalidates_during_layout_ = 0;
- // Whether this view is in the middle of InvalidateLayout().
- bool invalidating_ = false;
-
// The View's LayoutManager defines the sizing heuristics applied to child
// Views. The default is absolute positioning according to bounds_.
std::unique_ptr<LayoutManager> layout_manager_;

View File

@@ -1,3 +1,3 @@
chore_allow_customizing_microtask_policy_per_context.patch
deps_add_v8_object_setinternalfieldfornodecore.patch
cherry-pick-f320600cd1f4.patch
cherry-pick-b3c01ac1e60a.patch

View File

@@ -0,0 +1,76 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shu-yu Guo <syg@chromium.org>
Date: Mon, 13 May 2024 11:23:20 -0700
Subject: Don't build AccessInfo for storing to module exports
Bug: 340221135
Change-Id: I5af35be6ebf6a69db1c4687107503575b23973c4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5534518
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Shu-yu Guo <syg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93872}
diff --git a/src/compiler/access-info.cc b/src/compiler/access-info.cc
index 7cff878839c85cd9c6571ee48f1a0fce081f4471..9d022ba402d7bfdd5ca745a4193ee0de0e3d755e 100644
--- a/src/compiler/access-info.cc
+++ b/src/compiler/access-info.cc
@@ -526,6 +526,14 @@ PropertyAccessInfo AccessorAccessInfoHelper(
Cell::cast(module_namespace->module()->exports()->Lookup(
isolate, name.object(),
Smi::ToInt(Object::GetHash(*name.object())))));
+ if (IsAnyStore(access_mode)) {
+ // ES#sec-module-namespace-exotic-objects-set-p-v-receiver
+ // ES#sec-module-namespace-exotic-objects-defineownproperty-p-desc
+ //
+ // Storing to a module namespace object is always an error or a no-op in
+ // JS.
+ return PropertyAccessInfo::Invalid(zone);
+ }
if (IsTheHole(cell->value(kRelaxedLoad), isolate)) {
// This module has not been fully initialized yet.
return PropertyAccessInfo::Invalid(zone);
diff --git a/src/maglev/maglev-graph-builder.cc b/src/maglev/maglev-graph-builder.cc
index 73ead492da3ee56a80ee088d9440abb2d9ae8cdd..efcdd6d2028a5e0f0ec1149925ab2e1fe5f90412 100644
--- a/src/maglev/maglev-graph-builder.cc
+++ b/src/maglev/maglev-graph-builder.cc
@@ -4001,19 +4001,28 @@ ReduceResult MaglevGraphBuilder::TryBuildPropertyStore(
access_info.holder().value());
}
- if (access_info.IsFastAccessorConstant()) {
- return TryBuildPropertySetterCall(access_info, receiver,
- GetAccumulatorTagged());
- } else {
- DCHECK(access_info.IsDataField() || access_info.IsFastDataConstant());
- ReduceResult res = TryBuildStoreField(access_info, receiver, access_mode);
- if (res.IsDone()) {
- RecordKnownProperty(receiver, name,
- current_interpreter_frame_.accumulator(),
- AccessInfoGuaranteedConst(access_info), access_mode);
- return res;
+ switch (access_info.kind()) {
+ case compiler::PropertyAccessInfo::kFastAccessorConstant:
+ return TryBuildPropertySetterCall(access_info, receiver,
+ GetAccumulatorTagged());
+ case compiler::PropertyAccessInfo::kDataField:
+ case compiler::PropertyAccessInfo::kFastDataConstant: {
+ ReduceResult res = TryBuildStoreField(access_info, receiver, access_mode);
+ if (res.IsDone()) {
+ RecordKnownProperty(
+ receiver, name, current_interpreter_frame_.accumulator(),
+ AccessInfoGuaranteedConst(access_info), access_mode);
+ return res;
+ }
+ return ReduceResult::Fail();
}
- return ReduceResult::Fail();
+ case compiler::PropertyAccessInfo::kInvalid:
+ case compiler::PropertyAccessInfo::kNotFound:
+ case compiler::PropertyAccessInfo::kDictionaryProtoDataConstant:
+ case compiler::PropertyAccessInfo::kDictionaryProtoAccessorConstant:
+ case compiler::PropertyAccessInfo::kModuleExport:
+ case compiler::PropertyAccessInfo::kStringLength:
+ UNREACHABLE();
}
}

View File

@@ -1,27 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shu-yu Guo <syg@chromium.org>
Date: Thu, 9 May 2024 12:03:28 -0700
Subject: Only normalize JSObject targets in SetOrCopyDataProperties
Bug: 339458194
Change-Id: I4d6eebdd921971fa28d7c474535d978900ba633f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5527397
Reviewed-by: Rezvan Mahdavi Hezaveh <rezvan@chromium.org>
Commit-Queue: Shu-yu Guo <syg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93811}
diff --git a/src/objects/js-objects.cc b/src/objects/js-objects.cc
index e5a03dff14835e98a53ff7a40c5c60b362c4afec..2f3ab484cdc010915c57cd6112c4330c4ed69c6c 100644
--- a/src/objects/js-objects.cc
+++ b/src/objects/js-objects.cc
@@ -432,9 +432,7 @@ Maybe<bool> JSReceiver::SetOrCopyDataProperties(
Nothing<bool>());
if (!from->HasFastProperties() && target->HasFastProperties() &&
- !IsJSGlobalProxy(*target)) {
- // JSProxy is always in slow-mode.
- DCHECK(!IsJSProxy(*target));
+ IsJSObject(*target) && !IsJSGlobalProxy(*target)) {
// Convert to slow properties if we're guaranteed to overflow the number of
// descriptors.
int source_length;

View File

@@ -218,7 +218,7 @@ async function installSpecModules (dir) {
if (fs.existsSync(path.resolve(dir, 'node_modules'))) {
await fs.remove(path.resolve(dir, 'node_modules'));
}
const { status } = childProcess.spawnSync(NPX_CMD, [`yarn@${YARN_VERSION}`, 'install', '--frozen-lockfile'], {
const { status } = childProcess.spawnSync(NPX_CMD, [`yarn@${YARN_VERSION}`, 'install', '--frozen-lockfile', '--ignore-engines'], {
env,
cwd: dir,
stdio: 'inherit',

View File

@@ -11,6 +11,7 @@
#include "base/containers/contains.h"
#include "base/task/single_thread_task_runner.h"
#include "content/public/common/color_parser.h"
#include "electron/buildflags/buildflags.h"
#include "gin/dictionary.h"
#include "shell/browser/api/electron_api_menu.h"
@@ -36,6 +37,7 @@
#endif
#if BUILDFLAG(IS_WIN)
#include "shell/browser/ui/views/win_frame_view.h"
#include "shell/browser/ui/win/taskbar_host.h"
#include "ui/base/win/shell.h"
#endif
@@ -1044,6 +1046,63 @@ void BaseWindow::SetAppDetails(const gin_helper::Dictionary& options) {
relaunch_command, relaunch_display_name,
window_->GetAcceleratedWidget());
}
void BaseWindow::SetTitleBarOverlay(const gin_helper::Dictionary& options,
gin_helper::Arguments* args) {
// Ensure WCO is already enabled on this window
if (!window_->titlebar_overlay_enabled()) {
args->ThrowError("Titlebar overlay is not enabled");
return;
}
auto* window = static_cast<NativeWindowViews*>(window_.get());
bool updated = false;
// Check and update the button color
std::string btn_color;
if (options.Get(options::kOverlayButtonColor, &btn_color)) {
// Parse the string as a CSS color
SkColor color;
if (!content::ParseCssColorString(btn_color, &color)) {
args->ThrowError("Could not parse color as CSS color");
return;
}
// Update the view
window->set_overlay_button_color(color);
updated = true;
}
// Check and update the symbol color
std::string symbol_color;
if (options.Get(options::kOverlaySymbolColor, &symbol_color)) {
// Parse the string as a CSS color
SkColor color;
if (!content::ParseCssColorString(symbol_color, &color)) {
args->ThrowError("Could not parse symbol color as CSS color");
return;
}
// Update the view
window->set_overlay_symbol_color(color);
updated = true;
}
// Check and update the height
int height = 0;
if (options.Get(options::kOverlayHeight, &height)) {
window->set_titlebar_overlay_height(height);
updated = true;
}
// If anything was updated, invalidate the layout and schedule a paint of the
// window's frame view
if (updated) {
auto* frame_view = static_cast<WinFrameView*>(
window->widget()->non_client_view()->frame_view());
frame_view->InvalidateCaptionButtons();
}
}
#endif
int32_t BaseWindow::GetID() const {
@@ -1232,6 +1291,7 @@ void BaseWindow::BuildPrototype(v8::Isolate* isolate,
.SetMethod("setThumbnailClip", &BaseWindow::SetThumbnailClip)
.SetMethod("setThumbnailToolTip", &BaseWindow::SetThumbnailToolTip)
.SetMethod("setAppDetails", &BaseWindow::SetAppDetails)
.SetMethod("setTitleBarOverlay", &BaseWindow::SetTitleBarOverlay)
#endif
.SetProperty("id", &BaseWindow::GetID);
}

View File

@@ -241,6 +241,8 @@ class BaseWindow : public gin_helper::TrackableObject<BaseWindow>,
bool SetThumbnailClip(const gfx::Rect& region);
bool SetThumbnailToolTip(const std::string& tooltip);
void SetAppDetails(const gin_helper::Dictionary& options);
void SetTitleBarOverlay(const gin_helper::Dictionary& options,
gin_helper::Arguments* args);
#endif
int32_t GetID() const;

View File

@@ -10,7 +10,6 @@
#include "content/browser/web_contents/web_contents_impl.h" // nogncheck
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/common/color_parser.h"
#include "shell/browser/api/electron_api_web_contents_view.h"
#include "shell/browser/browser.h"
#include "shell/browser/web_contents_preferences.h"
@@ -27,10 +26,6 @@
#include "shell/browser/native_window_views.h"
#endif
#if BUILDFLAG(IS_WIN)
#include "shell/browser/ui/views/win_frame_view.h"
#endif
namespace electron::api {
BrowserWindow::BrowserWindow(gin::Arguments* args,
@@ -303,65 +298,6 @@ v8::Local<v8::Value> BrowserWindow::GetWebContents(v8::Isolate* isolate) {
return v8::Local<v8::Value>::New(isolate, web_contents_);
}
#if BUILDFLAG(IS_WIN)
void BrowserWindow::SetTitleBarOverlay(const gin_helper::Dictionary& options,
gin_helper::Arguments* args) {
// Ensure WCO is already enabled on this window
if (!window_->titlebar_overlay_enabled()) {
args->ThrowError("Titlebar overlay is not enabled");
return;
}
auto* window = static_cast<NativeWindowViews*>(window_.get());
bool updated = false;
// Check and update the button color
std::string btn_color;
if (options.Get(options::kOverlayButtonColor, &btn_color)) {
// Parse the string as a CSS color
SkColor color;
if (!content::ParseCssColorString(btn_color, &color)) {
args->ThrowError("Could not parse color as CSS color");
return;
}
// Update the view
window->set_overlay_button_color(color);
updated = true;
}
// Check and update the symbol color
std::string symbol_color;
if (options.Get(options::kOverlaySymbolColor, &symbol_color)) {
// Parse the string as a CSS color
SkColor color;
if (!content::ParseCssColorString(symbol_color, &color)) {
args->ThrowError("Could not parse symbol color as CSS color");
return;
}
// Update the view
window->set_overlay_symbol_color(color);
updated = true;
}
// Check and update the height
int height = 0;
if (options.Get(options::kOverlayHeight, &height)) {
window->set_titlebar_overlay_height(height);
updated = true;
}
// If anything was updated, invalidate the layout and schedule a paint of the
// window's frame view
if (updated) {
auto* frame_view = static_cast<WinFrameView*>(
window->widget()->non_client_view()->frame_view());
frame_view->InvalidateCaptionButtons();
}
}
#endif
void BrowserWindow::ScheduleUnresponsiveEvent(int ms) {
if (!window_unresponsive_closure_.IsCancelled())
return;
@@ -419,9 +355,6 @@ void BrowserWindow::BuildPrototype(v8::Isolate* isolate,
.SetMethod("focusOnWebView", &BrowserWindow::FocusOnWebView)
.SetMethod("blurWebView", &BrowserWindow::BlurWebView)
.SetMethod("isWebViewFocused", &BrowserWindow::IsWebViewFocused)
#if BUILDFLAG(IS_WIN)
.SetMethod("setTitleBarOverlay", &BrowserWindow::SetTitleBarOverlay)
#endif
.SetProperty("webContents", &BrowserWindow::GetWebContents);
}

View File

@@ -76,10 +76,6 @@ class BrowserWindow : public BaseWindow,
void BlurWebView();
bool IsWebViewFocused();
v8::Local<v8::Value> GetWebContents(v8::Isolate* isolate);
#if BUILDFLAG(IS_WIN)
void SetTitleBarOverlay(const gin_helper::Dictionary& options,
gin_helper::Arguments* args);
#endif
private:
// Helpers.

View File

@@ -425,20 +425,7 @@ void NativeWindowMac::Focus(bool focus) {
// If we're a panel window, we do not want to activate the app,
// which enables Electron-apps to build Spotlight-like experiences.
if (!IsPanel()) {
// On macOS < Sonoma, "activateIgnoringOtherApps:NO" would not
// activate apps if focusing a window that is inActive. That
// changed with macOS Sonoma, which also deprecated
// "activateIgnoringOtherApps".
//
// There's a slim chance we should have never called
// activateIgnoringOtherApps, but we tried that many years ago
// and saw weird focus bugs on other macOS versions. So, to make
// this safe, we're gating by versions.
if (@available(macOS 14.0, *)) {
[[NSApplication sharedApplication] activate];
} else {
[[NSApplication sharedApplication] activateIgnoringOtherApps:NO];
}
[[NSApplication sharedApplication] activateIgnoringOtherApps:NO];
}
[window_ makeKeyAndOrderFront:nil];
} else {

View File

@@ -71,9 +71,15 @@ void ElectronDesktopWindowTreeHostLinux::OnWindowStateChanged(
void ElectronDesktopWindowTreeHostLinux::OnWindowTiledStateChanged(
ui::WindowTiledEdges new_tiled_edges) {
static_cast<ClientFrameViewLinux*>(
native_window_view_->widget()->non_client_view()->frame_view())
->set_tiled_edges(new_tiled_edges);
// CreateNonClientFrameView creates `ClientFrameViewLinux` only when both
// frame and client_frame booleans are set, otherwise it is a different type
// of view.
if (native_window_view_->has_frame() &&
native_window_view_->has_client_frame()) {
static_cast<ClientFrameViewLinux*>(
native_window_view_->widget()->non_client_view()->frame_view())
->set_tiled_edges(new_tiled_edges);
}
UpdateFrameHints();
}

View File

@@ -41,6 +41,17 @@ describe('webContents module', () => {
});
});
describe('webContents properties', () => {
afterEach(closeAllWindows);
it('has expected additional enumerable properties', () => {
const w = new BrowserWindow({ show: false });
const properties = Object.getOwnPropertyNames(w.webContents);
expect(properties).to.include('ipc');
expect(properties).to.include('navigationHistory');
});
});
describe('fromId()', () => {
it('returns undefined for an unknown id', () => {
expect(webContents.fromId(12345)).to.be.undefined();