Compare commits

..

17 Commits

Author SHA1 Message Date
Sudowoodo Release Bot
e52c9e3954 Bump v14.0.0-beta.23 2021-08-19 06:32:23 -07:00
trop[bot]
5b7c5add62 fix: WebFrameMain mojo pipe not reset (#30631)
Co-authored-by: Samuel Maddock <samuel.maddock@gmail.com>
2021-08-19 16:55:47 +09:00
trop[bot]
c578d6f2de docs: typo in launch-app-from-url-in-another-app.md (#30627)
* Typo in launch-app-from-url-in-another-app.md

Code snippet for the info.plist example had html formatting. Removed.

* Fix paddings

Co-authored-by: Larry Kluger <larry.kluger@docusign.com>
Co-authored-by: Cheng Zhao <github@zcbenz.com>
2021-08-19 15:11:08 +09:00
trop[bot]
a5e4a23e41 fix: cross-origin navigation disposing WebFrameMain instances (#30599)
* refactor: call methods directly from electron:WebContents

Writing static method boilerplate isn't fun

* fix: cross-origin navigation disposing WebFrameMain instances

* fix: move call to WFM::Connect

* refactor: use base::NoDestructor<T>

* Update shell/browser/api/electron_api_web_frame_main.cc

Co-authored-by: Jeremy Rose <nornagon@nornagon.net>

Co-authored-by: samuelmaddock <samuel.maddock@gmail.com>
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-08-19 15:09:01 +09:00
trop[bot]
22b98cf390 fix: handle nullish WebContentsView in UpdateDraggableRegions (#30559)
* fix: handle nullish WebContentsView in UpdateDraggableRegions

* build: nogncheck on webcontentsimpl include

Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2021-08-19 10:39:13 +09:00
trop[bot]
f229bc1032 docs: remove unused Desktop Environment Integration doc (#30620)
* docs: remove unused Desktop Environment Integration doc

* Update docs/api/app.md

Co-authored-by: Mark Lee <malept@users.noreply.github.com>

* Update docs/api/app.md

Co-authored-by: Mark Lee <malept@users.noreply.github.com>

Co-authored-by: Erick Zhao <erick@hotmail.ca>
Co-authored-by: Mark Lee <malept@users.noreply.github.com>
2021-08-19 09:54:24 +09:00
trop[bot]
2f3ab58a12 docs: update Hazel information (#30622)
Co-authored-by: Erick Zhao <erick@hotmail.ca>
2021-08-19 09:53:20 +09:00
trop[bot]
627a29964c fix: {exit|enter}-html-fullscreen emitted after esc in webview (#30561)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-08-19 08:39:06 +09:00
trop[bot]
94f2a1d438 fix: documentEdited with non-default titlebarStyle (#30605)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-08-18 14:15:32 -07:00
Sudowoodo Release Bot
5cc4fb83b3 Bump v14.0.0-beta.22 2021-08-17 08:43:00 -07:00
Sudowoodo Release Bot
4048a580a6 Revert "Bump v14.0.0-beta.22"
This reverts commit 9b08950054.
2021-08-16 22:01:16 -07:00
trop[bot]
99af7e3f50 fix: persist BrowserView background color when bounds offscreen (#30541)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-08-16 15:09:30 -04:00
trop[bot]
fbe39223ef fix: disable kWindowCaptureMacV2 for desktopCapturer (#30524)
Co-authored-by: VerteDinde <khammond@slack-corp.com>
2021-08-16 11:17:35 -07:00
trop[bot]
d8ea9eed3e docs: uniformize tutorial titles (#30545)
Co-authored-by: Erick Zhao <erick@hotmail.ca>
2021-08-16 14:09:32 -04:00
trop[bot]
2567f30267 docs: clarify usage of option (#30549)
Co-authored-by: Erick Zhao <erick@hotmail.ca>
2021-08-16 14:05:42 -04:00
Sudowoodo Release Bot
9b08950054 Bump v14.0.0-beta.22 2021-08-16 06:31:47 -07:00
electron-roller[bot]
43490c6300 chore: bump chromium to 93.0.4577.25 (14-x-y) (#30349)
* chore: bump chromium in DEPS to 93.0.4577.18

* chore: update patches

* chore: bump chromium in DEPS to 93.0.4577.25

* chore: update patches

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>
2021-08-12 14:40:18 -04:00
42 changed files with 321 additions and 256 deletions

2
DEPS
View File

@@ -15,7 +15,7 @@ gclient_gn_args = [
vars = {
'chromium_version':
'93.0.4577.15',
'93.0.4577.25',
'node_version':
'v14.17.0',
'nan_version':

View File

@@ -1 +1 @@
14.0.0-beta.21
14.0.0-beta.23

View File

@@ -1135,8 +1135,8 @@ badge.
On macOS, it shows on the dock icon. On Linux, it only works for Unity launcher.
**Note:** Unity launcher requires the existence of a `.desktop` file to work,
for more information please read [Desktop Environment Integration][unity-requirement].
**Note:** Unity launcher requires a `.desktop` file to work. For more information,
please read the [Unity integration documentation][unity-requirement].
### `app.getBadgeCount()` _Linux_ _macOS_
@@ -1374,8 +1374,8 @@ An `Integer` property that returns the badge count for current app. Setting the
On macOS, setting this with any nonzero integer shows on the dock icon. On Linux, this property only works for Unity launcher.
**Note:** Unity launcher requires the existence of a `.desktop` file to work,
for more information please read [Desktop Environment Integration][unity-requirement].
**Note:** Unity launcher requires a `.desktop` file to work. For more information,
please read the [Unity integration documentation][unity-requirement].
**Note:** On macOS, you need to ensure that your application has the permission
to display notifications for this property to take effect.
@@ -1403,7 +1403,7 @@ A `Boolean` property that returns `true` if the app is packaged, `false` otherw
[LSCopyDefaultHandlerForURLScheme]: https://developer.apple.com/library/mac/documentation/Carbon/Reference/LaunchServicesReference/#//apple_ref/c/func/LSCopyDefaultHandlerForURLScheme
[handoff]: https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html
[activity-type]: https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType
[unity-requirement]: ../tutorial/desktop-environment-integration.md#unity-launcher
[unity-requirement]: https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles#Adding_shortcuts_to_a_launcher
[mas-builds]: ../tutorial/mac-app-store-submission-guide.md
[Squirrel-Windows]: https://github.com/Squirrel/Squirrel.Windows
[JumpListBeginListMSDN]: https://msdn.microsoft.com/en-us/library/windows/desktop/dd378398(v=vs.85).aspx

View File

@@ -187,9 +187,9 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
* `parent` BrowserWindow (optional) - Specify parent window. Default is `null`.
* `modal` Boolean (optional) - Whether this is a modal window. This only works when the
window is a child window. Default is `false`.
* `acceptFirstMouse` Boolean (optional) - Whether the web view accepts a single
mouse-down event that simultaneously activates the window. Default is
`false`.
* `acceptFirstMouse` Boolean (optional) - Whether clicking an inactive window will also
click through to the web contents. Default is `false` on macOS. This option is not
configurable on other platforms.
* `disableAutoHideCursor` Boolean (optional) - Whether to hide cursor when typing.
Default is `false`.
* `autoHideMenuBar` Boolean (optional) - Auto hide the menu bar unless the `Alt`

View File

@@ -1,35 +0,0 @@
# Desktop Environment Integration
Different operating systems provide different features for integrating desktop
applications into their desktop environments. For example, on Windows,
applications can put shortcuts in the JumpList of task bar, and on Mac,
applications can put a custom menu in the dock menu.
This guide explains how to integrate your application into those desktop
environments with Electron APIs.
## Notifications
See the [Notifications documentation](notifications.md).
## Recent Documents
See [Recent Documents documentation](recent-documents.md).
## Progress Bar
See the [Progress Bar documentation](progress-bar.md).
## Unity Launcher
See the [Unity Launcher documentation][unity-launcher].
## Represented File for macOS Window
See the [Represented File documentation](represented-file.md).
## Dragging files out of the window
See the [Native File Drag & Drop documentation](native-file-drag-drop.md).
[unity-launcher]: https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles#Adding_shortcuts_to_a_launcher

View File

@@ -1,4 +1,4 @@
# In-App Purchase (macOS)
# In-App Purchases (macOS)
## Preparing

View File

@@ -1,4 +1,4 @@
# Installation
# Advanced Installation Instructions
To install prebuilt Electron binaries, use [`npm`][npm].
The preferred method is to install Electron as a development dependency in your

View File

@@ -127,31 +127,25 @@ can add the flag `--extend-info` with a path to the `plist` you've created. The
### Plist
```XML
<p>
<h5>macOS plist</h5>
<pre><code>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>electron-api-demos</string>
</array>
<key>CFBundleURLName</key>
<string>Electron API Demos Protocol</string>
</dict>
</array>
<key>ElectronTeamID</key>
<string>VEKTX9H2N7</string>
</dict>
</plist>
</code>
</pre>
<p>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>electron-api-demos</string>
</array>
<key>CFBundleURLName</key>
<string>Electron API Demos Protocol</string>
</dict>
</array>
<key>ElectronTeamID</key>
<string>VEKTX9H2N7</string>
</dict>
</plist>
```
## Conclusion

View File

@@ -1,4 +1,4 @@
# Custom Linux Desktop Launcher Actions
# Desktop Launcher Actions (Linux)
## Overview

View File

@@ -1,4 +1,4 @@
# Configuring the macOS Dock
# Dock (macOS)
Electron has APIs to configure the app's icon in the macOS Dock. A macOS-only
API exists to create a custom dock menu, but Electron also uses the app dock

View File

@@ -1,4 +1,4 @@
# Notifications (Windows, Linux, macOS)
# Notifications
## Overview

View File

@@ -1,4 +1,4 @@
# Progress Bar in Taskbar (Windows, macOS, Unity)
# Taskbar Progress Bar (Windows & macOS)
## Overview

View File

@@ -1,4 +1,4 @@
# Represented File for macOS BrowserWindows
# Representing Files in a BrowserWindow (macOS)
## Overview

View File

@@ -1,4 +1,4 @@
# Snapcraft Guide (Ubuntu Software Center & More)
# Snapcraft Guide (Linux)
This guide provides information on how to package your Electron application
for any Snapcraft environment, including the Ubuntu Software Center.

View File

@@ -49,7 +49,7 @@ update server.
Depending on your needs, you can choose from one of these:
- [Hazel][hazel] Update server for private or open-source apps which can be
deployed for free on [Now][now]. It pulls from [GitHub Releases][gh-releases]
deployed for free on [Vercel][vercel]. It pulls from [GitHub Releases][gh-releases]
and leverages the power of GitHub's CDN.
- [Nuts][nuts] Also uses [GitHub Releases][gh-releases], but caches app
updates on disk and supports private repositories.
@@ -64,7 +64,7 @@ to minify server cost.
Once you've deployed your update server, continue with importing the required
modules in your code. The following code might vary for different server
software, but it works like described when using
[Hazel](https://github.com/zeit/hazel).
[Hazel][hazel].
**Important:** Please ensure that the code below will only be executed in
your packaged app, and not in development. You can use
@@ -136,8 +136,8 @@ autoUpdater.on('error', message => {
Because the requests made by Auto Update aren't under your direct control, you may find situations that are difficult to handle (such as if the update server is behind authentication). The `url` field does support files, which means that with some effort, you can sidestep the server-communication aspect of the process. [Here's an example of how this could work](https://github.com/electron/electron/issues/5020#issuecomment-477636990).
[now]: https://zeit.co/now
[hazel]: https://github.com/zeit/hazel
[vercel]: https://vercel.com
[hazel]: https://github.com/vercel/hazel
[nuts]: https://github.com/GitbookIO/nuts
[gh-releases]: https://help.github.com/articles/creating-releases/
[electron-release-server]: https://github.com/ArekSredzki/electron-release-server

View File

@@ -1,4 +1,4 @@
# Using Native Node Modules
# Native Node Modules
Native Node.js modules are supported by Electron, but since Electron has a different
[application binary interface (ABI)][abi] from a given Node.js binary (due to

View File

@@ -1,4 +1,4 @@
# Using Pepper Flash Plugin
# Pepper Flash Plugin
Electron no longer supports the Pepper Flash plugin, as Chrome has removed support.

View File

@@ -1,4 +1,4 @@
# Using Selenium and WebDriver
# Selenium and WebDriver
From [ChromeDriver - WebDriver for Chrome][chrome-driver]:

View File

@@ -1,4 +1,4 @@
# Web embeds
# Web Embeds
## Overview

View File

@@ -1,4 +1,4 @@
# Windows 10 on Arm
# Windows on ARM
If your app runs with Electron 6.0.8 or later, you can now build it for Windows 10 on Arm. This considerably improves performance, but requires recompilation of any native modules used in your app. It may also require small fixups to your build and packaging scripts.

View File

@@ -1,4 +1,4 @@
# Windows Taskbar
# Taskbar Customization (Windows)
## Overview

View File

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

View File

@@ -103,5 +103,4 @@ refactor_restore_base_adaptcallbackforrepeating.patch
hack_to_allow_gclient_sync_with_host_os_mac_on_linux_in_ci.patch
add_gin_wrappable_crash_key.patch
revert_roll_clang_llvmorg-13-init-14732-g8a7b5ebf-2.patch
update_the_py_wheel_to_a_version_that_is_compatible_with.patch
logging_win32_only_create_a_console_if_logging_to_stderr.patch

View File

@@ -9,10 +9,10 @@ potentially prevent a window from being created.
TODO(loc): this patch is currently broken.
diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc
index 01bf04ee4615101070ef14abad57a6a75d8359cc..c57f9f72abe841d31e0dd14924e73cb565e9d226 100644
index ee638fbd09ad247756659a5345ee58abed7dc6cd..c842246f9250c45793c4e763f1de3f2b486a56aa 100644
--- a/content/browser/renderer_host/render_frame_host_impl.cc
+++ b/content/browser/renderer_host/render_frame_host_impl.cc
@@ -6263,6 +6263,7 @@ void RenderFrameHostImpl::CreateNewWindow(
@@ -6280,6 +6280,7 @@ void RenderFrameHostImpl::CreateNewWindow(
last_committed_origin_, params->window_container_type,
params->target_url, params->referrer.To<Referrer>(),
params->frame_name, params->disposition, *params->features,

View File

@@ -205,7 +205,7 @@ index e7adfee3210ec723c687adfcc4bee8827ef643e7..25a924a47eeb30d783ef83dbb4896c4b
+
#endif // UI_BASE_COCOA_REMOTE_ACCESSIBILITY_API_H_
diff --git a/ui/views/cocoa/native_widget_mac_ns_window_host.h b/ui/views/cocoa/native_widget_mac_ns_window_host.h
index 9f5543d22e7a72dc7ca031e04434279b5066215c..2eaaa54778f1f5d450389967ae77c5e4d578eb04 100644
index ce96d1bee29c8ee13f4a10bb17a7000b332637c8..74bfcc4eb8490f8b27363283372525dfffd11776 100644
--- a/ui/views/cocoa/native_widget_mac_ns_window_host.h
+++ b/ui/views/cocoa/native_widget_mac_ns_window_host.h
@@ -30,7 +30,9 @@
@@ -218,7 +218,7 @@ index 9f5543d22e7a72dc7ca031e04434279b5066215c..2eaaa54778f1f5d450389967ae77c5e4
@class NSView;
namespace remote_cocoa {
@@ -420,11 +422,13 @@ class VIEWS_EXPORT NativeWidgetMacNSWindowHost
@@ -424,11 +426,13 @@ class VIEWS_EXPORT NativeWidgetMacNSWindowHost
mojo::AssociatedRemote<remote_cocoa::mojom::NativeWidgetNSWindow>
remote_ns_window_remote_;
@@ -233,7 +233,7 @@ index 9f5543d22e7a72dc7ca031e04434279b5066215c..2eaaa54778f1f5d450389967ae77c5e4
// Used to force the NSApplication's focused accessibility element to be the
// views::Views accessibility tree when the NSView for this is focused.
diff --git a/ui/views/cocoa/native_widget_mac_ns_window_host.mm b/ui/views/cocoa/native_widget_mac_ns_window_host.mm
index a756f7b856196606c1cd4fc26e8a907d9891d36c..2dce88094b9a697bd7f4d85a69294a098a2dd427 100644
index da26f5e6bee82cb16d2a192e26f206e491b5a068..6b62858ddb2bf3e977550ee6d257e8d6d99d4d90 100644
--- a/ui/views/cocoa/native_widget_mac_ns_window_host.mm
+++ b/ui/views/cocoa/native_widget_mac_ns_window_host.mm
@@ -285,14 +285,22 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
@@ -259,7 +259,7 @@ index a756f7b856196606c1cd4fc26e8a907d9891d36c..2dce88094b9a697bd7f4d85a69294a09
}
remote_cocoa::mojom::NativeWidgetNSWindow*
@@ -1197,6 +1205,7 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
@@ -1201,6 +1209,7 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
void NativeWidgetMacNSWindowHost::SetRemoteAccessibilityTokens(
const std::vector<uint8_t>& window_token,
const std::vector<uint8_t>& view_token) {
@@ -267,7 +267,7 @@ index a756f7b856196606c1cd4fc26e8a907d9891d36c..2dce88094b9a697bd7f4d85a69294a09
remote_window_accessible_ =
ui::RemoteAccessibility::GetRemoteElementFromToken(window_token);
remote_view_accessible_ =
@@ -1204,14 +1213,17 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
@@ -1208,14 +1217,17 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
[remote_view_accessible_ setWindowUIElement:remote_window_accessible_.get()];
[remote_view_accessible_
setTopLevelUIElement:remote_window_accessible_.get()];

View File

@@ -126,7 +126,7 @@ index 2824b97e715a493082734d40f62860c8cafa5f34..584d4ef2b73a0f89458224eb134a8d8a
}
diff --git a/chrome/browser/printing/print_view_manager_base.cc b/chrome/browser/printing/print_view_manager_base.cc
index 867227684ddba1b1032d7aa4935cbfdca8518309..fbcb81b7dedcf5d9bad949dbf721c0a34a7c8f2b 100644
index e345c611cac05d7e802b1f910031e8d799196e31..562800bf194e1f07f58b912b54a740b7c7dcabb6 100644
--- a/chrome/browser/printing/print_view_manager_base.cc
+++ b/chrome/browser/printing/print_view_manager_base.cc
@@ -28,10 +28,10 @@
@@ -202,10 +202,10 @@ index 867227684ddba1b1032d7aa4935cbfdca8518309..fbcb81b7dedcf5d9bad949dbf721c0a3
+ bool silent,
+ base::Value settings,
+ CompletionCallback callback) {
auto weak_this = weak_ptr_factory_.GetWeakPtr();
DisconnectFromCurrentPrintJob();
// Don't print / print preview crashed tabs.
@@ -364,7 +375,14 @@ bool PrintViewManagerBase::PrintNow(content::RenderFrameHost* rfh) {
if (!weak_this)
@@ -367,7 +378,14 @@ bool PrintViewManagerBase::PrintNow(content::RenderFrameHost* rfh) {
// go in `ReleasePrintJob()`.
SetPrintingRFH(rfh);
@@ -221,7 +221,7 @@ index 867227684ddba1b1032d7aa4935cbfdca8518309..fbcb81b7dedcf5d9bad949dbf721c0a3
return true;
}
@@ -519,9 +537,9 @@ void PrintViewManagerBase::ScriptedPrintReply(
@@ -522,9 +540,9 @@ void PrintViewManagerBase::ScriptedPrintReply(
void PrintViewManagerBase::UpdatePrintingEnabled() {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
// The Unretained() is safe because ForEachFrame() is synchronous.
@@ -234,7 +234,7 @@ index 867227684ddba1b1032d7aa4935cbfdca8518309..fbcb81b7dedcf5d9bad949dbf721c0a3
}
void PrintViewManagerBase::NavigationStopped() {
@@ -635,12 +653,13 @@ void PrintViewManagerBase::DidPrintDocument(
@@ -638,12 +656,13 @@ void PrintViewManagerBase::DidPrintDocument(
void PrintViewManagerBase::GetDefaultPrintSettings(
GetDefaultPrintSettingsCallback callback) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
@@ -249,7 +249,7 @@ index 867227684ddba1b1032d7aa4935cbfdca8518309..fbcb81b7dedcf5d9bad949dbf721c0a3
content::RenderFrameHost* render_frame_host = GetCurrentTargetFrame();
auto callback_wrapper =
base::BindOnce(&PrintViewManagerBase::GetDefaultPrintSettingsReply,
@@ -658,12 +677,13 @@ void PrintViewManagerBase::UpdatePrintSettings(
@@ -661,12 +680,13 @@ void PrintViewManagerBase::UpdatePrintSettings(
base::Value job_settings,
UpdatePrintSettingsCallback callback) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
@@ -264,7 +264,7 @@ index 867227684ddba1b1032d7aa4935cbfdca8518309..fbcb81b7dedcf5d9bad949dbf721c0a3
if (!job_settings.FindIntKey(kSettingPrinterType)) {
UpdatePrintSettingsReply(std::move(callback),
CreateEmptyPrintPagesParamsPtr(), false);
@@ -708,13 +728,18 @@ void PrintViewManagerBase::PrintingFailed(int32_t cookie) {
@@ -711,13 +731,18 @@ void PrintViewManagerBase::PrintingFailed(int32_t cookie) {
PrintManager::PrintingFailed(cookie);
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
@@ -284,7 +284,7 @@ index 867227684ddba1b1032d7aa4935cbfdca8518309..fbcb81b7dedcf5d9bad949dbf721c0a3
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::BindOnce(&ShowWarningMessageBox,
l10n_util::GetStringUTF16(
@@ -794,6 +819,11 @@ void PrintViewManagerBase::OnNotifyPrintJobEvent(
@@ -797,6 +822,11 @@ void PrintViewManagerBase::OnNotifyPrintJobEvent(
#endif
break;
}
@@ -296,20 +296,21 @@ index 867227684ddba1b1032d7aa4935cbfdca8518309..fbcb81b7dedcf5d9bad949dbf721c0a3
case JobEventDetails::JOB_DONE:
// Printing is done, we don't need it anymore.
// print_job_->is_job_pending() may still be true, depending on the order
@@ -859,8 +889,10 @@ bool PrintViewManagerBase::CreateNewPrintJob(
@@ -864,9 +894,11 @@ bool PrintViewManagerBase::CreateNewPrintJob(
DCHECK(!quit_inner_loop_);
DCHECK(query);
- // Disconnect the current |print_job_|.
auto weak_this = weak_ptr_factory_.GetWeakPtr();
- DisconnectFromCurrentPrintJob();
+ if (callback_.is_null()) {
+ // Disconnect the current |print_job_| only when calling window.print()
+ DisconnectFromCurrentPrintJob();
+ }
if (!weak_this)
return false;
// We can't print if there is no renderer.
if (!web_contents()->GetMainFrame()->GetRenderViewHost() ||
@@ -881,8 +913,6 @@ bool PrintViewManagerBase::CreateNewPrintJob(
@@ -889,8 +921,6 @@ bool PrintViewManagerBase::CreateNewPrintJob(
/*source_id=*/"");
#endif
@@ -318,7 +319,7 @@ index 867227684ddba1b1032d7aa4935cbfdca8518309..fbcb81b7dedcf5d9bad949dbf721c0a3
printing_succeeded_ = false;
return true;
}
@@ -931,14 +961,22 @@ void PrintViewManagerBase::ReleasePrintJob() {
@@ -942,14 +972,22 @@ void PrintViewManagerBase::ReleasePrintJob() {
content::RenderFrameHost* rfh = printing_rfh_;
printing_rfh_ = nullptr;
@@ -343,7 +344,7 @@ index 867227684ddba1b1032d7aa4935cbfdca8518309..fbcb81b7dedcf5d9bad949dbf721c0a3
// Don't close the worker thread.
print_job_ = nullptr;
}
@@ -974,7 +1012,7 @@ bool PrintViewManagerBase::RunInnerMessageLoop() {
@@ -988,7 +1026,7 @@ bool PrintViewManagerBase::RunInnerMessageLoop() {
}
bool PrintViewManagerBase::OpportunisticallyCreatePrintJob(int cookie) {
@@ -353,7 +354,7 @@ index 867227684ddba1b1032d7aa4935cbfdca8518309..fbcb81b7dedcf5d9bad949dbf721c0a3
if (!cookie) {
diff --git a/chrome/browser/printing/print_view_manager_base.h b/chrome/browser/printing/print_view_manager_base.h
index 48e2baa05cdf61ac18d9d5a357833abd07b373b0..21ed887db41c979470f2a72b7a1c1832ad0e7961 100644
index eaa0e162a339ba68d42c920fdd30869d259b4f27..8381f5171970aa89fc5c406d57d2665e16c6678b 100644
--- a/chrome/browser/printing/print_view_manager_base.h
+++ b/chrome/browser/printing/print_view_manager_base.h
@@ -38,6 +38,8 @@ class PrintJob;
@@ -377,7 +378,7 @@ index 48e2baa05cdf61ac18d9d5a357833abd07b373b0..21ed887db41c979470f2a72b7a1c1832
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
// Prints the document in |print_data| with settings specified in
@@ -230,9 +235,15 @@ class PrintViewManagerBase : public content::NotificationObserver,
@@ -234,9 +239,15 @@ class PrintViewManagerBase : public content::NotificationObserver,
// The current RFH that is printing with a system printing dialog.
content::RenderFrameHost* printing_rfh_ = nullptr;

View File

@@ -1,29 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Brian Ryner <bryner@google.com>
Date: Thu, 22 Jul 2021 18:54:22 +0000
Subject: Update the "py" wheel to a version that is compatible with
pytest-6.2.2.
Bug: 1231439
Change-Id: Iaf68a72c01aa0efe2a6007a8fc1060afe69598c6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3044950
Commit-Queue: Brian Ryner <bryner@google.com>
Commit-Queue: Robbie Iannucci <iannucci@chromium.org>
Auto-Submit: Brian Ryner <bryner@google.com>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Cr-Commit-Position: refs/heads/master@{#904417}
diff --git a/.vpython3 b/.vpython3
index 14faab39343e82ff6706e625f948f97163863bb8..0aeeb03f79bdd6cbfb62a47391f4a996619b0594 100644
--- a/.vpython3
+++ b/.vpython3
@@ -204,7 +204,7 @@ wheel <
wheel <
name: "infra/python/wheels/py-py2_py3"
- version: "version:1.5.3"
+ version: "version:1.10.0"
>
wheel <

View File

@@ -14,10 +14,10 @@ Note that we also need to manually update embedder's
`api::WebContents::IsFullscreenForTabOrPending` value.
diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc
index c57f9f72abe841d31e0dd14924e73cb565e9d226..48512a8f96be1ccaab1a4ae19e9d62dafd01bfcc 100644
index c842246f9250c45793c4e763f1de3f2b486a56aa..d993cd6651689818ef4deb4caa02737644bdafb5 100644
--- a/content/browser/renderer_host/render_frame_host_impl.cc
+++ b/content/browser/renderer_host/render_frame_host_impl.cc
@@ -5699,6 +5699,15 @@ void RenderFrameHostImpl::EnterFullscreen(
@@ -5716,6 +5716,15 @@ void RenderFrameHostImpl::EnterFullscreen(
notified_instances.insert(parent_site_instance);
}

View File

@@ -4,6 +4,7 @@
#include "shell/browser/api/electron_api_browser_window.h"
#include "content/browser/web_contents/web_contents_impl.h" // nogncheck
#include "shell/browser/native_window_views.h"
#include "ui/aura/window.h"
@@ -17,8 +18,10 @@ void BrowserWindow::UpdateDraggableRegions(
return;
if (&draggable_regions_ != &regions) {
auto* nv = web_contents()->GetNativeView();
if (nv) {
auto* view =
static_cast<content::WebContentsImpl*>(web_contents())->GetView();
if (view) {
const gfx::NativeView nv = view->GetNativeView();
auto const offset = nv->GetBoundsInRootWindow();
auto snapped_regions = mojo::Clone(regions);
for (auto& snapped_region : snapped_regions) {

View File

@@ -1237,31 +1237,29 @@ void WebContents::OnEnterFullscreenModeForTab(
content::RenderFrameHost* requesting_frame,
const blink::mojom::FullscreenOptions& options,
bool allowed) {
if (!allowed)
return;
if (!owner_window_)
if (!allowed || !owner_window_)
return;
auto* source = content::WebContents::FromRenderFrameHost(requesting_frame);
if (IsFullscreenForTabOrPending(source)) {
DCHECK_EQ(fullscreen_frame_, source->GetFocusedFrame());
return;
}
SetHtmlApiFullscreen(true);
owner_window_->NotifyWindowEnterHtmlFullScreen();
if (native_fullscreen_) {
// Explicitly trigger a view resize, as the size is not actually changing if
// the browser is fullscreened, too.
source->GetRenderViewHost()->GetWidget()->SynchronizeVisualProperties();
}
Emit("enter-html-full-screen");
}
void WebContents::ExitFullscreenModeForTab(content::WebContents* source) {
if (!owner_window_)
return;
SetHtmlApiFullscreen(false);
owner_window_->NotifyWindowLeaveHtmlFullScreen();
if (native_fullscreen_) {
// Explicitly trigger a view resize, as the size is not actually changing if
@@ -1269,7 +1267,6 @@ void WebContents::ExitFullscreenModeForTab(content::WebContents* source) {
// `chrome/browser/ui/exclusive_access/fullscreen_controller.cc`.
source->GetRenderViewHost()->GetWidget()->SynchronizeVisualProperties();
}
Emit("leave-html-full-screen");
}
void WebContents::RendererUnresponsive(
@@ -1390,7 +1387,9 @@ void WebContents::HandleNewRenderFrame(
if (rwh_impl)
rwh_impl->disable_hidden_ = !background_throttling_;
WebFrameMain::RenderFrameCreated(render_frame_host);
auto* web_frame = WebFrameMain::FromRenderFrameHost(render_frame_host);
if (web_frame)
web_frame->Connect();
}
void WebContents::RenderFrameCreated(
@@ -1398,6 +1397,46 @@ void WebContents::RenderFrameCreated(
HandleNewRenderFrame(render_frame_host);
}
void WebContents::RenderFrameDeleted(
content::RenderFrameHost* render_frame_host) {
// A RenderFrameHost can be deleted when:
// - A WebContents is removed and its containing frames are disposed.
// - An <iframe> is removed from the DOM.
// - Cross-origin navigation creates a new RFH in a separate process which
// is swapped by content::RenderFrameHostManager.
//
// WebFrameMain::FromRenderFrameHost(rfh) will use the RFH's FrameTreeNode ID
// to find an existing instance of WebFrameMain. During a cross-origin
// navigation, the deleted RFH will be the old host which was swapped out. In
// this special case, we need to also ensure that WebFrameMain's internal RFH
// matches before marking it as disposed.
auto* web_frame = WebFrameMain::FromRenderFrameHost(render_frame_host);
if (web_frame && web_frame->render_frame_host() == render_frame_host)
web_frame->MarkRenderFrameDisposed();
}
void WebContents::RenderFrameHostChanged(content::RenderFrameHost* old_host,
content::RenderFrameHost* new_host) {
// During cross-origin navigation, a FrameTreeNode will swap out its RFH.
// If an instance of WebFrameMain exists, it will need to have its RFH
// swapped as well.
//
// |old_host| can be a nullptr in so we use |new_host| for looking up the
// WebFrameMain instance.
auto* web_frame =
WebFrameMain::FromFrameTreeNodeId(new_host->GetFrameTreeNodeId());
if (web_frame) {
CHECK_EQ(web_frame->render_frame_host(), old_host);
web_frame->UpdateRenderFrameHost(new_host);
}
}
void WebContents::FrameDeleted(int frame_tree_node_id) {
auto* web_frame = WebFrameMain::FromFrameTreeNodeId(frame_tree_node_id);
if (web_frame)
web_frame->Destroyed();
}
void WebContents::RenderViewDeleted(content::RenderViewHost* render_view_host) {
// This event is necessary for tracking any states with respect to
// intermediate render view hosts aka speculative render view hosts. Currently
@@ -1638,13 +1677,6 @@ void WebContents::UpdateDraggableRegions(
observer.OnDraggableRegionsUpdated(regions);
}
void WebContents::RenderFrameDeleted(
content::RenderFrameHost* render_frame_host) {
// A WebFrameMain can outlive its RenderFrameHost so we need to mark it as
// disposed to prevent access to it.
WebFrameMain::RenderFrameDeleted(render_frame_host);
}
void WebContents::DidStartNavigation(
content::NavigationHandle* navigation_handle) {
EmitNavigationEvent("did-start-navigation", navigation_handle);
@@ -3588,7 +3620,7 @@ void WebContents::SetHtmlApiFullscreen(bool enter_fullscreen) {
}
void WebContents::UpdateHtmlApiFullscreen(bool fullscreen) {
if (fullscreen == html_fullscreen_)
if (fullscreen == is_html_fullscreen())
return;
html_fullscreen_ = fullscreen;
@@ -3599,11 +3631,19 @@ void WebContents::UpdateHtmlApiFullscreen(bool fullscreen) {
->GetWidget()
->SynchronizeVisualProperties();
// The embedder WebContents is spearated from the frame tree of webview, so
// The embedder WebContents is separated from the frame tree of webview, so
// we must manually sync their fullscreen states.
if (embedder_)
embedder_->SetHtmlApiFullscreen(fullscreen);
if (fullscreen) {
Emit("enter-html-full-screen");
owner_window_->NotifyWindowEnterHtmlFullScreen();
} else {
Emit("leave-html-full-screen");
owner_window_->NotifyWindowLeaveHtmlFullScreen();
}
// Make sure all child webviews quit html fullscreen.
if (!fullscreen && !IsGuest()) {
auto* manager = WebViewManager::GetWebViewManager(web_contents());

View File

@@ -544,9 +544,12 @@ class WebContents : public gin::Wrappable<WebContents>,
void BeforeUnloadFired(bool proceed,
const base::TimeTicks& proceed_time) override;
void RenderFrameCreated(content::RenderFrameHost* render_frame_host) override;
void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override;
void RenderFrameHostChanged(content::RenderFrameHost* old_host,
content::RenderFrameHost* new_host) override;
void FrameDeleted(int frame_tree_node_id) override;
void RenderViewDeleted(content::RenderViewHost*) override;
void RenderProcessGone(base::TerminationStatus status) override;
void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override;
void DOMContentLoaded(content::RenderFrameHost* render_frame_host) override;
void DidFinishLoad(content::RenderFrameHost* render_frame_host,
const GURL& validated_url) override;

View File

@@ -9,8 +9,8 @@
#include <utility>
#include <vector>
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/no_destructor.h"
#include "content/browser/renderer_host/frame_tree_node.h" // nogncheck
#include "content/public/browser/render_frame_host.h"
#include "electron/shell/common/api/api.mojom.h"
@@ -56,36 +56,55 @@ namespace electron {
namespace api {
typedef std::unordered_map<content::RenderFrameHost*, WebFrameMain*>
RenderFrameMap;
base::LazyInstance<RenderFrameMap>::DestructorAtExit g_render_frame_map =
LAZY_INSTANCE_INITIALIZER;
typedef std::unordered_map<int, WebFrameMain*> WebFrameMainIdMap;
WebFrameMain* FromRenderFrameHost(content::RenderFrameHost* rfh) {
auto frame_map = g_render_frame_map.Get();
auto iter = frame_map.find(rfh);
WebFrameMainIdMap& GetWebFrameMainMap() {
static base::NoDestructor<WebFrameMainIdMap> instance;
return *instance;
}
// static
WebFrameMain* WebFrameMain::FromFrameTreeNodeId(int frame_tree_node_id) {
WebFrameMainIdMap& frame_map = GetWebFrameMainMap();
auto iter = frame_map.find(frame_tree_node_id);
auto* web_frame = iter == frame_map.end() ? nullptr : iter->second;
return web_frame;
}
// static
WebFrameMain* WebFrameMain::FromRenderFrameHost(content::RenderFrameHost* rfh) {
return rfh ? FromFrameTreeNodeId(rfh->GetFrameTreeNodeId()) : nullptr;
}
gin::WrapperInfo WebFrameMain::kWrapperInfo = {gin::kEmbedderNativeGin};
WebFrameMain::WebFrameMain(content::RenderFrameHost* rfh) : render_frame_(rfh) {
g_render_frame_map.Get().emplace(rfh, this);
WebFrameMain::WebFrameMain(content::RenderFrameHost* rfh)
: frame_tree_node_id_(rfh->GetFrameTreeNodeId()), render_frame_(rfh) {
GetWebFrameMainMap().emplace(frame_tree_node_id_, this);
}
WebFrameMain::~WebFrameMain() {
Destroyed();
}
void WebFrameMain::Destroyed() {
MarkRenderFrameDisposed();
GetWebFrameMainMap().erase(frame_tree_node_id_);
Unpin();
}
void WebFrameMain::MarkRenderFrameDisposed() {
if (render_frame_disposed_)
return;
Unpin();
g_render_frame_map.Get().erase(render_frame_);
render_frame_ = nullptr;
render_frame_disposed_ = true;
}
void WebFrameMain::UpdateRenderFrameHost(content::RenderFrameHost* rfh) {
// Should only be called when swapping frames.
DCHECK(render_frame_);
render_frame_ = rfh;
renderer_api_.reset();
}
bool WebFrameMain::CheckRenderFrame() const {
if (render_frame_disposed_) {
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
@@ -213,9 +232,7 @@ void WebFrameMain::PostMessage(v8::Isolate* isolate,
}
int WebFrameMain::FrameTreeNodeID() const {
if (!CheckRenderFrame())
return -1;
return render_frame_->GetFrameTreeNodeId();
return frame_tree_node_id_;
}
std::string WebFrameMain::Name() const {
@@ -293,6 +310,13 @@ std::vector<content::RenderFrameHost*> WebFrameMain::FramesInSubtree() const {
return frame_hosts;
}
void WebFrameMain::Connect() {
if (pending_receiver_) {
render_frame_->GetRemoteInterfaces()->GetInterface(
std::move(pending_receiver_));
}
}
// static
gin::Handle<WebFrameMain> WebFrameMain::New(v8::Isolate* isolate) {
return gin::Handle<WebFrameMain>();
@@ -315,35 +339,6 @@ gin::Handle<WebFrameMain> WebFrameMain::From(v8::Isolate* isolate,
return handle;
}
// static
gin::Handle<WebFrameMain> WebFrameMain::FromID(v8::Isolate* isolate,
int render_process_id,
int render_frame_id) {
auto* rfh =
content::RenderFrameHost::FromID(render_process_id, render_frame_id);
return From(isolate, rfh);
}
// static
void WebFrameMain::RenderFrameDeleted(content::RenderFrameHost* rfh) {
auto* web_frame = FromRenderFrameHost(rfh);
if (web_frame)
web_frame->MarkRenderFrameDisposed();
}
void WebFrameMain::RenderFrameCreated(content::RenderFrameHost* rfh) {
auto* web_frame = FromRenderFrameHost(rfh);
if (web_frame)
web_frame->Connect();
}
void WebFrameMain::Connect() {
if (pending_receiver_) {
render_frame_->GetRemoteInterfaces()->GetInterface(
std::move(pending_receiver_));
}
}
// static
v8::Local<v8::ObjectTemplate> WebFrameMain::FillObjectTemplate(
v8::Isolate* isolate,
@@ -387,9 +382,10 @@ v8::Local<v8::Value> FromID(gin_helper::ErrorThrower thrower,
return v8::Null(thrower.isolate());
}
return WebFrameMain::FromID(thrower.isolate(), render_process_id,
render_frame_id)
.ToV8();
auto* rfh =
content::RenderFrameHost::FromID(render_process_id, render_frame_id);
return WebFrameMain::From(thrower.isolate(), rfh).ToV8();
}
void Initialize(v8::Local<v8::Object> exports,

View File

@@ -36,6 +36,8 @@ namespace electron {
namespace api {
class WebContents;
// Bindings for accessing frames from the main process.
class WebFrameMain : public gin::Wrappable<WebFrameMain>,
public gin_helper::Pinnable<WebFrameMain>,
@@ -44,23 +46,12 @@ class WebFrameMain : public gin::Wrappable<WebFrameMain>,
// Create a new WebFrameMain and return the V8 wrapper of it.
static gin::Handle<WebFrameMain> New(v8::Isolate* isolate);
static gin::Handle<WebFrameMain> FromID(v8::Isolate* isolate,
int render_process_id,
int render_frame_id);
static gin::Handle<WebFrameMain> From(
v8::Isolate* isolate,
content::RenderFrameHost* render_frame_host);
// Called to mark any RenderFrameHost as disposed by any WebFrameMain that
// may be holding a weak reference.
static void RenderFrameDeleted(content::RenderFrameHost* rfh);
static void RenderFrameCreated(content::RenderFrameHost* rfh);
// Mark RenderFrameHost as disposed and to no longer access it. This can
// occur upon frame navigation.
void MarkRenderFrameDisposed();
const mojo::Remote<mojom::ElectronRenderer>& GetRendererApi();
static WebFrameMain* FromFrameTreeNodeId(int frame_tree_node_id);
static WebFrameMain* FromRenderFrameHost(
content::RenderFrameHost* render_frame_host);
// gin::Wrappable
static gin::WrapperInfo kWrapperInfo;
@@ -69,11 +60,28 @@ class WebFrameMain : public gin::Wrappable<WebFrameMain>,
v8::Local<v8::ObjectTemplate>);
const char* GetTypeName() override;
content::RenderFrameHost* render_frame_host() const { return render_frame_; }
protected:
explicit WebFrameMain(content::RenderFrameHost* render_frame);
~WebFrameMain() override;
private:
friend class WebContents;
// Called when FrameTreeNode is deleted.
void Destroyed();
// Mark RenderFrameHost as disposed and to no longer access it. This can
// happen when the WebFrameMain v8 handle is GC'd or when a FrameTreeNode
// is removed.
void MarkRenderFrameDisposed();
// Swap out the internal RFH when cross-origin navigation occurs.
void UpdateRenderFrameHost(content::RenderFrameHost* rfh);
const mojo::Remote<mojom::ElectronRenderer>& GetRendererApi();
// WebFrameMain can outlive its RenderFrameHost pointer so we need to check
// whether its been disposed of prior to accessing it.
bool CheckRenderFrame() const;
@@ -109,6 +117,8 @@ class WebFrameMain : public gin::Wrappable<WebFrameMain>,
mojo::Remote<mojom::ElectronRenderer> renderer_api_;
mojo::PendingReceiver<mojom::ElectronRenderer> pending_receiver_;
int frame_tree_node_id_;
content::RenderFrameHost* render_frame_ = nullptr;
// Whether the RenderFrameHost has been removed and that it should no longer

View File

@@ -48,6 +48,12 @@ void InitializeFeatureList() {
// an empty suggestions list to be returned
disable_features +=
std::string(",") + spellcheck::kWinRetrieveSuggestionsOnlyOnDemand.name;
#endif
#if defined(OS_MAC)
// Disable kWindowCaptureMacV2, which causes the wrong window id to
// be returned (this has been disabled in upstream Chromium here):
// https://chromium-review.googlesource.com/c/chromium/src/+/3069272
disable_features += std::string(",") + features::kWindowCaptureMacV2.name;
#endif
base::FeatureList::InitializeInstance(enable_features, disable_features);
}

View File

@@ -1139,6 +1139,8 @@ std::string NativeWindowMac::GetRepresentedFilename() {
void NativeWindowMac::SetDocumentEdited(bool edited) {
[window_ setDocumentEdited:edited];
if (buttons_proxy_)
[buttons_proxy_ redraw];
}
bool NativeWindowMac::IsDocumentEdited() {

View File

@@ -50,8 +50,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 14,0,0,21
PRODUCTVERSION 14,0,0,21
FILEVERSION 14,0,0,23
PRODUCTVERSION 14,0,0,23
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L

View File

@@ -213,7 +213,7 @@ void InspectableWebContentsViewViews::SetTitle(const std::u16string& title) {
void InspectableWebContentsViewViews::Layout() {
if (!devtools_web_view_->GetVisible()) {
contents_web_view_->SetBoundsRect(GetContentsBounds());
contents_web_view_->SetBoundsRect(GetVisibleBounds());
return;
}

View File

@@ -146,6 +146,42 @@ ifdescribe(!process.arch.includes('arm') && process.platform !== 'win32')('deskt
expect(mediaSourceId).to.equal(foundSource!.id);
});
it('getSources should not incorrectly duplicate window_id', async () => {
const w = new BrowserWindow({ show: false, width: 100, height: 100, webPreferences: { contextIsolation: false } });
const wShown = emittedOnce(w, 'show');
const wFocused = emittedOnce(w, 'focus');
w.show();
w.focus();
await wShown;
await wFocused;
// ensure window_id isn't duplicated in getMediaSourceId,
// which uses a different method than getSources
const mediaSourceId = w.getMediaSourceId();
const ids = mediaSourceId.split(':');
expect(ids[1]).to.not.equal(ids[2]);
const sources = await getSources({
types: ['window'],
thumbnailSize: { width: 0, height: 0 }
});
w.destroy();
// TODO(julien.isorce): investigate why |sources| is empty on the linux
// bots while it is not on my workstation, as expected, with and without
// the --ci parameter.
if (process.platform === 'linux' && sources.length === 0) {
it.skip('desktopCapturer.getSources returned an empty source list');
return;
}
expect(sources).to.be.an('array').that.is.not.empty();
for (const source of sources) {
const sourceIds = source.id.split(':');
expect(sourceIds[1]).to.not.equal(sourceIds[2]);
}
});
// TODO(deepak1556): currently fails on all ci, enable it after upgrade.
it.skip('moveAbove should move the window at the requested place', async () => {
// DesktopCapturer.getSources() is guaranteed to return in the correct

View File

@@ -14,6 +14,24 @@ describe('webFrameMain module', () => {
const fileUrl = (filename: string) => url.pathToFileURL(path.join(subframesPath, filename)).href;
type Server = { server: http.Server, url: string }
/** Creates an HTTP server whose handler embeds the given iframe src. */
const createServer = () => new Promise<Server>(resolve => {
const server = http.createServer((req, res) => {
const params = new URLSearchParams(url.parse(req.url || '').search || '');
if (params.has('frameSrc')) {
res.end(`<iframe src="${params.get('frameSrc')}"></iframe>`);
} else {
res.end('');
}
});
server.listen(0, '127.0.0.1', () => {
const url = `http://127.0.0.1:${(server.address() as AddressInfo).port}/`;
resolve({ server, url });
});
});
afterEach(closeAllWindows);
describe('WebFrame traversal APIs', () => {
@@ -70,24 +88,6 @@ describe('webFrameMain module', () => {
});
describe('cross-origin', () => {
type Server = { server: http.Server, url: string }
/** Creates an HTTP server whose handler embeds the given iframe src. */
const createServer = () => new Promise<Server>(resolve => {
const server = http.createServer((req, res) => {
const params = new URLSearchParams(url.parse(req.url || '').search || '');
if (params.has('frameSrc')) {
res.end(`<iframe src="${params.get('frameSrc')}"></iframe>`);
} else {
res.end('');
}
});
server.listen(0, '127.0.0.1', () => {
const url = `http://127.0.0.1:${(server.address() as AddressInfo).port}/`;
resolve({ server, url });
});
});
let serverA = null as unknown as Server;
let serverB = null as unknown as Server;
@@ -194,21 +194,32 @@ describe('webFrameMain module', () => {
});
});
describe('disposed WebFrames', () => {
describe('RenderFrame lifespan', () => {
let w: BrowserWindow;
let webFrame: WebFrameMain;
before(async () => {
beforeEach(async () => {
w = new BrowserWindow({ show: false, webPreferences: { contextIsolation: true } });
});
it('throws upon accessing properties when disposed', async () => {
await w.loadFile(path.join(subframesPath, 'frame-with-frame-container.html'));
webFrame = w.webContents.mainFrame;
const { mainFrame } = w.webContents;
w.destroy();
// Wait for WebContents, and thus RenderFrameHost, to be destroyed.
await new Promise(resolve => setTimeout(resolve, 0));
expect(() => mainFrame.url).to.throw();
});
it('throws upon accessing properties', () => {
expect(() => webFrame.url).to.throw();
it('persists through cross-origin navigation', async () => {
const server = await createServer();
// 'localhost' is treated as a separate origin.
const crossOriginUrl = server.url.replace('127.0.0.1', 'localhost');
await w.loadURL(server.url);
const { mainFrame } = w.webContents;
expect(mainFrame.url).to.equal(server.url);
await w.loadURL(crossOriginUrl);
expect(w.webContents.mainFrame).to.equal(mainFrame);
expect(mainFrame.url).to.equal(crossOriginUrl);
});
});

View File

@@ -456,6 +456,34 @@ describe('<webview> tag', function () {
await delay(0);
expect(w.isFullScreen()).to.be.false();
});
it('pressing ESC should emit the leave-html-full-screen event', async () => {
const w = new BrowserWindow({
show: false,
webPreferences: {
webviewTag: true,
nodeIntegration: true,
contextIsolation: false
}
});
const didAttachWebview = emittedOnce(w.webContents, 'did-attach-webview');
w.loadFile(path.join(fixtures, 'pages', 'webview-did-attach-event.html'));
const [, webContents] = await didAttachWebview;
const enterFSWindow = emittedOnce(w, 'enter-html-full-screen');
const enterFSWebview = emittedOnce(webContents, 'enter-html-full-screen');
await webContents.executeJavaScript('document.getElementById("div").requestFullscreen()', true);
await enterFSWindow;
await enterFSWebview;
const leaveFSWindow = emittedOnce(w, 'leave-html-full-screen');
const leaveFSWebview = emittedOnce(webContents, 'leave-html-full-screen');
webContents.sendInputEvent({ type: 'keyDown', keyCode: 'Escape' });
await leaveFSWindow;
await leaveFSWebview;
});
});
describe('nativeWindowOpen option', () => {

View File

@@ -3,6 +3,7 @@
<link rel="icon" type="image/png" href="http://test.com/favicon.png"/>
<meta http-equiv="content-security-policy" content="script-src 'self' 'unsafe-inline'" />
<body>
<div id="div">Hello World</div>
<script type="text/javascript" charset="utf-8">
console.log('a');
document.title = "test"

View File

@@ -172,7 +172,6 @@ app.whenReady().then(() => {
app.getLocale()
// Desktop environment integration
// https://github.com/electron/electron/blob/master/docs/tutorial/desktop-environment-integration.md
app.addRecentDocument('/Users/USERNAME/Desktop/work.type')
app.clearRecentDocuments()