Compare commits

..

17 Commits

Author SHA1 Message Date
Sudowoodo Release Bot
816e8e804c Bump v20.0.0-beta.13 2022-07-28 06:32:12 -07:00
trop[bot]
5f1c3b4d13 fix: handle WCO pressed state when going maximized -> minimized (#35074)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-07-27 11:42:49 +02:00
trop[bot]
7b1872dafe fix: allow setsize to be called within a move or resize for preventDefault (#35084)
fix: #34599 allow setsize to be called within a move or resize for preventDefault

Co-authored-by: Ian German Mesner <mesner@gmail.com>
2022-07-27 11:14:21 +02:00
trop[bot]
c10922f15f fix: use win_clang_x64 binary for x86 extract symbols (#35091)
fix: use win_clang_x64 for x86 extract symbols

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>
2022-07-27 11:13:15 +02:00
Devin Foley
d8edf84cfc fix: Make disable_color_correct_rendering patch work again (#35087)
Fix disable_color_correct_rendering patch.
2022-07-27 11:09:45 +02:00
trop[bot]
215ae2b012 fix: crash on startup in X11 (#35092)
Fixes #34996.

Co-authored-by: Charles Kerr <charles@charleskerr.com>
2022-07-27 11:09:11 +02:00
trop[bot]
09c4fdd6d0 docs: Add missing link to tutorial page (#35041)
Add missing link to tutorial page

Co-authored-by: Mike Lee <mikemunkyu.lee@gmail.com>
2022-07-26 18:24:45 +02:00
trop[bot]
77d561a8a6 fix: merge crash annotations instead of overwriting (#35045)
ElectronCrashReporterClient::GetProcessSimpleAnnotations() merges
annotations provided as argument with global_annotations_,
preserving useful information.

Co-authored-by: Alexander Petrov <zowers+github@zowers.net>
2022-07-26 17:37:23 +09:00
electron-roller[bot]
3777902abc chore: bump chromium to 104.0.5112.57 (20-x-y) (#35018)
* chore: bump chromium in DEPS to 104.0.5112.57

* Trigger Build

* chore: update patches

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@github.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2022-07-25 19:57:37 -04:00
trop[bot]
3a079feb87 fix: properly fire serial-port-added and serial-port-removed events (#35047)
Based on 2309652: [webhid] Notify chooser context observers on shutdown | https://chromium-review.googlesource.com/c/chromium/src/+/2309652

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2022-07-25 16:36:59 -04:00
Sudowoodo Release Bot
8d68009abc Bump v20.0.0-beta.12 2022-07-25 06:30:44 -07:00
trop[bot]
4f3be68ad5 refactor: only create webContents after 'will-attach-webview' (#35016)
refactor: only create webContents after 'will-attach-webview' (#30311)

Co-authored-by: Milan Burda <milan.burda@gmail.com>
2022-07-25 10:11:12 +02:00
trop[bot]
c7509b0a53 fix: add support for --ozone-platform-hint flag on Linux (#35014)
Co-authored-by: Valentin Hăloiu <valentin.haloiu@gmail.com>
2022-07-25 09:59:22 +02:00
Sudowoodo Release Bot
fa4052fc9e Bump v20.0.0-beta.11 2022-07-21 06:31:05 -07:00
trop[bot]
e02fbe1d29 fix: crash on BrowserWindow.setEnabled() (#34972)
fix: crash on BrowserWindow.setEnabled()

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-07-21 10:38:44 +02:00
trop[bot]
7e06da25ef ci: wait longer for goma to be ready (#34965)
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2022-07-19 20:31:40 +02:00
trop[bot]
f0ae458f6f fix: potential hang on print settings failure (#34968)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-07-19 16:28:09 +02:00
43 changed files with 339 additions and 174 deletions

View File

@@ -346,7 +346,7 @@ step-wait-for-goma: &step-wait-for-goma
sleep 5
done
echo "Goma ready"
no_output_timeout: 2m
no_output_timeout: 5m
step-restore-brew-cache: &step-restore-brew-cache
restore_cache:

2
DEPS
View File

@@ -2,7 +2,7 @@ gclient_gn_args_from = 'src'
vars = {
'chromium_version':
'104.0.5112.48',
'104.0.5112.57',
'node_version':
'v16.15.0',
'nan_version':

View File

@@ -1 +1 @@
20.0.0-beta.10
20.0.0-beta.13

View File

@@ -170,19 +170,16 @@ build_script:
- python %LOCAL_GOMA_DIR%\goma_ctl.py stat
- python3 electron/build/profile_toolchain.py --output-json=out/Default/windows_toolchain_profile.json
- 7z a node_headers.zip out\Default\gen\node_headers
# Temporarily disable symbol generation on 32-bit Windows due to failures
- ps: >-
if ($env:GN_CONFIG -eq 'release' -And $env:TARGET_ARCH -ne 'ia32') {
if ($env:GN_CONFIG -eq 'release') {
# Needed for msdia140.dll on 64-bit windows
$env:Path += ";$pwd\third_party\llvm-build\Release+Asserts\bin"
ninja -C out/Default electron:electron_symbols
}
- ps: >-
if ($env:GN_CONFIG -eq 'release') {
if ($env:TARGET_ARCH -ne 'ia32') {
python electron\script\zip-symbols.py
appveyor-retry appveyor PushArtifact out/Default/symbols.zip
}
python electron\script\zip-symbols.py
appveyor-retry appveyor PushArtifact out/Default/symbols.zip
} else {
# It's useful to have pdb files when debugging testing builds that are
# built on CI.

View File

@@ -24,7 +24,11 @@ template("extract_symbols") {
assert(defined(invoker.binary), "Need binary to dump")
assert(defined(invoker.symbol_dir), "Need directory for symbol output")
dump_syms_label = "//third_party/breakpad:dump_syms($host_toolchain)"
if (host_os == "win" && target_cpu == "x86") {
dump_syms_label = "//third_party/breakpad:dump_syms(//build/toolchain/win:win_clang_x64)"
} else {
dump_syms_label = "//third_party/breakpad:dump_syms($host_toolchain)"
}
dump_syms_binary = get_label_info(dump_syms_label, "root_out_dir") +
"/dump_syms$_host_executable_suffix"

View File

@@ -66,6 +66,7 @@ Are you getting stuck anywhere? Here are a few links to places to look:
<!-- Links -->
[tutorial]: tutorial-1-prerequisites.md
[api documentation]: ../api/app.md
[chromium]: https://www.chromium.org/
[discord]: https://discord.com/invite/APGC3k5yaH

View File

@@ -23,6 +23,7 @@ filenames = {
lib_sources_linux = [
"shell/browser/browser_linux.cc",
"shell/browser/electron_browser_main_parts_linux.cc",
"shell/browser/lib/power_observer_linux.cc",
"shell/browser/lib/power_observer_linux.h",
"shell/browser/linux/unity_service.cc",

View File

@@ -7,7 +7,7 @@ import { webViewEvents } from '@electron/internal/browser/web-view-events';
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
interface GuestInstance {
elementInstanceId?: number;
elementInstanceId: number;
visibilityState?: VisibilityState;
embedder: Electron.WebContents;
guest: Electron.WebContents;
@@ -46,6 +46,7 @@ function makeWebPreferences (embedder: Electron.WebContents, params: Record<stri
webSecurity: !params.disablewebsecurity,
enableBlinkFeatures: params.blinkfeatures,
disableBlinkFeatures: params.disableblinkfeatures,
partition: params.partition,
...parsedWebPreferences
};
@@ -87,14 +88,26 @@ function makeLoadURLOptions (params: Record<string, any>) {
// Create a new guest instance.
const createGuest = function (embedder: Electron.WebContents, embedderFrameId: number, elementInstanceId: number, params: Record<string, any>) {
const webPreferences = makeWebPreferences(embedder, params);
const event = eventBinding.createWithSender(embedder);
const { instanceId } = params;
embedder.emit('will-attach-webview', event, webPreferences, params);
if (event.defaultPrevented) {
return -1;
}
// eslint-disable-next-line no-undef
const guest = (webContents as typeof ElectronInternal.WebContents).create({
...webPreferences,
type: 'webview',
partition: params.partition,
embedder
});
const guestInstanceId = guest.id;
guestInstances.set(guestInstanceId, {
elementInstanceId,
guest,
embedder
});
@@ -108,11 +121,8 @@ const createGuest = function (embedder: Electron.WebContents, embedderFrameId: n
// Init guest web view after attached.
guest.once('did-attach' as any, function (this: Electron.WebContents, event: Electron.Event) {
const params = this.attachParams!;
delete this.attachParams;
const previouslyAttached = this.viewInstanceId != null;
this.viewInstanceId = params.instanceId;
this.viewInstanceId = instanceId;
// Only load URL and set size on first attach
if (previouslyAttached) {
@@ -120,7 +130,7 @@ const createGuest = function (embedder: Electron.WebContents, embedderFrameId: n
}
if (params.src) {
this.loadURL(params.src, params.opts);
this.loadURL(params.src, makeLoadURLOptions(params));
}
embedder.emit('did-attach-webview', event, guest);
});
@@ -173,78 +183,25 @@ const createGuest = function (embedder: Electron.WebContents, embedderFrameId: n
}
});
if (attachGuest(embedder, embedderFrameId, elementInstanceId, guestInstanceId, params)) {
return guestInstanceId;
}
return -1;
};
// Attach the guest to an element of embedder.
const attachGuest = function (embedder: Electron.WebContents, embedderFrameId: number, elementInstanceId: number, guestInstanceId: number, params: Record<string, any>) {
// Destroy the old guest when attaching.
const key = `${embedder.id}-${elementInstanceId}`;
const oldGuestInstanceId = embedderElementsMap.get(key);
if (oldGuestInstanceId != null) {
// Reattachment to the same guest is just a no-op.
if (oldGuestInstanceId === guestInstanceId) {
return false;
}
const oldGuestInstance = guestInstances.get(oldGuestInstanceId);
if (oldGuestInstance) {
oldGuestInstance.guest.detachFromOuterFrame();
}
}
const guestInstance = guestInstances.get(guestInstanceId);
// If this isn't a valid guest instance then do nothing.
if (!guestInstance) {
console.error(new Error(`Guest attach failed: Invalid guestInstanceId ${guestInstanceId}`));
return false;
}
const { guest } = guestInstance;
if (guest.hostWebContents !== embedder) {
console.error(new Error(`Guest attach failed: Access denied to guestInstanceId ${guestInstanceId}`));
return false;
}
const { instanceId } = params;
// If this guest is already attached to an element then remove it
if (guestInstance.elementInstanceId) {
const oldKey = `${guestInstance.embedder.id}-${guestInstance.elementInstanceId}`;
embedderElementsMap.delete(oldKey);
// Remove guest from embedder if moving across web views
if (guest.viewInstanceId !== instanceId) {
webViewManager.removeGuest(guestInstance.embedder, guestInstanceId);
guestInstance.embedder._sendInternal(`${IPC_MESSAGES.GUEST_VIEW_INTERNAL_DESTROY_GUEST}-${guest.viewInstanceId}`);
}
}
const webPreferences = makeWebPreferences(embedder, params);
const event = eventBinding.createWithSender(embedder);
embedder.emit('will-attach-webview', event, webPreferences, params);
if (event.defaultPrevented) {
if (guest.viewInstanceId == null) guest.viewInstanceId = instanceId;
guest.destroy();
return false;
}
guest.attachParams = { instanceId, src: params.src, opts: makeLoadURLOptions(params) };
embedderElementsMap.set(key, guestInstanceId);
guest.setEmbedder(embedder);
guestInstance.embedder = embedder;
guestInstance.elementInstanceId = elementInstanceId;
watchEmbedder(embedder);
webViewManager.addGuest(guestInstanceId, embedder, guest, webPreferences);
guest.attachToIframe(embedder, embedderFrameId);
return true;
return guestInstanceId;
};
// Remove an guest-embedder relationship.

View File

@@ -9,7 +9,6 @@ export const enum IPC_MESSAGES {
GUEST_INSTANCE_VISIBILITY_CHANGE = 'GUEST_INSTANCE_VISIBILITY_CHANGE',
GUEST_VIEW_INTERNAL_DESTROY_GUEST = 'GUEST_VIEW_INTERNAL_DESTROY_GUEST',
GUEST_VIEW_INTERNAL_DISPATCH_EVENT = 'GUEST_VIEW_INTERNAL_DISPATCH_EVENT',
GUEST_VIEW_MANAGER_CREATE_AND_ATTACH_GUEST = 'GUEST_VIEW_MANAGER_CREATE_AND_ATTACH_GUEST',

View File

@@ -6,7 +6,6 @@ const { mainFrame: webFrame } = process._linkedBinding('electron_renderer_web_fr
export interface GuestViewDelegate {
dispatchEvent (eventName: string, props: Record<string, any>): void;
reset(): void;
}
const DEPRECATED_EVENTS: Record<string, string> = {
@@ -14,11 +13,6 @@ const DEPRECATED_EVENTS: Record<string, string> = {
} as const;
export function registerEvents (viewInstanceId: number, delegate: GuestViewDelegate) {
ipcRendererInternal.on(`${IPC_MESSAGES.GUEST_VIEW_INTERNAL_DESTROY_GUEST}-${viewInstanceId}`, function () {
delegate.reset();
delegate.dispatchEvent('destroyed', {});
});
ipcRendererInternal.on(`${IPC_MESSAGES.GUEST_VIEW_INTERNAL_DISPATCH_EVENT}-${viewInstanceId}`, function (event, eventName, props) {
if (DEPRECATED_EVENTS[eventName] != null) {
delegate.dispatchEvent(DEPRECATED_EVENTS[eventName], props);
@@ -29,7 +23,6 @@ export function registerEvents (viewInstanceId: number, delegate: GuestViewDeleg
}
export function deregisterEvents (viewInstanceId: number) {
ipcRendererInternal.removeAllListeners(`${IPC_MESSAGES.GUEST_VIEW_INTERNAL_DESTROY_GUEST}-${viewInstanceId}`);
ipcRendererInternal.removeAllListeners(`${IPC_MESSAGES.GUEST_VIEW_INTERNAL_DISPATCH_EVENT}-${viewInstanceId}`);
}

View File

@@ -55,8 +55,7 @@ const defineWebViewElement = (hooks: WebViewImplHooks) => {
}
if (!internal.elementAttached) {
hooks.guestViewInternal.registerEvents(internal.viewInstanceId, {
dispatchEvent: internal.dispatchEvent.bind(internal),
reset: internal.reset.bind(internal)
dispatchEvent: internal.dispatchEvent.bind(internal)
});
internal.elementAttached = true;
(internal.attributes.get(WEB_VIEW_CONSTANTS.ATTRIBUTE_SRC) as SrcAttribute).parse();

View File

@@ -191,7 +191,7 @@ export class WebViewImpl {
attachGuestInstance (guestInstanceId: number) {
if (guestInstanceId === -1) {
// Do nothing
this.dispatchEvent('destroyed');
return;
}

View File

@@ -1,6 +1,6 @@
{
"name": "electron",
"version": "20.0.0-beta.10",
"version": "20.0.0-beta.13",
"repository": "https://github.com/electron/electron",
"description": "Build cross platform desktop apps with JavaScript, HTML, and CSS",
"devDependencies": {

View File

@@ -21,10 +21,10 @@ index b857d325233430a5b79b3022d33823486e558309..83cc6ded4b3354f37b8e1dc0d9e4f328
&no_javascript_access);
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 33f6efe4df4eecabcbcd08f908ed3ef12d056eb2..0e1e25d40ebf3ca92c57dfdfb52c5269198aa6f7 100644
index 141f6e137f2d7e2a6779cad3e8729b9cfb557480..44c1f304cf2d88dca06ee1bd53c774022766ed35 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -3947,6 +3947,14 @@ FrameTree* WebContentsImpl::CreateNewWindow(
@@ -3953,6 +3953,14 @@ FrameTree* WebContentsImpl::CreateNewWindow(
}
auto* new_contents_impl = new_contents.get();
@@ -39,7 +39,7 @@ index 33f6efe4df4eecabcbcd08f908ed3ef12d056eb2..0e1e25d40ebf3ca92c57dfdfb52c5269
new_contents_impl->GetController().SetSessionStorageNamespace(
partition_config, session_storage_namespace);
@@ -3991,12 +3999,6 @@ FrameTree* WebContentsImpl::CreateNewWindow(
@@ -3997,12 +4005,6 @@ FrameTree* WebContentsImpl::CreateNewWindow(
AddWebContentsDestructionObserver(new_contents_impl);
}
@@ -68,7 +68,7 @@ index 9c3a03faeee19f6f0a250680db36906ee64bf55a..0450700d02c74e047fa5124aa43b9f75
// Operation result when the renderer asks the browser to create a new window.
diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc
index 69bcd725d0f86bf3b175fde86bd2dbd85b59f002..b72d89b19024a9074108dde4c5c9cd0f45b719bb 100644
index c1beba6701e68255c212e56d78ae8259e2ffdab9..9f77c2a5df8f25876f875c4a7148d82c3dd79db8 100644
--- a/content/public/browser/content_browser_client.cc
+++ b/content/public/browser/content_browser_client.cc
@@ -595,6 +595,8 @@ bool ContentBrowserClient::CanCreateWindow(
@@ -81,7 +81,7 @@ index 69bcd725d0f86bf3b175fde86bd2dbd85b59f002..b72d89b19024a9074108dde4c5c9cd0f
bool opener_suppressed,
bool* no_javascript_access) {
diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h
index d0b7aed3162b8ea7673ab3ef31d2a3302f4e6456..6328fc21548f2b8277b461f9938dbcc50f6853f1 100644
index a49794184baa977ddf03cd911f8d8d7d671df65f..7997c0de85315e30b350316f33e598a0221d583f 100644
--- a/content/public/browser/content_browser_client.h
+++ b/content/public/browser/content_browser_client.h
@@ -164,6 +164,7 @@ class NetworkService;

View File

@@ -246,10 +246,10 @@ index c6bd5c19f8a7ceec17c9e32af5296a9617f3a619..02199b439fba7fdc617b7f7980d958b7
void AddNewContents(content::WebContents* source,
std::unique_ptr<content::WebContents> new_contents,
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 889da8724da515ab7e6b412fbaff434eb53289dc..7dba296aaa55b9aa6026ccdf288171f701601f46 100644
index c4c6159fa9bb94b340a5fbc545e77ac696e8cc52..6ca8c2510a42b50651621831474da6aee783e4c0 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -3880,8 +3880,7 @@ FrameTree* WebContentsImpl::CreateNewWindow(
@@ -3886,8 +3886,7 @@ FrameTree* WebContentsImpl::CreateNewWindow(
if (delegate_ && delegate_->IsWebContentsCreationOverridden(
source_site_instance, params.window_container_type,

View File

@@ -20,14 +20,15 @@ to deal with color spaces. That is being tracked at
https://crbug.com/634542 and https://crbug.com/711107.
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index 5ab61f6045aea2bf35ed25bd05270f044cbd8dd6..85875fe07d9eaf60406f60e6ffcd10dd06a265a6 100644
index aca208728d0dae78e57bf4b7f0af46ed5ad73e68..2afef2fb0d3890bdada7d5785a4a48494d580cab 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -1852,6 +1852,9 @@ void LayerTreeHostImpl::SetIsLikelyToRequireADraw(
@@ -1852,6 +1852,10 @@ void LayerTreeHostImpl::SetIsLikelyToRequireADraw(
TargetColorParams LayerTreeHostImpl::GetTargetColorParams(
gfx::ContentColorUsage content_color_usage) const {
TargetColorParams params;
+ if (!settings_.enable_color_correct_rendering) {
+ params.color_space = gfx::ColorSpace();
+ return params;
+ }
@@ -112,7 +113,7 @@ index 73a50b19f8bf75119b6af7698cdf7d569c504e77..9fdc3d5235a95cfc9ef3b94ba9c19630
sandbox::policy::switches::kDisableSeccompFilterSandbox,
sandbox::policy::switches::kNoSandbox,
diff --git a/third_party/blink/renderer/platform/graphics/canvas_color_params.cc b/third_party/blink/renderer/platform/graphics/canvas_color_params.cc
index 75d7af9a79d4e7f2cd39e45496ab5fff66407638..b4ddafdd126edd16172f00448bbbd56eaf509b1f 100644
index 75d7af9a79d4e7f2cd39e45496ab5fff66407638..35b0bb908245330fbdc5205caa3299bf6fd8f7b4 100644
--- a/third_party/blink/renderer/platform/graphics/canvas_color_params.cc
+++ b/third_party/blink/renderer/platform/graphics/canvas_color_params.cc
@@ -4,6 +4,7 @@
@@ -131,7 +132,18 @@ index 75d7af9a79d4e7f2cd39e45496ab5fff66407638..b4ddafdd126edd16172f00448bbbd56e
namespace blink {
@@ -118,6 +120,11 @@ uint8_t CanvasColorParams::BytesPerPixel() const {
@@ -19,6 +21,10 @@ namespace blink {
// Level 4 specification.
gfx::ColorSpace PredefinedColorSpaceToGfxColorSpace(
PredefinedColorSpace color_space) {
+ auto* cmd_line = base::CommandLine::ForCurrentProcess();
+ if (cmd_line->HasSwitch(switches::kDisableColorCorrectRendering)) {
+ return gfx::ColorSpace();
+ }
switch (color_space) {
case PredefinedColorSpace::kSRGB:
return gfx::ColorSpace::CreateSRGB();
@@ -118,6 +124,11 @@ uint8_t CanvasColorParams::BytesPerPixel() const {
}
gfx::ColorSpace CanvasColorParams::GetStorageGfxColorSpace() const {

View File

@@ -6,7 +6,7 @@ Subject: fix: allow guest webcontents to enter fullscreen
This can be upstreamed, a guest webcontents can't technically become the focused webContents. This DCHECK should allow all guest webContents to request fullscreen entrance.
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 050e59567dfb72833d96a9331329b8235d0a4a07..3f740e42f2ca869c4f19632a5cfee6142702f02a 100644
index 314459717b239f302cdd6485752f7c67e2d1b22b..1afc4f2064c89c5d586a41c7e4426cd91ea52da2 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -3417,7 +3417,7 @@ void WebContentsImpl::EnterFullscreenMode(

View File

@@ -20,7 +20,7 @@ index 398358851f4ec3d1373091c352fe864b8901f08b..0fadcf6eb5aa9e7e6ca32ec252f1722a
}
diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h
index 6328fc21548f2b8277b461f9938dbcc50f6853f1..90058e16373ce92a9eede27f13010417cf51dae2 100644
index 7997c0de85315e30b350316f33e598a0221d583f..e4a5c9fab5238f3e99fe0d44f1a5b47d059540cc 100644
--- a/content/public/browser/content_browser_client.h
+++ b/content/public/browser/content_browser_client.h
@@ -270,6 +270,11 @@ class CONTENT_EXPORT ContentBrowserClient {

View File

@@ -55,7 +55,7 @@ index 331a084371402b5a2440b5d60feac8f0189e84b9..6755d1f497cef4deea6b83df1d8720dc
: PdfRenderSettings::Mode::POSTSCRIPT_LEVEL3;
}
diff --git a/chrome/browser/printing/print_job_worker.cc b/chrome/browser/printing/print_job_worker.cc
index d9ae000f1348529ab849349d7562dbb04fe9fd16..cf66978761f5dda2f8958234d62c3cf11ae4cf9c 100644
index d9ae000f1348529ab849349d7562dbb04fe9fd16..fcfeffd86bd897467b12bf1aba4aaac09986cfd9 100644
--- a/chrome/browser/printing/print_job_worker.cc
+++ b/chrome/browser/printing/print_job_worker.cc
@@ -20,7 +20,6 @@
@@ -74,7 +74,7 @@ index d9ae000f1348529ab849349d7562dbb04fe9fd16..cf66978761f5dda2f8958234d62c3cf1
#include "printing/backend/print_backend.h"
#include "printing/buildflags/buildflags.h"
#include "printing/mojom/print.mojom.h"
@@ -222,16 +222,21 @@ void PrintJobWorker::UpdatePrintSettings(base::Value::Dict new_settings,
@@ -222,16 +222,19 @@ void PrintJobWorker::UpdatePrintSettings(base::Value::Dict new_settings,
#endif // BUILDFLAG(IS_LINUX) && defined(USE_CUPS)
}
@@ -88,12 +88,10 @@ index d9ae000f1348529ab849349d7562dbb04fe9fd16..cf66978761f5dda2f8958234d62c3cf1
- result = printing_context_->UpdatePrintSettings(std::move(new_settings));
+ // Reset settings from previous print job
+ printing_context_->ResetSettings();
+ mojom::ResultCode get_default_result = printing_context_->UseDefaultSettings();
+ if (get_default_result == mojom::ResultCode::kSuccess) {
+ mojom::ResultCode update_result =
+ printing_context_->UpdatePrintSettings(std::move(new_settings));
+ GetSettingsDone(std::move(callback), update_result);
+ }
+ mojom::ResultCode result_code = printing_context_->UseDefaultSettings();
+ if (result_code == mojom::ResultCode::kSuccess)
+ result_code = printing_context_->UpdatePrintSettings(std::move(new_settings));
+ GetSettingsDone(std::move(callback), result_code);
}
- GetSettingsDone(std::move(callback), result);
}
@@ -113,7 +111,7 @@ index 1e158ecd686e775f656d5a05a9d916ce8f075fa8..20613012d1e6f435c3211d78ec311cf0
void PrintJobWorkerOop::UnregisterServiceManagerClient() {
diff --git a/chrome/browser/printing/print_view_manager_base.cc b/chrome/browser/printing/print_view_manager_base.cc
index e665eb42fad5f47b1643315d2cdcdf2eb66b069d..810c190e60bfc1bab4dcc5385c9cb30ae491a0fb 100644
index 4bd871e5cadc693aea6e8c71b3fe3296b743d9ec..560e84fcddf1108114cc863ac0bd9cb7f7f4da4c 100644
--- a/chrome/browser/printing/print_view_manager_base.cc
+++ b/chrome/browser/printing/print_view_manager_base.cc
@@ -30,10 +30,10 @@
@@ -395,7 +393,7 @@ index e665eb42fad5f47b1643315d2cdcdf2eb66b069d..810c190e60bfc1bab4dcc5385c9cb30a
return true;
if (!cookie) {
@@ -1067,7 +1113,7 @@ void PrintViewManagerBase::SendPrintingEnabled(bool enabled,
@@ -1069,7 +1115,7 @@ void PrintViewManagerBase::SendPrintingEnabled(bool enabled,
}
void PrintViewManagerBase::CompletePrintNow(content::RenderFrameHost* rfh) {

View File

@@ -43,10 +43,10 @@ index 273750752cdef18ccd7d54b9b28c524375bb3e8d..3eec2e5c14186b39a67ca8ad410a3268
void RenderWidgetHostImpl::ShowContextMenuAtPoint(
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 0e1e25d40ebf3ca92c57dfdfb52c5269198aa6f7..889da8724da515ab7e6b412fbaff434eb53289dc 100644
index 44c1f304cf2d88dca06ee1bd53c774022766ed35..c4c6159fa9bb94b340a5fbc545e77ac696e8cc52 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -4526,6 +4526,11 @@ TextInputManager* WebContentsImpl::GetTextInputManager() {
@@ -4532,6 +4532,11 @@ TextInputManager* WebContentsImpl::GetTextInputManager() {
return text_input_manager_.get();
}

View File

@@ -9,7 +9,7 @@ is needed for OSR.
Originally landed in https://github.com/electron/libchromiumcontent/pull/226.
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 7dba296aaa55b9aa6026ccdf288171f701601f46..050e59567dfb72833d96a9331329b8235d0a4a07 100644
index 6ca8c2510a42b50651621831474da6aee783e4c0..314459717b239f302cdd6485752f7c67e2d1b22b 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -3036,6 +3036,13 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params,

View File

@@ -128,9 +128,8 @@ function assetsForVersion (version, validatingRelease) {
`electron-${version}-mas-arm64-dsym-snapshot.zip`,
`electron-${version}-mas-arm64-symbols.zip`,
`electron-${version}-mas-arm64.zip`,
// TODO(vertedinde) Symbol generation on 32-bit Windows is temporarily disabled due to CI failures
// `electron-${version}-win32-ia32-pdb.zip`,
// `electron-${version}-win32-ia32-symbols.zip`,
`electron-${version}-win32-ia32-pdb.zip`,
`electron-${version}-win32-ia32-symbols.zip`,
`electron-${version}-win32-ia32.zip`,
`electron-${version}-win32-x64-pdb.zip`,
`electron-${version}-win32-x64-symbols.zip`,

View File

@@ -76,10 +76,9 @@ def main():
shutil.copy2(os.path.join(OUT_DIR, 'dist.zip'), electron_zip)
upload_electron(release, electron_zip, args)
if get_target_arch() != 'mips64el':
if (get_target_arch() != 'ia32' or PLATFORM != 'win32'):
symbols_zip = os.path.join(OUT_DIR, SYMBOLS_NAME)
shutil.copy2(os.path.join(OUT_DIR, 'symbols.zip'), symbols_zip)
upload_electron(release, symbols_zip, args)
symbols_zip = os.path.join(OUT_DIR, SYMBOLS_NAME)
shutil.copy2(os.path.join(OUT_DIR, 'symbols.zip'), symbols_zip)
upload_electron(release, symbols_zip, args)
if PLATFORM == 'darwin':
if get_platform_key() == 'darwin' and get_target_arch() == 'x64':
api_path = os.path.join(ELECTRON_DIR, 'electron-api.json')
@@ -96,10 +95,9 @@ def main():
shutil.copy2(os.path.join(OUT_DIR, 'dsym-snapshot.zip'), dsym_snaphot_zip)
upload_electron(release, dsym_snaphot_zip, args)
elif PLATFORM == 'win32':
if get_target_arch() != 'ia32':
pdb_zip = os.path.join(OUT_DIR, PDB_NAME)
shutil.copy2(os.path.join(OUT_DIR, 'pdb.zip'), pdb_zip)
upload_electron(release, pdb_zip, args)
pdb_zip = os.path.join(OUT_DIR, PDB_NAME)
shutil.copy2(os.path.join(OUT_DIR, 'pdb.zip'), pdb_zip)
upload_electron(release, pdb_zip, args)
elif PLATFORM == 'linux':
debug_zip = os.path.join(OUT_DIR, DEBUG_NAME)
shutil.copy2(os.path.join(OUT_DIR, 'debug.zip'), debug_zip)

View File

@@ -190,7 +190,9 @@ bool ElectronCrashReporterClient::GetShouldCompressUploads() {
void ElectronCrashReporterClient::GetProcessSimpleAnnotations(
std::map<std::string, std::string>* annotations) {
*annotations = global_annotations_;
for (auto&& pair : global_annotations_) {
(*annotations)[pair.first] = pair.second;
}
(*annotations)["prod"] = ELECTRON_PRODUCT_NAME;
(*annotations)["ver"] = ELECTRON_VERSION_STRING;
}

View File

@@ -28,10 +28,6 @@ void AddGuest(int guest_instance_id,
electron::WebContentsZoomController::FromWebContents(guest_web_contents)
->SetDefaultZoomFactor(zoom_factor);
}
WebContentsPreferences::From(guest_web_contents)->Merge(options);
// Trigger re-calculation of webkit prefs.
guest_web_contents->NotifyPreferencesChanged();
}
void RemoveGuest(content::WebContents* embedder, int guest_instance_id) {

View File

@@ -217,6 +217,7 @@ int ElectronBrowserMainParts::PreEarlyInitialization() {
HandleSIGCHLD();
#endif
#if BUILDFLAG(IS_LINUX)
DetectOzonePlatform();
ui::OzonePlatform::PreEarlyInitialization();
#endif
#if BUILDFLAG(IS_MAC)
@@ -277,12 +278,6 @@ void ElectronBrowserMainParts::PostEarlyInitialization() {
}
int ElectronBrowserMainParts::PreCreateThreads() {
#if defined(USE_AURA)
if (!display::Screen::GetScreen()) {
screen_ = views::CreateDesktopScreen();
}
#endif
if (!views::LayoutProvider::Get())
layout_provider_ = std::make_unique<views::LayoutProvider>();
@@ -313,6 +308,14 @@ int ElectronBrowserMainParts::PreCreateThreads() {
// Load resources bundle according to locale.
std::string loaded_locale = LoadResourceBundle(locale);
#if defined(USE_AURA)
// NB: must be called _after_ locale resource bundle is loaded,
// because ui lib makes use of it in X11
if (!display::Screen::GetScreen()) {
screen_ = views::CreateDesktopScreen();
}
#endif
// Initialize the app locale.
std::string app_locale = l10n_util::GetApplicationLocale(loaded_locale);
ElectronBrowserClient::SetApplicationLocale(app_locale);

View File

@@ -122,6 +122,10 @@ class ElectronBrowserMainParts : public content::BrowserMainParts {
const scoped_refptr<base::SingleThreadTaskRunner>& task_runner);
#endif
#if BUILDFLAG(IS_LINUX)
void DetectOzonePlatform();
#endif
#if BUILDFLAG(IS_MAC)
void FreeAppDelegate();
void RegisterURLHandler();

View File

@@ -0,0 +1,134 @@
// Copyright (c) 2022 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "shell/browser/electron_browser_main_parts.h"
#include "base/command_line.h"
#include "base/environment.h"
#include "ui/ozone/public/ozone_switches.h"
#if BUILDFLAG(OZONE_PLATFORM_WAYLAND)
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/nix/xdg_util.h"
#include "base/threading/thread_restrictions.h"
#endif
#if BUILDFLAG(OZONE_PLATFORM_WAYLAND)
constexpr char kPlatformWayland[] = "wayland";
bool HasWaylandDisplay(base::Environment* env) {
std::string wayland_display;
const bool has_wayland_display =
env->GetVar("WAYLAND_DISPLAY", &wayland_display) &&
!wayland_display.empty();
if (has_wayland_display)
return true;
std::string xdg_runtime_dir;
const bool has_xdg_runtime_dir =
env->GetVar("XDG_RUNTIME_DIR", &xdg_runtime_dir) &&
!xdg_runtime_dir.empty();
if (has_xdg_runtime_dir) {
auto wayland_server_pipe =
base::FilePath(xdg_runtime_dir).Append("wayland-0");
// Normally, this should happen exactly once, at the startup of the main
// process.
base::ScopedAllowBlocking allow_blocking;
return base::PathExists(wayland_server_pipe);
}
return false;
}
#endif // BUILDFLAG(OZONE_PLATFORM_WAYLAND)
#if BUILDFLAG(OZONE_PLATFORM_X11)
constexpr char kPlatformX11[] = "x11";
#endif
namespace electron {
namespace {
// Evaluates the environment and returns the effective platform name for the
// given |ozone_platform_hint|.
// For the "auto" value, returns "wayland" if the XDG session type is "wayland",
// "x11" otherwise.
// For the "wayland" value, checks if the Wayland server is available, and
// returns "x11" if it is not.
// See https://crbug.com/1246928.
std::string MaybeFixPlatformName(const std::string& ozone_platform_hint) {
#if BUILDFLAG(OZONE_PLATFORM_WAYLAND)
// Wayland is selected if both conditions below are true:
// 1. The user selected either 'wayland' or 'auto'.
// 2. The XDG session type is 'wayland', OR the user has selected 'wayland'
// explicitly and a Wayland server is running.
// Otherwise, fall back to X11.
if (ozone_platform_hint == kPlatformWayland ||
ozone_platform_hint == "auto") {
auto env(base::Environment::Create());
std::string xdg_session_type;
const bool has_xdg_session_type =
env->GetVar(base::nix::kXdgSessionTypeEnvVar, &xdg_session_type) &&
!xdg_session_type.empty();
if ((has_xdg_session_type && xdg_session_type == "wayland") ||
(ozone_platform_hint == kPlatformWayland &&
HasWaylandDisplay(env.get()))) {
return kPlatformWayland;
}
}
#endif // BUILDFLAG(OZONE_PLATFORM_WAYLAND)
#if BUILDFLAG(OZONE_PLATFORM_X11)
if (ozone_platform_hint == kPlatformX11) {
return kPlatformX11;
}
#if BUILDFLAG(OZONE_PLATFORM_WAYLAND)
if (ozone_platform_hint == kPlatformWayland ||
ozone_platform_hint == "auto") {
// We are here if:
// - The binary has both X11 and Wayland backends.
// - The user wanted Wayland but that did not work, otherwise it would have
// been returned above.
if (ozone_platform_hint == kPlatformWayland) {
LOG(WARNING) << "No Wayland server is available. Falling back to X11.";
} else {
LOG(WARNING) << "This is not a Wayland session. Falling back to X11. "
"If you need to run Chrome on Wayland using some "
"embedded compositor, e. g., Weston, please specify "
"Wayland as your preferred Ozone platform, or use "
"--ozone-platform=wayland.";
}
return kPlatformX11;
}
#endif // BUILDFLAG(OZONE_PLATFORM_WAYLAND)
#endif // BUILDFLAG(OZONE_PLATFORM_X11)
return ozone_platform_hint;
}
} // namespace
void ElectronBrowserMainParts::DetectOzonePlatform() {
auto* const command_line = base::CommandLine::ForCurrentProcess();
if (!command_line->HasSwitch(switches::kOzonePlatform)) {
const auto ozone_platform_hint =
command_line->GetSwitchValueASCII(switches::kOzonePlatformHint);
if (!ozone_platform_hint.empty()) {
command_line->AppendSwitchASCII(
switches::kOzonePlatform, MaybeFixPlatformName(ozone_platform_hint));
}
}
auto env = base::Environment::Create();
std::string desktop_startup_id;
if (env->GetVar("DESKTOP_STARTUP_ID", &desktop_startup_id))
command_line->AppendSwitchASCII("desktop-startup-id", desktop_startup_id);
}
} // namespace electron

View File

@@ -488,7 +488,8 @@ void NativeWindowMac::Close() {
// [window_ performClose:nil], the window won't close properly
// even after the user has ended the sheet.
// Ensure it's closed before calling [window_ performClose:nil].
SetEnabled(true);
if ([window_ attachedSheet])
[window_ endSheet:[window_ attachedSheet]];
[window_ performClose:nil];
@@ -558,7 +559,8 @@ void NativeWindowMac::Hide() {
// If a sheet is attached to the window when we call [window_ orderOut:nil],
// the sheet won't be able to show again on the same window.
// Ensure it's closed before calling [window_ orderOut:nil].
SetEnabled(true);
if ([window_ attachedSheet])
[window_ endSheet:[window_ attachedSheet]];
if (is_modal() && parent()) {
[window_ orderOut:nil];
@@ -597,9 +599,18 @@ bool NativeWindowMac::IsEnabled() {
void NativeWindowMac::SetEnabled(bool enable) {
if (!enable) {
[window_ beginSheet:window_
NSRect frame = [window_ frame];
NSWindow* window =
[[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, frame.size.width,
frame.size.height)
styleMask:NSWindowStyleMaskTitled
backing:NSBackingStoreBuffered
defer:NO];
[window setAlphaValue:0.5];
[window_ beginSheet:window
completionHandler:^(NSModalResponse returnCode) {
NSLog(@"modal enabled");
NSLog(@"main window disabled");
return;
}];
} else if ([window_ attachedSheet]) {

View File

@@ -729,7 +729,6 @@ void NativeWindowViews::SetBounds(const gfx::Rect& bounds, bool animate) {
#if BUILDFLAG(IS_WIN)
if (is_moving_ || is_resizing_) {
pending_bounds_change_ = bounds;
return;
}
#endif

View File

@@ -225,6 +225,7 @@ class NativeWindowViews : public NativeWindow,
#if BUILDFLAG(IS_WIN)
void HandleSizeEvent(WPARAM w_param, LPARAM l_param);
void ResetWindowControls();
void SetForwardMouseMessages(bool forward);
static LRESULT CALLBACK SubclassProc(HWND hwnd,
UINT msg,

View File

@@ -415,6 +415,7 @@ void NativeWindowViews::HandleSizeEvent(WPARAM w_param, LPARAM l_param) {
last_window_state_ != ui::SHOW_STATE_MAXIMIZED) {
last_window_state_ = ui::SHOW_STATE_MAXIMIZED;
NotifyWindowMaximize();
ResetWindowControls();
} else if (w_param == SIZE_MINIMIZED &&
last_window_state_ != ui::SHOW_STATE_MINIMIZED) {
last_window_state_ = ui::SHOW_STATE_MINIMIZED;
@@ -440,18 +441,23 @@ void NativeWindowViews::HandleSizeEvent(WPARAM w_param, LPARAM l_param) {
default:
break;
}
// If a given window was minimized/maximized and has since been
// restored, ensure the WCO buttons are set to normal state.
auto* ncv = widget()->non_client_view();
if (IsWindowControlsOverlayEnabled() && ncv) {
auto* frame_view = static_cast<WinFrameView*>(ncv->frame_view());
frame_view->caption_button_container()->ResetWindowControls();
}
ResetWindowControls();
break;
}
}
}
void NativeWindowViews::ResetWindowControls() {
// If a given window was minimized and has since been
// unminimized (restored/maximized), ensure the WCO buttons
// are reset to their default unpressed state.
auto* ncv = widget()->non_client_view();
if (IsWindowControlsOverlayEnabled() && ncv) {
auto* frame_view = static_cast<WinFrameView*>(ncv->frame_view());
frame_view->caption_button_container()->ResetWindowControls();
}
}
void NativeWindowViews::SetForwardMouseMessages(bool forward) {
if (forward && !forwarding_mouse_messages_) {
forwarding_mouse_messages_ = true;

View File

@@ -50,8 +50,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 20,0,0,10
PRODUCTVERSION 20,0,0,10
FILEVERSION 20,0,0,13
PRODUCTVERSION 20,0,0,13
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L

View File

@@ -70,15 +70,15 @@ device::mojom::SerialPortManager* ElectronSerialDelegate::GetPortManager(
void ElectronSerialDelegate::AddObserver(content::RenderFrameHost* frame,
Observer* observer) {
return GetChooserContext(frame)->AddPortObserver(observer);
observer_list_.AddObserver(observer);
auto* chooser_context = GetChooserContext(frame);
if (!port_observation_.IsObserving())
port_observation_.Observe(chooser_context);
}
void ElectronSerialDelegate::RemoveObserver(content::RenderFrameHost* frame,
Observer* observer) {
SerialChooserContext* serial_chooser_context = GetChooserContext(frame);
if (serial_chooser_context) {
return serial_chooser_context->RemovePortObserver(observer);
}
observer_list_.RemoveObserver(observer);
}
void ElectronSerialDelegate::RevokePortPermissionWebInitiated(
@@ -119,4 +119,27 @@ void ElectronSerialDelegate::DeleteControllerForFrame(
controller_map_.erase(render_frame_host);
}
// SerialChooserContext::PortObserver:
void ElectronSerialDelegate::OnPortAdded(
const device::mojom::SerialPortInfo& port) {
for (auto& observer : observer_list_)
observer.OnPortAdded(port);
}
void ElectronSerialDelegate::OnPortRemoved(
const device::mojom::SerialPortInfo& port) {
for (auto& observer : observer_list_)
observer.OnPortRemoved(port);
}
void ElectronSerialDelegate::OnPortManagerConnectionError() {
port_observation_.Reset();
for (auto& observer : observer_list_)
observer.OnPortManagerConnectionError();
}
void ElectronSerialDelegate::OnSerialChooserContextShutdown() {
port_observation_.Reset();
}
} // namespace electron

View File

@@ -11,13 +11,15 @@
#include "base/memory/weak_ptr.h"
#include "content/public/browser/serial_delegate.h"
#include "shell/browser/serial/serial_chooser_context.h"
#include "shell/browser/serial/serial_chooser_controller.h"
namespace electron {
class SerialChooserController;
class ElectronSerialDelegate : public content::SerialDelegate {
class ElectronSerialDelegate : public content::SerialDelegate,
public SerialChooserContext::PortObserver {
public:
ElectronSerialDelegate();
~ElectronSerialDelegate() override;
@@ -48,6 +50,13 @@ class ElectronSerialDelegate : public content::SerialDelegate {
void DeleteControllerForFrame(content::RenderFrameHost* render_frame_host);
// SerialChooserContext::PortObserver:
void OnPortAdded(const device::mojom::SerialPortInfo& port) override;
void OnPortRemoved(const device::mojom::SerialPortInfo& port) override;
void OnPortManagerConnectionError() override;
void OnPermissionRevoked(const url::Origin& origin) override {}
void OnSerialChooserContextShutdown() override;
private:
SerialChooserController* ControllerForFrame(
content::RenderFrameHost* render_frame_host);
@@ -56,6 +65,13 @@ class ElectronSerialDelegate : public content::SerialDelegate {
std::vector<blink::mojom::SerialPortFilterPtr> filters,
content::SerialChooser::Callback callback);
base::ScopedObservation<SerialChooserContext,
SerialChooserContext::PortObserver,
&SerialChooserContext::AddPortObserver,
&SerialChooserContext::RemovePortObserver>
port_observation_{this};
base::ObserverList<content::SerialDelegate::Observer> observer_list_;
std::unordered_map<content::RenderFrameHost*,
std::unique_ptr<SerialChooserController>>
controller_map_;

View File

@@ -90,11 +90,13 @@ base::Value PortInfoToValue(const device::mojom::SerialPortInfo& port) {
SerialChooserContext::SerialChooserContext(ElectronBrowserContext* context)
: browser_context_(context) {}
SerialChooserContext::~SerialChooserContext() = default;
void SerialChooserContext::OnPermissionRevoked(const url::Origin& origin) {
for (auto& observer : port_observer_list_)
observer.OnPermissionRevoked(origin);
SerialChooserContext::~SerialChooserContext() {
// Notify observers that the chooser context is about to be destroyed.
// Observers must remove themselves from the observer lists.
for (auto& observer : port_observer_list_) {
observer.OnSerialChooserContextShutdown();
DCHECK(!port_observer_list_.HasObserver(&observer));
}
}
void SerialChooserContext::GrantPortPermission(
@@ -127,8 +129,6 @@ void SerialChooserContext::RevokePortPermissionWebInitiated(
auto it = port_info_.find(token);
if (it == port_info_.end())
return;
return OnPermissionRevoked(origin);
}
// static

View File

@@ -46,7 +46,12 @@ extern const char kUsbDriverKey[];
class SerialChooserContext : public KeyedService,
public device::mojom::SerialPortManagerClient {
public:
using PortObserver = content::SerialDelegate::Observer;
class PortObserver : public content::SerialDelegate::Observer {
public:
// Called when the SerialChooserContext is shutting down. Observers must
// remove themselves before returning.
virtual void OnSerialChooserContextShutdown() = 0;
};
explicit SerialChooserContext(ElectronBrowserContext* context);
~SerialChooserContext() override;
@@ -55,9 +60,6 @@ class SerialChooserContext : public KeyedService,
SerialChooserContext(const SerialChooserContext&) = delete;
SerialChooserContext& operator=(const SerialChooserContext&) = delete;
// ObjectPermissionContextBase::PermissionObserver:
void OnPermissionRevoked(const url::Origin& origin);
// Serial-specific interface for granting and checking permissions.
void GrantPortPermission(const url::Origin& origin,
const device::mojom::SerialPortInfo& port,

View File

@@ -77,13 +77,11 @@ SerialChooserController::SerialChooserController(
DCHECK(chooser_context_);
chooser_context_->GetPortManager()->GetDevices(base::BindOnce(
&SerialChooserController::OnGetDevices, weak_factory_.GetWeakPtr()));
observation_.Observe(chooser_context_.get());
}
SerialChooserController::~SerialChooserController() {
RunCallback(/*port=*/nullptr);
if (chooser_context_) {
chooser_context_->RemovePortObserver(this);
}
}
api::Session* SerialChooserController::GetSession() {
@@ -117,7 +115,11 @@ void SerialChooserController::OnPortRemoved(
}
void SerialChooserController::OnPortManagerConnectionError() {
// TODO(nornagon/jkleinsc): report event
observation_.Reset();
}
void SerialChooserController::OnSerialChooserContextShutdown() {
observation_.Reset();
}
void SerialChooserController::OnDeviceChosen(const std::string& port_id) {

View File

@@ -48,6 +48,7 @@ class SerialChooserController final : public SerialChooserContext::PortObserver,
void OnPortRemoved(const device::mojom::SerialPortInfo& port) override;
void OnPortManagerConnectionError() override;
void OnPermissionRevoked(const url::Origin& origin) override {}
void OnSerialChooserContextShutdown() override;
private:
api::Session* GetSession();
@@ -62,6 +63,12 @@ class SerialChooserController final : public SerialChooserContext::PortObserver,
base::WeakPtr<SerialChooserContext> chooser_context_;
base::ScopedObservation<SerialChooserContext,
SerialChooserContext::PortObserver,
&SerialChooserContext::AddPortObserver,
&SerialChooserContext::RemovePortObserver>
observation_{this};
std::vector<device::mojom::SerialPortInfoPtr> ports_;
base::WeakPtr<ElectronSerialDelegate> serial_delegate_;

View File

@@ -176,11 +176,7 @@ void WebContentsPreferences::Clear() {
void WebContentsPreferences::SetFromDictionary(
const gin_helper::Dictionary& web_preferences) {
Clear();
Merge(web_preferences);
}
void WebContentsPreferences::Merge(
const gin_helper::Dictionary& web_preferences) {
web_preferences.Get(options::kPlugins, &plugins_);
web_preferences.Get(options::kExperimentalFeatures, &experimental_features_);
web_preferences.Get(options::kNodeIntegration, &node_integration_);

View File

@@ -40,8 +40,6 @@ class WebContentsPreferences
WebContentsPreferences(const WebContentsPreferences&) = delete;
WebContentsPreferences& operator=(const WebContentsPreferences&) = delete;
void Merge(const gin_helper::Dictionary& new_web_preferences);
void SetFromDictionary(const gin_helper::Dictionary& new_web_preferences);
// Append command paramters according to preferences.

View File

@@ -4333,6 +4333,14 @@ describe('BrowserWindow module', () => {
await createTwo();
});
ifit(process.platform !== 'darwin')('can disable and enable a window', () => {
const w = new BrowserWindow({ show: false });
w.setEnabled(false);
expect(w.isEnabled()).to.be.false('w.isEnabled()');
w.setEnabled(true);
expect(w.isEnabled()).to.be.true('!w.isEnabled()');
});
ifit(process.platform !== 'darwin')('disables parent window', () => {
const w = new BrowserWindow({ show: false });
const c = new BrowserWindow({ show: false, parent: w, modal: true });

View File

@@ -81,7 +81,6 @@ declare namespace Electron {
attachToIframe(embedderWebContents: Electron.WebContents, embedderFrameId: number): void;
detachFromOuterFrame(): void;
setEmbedder(embedder: Electron.WebContents): void;
attachParams?: { instanceId: number; src: string, opts: LoadURLOptions };
viewInstanceId: number;
}