Skip to content

Commit

Permalink
Merge branch '30-x-y' into trop/30-x-y-bp-refactor-use-ui-shell_dialo…
Browse files Browse the repository at this point in the history
…gs-on-linux-1715262710806
  • Loading branch information
codebytere committed May 10, 2024
2 parents 4a29aef + 0864b87 commit 05795be
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 102 deletions.
2 changes: 1 addition & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ gclient_gn_args_from = 'src'

vars = {
'chromium_version':
'124.0.6367.119',
'124.0.6367.201',
'node_version':
'v20.11.1',
'nan_version':
Expand Down
1 change: 0 additions & 1 deletion patches/chromium/.patches
Original file line number Diff line number Diff line change
Expand Up @@ -131,5 +131,4 @@ fix_getcursorscreenpoint_wrongly_returns_0_0.patch
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
cherry-pick-b2cc7b7ac538.patch
feat_add_support_for_missing_dialog_features_to_shell_dialogs.patch
99 changes: 0 additions & 99 deletions patches/chromium/cherry-pick-b2cc7b7ac538.patch

This file was deleted.

8 changes: 8 additions & 0 deletions shell/browser/api/electron_api_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,14 @@ void View::AddChildViewAt(gin::Handle<View> child,
// has a View, possibly a wrapper view around the underlying platform View.
if (!view_)
return;

// This will CHECK and crash in View::AddChildViewAtImpl if not handled here.
if (view_ == child->view()) {
gin_helper::ErrorThrower(isolate()).ThrowError(
"A view cannot be added as its own child");
return;
}

size_t index =
std::min(child_views_.size(), maybe_index.value_or(child_views_.size()));
child_views_.emplace(child_views_.begin() + index, // index
Expand Down
12 changes: 11 additions & 1 deletion spec/api-view-spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { expect } from 'chai';
import { closeWindow } from './lib/window-helpers';
import { BaseWindow, View } from 'electron/main';

Expand All @@ -10,6 +11,15 @@ describe('View', () => {

it('can be used as content view', () => {
w = new BaseWindow({ show: false });
w.setContentView(new View());
const v = new View();
w.setContentView(v);
expect(w.contentView).to.equal(v);
});

it('will throw when added as a child to itself', () => {
w = new BaseWindow({ show: false });
expect(() => {
w.contentView.addChildView(w.contentView);
}).to.throw('A view cannot be added as its own child');
});
});

0 comments on commit 05795be

Please sign in to comment.