Compare commits

...

29 Commits

Author SHA1 Message Date
Electron Bot
3ac4fa85dd Bump v10.0.0-nightly.20200422 2020-04-22 08:32:17 -07:00
Samuel Attard
0cbcee6740 fix: ensure that functions are not retained beyond their context being released (#23207) 2020-04-21 18:05:01 -07:00
loc
aca2e4f968 refactor: improve feature string parsing (#23130)
* test: add pre-change snapshot of new-window event

* move to .ts file for easier diff

* refactor: improve feature string parsing logic

* test: update snapshots

* update type names per review

* update comma-separated parse test

* use for loop instead of reduce per review

* tighten up types

* avoid variable guest contents id returnValue in test snapshot
2020-04-21 16:23:00 -04:00
Iván Montes
b3909f5600 fix: moveAbove not working on Windows (#23161)
* fix moveAbove on Windows systems

The documentation for [setWindowPos](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setwindowpos) second argument `hWndInsertAfter` is a bit confusing...

> A handle to the window to precede the positioned window in the Z order. This parameter must be a window handle or one of the following values.

Since Windows refers to the Z order from low to high it means that the window provided as reference will always _precede_ the electron window, which is the opposite of what we want in this function, since the electron window is displayed behind the referenced window.

The change is simply to ask `SetWindowPos` to position our window *behind* the window that's *above* the reference window, effectively making our window sit just above the reference one.

* lint
2020-04-21 15:58:38 -04:00
loc
a041882192 test: add test for datalist autofills (#23110)
* test: add test for datalist autofills

* address style nits

* move fixture to spec-main
2020-04-21 12:28:31 -07:00
loc
cd0dda0125 fix: allow blocking IO for setAppLogsPath to avoid DCHECK (#23111)
* fix: let setAppLogsPath write to disk on UI thread

Otherwise, the DCHECK in thread_restrictions will fire.

* scope the io allowance more tightly

* oops, scope it tightly in the mac version too
2020-04-21 12:28:01 -07:00
Charles Kerr
07654c47ec fix: use Node's microtasks policy in node_main.cc (#23153)
Fixes #21515.
2020-04-21 12:18:22 -07:00
Samuel Attard
3ada079fe3 docs: update versioning doc for new major-x-y format (#23176) 2020-04-21 12:17:37 -07:00
Electron Bot
6e8446d06d chore: bump chromium to a70ba0e79c1551239beb37961f643 (master) (#23199)
* chore: bump chromium in DEPS to 4b8b82c4e48a70ba0e79c1551239beb37961f643

* update patches

Co-authored-by: Electron Bot <anonymous@electronjs.org>
2020-04-21 14:10:23 -04:00
Shelley Vohr
f3dc3997b1 feat: support fullScreen BrowserWindow property (#23145) 2020-04-20 20:25:18 -07:00
Robo
928e23a263 fix: cherry-pick 04dab5a91b61 from chromium (#23179)
* [LayoutNG] Make HitTestResult::LocalPoint() for inline element as same as legacy layout

https://chromium-review.googlesource.com/c/chromium/src/+/2151775

* update patches

Co-authored-by: Electron Bot <anonymous@electronjs.org>
2020-04-20 18:33:40 -07:00
Electron Bot
1bbb407dc9 chore: bump chromium to 2600291d041c530698616a4716cdf (master) (#23122)
* chore: bump chromium in DEPS to 99e60beb593ecf98f8a441e3f03a13b68cfcb311

* update patches

* chore: bump chromium in DEPS to b1abadda21f417ba5e8276c4dd779d31445d16cd

* update patches

* 2146532: gtkui: Fix standalone Ozone/Wayland configuration

https://chromium-review.googlesource.com/c/chromium/src/+/2146532

* 2145152: Pass source URL when setting a cookie

https://chromium-review.googlesource.com/c/chromium/src/+/2145152

* lint

* chore: bump chromium in DEPS to 8897189f1da5a3670bbe32d343767fd71f80d779

* chore: bump chromium in DEPS to 8ac51eeee93a02ed5b81f47e28627079edeecde0

* chore: bump chromium in DEPS to e897b8003f3a5f3c8d654eee9b03c513046ae7ea

* chore: bump chromium in DEPS to 7b80f9c82122600291d041c530698616a4716cdf

* Update patches

* Move definition of WebInputEvent enums into mojo

https://chromium-review.googlesource.com/c/chromium/src/+/2152777

* update patches

Co-authored-by: Electron Bot <anonymous@electronjs.org>
Co-authored-by: Jeremy Apthorp <nornagon@nornagon.net>
Co-authored-by: John Kleinschmidt <jkleinsc@github.com>
2020-04-20 20:25:38 -04:00
Shelley Vohr
ba3928103f spec: fix type errors in devToolsWebContents (#23187) 2020-04-20 16:51:27 -07:00
Jeremy Apthorp
b17cb62287 build: fix crashpad+asan (#23180) 2020-04-20 14:50:10 -07:00
Jeremy Apthorp
e65cac6ae8 refactor: remove extra args from crashreporter init (#23144) 2020-04-20 14:44:09 -07:00
loc
554830b6ff fix: explicitly mark unlimited requests as max priority (#23118)
It's done for us implicitly here, but doing it ourselves avoids the DCHECK.
```
if ((load_flags_ & LOAD_IGNORE_LIMITS) != 0)
  SetPriority(MAXIMUM_PRIORITY);
```
Refs: https://source.chromium.org/chromium/chromium/src/+/master:net/url_request/url_request.cc;l=433;drc=0e1e59c69a449885aa58c403e05feb8274a67c3b;bpv=1;bpt=1
2020-04-20 12:16:34 -07:00
John Kleinschmidt
5f2746c48b docs: update code of conduct (#23137)
Update code of conduct to Contributor Covenant v2.0 in accordance with Electron joining the OpenJS foundation
2020-04-20 14:52:58 -04:00
Erick Zhao
a3ff5a810e docs: remove GitHub references (#23136) 2020-04-20 08:33:00 -07:00
Electron Bot
27aa76f058 Bump v10.0.0-nightly.20200420 2020-04-20 08:31:48 -07:00
Jeremy Apthorp
f6e8edfb3d chore: rename renderer_ipc.cc to ipc_renderer.cc (#23125) 2020-04-20 08:18:15 -07:00
Shelley Vohr
656d371b1b docs: fix devToolsWebContents union type (#23143) 2020-04-20 08:08:51 -07:00
Electron Bot
41b514f088 Bump v10.0.0-nightly.20200417 2020-04-17 08:31:42 -07:00
Shelley Vohr
8b2e863a30 fix: wasm codegen in script.runInNewContext (#23129) 2020-04-16 18:46:09 -07:00
Jeremy Apthorp
2541d62486 chore: remove disable_user_gesture... patch (#23066) 2020-04-16 15:22:39 -07:00
Samuel Attard
e4c82fdf2d Merge pull request from GHSA-h9jc-284h-533g 2020-04-16 14:10:18 -07:00
Shelley Vohr
d0f19d8369 fix: diagnostic reporting capabilities in Node.js (#23126) 2020-04-16 14:07:00 -07:00
Shelley Vohr
826e749e2b chore: shrink boringssl patch (#23101) 2020-04-16 10:54:15 -07:00
Felix Rieseberg
7d9e4a74c4 docs: Improve the codesigning docs (#22838)
* docs: Improve the codesigning docs

* docs: Clarify builder notarization

* Update docs/tutorial/code-signing.md

Co-Authored-By: Mark Lee <malept@users.noreply.github.com>

* Update docs/tutorial/code-signing.md

Co-Authored-By: Mark Lee <malept@users.noreply.github.com>

* Update docs/tutorial/code-signing.md

Co-Authored-By: Mark Lee <malept@users.noreply.github.com>

* Update docs/tutorial/code-signing.md

Co-Authored-By: Mark Lee <malept@users.noreply.github.com>

* Update docs/tutorial/code-signing.md

Co-Authored-By: Mark Lee <malept@users.noreply.github.com>

* Update docs/tutorial/code-signing.md

Co-Authored-By: Mark Lee <malept@users.noreply.github.com>

* Update docs/tutorial/code-signing.md

Co-Authored-By: Mark Lee <malept@users.noreply.github.com>

* Update docs/tutorial/code-signing.md

Co-Authored-By: Mark Lee <malept@users.noreply.github.com>

* Update docs/tutorial/code-signing.md

Co-Authored-By: Mark Lee <malept@users.noreply.github.com>

* Update docs/tutorial/code-signing.md

Co-Authored-By: Mark Lee <malept@users.noreply.github.com>

Co-authored-by: Mark Lee <malept@users.noreply.github.com>
2020-04-16 10:30:33 -07:00
Shelley Vohr
37e92b7650 docs: explain the swipe event on macOS (#23117) 2020-04-16 09:16:11 -07:00
92 changed files with 1460 additions and 541 deletions

View File

@@ -505,7 +505,7 @@ source_set("electron_lib") {
if (use_x11) {
deps += [
"//ui/gfx/x",
"//ui/gtk:x",
"//ui/gtk/x",
]
}
configs += [ ":gio_unix" ]
@@ -757,6 +757,12 @@ if (is_mac) {
outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
public_deps = [ "//third_party/crashpad/crashpad/handler:crashpad_handler" ]
if (is_asan) {
# crashpad_handler requires the ASan runtime at its @executable_path.
sources += [ "$root_out_dir/libclang_rt.asan_osx_dynamic.dylib" ]
public_deps += [ "//build/config/sanitizers:copy_asan_runtime" ]
}
}
mac_framework_bundle("electron_framework") {

View File

@@ -1,46 +1,135 @@
# Contributor Covenant Code of Conduct:
# Code of Conduct
## Our Pledge
As a member project of the OpenJS Foundation, Electron uses [Contributor Covenant v2.0](https://contributor-covenant.org/version/2/0/code_of_conduct) as their code of conduct. The full text is included [below](#contributor-covenant-code-of-conduct) in English, and translations are available from the Contributor Covenant organisation:
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
- [contributor-covenant.org/translations](https://www.contributor-covenant.org/translations)
- [github.com/ContributorCovenant](https://github.com/ContributorCovenant/contributor_covenant/tree/release/content/version/2/0)
## Our Standards
## Contributor Covenant Code of Conduct
Examples of behavior that contributes to creating a positive environment include:
### Our Pledge
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.
Examples of unacceptable behavior by participants include:
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
### Our Standards
Examples of behavior that contributes to a positive environment for our
community include:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
### Enforcement Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.
## Scope
### Scope
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
## Enforcement
### Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [coc@electronjs.org](mailto:coc@electronjs.org). All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
[coc@electronjs.org](mailto:coc@electronjs.org).
All complaints will be reviewed and investigated promptly and fairly.
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
## Attribution
### Enforcement Guidelines
This Code of Conduct is adapted from the [Contributor-Covenant][homepage], version 1.4, available at [https://contributor-covenant.org/version/1/4][version]
Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:
[homepage]: https://contributor-covenant.org
[version]: https://contributor-covenant.org/version/1/4/
#### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.
#### 2. Warning
**Community Impact**: A violation through a single incident or series
of actions.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.
#### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.
#### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within
the community.
### Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.

2
DEPS
View File

@@ -12,7 +12,7 @@ gclient_gn_args = [
vars = {
'chromium_version':
'c5cbec6b4ac8f405dc5d5e416ffaf640aa3d088a',
'4b8b82c4e48a70ba0e79c1551239beb37961f643',
'node_version':
'v12.16.2',
'nan_version':

View File

@@ -1 +1 @@
10.0.0-nightly.20200416
10.0.0-nightly.20200422

View File

@@ -623,6 +623,12 @@ Returns:
Emitted on 3-finger swipe. Possible directions are `up`, `right`, `down`, `left`.
The method underlying this event is built to handle older macOS-style trackpad swiping,
where the content on the screen doesn't move with the swipe. Most macOS trackpads are not
configured to allow this kind of swiping anymore, so in order for it to emit properly the
'Swipe between pages' preference in `System Preferences > Trackpad > More Gestures` must be
set to 'Swipe with two or three fingers'.
#### Event: 'rotate-gesture' _macOS_
Returns:
@@ -801,6 +807,10 @@ hide it immediately.
A `Boolean` property that determines whether the window is in simple (pre-Lion) fullscreen mode.
#### `win.fullScreen`
A `Boolean` property that determines whether the window is in fullscreen mode.
#### `win.visibleOnAllWorkspaces`
A `Boolean` property that determines whether the window is visible on all workspaces.

View File

@@ -1843,7 +1843,7 @@ A [`WebContents`](web-contents.md) instance that might own this `WebContents`.
#### `contents.devToolsWebContents` _Readonly_
A `WebContents` of DevTools for this `WebContents`.
A `WebContents | null` property that represents the of DevTools `WebContents` associated with a given `WebContents`.
**Note:** Users should never store this object because it may become `null`
when the DevTools has been closed.

View File

@@ -3,7 +3,7 @@
If you experience crashes or issues in Electron that you believe are not caused
by your JavaScript application, but instead by Electron itself, debugging can
be a little bit tricky, especially for developers not used to native/C++
debugging. However, using Visual Studio, GitHub's hosted Electron Symbol Server,
debugging. However, using Visual Studio, Electron's hosted Symbol Server,
and the Electron source code, you can enable step-through debugging
with breakpoints inside Electron's source code.
@@ -22,7 +22,7 @@ with breakpoints inside Electron's source code.
* **Visual Studio with C++ Tools**: The free community editions of Visual
Studio 2013 and Visual Studio 2015 both work. Once installed,
[configure Visual Studio to use GitHub's Electron Symbol server](setting-up-symbol-server.md).
[configure Visual Studio to use Electron's Symbol server](setting-up-symbol-server.md).
It will enable Visual Studio to gain a better understanding of what happens
inside Electron, making it easier to present variables in a human-readable
format.

View File

@@ -6,52 +6,153 @@ created by you.
On macOS the system can detect any change to the app, whether the change is
introduced accidentally or by malicious code.
On Windows the system assigns a trust level to your code signing certificate which
if you don't have, or if your trust level is low will cause security dialogs to
appear when users start using your application. Trust level builds over time
so it's better to start code signing as early as possible.
On Windows, the system assigns a trust level to your code signing certificate
which if you don't have, or if your trust level is low, will cause security
dialogs to appear when users start using your application. Trust level builds
over time so it's better to start code signing as early as possible.
While it is possible to distribute unsigned apps, it is not recommended. Both
Windows and macOS will, by default, prevent either the download or the
execution of unsigned applications. Starting with macOS Catalina (version 10.15),
users have to go through multiple manual steps to open unsigned applications.
Windows and macOS will, by default, prevent either the download or the execution
of unsigned applications. Starting with macOS Catalina (version 10.15), users
have to go through multiple manual steps to open unsigned applications.
![macOS Catalina Gatekeeper warning: The app cannot be opened because the developer cannot be verified](../images/gatekeeper.png)
![macOS Catalina Gatekeeper warning: The app cannot be opened because the
developer cannot be verified](../images/gatekeeper.png)
As you can see, users get two options: Move the app straight to the trash or
cancel running it. You don't want your users to see that dialog.
If you are building an Electron app that you intend to package and distribute,
it should be code-signed. The Mac and Windows app stores do not allow unsigned
apps.
it should be code-signed.
# Signing macOS builds
# Signing & notarizing macOS builds
Before signing macOS builds, you must do the following:
Properly preparing macOS applications for release requires two steps: First, the
app needs to be code-signed. Then, the app needs to be uploaded to Apple for a
process called "notarization", where automated systems will further verify that
your app isn't doing anything to endanger its users.
To start the process, ensure that you fulfill the requirements for signing and
notarizing your app:
1. Enroll in the [Apple Developer Program] (requires an annual fee)
2. Download and install [Xcode]
2. Download and install [Xcode] - this requires a computer running macOS
3. Generate, download, and install [signing certificates]
There are a number of tools for signing your packaged app:
Electron's ecosystem favors configuration and freedom, so there are multiple
ways to get your application signed and notarized.
- [`electron-osx-sign`] is a standalone tool for signing macOS packages.
- [`electron-packager`] bundles `electron-osx-sign`. If you're using `electron-packager`,
pass the `--osx-sign=true` flag to sign your build.
- [`electron-forge`] uses `electron-packager` internally, you can set the `osxSign` option
in your forge config.
- [`electron-builder`] has built-in code-signing capabilities. See [electron.build/code-signing](https://www.electron.build/code-signing)
## `electron-forge`
## Notarization
If you're using Electron's favorite build tool, getting your application signed
and notarized requires a few additions to your configuration. [Forge](https://electronforge.io) is a
collection of the official Electron tools, using [`electron-packager`],
[`electron-osx-sign`], and [`electron-notarize`] under the hood.
Starting with macOS Catalina, Apple requires applications to be notarized.
"Notarization" as defined by Apple means that you upload your previously signed
application to Apple for additional verification _before_ distributing the app
to your users.
Let's take a look at an example configuration with all required fields. Not all
of them are required: the tools will be clever enough to automatically find a
suitable `identity`, for instance, but we recommend that you are explicit.
To automate this process, you can use the [`electron-notarize`] module. You
do not necessarily need to complete this step for every build you make  just
the builds you intend to ship to users.
```json
{
"name": "my-app",
"version": "0.0.1",
"config": {
"forge": {
"packagerConfig": {
"osxSign": {
"identity": "Developer ID Application: Felix Rieseberg (LT94ZKYDCJ)",
"hardened-runtime": true,
"entitlements": "entitlements.plist",
"entitlements-inherit": "entitlements.plist",
"signature-flags": "library"
},
"osxNotarize": {
"appleId": "felix@felix.fun",
"appleIdPassword": "my-apple-id-password",
}
}
}
}
}
```
The `plist` file referenced here needs the following macOS-specific entitlements
to assure the Apple security mechanisms that your app is doing these things
without meaning any harm:
```xml
<?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>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
<key>com.apple.security.cs.debugger</key>
<true/>
</dict>
</plist>
```
To see all of this in action, check out Electron Fiddle's source code,
[especially its `electron-forge` configuration
file](https://github.com/electron/fiddle/blob/master/forge.config.js).
## `electron-builder`
Electron Builder comes with a custom solution for signing your application. You
can find [its documentation here](https://www.electron.build/code-signing).
## `electron-packager`
If you're not using an integrated build pipeline like Forge or Builder, you
are likely using [`electron-packager`], which includes [`electron-osx-sign`] and
[`electron-notarize`].
If you're using Packager's API, you can pass [in configuration that both signs
and notarizes your
application](https://electron.github.io/electron-packager/master/interfaces/electronpackager.options.html).
```js
const packager = require('electron-packager')
packager({
dir: '/path/to/my/app',
osxSign: {
identity: 'Developer ID Application: Felix Rieseberg (LT94ZKYDCJ)',
'hardened-runtime': true,
entitlements: 'entitlements.plist',
'entitlements-inherit': 'entitlements.plist',
'signature-flags': 'library'
},
osxNotarize: {
appleId: 'felix@felix.fun',
appleIdPassword: 'my-apple-id-password'
}
})
```
The `plist` file referenced here needs the following macOS-specific entitlements
to assure the Apple security mechanisms that your app is doing these things
without meaning any harm:
```xml
<?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>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
<key>com.apple.security.cs.debugger</key>
<true/>
</dict>
</plist>
```
## Mac App Store
@@ -62,19 +163,24 @@ See the [Mac App Store Guide].
Before signing Windows builds, you must do the following:
1. Get a Windows Authenticode code signing certificate (requires an annual fee)
2. Install Visual Studio 2015/2017 (to get the signing utility)
2. Install Visual Studio to get the signing utility (the free [Community
Edition](https://visualstudio.microsoft.com/vs/community/) is enough)
You can get a code signing certificate from a lot of resellers. Prices vary, so it may be worth your time to shop around. Popular resellers include:
You can get a code signing certificate from a lot of resellers. Prices vary, so
it may be worth your time to shop around. Popular resellers include:
* [digicert](https://www.digicert.com/code-signing/microsoft-authenticode.htm)
* [Comodo](https://www.comodo.com/landing/ssl-certificate/authenticode-signature/)
* [GoDaddy](https://au.godaddy.com/web-security/code-signing-certificate)
* Amongst others, please shop around to find one that suits your needs, Google is your friend :)
* Amongst others, please shop around to find one that suits your needs, Google
is your friend 😄
There are a number of tools for signing your packaged app:
- [`electron-winstaller`] will generate an installer for windows and sign it for you
- [`electron-forge`] can sign installers it generates through the Squirrel.Windows or MSI targets.
- [`electron-winstaller`] will generate an installer for windows and sign it for
you
- [`electron-forge`] can sign installers it generates through the
Squirrel.Windows or MSI targets.
- [`electron-builder`] can sign some of its windows targets
## Windows Store

View File

@@ -57,7 +57,7 @@ Stabilization branches are branches that run parallel to master, taking in only
![](../images/versioning-sketch-1.png)
Stabilization branches are always either **major** or **minor** version lines, and named against the following template `$MAJOR-$MINOR-x` e.g. `2-0-x`.
Since Electron 8, stabilization branches are always **major** version lines, and named against the following template `$MAJOR-x-y` e.g. `8-x-y`. Prior to that we used **minor** version lines and named them as `$MAJOR-$MINOR-x` e.g. `2-0-x`
We allow for multiple stabilization branches to exist simultaneously, and intend to support at least two in parallel at all times, backporting security fixes as necessary.
![](../images/versioning-sketch-2.png)

View File

@@ -7,7 +7,7 @@ Electron's [autoUpdater](../api/auto-updater.md) module.
## Using `update.electronjs.org`
GitHub's Electron team maintains [update.electronjs.org], a free and open-source
The Electron team maintains [update.electronjs.org], a free and open-source
webservice that Electron apps can use to self-update. The service is designed
for Electron apps that meet the following criteria:

View File

@@ -274,7 +274,7 @@ auto_filenames = {
"lib/common/define-properties.ts",
"lib/common/electron-binding-setup.ts",
"lib/common/init.ts",
"lib/common/parse-features-string.js",
"lib/common/parse-features-string.ts",
"lib/common/reset-search-paths.ts",
"lib/common/type-utils.ts",
"lib/common/web-view-methods.ts",

View File

@@ -581,7 +581,7 @@ filenames = {
"shell/renderer/api/context_bridge/render_frame_function_store.h",
"shell/renderer/api/electron_api_context_bridge.cc",
"shell/renderer/api/electron_api_context_bridge.h",
"shell/renderer/api/electron_api_renderer_ipc.cc",
"shell/renderer/api/electron_api_ipc_renderer.cc",
"shell/renderer/api/electron_api_spell_check_client.cc",
"shell/renderer/api/electron_api_spell_check_client.h",
"shell/renderer/api/electron_api_web_frame.cc",

View File

@@ -29,6 +29,11 @@ Object.defineProperty(TopLevelWindow.prototype, 'visibleOnAllWorkspaces', {
set: function (visible) { this.setVisibleOnAllWorkspaces(visible); }
});
Object.defineProperty(TopLevelWindow.prototype, 'fullScreen', {
get: function () { return this.isFullScreen(); },
set: function (full) { this.setFullScreen(full); }
});
Object.defineProperty(TopLevelWindow.prototype, 'simpleFullScreen', {
get: function () { return this.isSimpleFullScreen(); },
set: function (simple) { this.setSimpleFullScreen(simple); }

View File

@@ -11,7 +11,7 @@ const { internalWindowOpen } = require('@electron/internal/browser/guest-window-
const NavigationController = require('@electron/internal/browser/navigation-controller');
const { ipcMainInternal } = require('@electron/internal/browser/ipc-main-internal');
const ipcMainUtils = require('@electron/internal/browser/ipc-main-internal-utils');
const { convertFeaturesString } = require('@electron/internal/common/parse-features-string');
const { parseFeatures } = require('@electron/internal/common/parse-features-string');
const { MessagePortMain } = require('@electron/internal/browser/message-port-main');
// session is not used here, the purpose is to make sure session is initalized
@@ -511,11 +511,13 @@ WebContents.prototype._init = function () {
// Make new windows requested by links behave like "window.open".
this.on('-new-window', (event, url, frameName, disposition,
rawFeatures, referrer, postData) => {
const { options, additionalFeatures } = convertFeaturesString(rawFeatures, frameName);
const { options, webPreferences, additionalFeatures } = parseFeatures(rawFeatures);
const mergedOptions = {
show: true,
width: 800,
height: 600,
title: frameName,
webPreferences,
...options
};
@@ -533,12 +535,14 @@ WebContents.prototype._init = function () {
return;
}
const { options, additionalFeatures } = convertFeaturesString(rawFeatures, frameName);
const { options, webPreferences, additionalFeatures } = parseFeatures(rawFeatures);
const mergedOptions = {
show: true,
width: 800,
height: 600,
webContents,
title: frameName,
webPreferences,
...options
};

View File

@@ -3,7 +3,7 @@
const { webContents } = require('electron');
const { ipcMainInternal } = require('@electron/internal/browser/ipc-main-internal');
const ipcMainUtils = require('@electron/internal/browser/ipc-main-internal-utils');
const { parseFeaturesString } = require('@electron/internal/common/parse-features-string');
const { parseWebViewWebPreferences } = require('@electron/internal/common/parse-features-string');
const { syncMethods, asyncMethods, properties } = require('@electron/internal/common/web-view-methods');
const { serialize } = require('@electron/internal/common/type-utils');
@@ -184,6 +184,13 @@ const attachGuest = function (event, embedderFrameId, elementInstanceId, guestIn
}
}
// parse the 'webpreferences' attribute string, if set
// this uses the same parsing rules as window.open uses for its features
const parsedWebPreferences =
typeof params.webpreferences === 'string'
? parseWebViewWebPreferences(params.webpreferences)
: null;
const webPreferences = {
guestInstanceId: guestInstanceId,
nodeIntegration: params.nodeintegration != null ? params.nodeintegration : false,
@@ -194,21 +201,10 @@ const attachGuest = function (event, embedderFrameId, elementInstanceId, guestIn
disablePopups: !params.allowpopups,
webSecurity: !params.disablewebsecurity,
enableBlinkFeatures: params.blinkfeatures,
disableBlinkFeatures: params.disableblinkfeatures
disableBlinkFeatures: params.disableblinkfeatures,
...parsedWebPreferences
};
// parse the 'webpreferences' attribute string, if set
// this uses the same parsing rules as window.open uses for its features
if (typeof params.webpreferences === 'string') {
parseFeaturesString(params.webpreferences, function (key, value) {
if (value === undefined) {
// no value was specified, default it to true
value = true;
}
webPreferences[key] = value;
});
}
if (params.preload) {
webPreferences.preloadURL = params.preload;
}

View File

@@ -5,7 +5,7 @@ const { BrowserWindow } = electron;
const { isSameOrigin } = process.electronBinding('v8_util');
const { ipcMainInternal } = require('@electron/internal/browser/ipc-main-internal');
const ipcMainUtils = require('@electron/internal/browser/ipc-main-internal-utils');
const { convertFeaturesString } = require('@electron/internal/common/parse-features-string');
const { parseFeatures } = require('@electron/internal/common/parse-features-string');
const hasProp = {}.hasOwnProperty;
const frameToGuest = new Map();
@@ -224,7 +224,10 @@ ipcMainInternal.on('ELECTRON_GUEST_WINDOW_MANAGER_WINDOW_OPEN', (event, url, fra
if (features == null) features = '';
const disposition = 'new-window';
const { options, additionalFeatures } = convertFeaturesString(features, frameName);
const { options, webPreferences, additionalFeatures } = parseFeatures(features);
if (!options.title) options.title = frameName;
options.webPreferences = webPreferences;
const referrer = { url: '', policy: 'default' };
internalWindowOpen(event, url, referrer, frameName, disposition, options, additionalFeatures, null);
});

View File

@@ -41,7 +41,7 @@ class CrashReporter {
if (extra._companyName == null) extra._companyName = companyName;
if (extra._version == null) extra._version = ret.appVersion;
binding.start(ret.productName, companyName, submitURL, ret.crashesDirectory, uploadToServer, ignoreSystemCrashHandler, rateLimit, compress, extra);
binding.start(submitURL, ret.crashesDirectory, uploadToServer, ignoreSystemCrashHandler, rateLimit, compress, extra);
}
getLastCrashReport () {

View File

@@ -1,85 +0,0 @@
'use strict';
// parses a feature string that has the format used in window.open()
// - `features` input string
// - `emit` function(key, value) - called for each parsed KV
function parseFeaturesString (features, emit) {
features = `${features}`.trim();
// split the string by ','
features.split(/\s*,\s*/).forEach((feature) => {
// expected form is either a key by itself or a key/value pair in the form of
// 'key=value'
let [key, value] = feature.split(/\s*=\s*/);
if (!key) return;
// interpret the value as a boolean, if possible
value = (value === 'yes' || value === '1') ? true : (value === 'no' || value === '0') ? false : value;
// emit the parsed pair
emit(key, value);
});
}
function convertFeaturesString (features, frameName) {
const options = {};
const ints = ['x', 'y', 'width', 'height', 'minWidth', 'maxWidth', 'minHeight', 'maxHeight', 'zoomFactor'];
const webPreferences = ['zoomFactor', 'nodeIntegration', 'enableRemoteModule', 'preload', 'javascript', 'contextIsolation', 'webviewTag'];
// Used to store additional features
const additionalFeatures = [];
// Parse the features
parseFeaturesString(features, function (key, value) {
if (value === undefined) {
additionalFeatures.push(key);
} else {
// Don't allow webPreferences to be set since it must be an object
// that cannot be directly overridden
if (key === 'webPreferences') return;
if (webPreferences.includes(key)) {
if (options.webPreferences == null) {
options.webPreferences = {};
}
options.webPreferences[key] = value;
} else {
options[key] = value;
}
}
});
if (options.left) {
if (options.x == null) {
options.x = options.left;
}
}
if (options.top) {
if (options.y == null) {
options.y = options.top;
}
}
if (options.title == null) {
options.title = frameName;
}
if (options.width == null) {
options.width = 800;
}
if (options.height == null) {
options.height = 600;
}
for (const name of ints) {
if (options[name] != null) {
options[name] = parseInt(options[name], 10);
}
}
return {
options, additionalFeatures
};
}
module.exports = {
parseFeaturesString, convertFeaturesString
};

View File

@@ -0,0 +1,110 @@
/**
* Utilities to parse comma-separated key value pairs used in browser APIs.
* For example: "x=100,y=200,width=500,height=500"
*/
import { BrowserWindowConstructorOptions } from 'electron';
type RequiredBrowserWindowConstructorOptions = Required<BrowserWindowConstructorOptions>;
type IntegerBrowserWindowOptionKeys = {
[K in keyof RequiredBrowserWindowConstructorOptions]:
RequiredBrowserWindowConstructorOptions[K] extends number ? K : never
}[keyof RequiredBrowserWindowConstructorOptions];
// This could be an array of keys, but an object allows us to add a compile-time
// check validating that we haven't added an integer property to
// BrowserWindowConstructorOptions that this module doesn't know about.
const keysOfTypeNumberCompileTimeCheck: { [K in IntegerBrowserWindowOptionKeys] : true } = {
x: true,
y: true,
width: true,
height: true,
minWidth: true,
maxWidth: true,
minHeight: true,
maxHeight: true,
opacity: true
};
// Note `top` / `left` are special cases from the browser which we later convert
// to y / x.
const keysOfTypeNumber = ['top', 'left', ...Object.keys(keysOfTypeNumberCompileTimeCheck)];
/**
* Note that we only allow "0" and "1" boolean conversion when the type is known
* not to be an integer.
*
* The coercion of yes/no/1/0 represents best effort accordance with the spec:
* https://html.spec.whatwg.org/multipage/window-object.html#concept-window-open-features-parse-boolean
*/
type CoercedValue = string | number | boolean;
function coerce (key: string, value: string): CoercedValue {
if (keysOfTypeNumber.includes(key)) {
return Number(value);
}
switch (value) {
case 'true':
case '1':
case 'yes':
case undefined:
return true;
case 'false':
case '0':
case 'no':
return false;
default:
return value;
}
}
export function parseCommaSeparatedKeyValue (source: string, useSoonToBeDeprecatedBehaviorForBareKeys: boolean) {
const bareKeys = [] as string[];
const parsed = {} as { [key: string]: any };
for (const keyValuePair of source.split(',')) {
const [key, value] = keyValuePair.split('=').map(str => str.trim());
if (useSoonToBeDeprecatedBehaviorForBareKeys && value === undefined) {
bareKeys.push(key);
continue;
}
parsed[key] = coerce(key, value);
}
return { parsed, bareKeys };
}
export function parseWebViewWebPreferences (preferences: string) {
return parseCommaSeparatedKeyValue(preferences, false).parsed;
}
const allowedWebPreferences = ['zoomFactor', 'nodeIntegration', 'enableRemoteModule', 'preload', 'javascript', 'contextIsolation', 'webviewTag'] as const;
type AllowedWebPreference = (typeof allowedWebPreferences)[number];
/**
* Parses a feature string that has the format used in window.open().
*
* `useSoonToBeDeprecatedBehaviorForBareKeys` — In the html spec, windowFeatures keys
* without values are interpreted as `true`. Previous versions of Electron did
* not respect this. In order to not break any applications, this will be
* flipped in the next major version.
*/
export function parseFeatures (
features: string,
useSoonToBeDeprecatedBehaviorForBareKeys: boolean = true
) {
const { parsed, bareKeys } = parseCommaSeparatedKeyValue(features, useSoonToBeDeprecatedBehaviorForBareKeys);
const webPreferences: { [K in AllowedWebPreference]?: any } = {};
allowedWebPreferences.forEach((key) => {
if (parsed[key] === undefined) return;
webPreferences[key] = parsed[key];
delete parsed[key];
});
if (parsed.left !== undefined) parsed.x = parsed.left;
if (parsed.top !== undefined) parsed.y = parsed.top;
return {
options: parsed as Omit<BrowserWindowConstructorOptions, 'webPreferences'> & { [key: string]: CoercedValue },
webPreferences,
additionalFeatures: bareKeys
};
}

View File

@@ -1,6 +1,6 @@
{
"name": "electron",
"version": "10.0.0-nightly.20200416",
"version": "10.0.0-nightly.20200422",
"repository": "https://github.com/electron/electron",
"description": "Build cross platform desktop apps with JavaScript, HTML, and CSS",
"devDependencies": {

View File

@@ -12,7 +12,6 @@ render_widget_host_view_base.patch
render_widget_host_view_mac.patch
thread_capabilities.patch
webview_cross_drag.patch
disable_user_gesture_requirement_for_beforeunload_dialogs.patch
gin_enable_disable_v8_platform.patch
blink-worker-enable-csp-in-file-scheme.patch
disable-redraw-lock.patch

View File

@@ -10,7 +10,7 @@ WebContents, and cancels the authentication if there's no WebContents
available, which there isn't in the case of the 'net' module.
diff --git a/services/network/public/mojom/network_context.mojom b/services/network/public/mojom/network_context.mojom
index a0d035ef7cbc701916ef0e10ce33ee62bae0777e..e556caa1e1f013559130794601fb9f3c098e5553 100644
index 45e920425345dd3cdb2427df5f60f6d8cc81e07a..9f3e54bb0dc28ed6d6c2c49686bb24bb50d27a78 100644
--- a/services/network/public/mojom/network_context.mojom
+++ b/services/network/public/mojom/network_context.mojom
@@ -161,6 +161,25 @@ struct HttpAuthStaticNetworkContextParams {
@@ -49,10 +49,10 @@ index a0d035ef7cbc701916ef0e10ce33ee62bae0777e..e556caa1e1f013559130794601fb9f3c
// the per-context allow patterns that is managed via NetworkContext
// interface. This still respects the per-context block lists.
diff --git a/services/network/url_loader.cc b/services/network/url_loader.cc
index 2664641db02ca54ff8e95a42a90fdb02de0f4b32..417fb715a846af104086d00802abaf00f7bc226e 100644
index 017193c28b387615dad57d50ceffe1c916fc7bea..ef8b093d4f7b13d9f7e7c25ce90c7cc1891dde0a 100644
--- a/services/network/url_loader.cc
+++ b/services/network/url_loader.cc
@@ -470,6 +470,7 @@ URLLoader::URLLoader(
@@ -471,6 +471,7 @@ URLLoader::URLLoader(
base::WeakPtr<KeepaliveStatisticsRecorder> keepalive_statistics_recorder,
base::WeakPtr<NetworkUsageAccumulator> network_usage_accumulator,
mojom::TrustedURLLoaderHeaderClient* url_loader_header_client,
@@ -60,7 +60,7 @@ index 2664641db02ca54ff8e95a42a90fdb02de0f4b32..417fb715a846af104086d00802abaf00
mojom::OriginPolicyManager* origin_policy_manager,
std::unique_ptr<TrustTokenRequestHelperFactory> trust_token_helper_factory)
: url_request_context_(url_request_context),
@@ -526,6 +527,11 @@ URLLoader::URLLoader(
@@ -527,6 +528,11 @@ URLLoader::URLLoader(
header_client_.set_disconnect_handler(
base::BindOnce(&URLLoader::OnMojoDisconnect, base::Unretained(this)));
}
@@ -72,7 +72,7 @@ index 2664641db02ca54ff8e95a42a90fdb02de0f4b32..417fb715a846af104086d00802abaf00
if (want_raw_headers_) {
options_ |= mojom::kURLLoadOptionSendSSLInfoWithResponse |
mojom::kURLLoadOptionSendSSLInfoForCertificateError;
@@ -1015,7 +1021,7 @@ void URLLoader::OnReceivedRedirect(net::URLRequest* url_request,
@@ -1016,7 +1022,7 @@ void URLLoader::OnReceivedRedirect(net::URLRequest* url_request,
void URLLoader::OnAuthRequired(net::URLRequest* url_request,
const net::AuthChallengeInfo& auth_info) {
@@ -81,7 +81,7 @@ index 2664641db02ca54ff8e95a42a90fdb02de0f4b32..417fb715a846af104086d00802abaf00
OnAuthCredentials(base::nullopt);
return;
}
@@ -1031,11 +1037,20 @@ void URLLoader::OnAuthRequired(net::URLRequest* url_request,
@@ -1032,11 +1038,20 @@ void URLLoader::OnAuthRequired(net::URLRequest* url_request,
if (url_request->response_headers())
head->headers = url_request->response_headers();
head->auth_challenge_info = auth_info;

View File

@@ -14,7 +14,7 @@ when there is code doing that.
This patch reverts the change to fix the crash in Electron.
diff --git a/third_party/blink/renderer/core/frame/local_frame.cc b/third_party/blink/renderer/core/frame/local_frame.cc
index d051a7e6621e70fb86434a000d5736fea040fe1c..0100d8ec83d86a5ca225ac08f4e7534862a5e245 100644
index 9f3d51c820c850737d4ce2489bbddeee08fb1792..bd5a98dfe75bcaf3a84a9ae4e96f35caa7848aa7 100644
--- a/third_party/blink/renderer/core/frame/local_frame.cc
+++ b/third_party/blink/renderer/core/frame/local_frame.cc
@@ -472,10 +472,6 @@ void LocalFrame::DetachImpl(FrameDetachType type) {

View File

@@ -7,7 +7,7 @@ This exposes a method for obtaining a reference to an isolated world, which is
otherwise not available in the Blink API.
diff --git a/third_party/blink/public/web/web_local_frame.h b/third_party/blink/public/web/web_local_frame.h
index 8a545fcae6275e77b4dcc422be52402b96ef9d1c..fb84aa2239222a1b1ed9ddd0dd4194e326758d37 100644
index afbed9686b4fccd43991f16be15a261486c127b9..80398b633bed8cd7d04f1ecb44abc306131fa977 100644
--- a/third_party/blink/public/web/web_local_frame.h
+++ b/third_party/blink/public/web/web_local_frame.h
@@ -334,6 +334,9 @@ class WebLocalFrame : public WebFrame {
@@ -21,10 +21,10 @@ index 8a545fcae6275e77b4dcc422be52402b96ef9d1c..fb84aa2239222a1b1ed9ddd0dd4194e3
// that the script evaluated to with callback. Script execution can be
// suspend.
diff --git a/third_party/blink/renderer/core/frame/web_local_frame_impl.cc b/third_party/blink/renderer/core/frame/web_local_frame_impl.cc
index 8944b0e99d757cbe3aac98af0d86ac386c62052b..a12d14bbc49e8f3f4034cb63377aa274a41f6ffd 100644
index bef9aa2ebcebea5e57f67ac03a1b16f6b0bfaa97..5deb335845057b1fb4e051af91f926ffeb2dd270 100644
--- a/third_party/blink/renderer/core/frame/web_local_frame_impl.cc
+++ b/third_party/blink/renderer/core/frame/web_local_frame_impl.cc
@@ -924,6 +924,13 @@ v8::Local<v8::Object> WebLocalFrameImpl::GlobalProxy() const {
@@ -925,6 +925,13 @@ v8::Local<v8::Object> WebLocalFrameImpl::GlobalProxy() const {
return MainWorldScriptContext()->Global();
}
@@ -39,7 +39,7 @@ index 8944b0e99d757cbe3aac98af0d86ac386c62052b..a12d14bbc49e8f3f4034cb63377aa274
return BindingSecurity::ShouldAllowAccessToFrame(
CurrentDOMWindow(V8PerIsolateData::MainThreadIsolate()),
diff --git a/third_party/blink/renderer/core/frame/web_local_frame_impl.h b/third_party/blink/renderer/core/frame/web_local_frame_impl.h
index 27ede2774376e2fa348be97c941ab6c6d0cba88f..9d787b5e62efdf7ac495f7ef230ce2eddc47d03d 100644
index 7f031166c0e98c06a93b419e11e1b2b9989a8e4e..ca5eb27215f12d0c15d9cd4a5ecc121327977ba4 100644
--- a/third_party/blink/renderer/core/frame/web_local_frame_impl.h
+++ b/third_party/blink/renderer/core/frame/web_local_frame_impl.h
@@ -161,6 +161,8 @@ class CORE_EXPORT WebLocalFrameImpl final

View File

@@ -8,10 +8,10 @@ categories in use are known / declared. This patch is required for us
to introduce a new Electron category for Electron-specific tracing.
diff --git a/base/trace_event/builtin_categories.h b/base/trace_event/builtin_categories.h
index ac67c35bbcb0e8b73e2059c1dfd5b510235449c4..648c35ba8eae74e8264f6d0e2ac74785d31460ae 100644
index e52d62b2c66c74e3876c68be92ed1c5c7b5ba43a..8da9bcc73e7b3fe6cb6d59656cfc523239642a96 100644
--- a/base/trace_event/builtin_categories.h
+++ b/base/trace_event/builtin_categories.h
@@ -68,6 +68,7 @@
@@ -74,6 +74,7 @@
X("dwrite") \
X("DXVA Decoding") \
X("EarlyJava") \

View File

@@ -9,7 +9,7 @@ potentially prevent a window from being created.
TODO(loc): this patch is currently broken.
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc
index d3aa739956bf04de6ad0882f04d030e2901ab80d..04debb0b15a068d6216ccd7e5295a417c18c8861 100644
index 347f57759468c89583c6366e6f9769ea6e2c777a..a0183ecd4c85a4d4c1019a108311a1c3b4499d9a 100644
--- a/content/browser/frame_host/render_frame_host_impl.cc
+++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -4341,6 +4341,7 @@ void RenderFrameHostImpl::CreateNewWindow(
@@ -21,10 +21,10 @@ index d3aa739956bf04de6ad0882f04d030e2901ab80d..04debb0b15a068d6216ccd7e5295a417
&no_javascript_access);
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index b93b364cc24369589a61da02ebed82207e04d658..2076b318c689a3998ca19c8393810d53d1d986d2 100644
index d0401023f395e05a628b529275440b60731f56e1..724a39e7a7c6157583050a31e51e3a54c029cce2 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -2946,9 +2946,9 @@ RenderFrameHostDelegate* WebContentsImpl::CreateNewWindow(
@@ -2960,9 +2960,9 @@ RenderFrameHostDelegate* WebContentsImpl::CreateNewWindow(
}
if (delegate_) {

View File

@@ -7,10 +7,10 @@ spellchecker uses a few IDS_ resources. We need to load these from
Electrons grit header instead of Chromes
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
index 0723a28167732c372ca567899d48363fb61e3ba2..b2b8bc688972369f52077a76e4e70cdb89314eb7 100644
index 6292627b6fcec0a993d3c921222a2615af068005..2ec0262c4eb8a419154d412eb73209d8d5f3d560 100644
--- a/chrome/browser/BUILD.gn
+++ b/chrome/browser/BUILD.gn
@@ -5317,6 +5317,7 @@ jumbo_static_library("browser") {
@@ -5305,6 +5305,7 @@ jumbo_static_library("browser") {
deps += [
"//components/spellcheck/browser",
"//components/spellcheck/common",

View File

@@ -16,10 +16,10 @@ https://github.com/electron/electron/pull/18483#discussion_r292703588
https://github.com/electron/electron/pull/18483#issuecomment-501090683
diff --git a/third_party/crashpad/crashpad/util/win/exception_handler_server.cc b/third_party/crashpad/crashpad/util/win/exception_handler_server.cc
index 2593ff2de0327c393c30cae9962a329c5e27b64e..e89b8ff675bed2fa65263ea451d40995e0b010b7 100644
index c841f7bc5c3d9962ea24664f26c6867ded529c7b..13218a598bbd4b51cd9a045879ee20b0491f8146 100644
--- a/third_party/crashpad/crashpad/util/win/exception_handler_server.cc
+++ b/third_party/crashpad/crashpad/util/win/exception_handler_server.cc
@@ -448,9 +448,16 @@ bool ExceptionHandlerServer::ServiceClientConnection(
@@ -445,9 +445,16 @@ bool ExceptionHandlerServer::ServiceClientConnection(
DWORD real_pid = 0;
if (get_named_pipe_client_process_id(service_context.pipe(), &real_pid) &&
message.registration.client_process_id != real_pid) {

View File

@@ -19,10 +19,10 @@ https://chromium-review.googlesource.com/c/chromium/src/+/1901591, we should try
re-submitting the patch.
diff --git a/content/app/content_main_runner_impl.cc b/content/app/content_main_runner_impl.cc
index bb72915a26e298bdb81009248fb3fb4df7bddab5..00d991ad0183ec0c82d23633c86a3c0d7a6e6754 100644
index 67d7e8e69d8a9b8b34b82b83bdf688df4c17ed59..9f6b797ea0489fc87b33a36bbcaae84a2cbf05f3 100644
--- a/content/app/content_main_runner_impl.cc
+++ b/content/app/content_main_runner_impl.cc
@@ -671,7 +671,7 @@ int ContentMainRunnerImpl::Initialize(const ContentMainParams& params) {
@@ -640,7 +640,7 @@ int ContentMainRunnerImpl::Initialize(const ContentMainParams& params) {
}
#endif
@@ -32,7 +32,7 @@ index bb72915a26e298bdb81009248fb3fb4df7bddab5..00d991ad0183ec0c82d23633c86a3c0d
#if !defined(OS_ANDROID)
diff --git a/content/common/url_schemes.cc b/content/common/url_schemes.cc
index d0a31f2406ee5c0dcc1f49e09177c914e8602132..a46deedb27c6509afaad40563bb2cbf49777fe68 100644
index c00901a2a4ef59a63033c6669171ec9e3ffd2686..d637b79d9df82ad44b1eed8529024a21e0b3555b 100644
--- a/content/common/url_schemes.cc
+++ b/content/common/url_schemes.cc
@@ -49,7 +49,7 @@ std::vector<std::string>& GetMutableServiceWorkerSchemes() {
@@ -44,7 +44,7 @@ index d0a31f2406ee5c0dcc1f49e09177c914e8602132..a46deedb27c6509afaad40563bb2cbf4
// On Android and in tests, schemes may have been registered already.
if (g_registered_url_schemes)
return;
@@ -104,7 +104,8 @@ void RegisterContentSchemes() {
@@ -105,7 +105,8 @@ void RegisterContentSchemes() {
// threadsafe so must be called when GURL isn't used on any other thread. This
// is really easy to mess up, so we say that all calls to Add*Scheme in Chrome
// must be inside this function.
@@ -68,10 +68,10 @@ index 3038f9d25798f36811b6398f8cc0e7d83ecc41b0..68189c36c47ef85b345b0ccc40c456f8
// Re-initializes schemes for tests.
CONTENT_EXPORT void ReRegisterContentSchemesForTests();
diff --git a/content/public/app/content_main_delegate.cc b/content/public/app/content_main_delegate.cc
index af1200a0f2e04c1582e527b609a2e89a97bb0f4c..7ab4cd4a1d8aefcb4bd90d68870f02f3edcff5a7 100644
index 6c27d324e6235051875b88c4bc5bd362d3907f3c..06c17d6673d280fabf5b47244e7f7f7ab374f9a3 100644
--- a/content/public/app/content_main_delegate.cc
+++ b/content/public/app/content_main_delegate.cc
@@ -40,6 +40,10 @@ int ContentMainDelegate::TerminateForFatalInitializationError() {
@@ -37,6 +37,10 @@ int ContentMainDelegate::TerminateForFatalInitializationError() {
return 0;
}

View File

@@ -15,7 +15,7 @@ the redraw locking mechanism, which fixes these issues. The electron issue
can be found at https://github.com/electron/electron/issues/1821
diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc
index d887bfd2e75be9c9f3d29a6ebf6d37abb639bc4d..f9cfb7b49bd8d5eeb4d88acd99c048d06b278ccf 100644
index 0328f536a10de1ff4b6fd0a70c1b80c260aa7b87..2bb93842c74feb1d3f33d4589b7a75ceff8858ef 100644
--- a/ui/views/win/hwnd_message_handler.cc
+++ b/ui/views/win/hwnd_message_handler.cc
@@ -306,6 +306,10 @@ constexpr int kSynthesizedMouseMessagesTimeDifference = 500;
@@ -37,7 +37,7 @@ index d887bfd2e75be9c9f3d29a6ebf6d37abb639bc4d..f9cfb7b49bd8d5eeb4d88acd99c048d0
(!(GetWindowLong(hwnd_, GWL_STYLE) & WS_CAPTION) ||
!ui::win::IsAeroGlassEnabled())) {
if (should_lock_)
@@ -976,6 +981,10 @@ HWNDMessageHandler::RegisterUnadjustedMouseEvent() {
@@ -969,6 +974,10 @@ HWNDMessageHandler::RegisterUnadjustedMouseEvent() {
return scoped_enable;
}
@@ -49,7 +49,7 @@ index d887bfd2e75be9c9f3d29a6ebf6d37abb639bc4d..f9cfb7b49bd8d5eeb4d88acd99c048d0
// HWNDMessageHandler, gfx::WindowImpl overrides:
diff --git a/ui/views/win/hwnd_message_handler.h b/ui/views/win/hwnd_message_handler.h
index 7b56d58faff84a72cc8cf9f77daeafdee110ce3a..d46ba47aaa31a0b893ab43e9f70dddbc48c5ea41 100644
index 4da6edd086c9df20af7cdcb5c6020cd61166fbea..81b300c2533a3aaa6e0c343405a6040351061e27 100644
--- a/ui/views/win/hwnd_message_handler.h
+++ b/ui/views/win/hwnd_message_handler.h
@@ -203,6 +203,8 @@ class VIEWS_EXPORT HWNDMessageHandler : public gfx::WindowImpl,

View File

@@ -66,7 +66,7 @@ index cb69e08c0185f55497089505ed5b226e57140321..362f28accc248248f3bcb54955c23528
!command_line->HasSwitch(switches::kUIDisablePartialSwap);
#if defined(OS_MACOSX)
diff --git a/components/viz/service/display/gl_renderer.cc b/components/viz/service/display/gl_renderer.cc
index ceb0c4ecbe0401c0190ba683bac479392726207b..ea6166d864a96769030f9b20dfda8d0f7bb8a5c9 100644
index 9dc031e83073d4a729667e95a8b63d3c59c1da84..b4c1440cd9d998d2f5fdba012684c8f1589566e8 100644
--- a/components/viz/service/display/gl_renderer.cc
+++ b/components/viz/service/display/gl_renderer.cc
@@ -84,6 +84,9 @@
@@ -79,7 +79,7 @@ index ceb0c4ecbe0401c0190ba683bac479392726207b..ea6166d864a96769030f9b20dfda8d0f
namespace viz {
namespace {
@@ -588,8 +591,9 @@ void GLRenderer::DoDrawQuad(const DrawQuad* quad,
@@ -589,8 +592,9 @@ void GLRenderer::DoDrawQuad(const DrawQuad* quad,
void GLRenderer::DrawDebugBorderQuad(const DebugBorderDrawQuad* quad) {
SetBlendEnabled(quad->ShouldDrawWithBlending());
@@ -91,7 +91,7 @@ index ceb0c4ecbe0401c0190ba683bac479392726207b..ea6166d864a96769030f9b20dfda8d0f
// Use the full quad_rect for debug quads to not move the edges based on
// partial swaps.
@@ -1547,7 +1551,8 @@ void GLRenderer::ChooseRPDQProgram(DrawRenderPassDrawQuadParams* params,
@@ -1563,7 +1567,8 @@ void GLRenderer::ChooseRPDQProgram(DrawRenderPassDrawQuadParams* params,
params->use_color_matrix, tint_gl_composited_content_,
params->apply_shader_based_rounded_corner &&
ShouldApplyRoundedCorner(params->quad)),
@@ -101,7 +101,7 @@ index ceb0c4ecbe0401c0190ba683bac479392726207b..ea6166d864a96769030f9b20dfda8d0f
}
void GLRenderer::UpdateRPDQUniforms(DrawRenderPassDrawQuadParams* params) {
@@ -2018,7 +2023,8 @@ void GLRenderer::DrawSolidColorQuad(const SolidColorDrawQuad* quad,
@@ -2034,7 +2039,8 @@ void GLRenderer::DrawSolidColorQuad(const SolidColorDrawQuad* quad,
SetUseProgram(ProgramKey::SolidColor(use_aa ? USE_AA : NO_AA,
tint_gl_composited_content_,
ShouldApplyRoundedCorner(quad)),
@@ -111,7 +111,7 @@ index ceb0c4ecbe0401c0190ba683bac479392726207b..ea6166d864a96769030f9b20dfda8d0f
SetShaderColor(color, opacity);
if (current_program_->rounded_corner_rect_location() != -1) {
SetShaderRoundedCorner(
@@ -2173,7 +2179,8 @@ void GLRenderer::DrawContentQuadAA(const ContentDrawQuadBase* quad,
@@ -2189,7 +2195,8 @@ void GLRenderer::DrawContentQuadAA(const ContentDrawQuadBase* quad,
: NON_PREMULTIPLIED_ALPHA,
false, false, tint_gl_composited_content_,
ShouldApplyRoundedCorner(quad)),
@@ -121,7 +121,7 @@ index ceb0c4ecbe0401c0190ba683bac479392726207b..ea6166d864a96769030f9b20dfda8d0f
if (current_program_->tint_color_matrix_location() != -1) {
auto matrix = cc::DebugColors::TintCompositedContentColorTransformMatrix();
@@ -2269,7 +2276,8 @@ void GLRenderer::DrawContentQuadNoAA(const ContentDrawQuadBase* quad,
@@ -2285,7 +2292,8 @@ void GLRenderer::DrawContentQuadNoAA(const ContentDrawQuadBase* quad,
!quad->ShouldDrawWithBlending(), has_tex_clamp_rect,
tint_gl_composited_content_,
ShouldApplyRoundedCorner(quad)),
@@ -131,7 +131,7 @@ index ceb0c4ecbe0401c0190ba683bac479392726207b..ea6166d864a96769030f9b20dfda8d0f
if (current_program_->tint_color_matrix_location() != -1) {
auto matrix = cc::DebugColors::TintCompositedContentColorTransformMatrix();
@@ -2371,7 +2379,8 @@ void GLRenderer::DrawYUVVideoQuad(const YUVVideoDrawQuad* quad,
@@ -2387,7 +2395,8 @@ void GLRenderer::DrawYUVVideoQuad(const YUVVideoDrawQuad* quad,
// The source color space should never be RGB.
DCHECK_NE(src_color_space, src_color_space.GetAsFullRangeRGB());
@@ -141,7 +141,7 @@ index ceb0c4ecbe0401c0190ba683bac479392726207b..ea6166d864a96769030f9b20dfda8d0f
#if defined(OS_WIN)
// Force sRGB output on Windows for overlay candidate video quads to match
@@ -2535,7 +2544,8 @@ void GLRenderer::DrawStreamVideoQuad(const StreamVideoDrawQuad* quad,
@@ -2551,7 +2560,8 @@ void GLRenderer::DrawStreamVideoQuad(const StreamVideoDrawQuad* quad,
SetUseProgram(ProgramKey::VideoStream(tex_coord_precision,
ShouldApplyRoundedCorner(quad)),
@@ -151,7 +151,7 @@ index ceb0c4ecbe0401c0190ba683bac479392726207b..ea6166d864a96769030f9b20dfda8d0f
DCHECK_EQ(GL_TEXTURE0, GetActiveTextureUnit(gl_));
gl_->BindTexture(GL_TEXTURE_EXTERNAL_OES, lock.texture_id());
@@ -2600,8 +2610,8 @@ void GLRenderer::FlushTextureQuadCache(BoundGeometry flush_binding) {
@@ -2616,8 +2626,8 @@ void GLRenderer::FlushTextureQuadCache(BoundGeometry flush_binding) {
draw_cache_.nearest_neighbor ? GL_NEAREST : GL_LINEAR);
// Bind the program to the GL state.
@@ -162,7 +162,7 @@ index ceb0c4ecbe0401c0190ba683bac479392726207b..ea6166d864a96769030f9b20dfda8d0f
if (current_program_->rounded_corner_rect_location() != -1) {
SetShaderRoundedCorner(
@@ -3340,7 +3350,9 @@ void GLRenderer::PrepareGeometry(BoundGeometry binding) {
@@ -3356,7 +3366,9 @@ void GLRenderer::PrepareGeometry(BoundGeometry binding) {
void GLRenderer::SetUseProgram(const ProgramKey& program_key_no_color,
const gfx::ColorSpace& src_color_space,
const gfx::ColorSpace& dst_color_space) {
@@ -173,7 +173,7 @@ index ceb0c4ecbe0401c0190ba683bac479392726207b..ea6166d864a96769030f9b20dfda8d0f
// If the input color space is PQ, and it did not specify a white level,
// override it with the frame's white level.
@@ -3722,9 +3734,9 @@ void GLRenderer::CopyRenderPassDrawQuadToOverlayResource(
@@ -3738,9 +3750,9 @@ void GLRenderer::CopyRenderPassDrawQuadToOverlayResource(
cc::MathUtil::CheckedRoundUp(iosurface_height, iosurface_multiple);
}
@@ -186,7 +186,7 @@ index ceb0c4ecbe0401c0190ba683bac479392726207b..ea6166d864a96769030f9b20dfda8d0f
*new_bounds = gfx::RectF(updated_dst_rect.origin(),
gfx::SizeF((*overlay_texture)->texture.size()));
@@ -3943,8 +3955,8 @@ void GLRenderer::FlushOverdrawFeedback(const gfx::Rect& output_rect) {
@@ -3959,8 +3971,8 @@ void GLRenderer::FlushOverdrawFeedback(const gfx::Rect& output_rect) {
PrepareGeometry(SHARED_BINDING);
@@ -197,7 +197,7 @@ index ceb0c4ecbe0401c0190ba683bac479392726207b..ea6166d864a96769030f9b20dfda8d0f
gfx::Transform render_matrix;
render_matrix.Translate(0.5 * output_rect.width() + output_rect.x(),
@@ -4053,3 +4065,5 @@ gfx::Size GLRenderer::GetRenderPassBackingPixelSize(
@@ -4074,3 +4086,5 @@ gfx::Size GLRenderer::GetRenderPassBackingPixelSize(
}
} // namespace viz
@@ -216,7 +216,7 @@ index d47312d5f89939eab55cfa94bd3fbd41a4bd7d2a..da2f5e9fdc0fda37c82357a12f4fa28f
service_manager::switches::kGpuSandboxAllowSysVShm,
service_manager::switches::kGpuSandboxFailuresFatal,
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index 1106c583146c5903fa8dc3868bd99061dbb88538..66d328457ed16d461bde3f316d3aef8e41e5efe3 100644
index 495e90285de38991e43425023aeaa8437254857b..ec383524faa4ddf738c915d309d660440a095cc7 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -228,6 +228,7 @@
@@ -236,7 +236,7 @@ index 1106c583146c5903fa8dc3868bd99061dbb88538..66d328457ed16d461bde3f316d3aef8e
service_manager::switches::kDisableInProcessStackTraces,
service_manager::switches::kDisableSeccompFilterSandbox,
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index 754621e31a6a07e52f9b4609c8263b2c1a17c246..95006fe1f4d1fefb51c2311d6323332d7c176fd4 100644
index 1f6ff811150998e2f307564e8aa1766056a9abbb..66bb6e241070965f42c6e9a2b8d24731acedd61e 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -2673,6 +2673,9 @@ cc::LayerTreeSettings RenderWidget::GenerateLayerTreeSettings(

View File

@@ -6,7 +6,7 @@ Subject: fix: disabling compositor recycling
Compositor recycling is useful for Chrome because there can be many tabs and spinning up a compositor for each one would be costly. In practice, Chrome uses the parent compositor code path of browser_compositor_view_mac.mm; the NSView of each tab is detached when it's hidden and attached when it's shown. For Electron, there is no parent compositor, so we're forced into the "own compositor" code path, which seems to be non-optimal and pretty ruthless in terms of the release of resources. Electron has no real concept of multiple tabs per window, so it should be okay to disable this ruthless recycling altogether in Electron.
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm
index f293a15c6145422707c22aeb5a254ad71a31900c..472869202ff8a62d854c9ca39ca9f14e2f91e8cf 100644
index 878837a454336afe177c3113062a1e8c8fff9076..17e3fe40522e088057eaf01a290b658a0b6d1d01 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -472,7 +472,11 @@ void RenderWidgetHostViewMac::WasOccluded() {

View File

@@ -1,22 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aleksei Kuzmin <alkuzmin@microsoft.com>
Date: Thu, 20 Sep 2018 17:47:33 -0700
Subject: disable_user_gesture_requirement_for_beforeunload_dialogs.patch
See https://github.com/electron/electron/issues/10754
diff --git a/third_party/blink/renderer/core/dom/document.cc b/third_party/blink/renderer/core/dom/document.cc
index 002633988171955abfa7418dddbaea10dcd99981..4be5be505bd658666f0189e4ec2ab132fc0dde32 100644
--- a/third_party/blink/renderer/core/dom/document.cc
+++ b/third_party/blink/renderer/core/dom/document.cc
@@ -4157,7 +4157,9 @@ bool Document::DispatchBeforeUnloadEvent(ChromeClient* chrome_client,
"frame that never had a user gesture since its load. "
"https://www.chromestatus.com/feature/5082396709879808";
Intervention::GenerateReport(frame_, "BeforeUnloadNoGesture", message);
- return true;
+ // TODO(alexeykuzmin): Uncomment `return true` when Electron tests are fixed.
+ // See https://github.com/electron/electron/issues/10754
+ // return true;
}
if (did_allow_navigation) {

View File

@@ -33,10 +33,10 @@ index 0ccfe130f00ec3b6c75cd8ee04d5a2777e1fd00c..653829457d58bf92057cc36aa8a28970
DISALLOW_COPY_AND_ASSIGN(StaticHttpUserAgentSettings);
};
diff --git a/services/network/network_context.cc b/services/network/network_context.cc
index 95a9d94838debcb64993e0a2533769d96e38dc1d..a16bb8858da2160288db8e67a565869e6b6a13ee 100644
index fa804e8f46ce96af4d9c1c2172220b0780729103..4e84b19cd515883f9dd1db4672ab1a3fccbf00f3 100644
--- a/services/network/network_context.cc
+++ b/services/network/network_context.cc
@@ -1029,6 +1029,13 @@ void NetworkContext::SetNetworkConditions(
@@ -1044,6 +1044,13 @@ void NetworkContext::SetNetworkConditions(
std::move(network_conditions));
}
@@ -51,10 +51,10 @@ index 95a9d94838debcb64993e0a2533769d96e38dc1d..a16bb8858da2160288db8e67a565869e
// This may only be called on NetworkContexts created with the constructor
// that calls MakeURLRequestContext().
diff --git a/services/network/network_context.h b/services/network/network_context.h
index fccf53cd1a7188685345764c599e16d85d8ee92b..6160cbb5f3e6d2fdcf1f205d84ca28283b6366ff 100644
index b70111eda2ed582e2b81e0364c6e5fade743515b..2682dc391d23cb9fe568c182ed55cc43412d9a1c 100644
--- a/services/network/network_context.h
+++ b/services/network/network_context.h
@@ -236,6 +236,7 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) NetworkContext
@@ -238,6 +238,7 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) NetworkContext
void CloseIdleConnections(CloseIdleConnectionsCallback callback) override;
void SetNetworkConditions(const base::UnguessableToken& throttling_profile_id,
mojom::NetworkConditionsPtr conditions) override;
@@ -63,10 +63,10 @@ index fccf53cd1a7188685345764c599e16d85d8ee92b..6160cbb5f3e6d2fdcf1f205d84ca2828
void SetEnableReferrers(bool enable_referrers) override;
#if defined(OS_CHROMEOS)
diff --git a/services/network/public/mojom/network_context.mojom b/services/network/public/mojom/network_context.mojom
index 44b00a1fc341de0adba9a2c908a4ce248bc02805..a0d035ef7cbc701916ef0e10ce33ee62bae0777e 100644
index 485960c69443533461da4f95d2e73995f604702f..45e920425345dd3cdb2427df5f60f6d8cc81e07a 100644
--- a/services/network/public/mojom/network_context.mojom
+++ b/services/network/public/mojom/network_context.mojom
@@ -1015,6 +1015,9 @@ interface NetworkContext {
@@ -1021,6 +1021,9 @@ interface NetworkContext {
SetNetworkConditions(mojo_base.mojom.UnguessableToken throttling_profile_id,
NetworkConditions? conditions);
@@ -77,10 +77,10 @@ index 44b00a1fc341de0adba9a2c908a4ce248bc02805..a0d035ef7cbc701916ef0e10ce33ee62
SetAcceptLanguage(string new_accept_language);
diff --git a/services/network/test/test_network_context.h b/services/network/test/test_network_context.h
index 51593e249f23f37d031bcfc98a44ea538eb13dbc..2b4f72aefd0389dee85e088ed75550e92becefb2 100644
index 30463e8b23411ff7d2b0c8b2464959b2f3ae88c2..f86b16b57b5b032c4460357e8c2248e4cd632712 100644
--- a/services/network/test/test_network_context.h
+++ b/services/network/test/test_network_context.h
@@ -102,6 +102,7 @@ class TestNetworkContext : public mojom::NetworkContext {
@@ -104,6 +104,7 @@ class TestNetworkContext : public mojom::NetworkContext {
void CloseIdleConnections(CloseIdleConnectionsCallback callback) override {}
void SetNetworkConditions(const base::UnguessableToken& throttling_profile_id,
mojom::NetworkConditionsPtr conditions) override {}

View File

@@ -94,7 +94,7 @@ index 1026b739d283f0fc252fa2af83a6d4cf51bc8553..fe562ab60ce98b8bb0c5080a6428deb3
private:
const HWND hwnd_;
diff --git a/components/viz/service/BUILD.gn b/components/viz/service/BUILD.gn
index 596e298cb3209d5999ded58b87de037155d8681f..544f2d8452faf7b437a85a5a1f0e5311b1fcbac5 100644
index 3af93631092dc191c314f378b89ab09a56b36b3a..bcb285ee09d7218098d748d422e6dbbdafbc4c6a 100644
--- a/components/viz/service/BUILD.gn
+++ b/components/viz/service/BUILD.gn
@@ -111,6 +111,8 @@ viz_component("service") {
@@ -455,7 +455,7 @@ index 2bb30e5318b6b48c2e6d4b1f64a6a36c68f963d1..9e805f27a9d7d1c0aa68cdf9f48895c0
waiting_on_draw_ack_ = true;
diff --git a/content/browser/compositor/viz_process_transport_factory.cc b/content/browser/compositor/viz_process_transport_factory.cc
index 8e10af98f2b039d0d96f8be908f751b9117193d5..f9501da88a008131e3d046b452ba9c34455a1da4 100644
index 24a753ace9900e31b6e6800b5b33b19def09fb2d..2e8b76a960910a0a17bb261d9a4ecd91d7209ee6 100644
--- a/content/browser/compositor/viz_process_transport_factory.cc
+++ b/content/browser/compositor/viz_process_transport_factory.cc
@@ -404,8 +404,13 @@ void VizProcessTransportFactory::OnEstablishedGpuChannel(
@@ -527,7 +527,7 @@ index 6b7fbb6cf13dc8ee6ade0878a9a2c1efc5d4d3f1..e2af75168cb914a7b3b4a6c9b6a28549
+ Draw(gfx.mojom.Rect damage_rect) => ();
};
diff --git a/ui/compositor/compositor.h b/ui/compositor/compositor.h
index 601c3d175ccd24161b15b2b19ecb1a9241083060..d2ca7469f2a28c8027aca74404a47364dcfe16e3 100644
index cf47803e781a2bf19f71c1eb2e7686cd7513f951..948affdaff9c55edf3d8067237bf64172d30ad8c 100644
--- a/ui/compositor/compositor.h
+++ b/ui/compositor/compositor.h
@@ -73,6 +73,7 @@ class DisplayPrivate;
@@ -564,7 +564,7 @@ index 601c3d175ccd24161b15b2b19ecb1a9241083060..d2ca7469f2a28c8027aca74404a47364
// Sets the root of the layer tree drawn by this Compositor. The root layer
// must have no parent. The compositor's root layer is reset if the root layer
// is destroyed. NULL can be passed to reset the root layer, in which case the
@@ -405,6 +418,8 @@ class COMPOSITOR_EXPORT Compositor : public cc::LayerTreeHostClient,
@@ -409,6 +422,8 @@ class COMPOSITOR_EXPORT Compositor : public cc::LayerTreeHostClient,
std::unique_ptr<PendingBeginFrameArgs> pending_begin_frame_args_;

View File

@@ -10,10 +10,10 @@ understanding, it seems like we slightly misuse the print preview API
and this is fallout from using it in a way the code doesn't expect.
diff --git a/components/printing/renderer/print_render_frame_helper.cc b/components/printing/renderer/print_render_frame_helper.cc
index da45fb0629424ec010cde2c2e403808633663e25..3394154814cf0c4433e12b6571d1a9a1fbe42de3 100644
index 03fb6efb2296d6e21b0569afd471487c08f49e66..bc38eaf3819561a2271624b4c856f4a9e999f909 100644
--- a/components/printing/renderer/print_render_frame_helper.cc
+++ b/components/printing/renderer/print_render_frame_helper.cc
@@ -1462,6 +1462,7 @@ PrintRenderFrameHelper::CreatePreviewDocument() {
@@ -1458,6 +1458,7 @@ PrintRenderFrameHelper::CreatePreviewDocument() {
const std::vector<int>& pages = print_pages_params_->pages;
bool require_document_metafile =

View File

@@ -13,10 +13,10 @@ This patch can be removed once app.allowRendererProcessReuse is forced
to true as then Chromiums assumptions around processes become correct.
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 2076b318c689a3998ca19c8393810d53d1d986d2..1373d882c2286164c0368bb417cba903329c9f2c 100644
index 724a39e7a7c6157583050a31e51e3a54c029cce2..0312eff770307ee7d66c8ef950a4992c07f56d8f 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -2349,11 +2349,13 @@ bool WebContentsImpl::HandleMouseEvent(const blink::WebMouseEvent& event) {
@@ -2363,11 +2363,13 @@ bool WebContentsImpl::HandleMouseEvent(const blink::WebMouseEvent& event) {
WebContentsImpl* outermost = GetOutermostWebContents();
if (event.button == blink::WebPointerProperties::Button::kBack &&
outermost->controller_.CanGoBack()) {

View File

@@ -9,7 +9,7 @@ that error. A crbug has been opened at https://bugs.chromium.org/p/chromium/issu
and this patch will be removed when it has been resolved upstream.
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm
index 472869202ff8a62d854c9ca39ca9f14e2f91e8cf..1be0ad4382c735b7dcb78715528148aa2ad2d2c1 100644
index 17e3fe40522e088057eaf01a290b658a0b6d1d01..a573ff0b42f344aade85f2c62ac5fbfb251f36ef 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -38,6 +38,7 @@

View File

@@ -42,7 +42,7 @@ index 906a1ee4ac58b0744a32153bbaafeac4322a60e4..c90f4aead36cbf3767dc5094728963c2
// another SiteInstance for the same site.
void RegisterSiteInstance(SiteInstanceImpl* site_instance);
diff --git a/content/browser/frame_host/navigation_request.cc b/content/browser/frame_host/navigation_request.cc
index a43d6d6aaaabbe7ec911ab725ba71ff6f1b36c10..ae3dffb5ba9791b9d46c5939c04d787799e30a31 100644
index 4494c15b90f951615d1c2f08736485017256b877..f0e5e780124ee9c2b6b3a7a0d2ecc3d41eb96150 100644
--- a/content/browser/frame_host/navigation_request.cc
+++ b/content/browser/frame_host/navigation_request.cc
@@ -1278,6 +1278,24 @@ void NavigationRequest::BeginNavigation() {
@@ -71,10 +71,10 @@ index a43d6d6aaaabbe7ec911ab725ba71ff6f1b36c10..ae3dffb5ba9791b9d46c5939c04d7877
render_frame_host_ =
frame_tree_node_->render_manager()->GetFrameHostForNavigation(this);
diff --git a/content/browser/frame_host/render_frame_host_manager.cc b/content/browser/frame_host/render_frame_host_manager.cc
index 6e8fdb4ebb0b99d8b36a18cef53c278c5053c9e6..03ebe91e06097d1055c52531bf41839143bbecfa 100644
index 30d39b16e65dd1b099beb9f9e3cc72923fd6367d..18adc443deea3ab825c1541f9175c81e689b58f1 100644
--- a/content/browser/frame_host/render_frame_host_manager.cc
+++ b/content/browser/frame_host/render_frame_host_manager.cc
@@ -2396,6 +2396,16 @@ bool RenderFrameHostManager::InitRenderView(
@@ -2392,6 +2392,16 @@ bool RenderFrameHostManager::InitRenderView(
scoped_refptr<SiteInstance>
RenderFrameHostManager::GetSiteInstanceForNavigationRequest(
NavigationRequest* request) {
@@ -91,7 +91,7 @@ index 6e8fdb4ebb0b99d8b36a18cef53c278c5053c9e6..03ebe91e06097d1055c52531bf418391
SiteInstance* current_site_instance = render_frame_host_->GetSiteInstance();
// All children of MHTML documents must be MHTML documents. They all live in
@@ -2415,10 +2425,60 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest(
@@ -2411,10 +2421,60 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest(
//
// TODO(clamy): We should also consider as a candidate SiteInstance the
// speculative SiteInstance that was computed on redirects.
@@ -156,7 +156,7 @@ index 6e8fdb4ebb0b99d8b36a18cef53c278c5053c9e6..03ebe91e06097d1055c52531bf418391
// Account for renderer-initiated reload as well.
// Needed as a workaround for https://crbug.com/1045524, remove it when it is
@@ -2461,6 +2521,9 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest(
@@ -2457,6 +2517,9 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest(
request->ResetStateForSiteInstanceChange();
}
@@ -270,7 +270,7 @@ index be343c7f4a9e412fbb7b43cc908b8bdcb12aa533..0321dca8ba52be7d5e51f14e2f5cf942
// implementations for the browser startup code. See comments in
// browser_main_parts.h.
diff --git a/content/public/browser/site_instance.h b/content/public/browser/site_instance.h
index e3095f34c057ccf25b46beb809fbb88a440cc230..9d4472415d87455468cff86217e7489d39383e4e 100644
index 0a5aec6455a9337f806a9376d83935b60891109b..b57294b1e19ce7a96aae05c23ab42190f35ae780 100644
--- a/content/public/browser/site_instance.h
+++ b/content/public/browser/site_instance.h
@@ -121,6 +121,11 @@ class CONTENT_EXPORT SiteInstance : public base::RefCounted<SiteInstance> {

View File

@@ -12,14 +12,14 @@ rendering and there is no signal from browser process on this event
to identify it.
diff --git a/content/browser/gpu/gpu_data_manager_impl.cc b/content/browser/gpu/gpu_data_manager_impl.cc
index db9780a6c0b679354a5f74b1f89e32a8ff9dd2e3..0fc50588e4776939093fb79b346ac032bf17b237 100644
index 80fd68b4b862e59ba255163f3a903846a7768d75..ced78998277f37b4b8d656d264f389b5f47ddb1c 100644
--- a/content/browser/gpu/gpu_data_manager_impl.cc
+++ b/content/browser/gpu/gpu_data_manager_impl.cc
@@ -165,6 +165,11 @@ void GpuDataManagerImpl::OnBrowserThreadsStarted() {
@@ -170,6 +170,11 @@ void GpuDataManagerImpl::TerminateInfoCollectionGpuProcess() {
base::AutoLock auto_lock(lock_);
private_->OnBrowserThreadsStarted();
private_->TerminateInfoCollectionGpuProcess();
}
+
+
+bool GpuDataManagerImpl::DxdiagDx12VulkanRequested() const {
+ base::AutoLock auto_lock(lock_);
+ return private_->DxdiagDx12VulkanRequested();
@@ -28,23 +28,23 @@ index db9780a6c0b679354a5f74b1f89e32a8ff9dd2e3..0fc50588e4776939093fb79b346ac032
void GpuDataManagerImpl::UpdateGpuFeatureInfo(
diff --git a/content/browser/gpu/gpu_data_manager_impl.h b/content/browser/gpu/gpu_data_manager_impl.h
index d5595c91f4d63362e575ad31070335ee344261fa..986d21000988aa0880bac3f0a58003257f1a3ad3 100644
index ce8f9551f1b17c7508a0e0bd0ecc55eca2c0ac6e..2e71ce71ff9f18e2fc68f51ddbeedc3901f3dc7c 100644
--- a/content/browser/gpu/gpu_data_manager_impl.h
+++ b/content/browser/gpu/gpu_data_manager_impl.h
@@ -92,6 +92,7 @@ class CONTENT_EXPORT GpuDataManagerImpl : public GpuDataManager,
bool Dx12VulkanRequested() const;
@@ -93,6 +93,7 @@ class CONTENT_EXPORT GpuDataManagerImpl : public GpuDataManager,
// Called from BrowserMainLoop::BrowserThreadsStarted().
void OnBrowserThreadsStarted();
void TerminateInfoCollectionGpuProcess();
+ bool DxdiagDx12VulkanRequested() const;
#endif
// Update the GPU feature info. This updates the blacklist and enabled status
// of GPU rasterization. In the future this will be used for more features.
diff --git a/content/browser/gpu/gpu_data_manager_impl_private.cc b/content/browser/gpu/gpu_data_manager_impl_private.cc
index aae01a85f5d37d4c8e809815540662dee1550dbc..ee05d2fb8524664d2e989779201a670a201dd8bb 100644
index b09b8ffe7684f511e971d0c470c8b67a46288b6e..f41734cc66d7ee71509a66effec76be3797b00d6 100644
--- a/content/browser/gpu/gpu_data_manager_impl_private.cc
+++ b/content/browser/gpu/gpu_data_manager_impl_private.cc
@@ -896,6 +896,10 @@ void GpuDataManagerImplPrivate::OnBrowserThreadsStarted() {
display::Screen::GetScreen()->AddObserver(owner_);
@@ -923,6 +923,10 @@ void GpuDataManagerImplPrivate::TerminateInfoCollectionGpuProcess() {
host->ForceShutdown();
}
+bool GpuDataManagerImplPrivate::DxdiagDx12VulkanRequested() const {
@@ -55,13 +55,13 @@ index aae01a85f5d37d4c8e809815540662dee1550dbc..ee05d2fb8524664d2e989779201a670a
void GpuDataManagerImplPrivate::UpdateGpuFeatureInfo(
diff --git a/content/browser/gpu/gpu_data_manager_impl_private.h b/content/browser/gpu/gpu_data_manager_impl_private.h
index 6a082f73e77d9f5e7630cc4dbc18188c7e565c0b..d880de03d168908f2f7d4bc0c65e18e283de0005 100644
index 37c11fa98c30d2ab0455e550847c9dbecc327304..082a2062107d4baed74ea3ea77d0c33295e3eac8 100644
--- a/content/browser/gpu/gpu_data_manager_impl_private.h
+++ b/content/browser/gpu/gpu_data_manager_impl_private.h
@@ -71,6 +71,7 @@ class CONTENT_EXPORT GpuDataManagerImplPrivate {
void UpdateDxDiagNodeRequestStatus(bool request_continues);
@@ -72,6 +72,7 @@ class CONTENT_EXPORT GpuDataManagerImplPrivate {
bool Dx12VulkanRequested() const;
void OnBrowserThreadsStarted();
void TerminateInfoCollectionGpuProcess();
+ bool DxdiagDx12VulkanRequested() const;
#endif
void UpdateGpuFeatureInfo(const gpu::GpuFeatureInfo& gpu_feature_info,

View File

@@ -6,10 +6,10 @@ Subject: gtk_visibility.patch
Allow electron to depend on GTK in the GN build.
diff --git a/build/config/linux/gtk/BUILD.gn b/build/config/linux/gtk/BUILD.gn
index 9249f88e3234d0c11fe870169fc3fe8ce3c00ff1..7c4261f06c74f13d29b4cb2d2e3c047bf319b7f0 100644
index a73160222398b0beb02a8f2c7f2e2f05a1b6e339..5a9ca1ca4f96a2a106eab3d92224a67d1620134f 100644
--- a/build/config/linux/gtk/BUILD.gn
+++ b/build/config/linux/gtk/BUILD.gn
@@ -28,6 +28,8 @@ group("gtk") {
@@ -29,6 +29,8 @@ group("gtk") {
# This should probably be moved into //ui/gtk.
"//ui/ozone/platform/wayland",

View File

@@ -117,7 +117,7 @@ index 0d8a8e14328be49407d35908bacadd92182dae31..86602419d16667ff002333f848abcd77
// Used to force the NSApplication's focused accessibility element to be the
// content::BrowserAccessibilityCocoa accessibility tree when the NSView for
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm
index 6c8313f7e09be253528ca83727b78152a17229c8..f293a15c6145422707c22aeb5a254ad71a31900c 100644
index 359c792b2586756b6e195eaa0b61e426edbe764d..878837a454336afe177c3113062a1e8c8fff9076 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -231,8 +231,10 @@ RenderWidgetHostViewMac::~RenderWidgetHostViewMac() {

View File

@@ -7,7 +7,7 @@ This adds a callback from the network service that's used to implement
session.setCertificateVerifyCallback.
diff --git a/services/network/network_context.cc b/services/network/network_context.cc
index 65fcd744438548f65cbefc0278164f7efb244394..95a9d94838debcb64993e0a2533769d96e38dc1d 100644
index 78978462eaaa607883e3368e81924a18b1bc876f..fa804e8f46ce96af4d9c1c2172220b0780729103 100644
--- a/services/network/network_context.cc
+++ b/services/network/network_context.cc
@@ -106,6 +106,11 @@
@@ -116,7 +116,7 @@ index 65fcd744438548f65cbefc0278164f7efb244394..95a9d94838debcb64993e0a2533769d9
void NetworkContext::CreateURLLoaderFactory(
mojo::PendingReceiver<mojom::URLLoaderFactory> receiver,
mojom::URLLoaderFactoryParamsPtr params) {
@@ -1701,6 +1786,7 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext() {
@@ -1716,6 +1801,7 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext() {
base::CommandLine::ForCurrentProcess();
std::unique_ptr<net::CertVerifier> cert_verifier;
@@ -124,7 +124,7 @@ index 65fcd744438548f65cbefc0278164f7efb244394..95a9d94838debcb64993e0a2533769d9
if (g_cert_verifier_for_testing) {
cert_verifier = std::make_unique<WrappedTestingCertVerifier>();
} else {
@@ -1749,8 +1835,8 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext() {
@@ -1764,8 +1850,8 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext() {
}
#endif
#if BUILDFLAG(BUILTIN_CERT_VERIFIER_FEATURE_SUPPORTED)
@@ -135,7 +135,7 @@ index 65fcd744438548f65cbefc0278164f7efb244394..95a9d94838debcb64993e0a2533769d9
std::make_unique<net::CoalescingCertVerifier>(
std::make_unique<net::MultiThreadedCertVerifier>(
UsingBuiltinCertVerifier(params_->use_builtin_cert_verifier)
@@ -1760,12 +1846,19 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext() {
@@ -1775,12 +1861,19 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext() {
cert_net_fetcher_))));
}
#endif
@@ -160,7 +160,7 @@ index 65fcd744438548f65cbefc0278164f7efb244394..95a9d94838debcb64993e0a2533769d9
std::unique_ptr<NetworkServiceNetworkDelegate> network_delegate =
std::make_unique<NetworkServiceNetworkDelegate>(
diff --git a/services/network/network_context.h b/services/network/network_context.h
index 1c1446dae8e341c9440ea90ca2d997535cd490c1..fccf53cd1a7188685345764c599e16d85d8ee92b 100644
index bdda02b62c129116af89334056e5ae7da85f0636..b70111eda2ed582e2b81e0364c6e5fade743515b 100644
--- a/services/network/network_context.h
+++ b/services/network/network_context.h
@@ -84,6 +84,7 @@ class DomainReliabilityMonitor;
@@ -180,7 +180,7 @@ index 1c1446dae8e341c9440ea90ca2d997535cd490c1..fccf53cd1a7188685345764c599e16d8
void ResetURLLoaderFactories() override;
void GetCookieManager(
mojo::PendingReceiver<mojom::CookieManager> receiver) override;
@@ -652,6 +655,8 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) NetworkContext
@@ -654,6 +657,8 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) NetworkContext
std::unique_ptr<network::NSSTempCertsCacheChromeOS> nss_temp_certs_cache_;
#endif
@@ -190,7 +190,7 @@ index 1c1446dae8e341c9440ea90ca2d997535cd490c1..fccf53cd1a7188685345764c599e16d8
// CertNetFetcher is not used by the current platform.
scoped_refptr<net::CertNetFetcherURLRequest> cert_net_fetcher_;
diff --git a/services/network/public/mojom/network_context.mojom b/services/network/public/mojom/network_context.mojom
index 02675e0ce69f815cbd59349dc5ef5ae6535b829b..44b00a1fc341de0adba9a2c908a4ce248bc02805 100644
index cb96bae3601876f0447b668d335ddc8dbe76c3e3..485960c69443533461da4f95d2e73995f604702f 100644
--- a/services/network/public/mojom/network_context.mojom
+++ b/services/network/public/mojom/network_context.mojom
@@ -161,6 +161,17 @@ struct HttpAuthStaticNetworkContextParams {

View File

@@ -108,7 +108,7 @@ index 4bf25bf1fa69f7d3869369172d375e2e489e62a1..f80ef2cecc8b111dc54e109646573a59
mojo::PendingReceiver<blink::mojom::NotificationService> receiver);
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index f1443f39284113392e268fa657b47b51429368a1..3ed28b408733a6ad2609336fbf635e3d68bac66b 100644
index 40ef859ab14696de3e028256446bb1e5327ac4bc..5300930629a7a5741c0962f6bf6a1fca9a7a3976 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -2108,7 +2108,7 @@ void RenderProcessHostImpl::CreateNotificationService(

View File

@@ -11,7 +11,7 @@ majority of changes originally come from these PRs:
This patch also fixes callback for manual user cancellation and success.
diff --git a/chrome/browser/printing/print_job_worker.cc b/chrome/browser/printing/print_job_worker.cc
index 0819194e335de3cc63ad72c4c4abf632694828ac..7ef12b4fd4dde87bf677dc6f4823ce4cb8fc187a 100644
index 65065b781a0ae6e70c59d7c31d1410b4457fca49..04a13092de8e18f6a960f7b46be217bb4af34301 100644
--- a/chrome/browser/printing/print_job_worker.cc
+++ b/chrome/browser/printing/print_job_worker.cc
@@ -21,7 +21,6 @@
@@ -288,7 +288,7 @@ index 3d434244927aca5e5dbec8d7c1cd212c5c260c71..9d62c903bf08fa8cfa8c425d430c5e99
// This means we are _blocking_ until all the necessary pages have been
// rendered or the print settings are being loaded.
diff --git a/chrome/browser/printing/printing_message_filter.cc b/chrome/browser/printing/printing_message_filter.cc
index 40762a36024bc48dfe5259520161dc203197bfd0..e38aa442df858ce362645230f7642b2eb48262ce 100644
index d105aae9c8b949d2fe910467dd9a5209229b3592..4ac32e0306d75533e3a091cb512aa8d8f44757e3 100644
--- a/chrome/browser/printing/printing_message_filter.cc
+++ b/chrome/browser/printing/printing_message_filter.cc
@@ -22,6 +22,7 @@
@@ -332,7 +332,7 @@ index 40762a36024bc48dfe5259520161dc203197bfd0..e38aa442df858ce362645230f7642b2e
DCHECK_CURRENTLY_ON(BrowserThread::IO);
+#if 0
if (!is_printing_enabled_.GetValue()) {
// Reply with NULL query.
// Reply with null query.
OnGetDefaultPrintSettingsReply(nullptr, reply_msg);
return;
}
@@ -340,21 +340,22 @@ index 40762a36024bc48dfe5259520161dc203197bfd0..e38aa442df858ce362645230f7642b2e
std::unique_ptr<PrinterQuery> printer_query = queue_->PopPrinterQuery(0);
if (!printer_query) {
printer_query =
@@ -228,11 +234,13 @@ void PrintingMessageFilter::OnScriptedPrintReply(
@@ -228,12 +234,13 @@ void PrintingMessageFilter::OnScriptedPrintReply(
void PrintingMessageFilter::OnUpdatePrintSettings(int document_cookie,
base::Value job_settings,
IPC::Message* reply_msg) {
+#if 0
if (!is_printing_enabled_.GetValue()) {
// Reply with NULL query.
// Reply with null query.
OnUpdatePrintSettingsReply(nullptr, reply_msg);
return;
}
-
+#endif
std::unique_ptr<PrinterQuery> printer_query =
queue_->PopPrinterQuery(document_cookie);
if (!printer_query) {
@@ -258,7 +266,9 @@ void PrintingMessageFilter::OnUpdatePrintSettingsReply(
if (!job_settings.is_dict() ||
!job_settings.FindIntKey(kSettingPrinterType)) {
// Reply with null query.
@@ -266,7 +273,9 @@ void PrintingMessageFilter::OnUpdatePrintSettingsReply(
std::unique_ptr<PrinterQuery> printer_query,
IPC::Message* reply_msg) {
PrintMsg_PrintPages_Params params;
@@ -365,7 +366,7 @@ index 40762a36024bc48dfe5259520161dc203197bfd0..e38aa442df858ce362645230f7642b2e
params.Reset();
} else {
RenderParamsFromPrintSettings(printer_query->settings(), &params.params);
@@ -296,7 +306,7 @@ void PrintingMessageFilter::OnUpdatePrintSettingsReply(
@@ -304,7 +313,7 @@ void PrintingMessageFilter::OnUpdatePrintSettingsReply(
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
void PrintingMessageFilter::OnCheckForCancel(const PrintHostMsg_PreviewIds& ids,
bool* cancel) {
@@ -413,7 +414,7 @@ index 3695656560c54b5aa1fb08fb5e7c17d54989c597..85ffa5704d8dea809e80b1993c7c852f
// Tells the RenderFrame to switch the CSS to print media type, render every
// requested page using the print preview document's frame/node, and then
diff --git a/components/printing/renderer/print_render_frame_helper.cc b/components/printing/renderer/print_render_frame_helper.cc
index 214893c680526d62091c0aabde6b481219e9d62e..da45fb0629424ec010cde2c2e403808633663e25 100644
index 8e51567398aef2275236e962a71bce5e2ddb9c58..03fb6efb2296d6e21b0569afd471487c08f49e66 100644
--- a/components/printing/renderer/print_render_frame_helper.cc
+++ b/components/printing/renderer/print_render_frame_helper.cc
@@ -40,6 +40,7 @@
@@ -470,7 +471,7 @@ index 214893c680526d62091c0aabde6b481219e9d62e..da45fb0629424ec010cde2c2e4038086
print_preview_context_.OnPrintPreview();
base::UmaHistogramEnumeration(print_preview_context_.IsForArc()
@@ -1743,7 +1747,9 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) {
@@ -1733,7 +1737,9 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) {
auto self = weak_ptr_factory_.GetWeakPtr();
Print(duplicate_node.GetDocument().GetFrame(), duplicate_node,
@@ -481,7 +482,7 @@ index 214893c680526d62091c0aabde6b481219e9d62e..da45fb0629424ec010cde2c2e4038086
// Check if |this| is still valid.
if (!self)
return;
@@ -1754,7 +1760,9 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) {
@@ -1744,7 +1750,9 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) {
void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
const blink::WebNode& node,
@@ -492,7 +493,7 @@ index 214893c680526d62091c0aabde6b481219e9d62e..da45fb0629424ec010cde2c2e4038086
// If still not finished with earlier print request simply ignore.
if (prep_frame_view_)
return;
@@ -1762,7 +1770,7 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
@@ -1752,7 +1760,7 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
FrameReference frame_ref(frame);
int expected_page_count = 0;
@@ -501,7 +502,7 @@ index 214893c680526d62091c0aabde6b481219e9d62e..da45fb0629424ec010cde2c2e4038086
DidFinishPrinting(FAIL_PRINT_INIT);
return; // Failed to init print page settings.
}
@@ -1782,8 +1790,11 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
@@ -1772,8 +1780,11 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
PrintMsg_PrintPages_Params print_settings;
auto self = weak_ptr_factory_.GetWeakPtr();
@@ -515,7 +516,7 @@ index 214893c680526d62091c0aabde6b481219e9d62e..da45fb0629424ec010cde2c2e4038086
// Check if |this| is still valid.
if (!self)
return;
@@ -2018,10 +2029,23 @@ void PrintRenderFrameHelper::IPCProcessed() {
@@ -2008,10 +2019,23 @@ void PrintRenderFrameHelper::IPCProcessed() {
base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this);
}
@@ -542,7 +543,7 @@ index 214893c680526d62091c0aabde6b481219e9d62e..da45fb0629424ec010cde2c2e4038086
// Check if the printer returned any settings, if the settings is empty, we
// can safely assume there are no printer drivers configured. So we safely
// terminate.
@@ -2041,12 +2065,14 @@ bool PrintRenderFrameHelper::InitPrintSettings(bool fit_to_paper_size) {
@@ -2031,12 +2055,14 @@ bool PrintRenderFrameHelper::InitPrintSettings(bool fit_to_paper_size) {
return result;
}

View File

@@ -52,10 +52,10 @@ Some alternatives to this patch:
None of these options seems like a substantial maintainability win over this patch to me (@nornagon).
diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn
index d113eedf7afc704b0c2e8d112413e3bd7c58d8c7..fcd838d69b23e6799702353a551a0a7ac5c4ae15 100644
index 4d66277281addea7a42e3c29682193fda92382c4..284704829f490a1cd2375a3b4609c326deb85ac0 100644
--- a/chrome/BUILD.gn
+++ b/chrome/BUILD.gn
@@ -1470,7 +1470,7 @@ if (is_chrome_branded && !is_android) {
@@ -1369,7 +1369,7 @@ if (is_chrome_branded && !is_android) {
}
}
@@ -64,7 +64,7 @@ index d113eedf7afc704b0c2e8d112413e3bd7c58d8c7..fcd838d69b23e6799702353a551a0a7a
chrome_paks("packed_resources") {
if (is_mac) {
output_dir = "$root_gen_dir/repack"
@@ -1490,6 +1490,12 @@ if (!is_android) {
@@ -1389,6 +1389,12 @@ if (!is_android) {
}
}

View File

@@ -9,10 +9,10 @@ for every navigation to keep Node.js working properly. Once Native Modules in th
are required to be NAPI or context aware (Electron v11), this patch can be removed.
diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc
index 6dd8726c5576ec23e4966f564d07f5df59e30ff5..adca28e96b974536bc1ad8791c80ef6e25747c29 100644
index a513a74fa4f5f022b5fb269560953c3f0dd6a6d5..4569b87200227a889c10dfc4f4c337eab5b46950 100644
--- a/chrome/renderer/chrome_content_renderer_client.cc
+++ b/chrome/renderer/chrome_content_renderer_client.cc
@@ -1281,6 +1281,25 @@ bool ChromeContentRendererClient::AllowPopup() {
@@ -1288,6 +1288,25 @@ bool ChromeContentRendererClient::AllowPopup() {
#endif
}

View File

@@ -22,7 +22,7 @@ However, the patch would need to be reviewed by the security team, as it
does touch a security-sensitive class.
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index 3ed28b408733a6ad2609336fbf635e3d68bac66b..1106c583146c5903fa8dc3868bd99061dbb88538 100644
index 5300930629a7a5741c0962f6bf6a1fca9a7a3976..495e90285de38991e43425023aeaa8437254857b 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -414,6 +414,11 @@ class RendererSandboxedProcessLauncherDelegate

View File

@@ -6,7 +6,7 @@ Subject: ui_gtk_public_header.patch
Allow electron to depend on //ui/gtk/gtk_util.h
diff --git a/ui/gtk/BUILD.gn b/ui/gtk/BUILD.gn
index 2dd67393ec469b9c75761d98e729818453b6ce6b..53fc63acd371eb2efd77e9f50d60ce52b0436b59 100644
index be7a538b84318339c61d25e61a196222cfbf848a..8c8ac2559e44b1d00e29f5ba6f95ae6c40bd8296 100644
--- a/ui/gtk/BUILD.gn
+++ b/ui/gtk/BUILD.gn
@@ -22,13 +22,15 @@ component("gtk_ui_delegate") {

View File

@@ -9,10 +9,10 @@ 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 1373d882c2286164c0368bb417cba903329c9f2c..5eb25e36aa7b0fe78c7e34fa5556743aca9e192f 100644
index 0312eff770307ee7d66c8ef950a4992c07f56d8f..55d8d11648ac7ac912f9c0f805d82bc908f1fe60 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -2070,6 +2070,12 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) {
@@ -2084,6 +2084,12 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) {
std::string unique_name;
frame_tree_.root()->SetFrameName(params.main_frame_name, unique_name);
@@ -25,7 +25,7 @@ index 1373d882c2286164c0368bb417cba903329c9f2c..5eb25e36aa7b0fe78c7e34fa5556743a
WebContentsViewDelegate* delegate =
GetContentClient()->browser()->GetWebContentsViewDelegate(this);
@@ -2080,6 +2086,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) {
@@ -2094,6 +2100,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) {
view_.reset(CreateWebContentsView(this, delegate,
&render_view_host_delegate_view_));
}

View File

@@ -7,10 +7,10 @@ This adds GN build files for Node, so we don't have to build with GYP.
diff --git a/BUILD.gn b/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..22d119036d12c396af935fe85ae18751e6d80562
index 0000000000000000000000000000000000000000..2d8952a1d23af0ab4b3e5de0e56ec1e30c77dd71
--- /dev/null
+++ b/BUILD.gn
@@ -0,0 +1,360 @@
@@ -0,0 +1,376 @@
+import("//electron/build/asar.gni")
+import("//v8/gni/v8.gni")
+
@@ -18,6 +18,9 @@ index 0000000000000000000000000000000000000000..22d119036d12c396af935fe85ae18751
+ # Enable the V8 inspector protocol for use with node.
+ node_enable_inspector = true
+
+ # Enable diagnostic reporting withing Node.js
+ node_report = true
+
+ # Build node with SSL support.
+ # The variable is called "openssl" for parity with node's GYP build.
+ node_use_openssl = true
@@ -123,6 +126,11 @@ index 0000000000000000000000000000000000000000..22d119036d12c396af935fe85ae18751
+ } else {
+ defines += [ "NODE_USE_V8_PLATFORM=0" ]
+ }
+ if (node_report) {
+ defines += [ "NODE_REPORT=1" ]
+ } else {
+ defines += [ "NODE_REPORT=0" ]
+ }
+}
+
+config("node_lib_config") {
@@ -254,6 +262,14 @@ index 0000000000000000000000000000000000000000..22d119036d12c396af935fe85ae18751
+ libs += [ "CoreFoundation.framework" ]
+ }
+
+ if (node_report) {
+ sources += [
+ "src/node_report.cc",
+ "src/node_report_module.cc",
+ "src/node_report_utils.cc",
+ ]
+ }
+
+ if (node_enable_inspector) {
+ sources += [
+ "src/inspector_agent.cc",

View File

@@ -3,12 +3,12 @@ From: Shelley Vohr <shelley.vohr@gmail.com>
Date: Wed, 12 Feb 2020 15:08:04 -0800
Subject: fix: use crypto impls for compat
BoringSSL does not export DSA_get0_q, ECDSA_SIG_get0_r, or ECDSA_SIG_get0_s. This
patch works around that problem by using the implementations of those functions as
found in the OpenSSL repo. I plan to upstream a version of this.
BoringSSL does not export DSA_get0_q. This patch works around that problem
by using the implementations of those functions as found in the OpenSSL repo.
I plan to try and upstream a version of this.
diff --git a/src/node_crypto.cc b/src/node_crypto.cc
index 5e00468aac8b9f9c5ef7ea2f1e3b62991bfde255..c22989e1dae04b05cda1163e1583213ef990ecab 100644
index 5e00468aac8b9f9c5ef7ea2f1e3b62991bfde255..81a75049e51ee9e24f69361fca27ee858597c8e7 100644
--- a/src/node_crypto.cc
+++ b/src/node_crypto.cc
@@ -4481,7 +4481,7 @@ static unsigned int GetBytesOfRS(const ManagedEVPPKey& pkey) {
@@ -20,14 +20,3 @@ index 5e00468aac8b9f9c5ef7ea2f1e3b62991bfde255..c22989e1dae04b05cda1163e1583213e
} else if (base_id == EVP_PKEY_EC) {
EC_KEY* ec_key = EVP_PKEY_get0_EC_KEY(pkey.get());
const EC_GROUP* ec_group = EC_KEY_get0_group(ec_key);
@@ -4510,8 +4510,8 @@ static AllocatedBuffer ConvertSignatureToP1363(Environment* env,
AllocatedBuffer buf = env->AllocateManaged(2 * n);
unsigned char* data = reinterpret_cast<unsigned char*>(buf.data());
- const BIGNUM* r = ECDSA_SIG_get0_r(asn1_sig.get());
- const BIGNUM* s = ECDSA_SIG_get0_s(asn1_sig.get());
+ const BIGNUM* r = asn1_sig.get()->r;
+ const BIGNUM* s = asn1_sig.get()->s;
CHECK_EQ(n, static_cast<unsigned int>(BN_bn2binpad(r, data, n)));
CHECK_EQ(n, static_cast<unsigned int>(BN_bn2binpad(s, data + n, n)));

View File

@@ -12,7 +12,7 @@ when we override ReallocateBufferMemory, so we therefore need to implement
Realloc on the v8 side.
diff --git a/include/v8.h b/include/v8.h
index 800fc0da241b50d7a6629a1839f1aa1029e42d5b..94b7004c7d26764a598ade2d0e454e049167849d 100644
index 9a8f0c4816a92b726ac218ef80dd3ec7e5e5eca1..7d1b860e9ff239e89f9dfc6166b8ec9f82d6f6f2 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -5041,6 +5041,13 @@ class V8_EXPORT ArrayBuffer : public Object {
@@ -30,7 +30,7 @@ index 800fc0da241b50d7a6629a1839f1aa1029e42d5b..94b7004c7d26764a598ade2d0e454e04
* Free the memory block of size |length|, pointed to by |data|.
* That memory is guaranteed to be previously allocated by |Allocate|.
diff --git a/src/api/api.cc b/src/api/api.cc
index af686ca8c59d4b6ede00a78e542039b73f3ab363..ec522a513240c3fc2cbd28c0ff5dd52c420ca944 100644
index 17bf01ed4b8f4c1a0b87e172ac4b4f2439bf5840..9ef98523dacc94c5288ffc58477678545fcf4d1c 100644
--- a/src/api/api.cc
+++ b/src/api/api.cc
@@ -528,6 +528,10 @@ void V8::SetSnapshotDataBlob(StartupData* snapshot_blob) {

View File

@@ -9,11 +9,11 @@ necessary for native modules to load.
Also, some fixes relating to mksnapshot on ARM.
diff --git a/BUILD.gn b/BUILD.gn
index 912ea284c9b30b2ae5b123e6dec0b07b0c8b4b1e..99b96d05ade62564762fa58200778d91b2c885b2 100644
index 4517daa8563c0f1aca10419d6b523af62608bc16..f9f83b412e92999b6187dfdc24a63c0686d93bce 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -311,7 +311,7 @@ config("internal_config") {
":v8_tracing_config",
@@ -315,7 +315,7 @@ config("internal_config") {
":v8_header_features",
]
- if (is_component_build) {
@@ -21,7 +21,7 @@ index 912ea284c9b30b2ae5b123e6dec0b07b0c8b4b1e..99b96d05ade62564762fa58200778d91
defines += [ "BUILDING_V8_SHARED" ]
}
}
@@ -4081,7 +4081,7 @@ if (current_toolchain == v8_generator_toolchain) {
@@ -4134,7 +4134,7 @@ if (current_toolchain == v8_generator_toolchain) {
"src/interpreter/bytecodes.h",
]
@@ -30,7 +30,7 @@ index 912ea284c9b30b2ae5b123e6dec0b07b0c8b4b1e..99b96d05ade62564762fa58200778d91
deps = [
":v8_libbase",
@@ -4114,6 +4114,8 @@ if (current_toolchain == v8_snapshot_toolchain) {
@@ -4167,6 +4167,8 @@ if (current_toolchain == v8_snapshot_toolchain) {
configs = [ ":internal_config" ]

View File

@@ -6,10 +6,10 @@ Subject: dcheck.patch
https://github.com/auchenberg/volkswagen
diff --git a/src/api/api.cc b/src/api/api.cc
index ec522a513240c3fc2cbd28c0ff5dd52c420ca944..e630fa81eb510a45f8352fd2024f66f65e9d3573 100644
index 9ef98523dacc94c5288ffc58477678545fcf4d1c..72e2034bb6d0ae1f4ef825a87f8c69d18d9c9bd6 100644
--- a/src/api/api.cc
+++ b/src/api/api.cc
@@ -8732,7 +8732,7 @@ void Isolate::SetPromiseRejectCallback(PromiseRejectCallback callback) {
@@ -8726,7 +8726,7 @@ void Isolate::SetPromiseRejectCallback(PromiseRejectCallback callback) {
}
void Isolate::PerformMicrotaskCheckpoint() {
@@ -19,10 +19,10 @@ index ec522a513240c3fc2cbd28c0ff5dd52c420ca944..e630fa81eb510a45f8352fd2024f66f6
isolate->default_microtask_queue()->PerformCheckpoint(this);
}
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index 995ee61f42d436c6cd114575c15f96f18458f352..976b9f4c9cfb9330823088b973206e187e114b40 100644
index a1b15694c01aa3d5da9c18f01b038d9eb9a19bb6..9b20209255a624451cda111826c75169b6abfcc3 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -5489,9 +5489,9 @@ void Heap::TearDown() {
@@ -5511,9 +5511,9 @@ void Heap::TearDown() {
void Heap::AddGCPrologueCallback(v8::Isolate::GCCallbackWithData callback,
GCType gc_type, void* data) {
DCHECK_NOT_NULL(callback);

View File

@@ -12,11 +12,11 @@ This patch can be safely removed if, when it is removed, `node.lib` does not
contain any standard C++ library exports (e.g. `std::ostringstream`).
diff --git a/BUILD.gn b/BUILD.gn
index 7a49655f43afc236641e033c8a3f2d2e91d956e1..a67b95e844a84c4ed1582eca6bb7c9c2d21b0cb4 100644
index 61d9ad2aeb3543d2468e7cc8f3cf59247e527a8b..732e29b5b3f576d135acb1840d7d6a31c27f80dc 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -311,6 +311,10 @@ config("internal_config") {
":v8_tracing_config",
@@ -315,6 +315,10 @@ config("internal_config") {
":v8_header_features",
]
+ if (!is_component_build && is_electron_build) {

View File

@@ -6,10 +6,10 @@ Subject: expose_mksnapshot.patch
Needed in order to target mksnapshot for mksnapshot zip.
diff --git a/BUILD.gn b/BUILD.gn
index 99b96d05ade62564762fa58200778d91b2c885b2..7a49655f43afc236641e033c8a3f2d2e91d956e1 100644
index f9f83b412e92999b6187dfdc24a63c0686d93bce..61d9ad2aeb3543d2468e7cc8f3cf59247e527a8b 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -4092,7 +4092,6 @@ if (current_toolchain == v8_generator_toolchain) {
@@ -4145,7 +4145,6 @@ if (current_toolchain == v8_generator_toolchain) {
if (current_toolchain == v8_snapshot_toolchain) {
v8_executable("mksnapshot") {

View File

@@ -185,7 +185,6 @@
"parallel/test-v8-coverage",
"parallel/test-v8-flags",
"parallel/test-vm-basic",
"parallel/test-vm-codegen",
"parallel/test-vm-module-basic",
"parallel/test-vm-parse-abort-on-uncaught-exception",
"parallel/test-vm-sigint",
@@ -206,12 +205,6 @@
"parallel/test-zlib-unused-weak",
"pseudo-tty/test-set-raw-mode-reset-process-exit",
"pseudo-tty/test-set-raw-mode-reset-signal",
"report/test-report-config",
"report/test-report-getreport",
"report/test-report-signal",
"report/test-report-uncaught-exception",
"report/test-report-writereport",
"report/test-report-worker",
"sequential/test-child-process-execsync",
"sequential/test-cpu-prof-default",
"sequential/test-cpu-prof-dir-absolute",

View File

@@ -85,6 +85,13 @@ void HostCleanupFinalizationGroupCallback(
env->RegisterFinalizationGroupForCleanup(group);
}
bool AllowWasmCodeGenerationCallback(v8::Local<v8::Context> context,
v8::Local<v8::String>) {
v8::Local<v8::Value> wasm_code_gen = context->GetEmbedderData(
node::ContextEmbedderIndex::kAllowWasmCodeGeneration);
return wasm_code_gen->IsUndefined() || wasm_code_gen->IsTrue();
}
} // namespace
namespace electron {
@@ -139,6 +146,10 @@ int NodeMain(int argc, char* argv[]) {
JavascriptEnvironment gin_env(loop);
v8::Isolate* isolate = gin_env.isolate();
// TODO(ckerr) and/or TODO(codebytere) use node::SetIsolateMiscHandlers()
node::IsolateSettings is;
isolate->SetMicrotasksPolicy(is.policy);
v8::Isolate::Scope isolate_scope(isolate);
v8::Locker locker(isolate);
node::Environment* env = nullptr;
@@ -161,6 +172,9 @@ int NodeMain(int argc, char* argv[]) {
isolate->SetHostCleanupFinalizationGroupCallback(
HostCleanupFinalizationGroupCallback);
isolate->SetAllowWasmCodeGenerationCallback(
AllowWasmCodeGenerationCallback);
gin_helper::Dictionary process(isolate, env->process_object());
#if defined(OS_WIN)
process.SetMethod("log", &ElectronBindings::Log);

View File

@@ -851,13 +851,19 @@ void App::SetAppLogsPath(gin_helper::ErrorThrower thrower,
thrower.ThrowError("Path must be absolute");
return;
}
base::PathService::Override(DIR_APP_LOGS, custom_path.value());
{
base::ThreadRestrictions::ScopedAllowIO allow_io;
base::PathService::Override(DIR_APP_LOGS, custom_path.value());
}
} else {
base::FilePath path;
if (base::PathService::Get(DIR_USER_DATA, &path)) {
path = path.Append(base::FilePath::FromUTF8Unsafe(GetApplicationName()));
path = path.Append(base::FilePath::FromUTF8Unsafe("logs"));
base::PathService::Override(DIR_APP_LOGS, path);
{
base::ThreadRestrictions::ScopedAllowIO allow_io;
base::PathService::Override(DIR_APP_LOGS, path);
}
}
}
}
@@ -874,7 +880,6 @@ base::FilePath App::GetPath(gin_helper::ErrorThrower thrower,
// If users try to get the logs path before setting a logs path,
// set the path to a sensible default and then try to get it again
if (!succeed && name == "logs") {
base::ThreadRestrictions::ScopedAllowIO allow_io;
SetAppLogsPath(thrower, base::Optional<base::FilePath>());
succeed = base::PathService::Get(key, &path);
}

View File

@@ -21,7 +21,10 @@ void App::SetAppLogsPath(gin_helper::ErrorThrower thrower,
thrower.ThrowError("Path must be absolute");
return;
}
base::PathService::Override(DIR_APP_LOGS, custom_path.value());
{
base::ThreadRestrictions::ScopedAllowIO allow_io;
base::PathService::Override(DIR_APP_LOGS, custom_path.value());
}
} else {
NSString* bundle_name =
[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"];
@@ -29,8 +32,11 @@ void App::SetAppLogsPath(gin_helper::ErrorThrower thrower,
[NSString stringWithFormat:@"Library/Logs/%@", bundle_name];
NSString* library_path =
[NSHomeDirectory() stringByAppendingPathComponent:logs_path];
base::PathService::Override(DIR_APP_LOGS,
base::FilePath([library_path UTF8String]));
{
base::ThreadRestrictions::ScopedAllowIO allow_io;
base::PathService::Override(DIR_APP_LOGS,
base::FilePath([library_path UTF8String]));
}
}
}

View File

@@ -338,7 +338,7 @@ v8::Local<v8::Promise> Cookies::Set(v8::Isolate* isolate,
content::BrowserContext::GetDefaultStoragePartition(browser_context_);
auto* manager = storage_partition->GetCookieManagerForBrowserProcess();
manager->SetCanonicalCookie(
*canonical_cookie, url.scheme(), options,
*canonical_cookie, url, options,
base::BindOnce(
[](gin_helper::Promise<void> promise,
net::CanonicalCookie::CookieInclusionStatus status) {

View File

@@ -2299,7 +2299,8 @@ void WebContents::SendInputEvent(v8::Isolate* isolate,
// Chromium expects phase info in wheel events (and applies a
// DCHECK to verify it). See: https://crbug.com/756524.
mouse_wheel_event.phase = blink::WebMouseWheelEvent::kPhaseBegan;
mouse_wheel_event.dispatch_type = blink::WebInputEvent::kBlocking;
mouse_wheel_event.dispatch_type =
blink::WebInputEvent::DispatchType::kBlocking;
rwh->ForwardWheelEvent(mouse_wheel_event);
// Send a synthetic wheel event with phaseEnded to finish scrolling.
@@ -2308,7 +2309,7 @@ void WebContents::SendInputEvent(v8::Isolate* isolate,
mouse_wheel_event.delta_y = 0;
mouse_wheel_event.phase = blink::WebMouseWheelEvent::kPhaseEnded;
mouse_wheel_event.dispatch_type =
blink::WebInputEvent::kEventNonBlocking;
blink::WebInputEvent::DispatchType::kEventNonBlocking;
rwh->ForwardWheelEvent(mouse_wheel_event);
}
return;

View File

@@ -70,8 +70,8 @@
#include "ui/gfx/x/x11_types.h"
#include "ui/gtk/gtk_ui.h"
#include "ui/gtk/gtk_ui_delegate.h"
#include "ui/gtk/gtk_ui_delegate_x11.h"
#include "ui/gtk/gtk_util.h"
#include "ui/gtk/x/gtk_ui_delegate_x11.h"
#include "ui/views/linux_ui/linux_ui.h"
#endif

View File

@@ -654,10 +654,8 @@ bool NativeWindowViews::MoveAbove(const std::string& sourceId) {
if (!::IsWindow(otherWindow))
return false;
gfx::Point pos = GetPosition();
gfx::Size size = GetSize();
::SetWindowPos(GetAcceleratedWidget(), otherWindow, pos.x(), pos.y(),
size.width(), size.height(),
::SetWindowPos(GetAcceleratedWidget(), GetWindow(otherWindow, GW_HWNDPREV), 0,
0, 0, 0,
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
#elif defined(USE_X11)
if (!IsWindowValid(id.id))

View File

@@ -810,6 +810,7 @@ void ProxyingURLLoaderFactory::CreateLoaderAndStart(
network::ResourceRequest request = original_request;
if (ShouldIgnoreConnectionsLimit(request)) {
request.priority = net::RequestPriority::MAXIMUM_PRIORITY;
request.load_flags |= net::LOAD_IGNORE_LIMITS;
}

View File

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

View File

@@ -46,9 +46,7 @@ bool CrashReporter::IsInitialized() {
return is_initialized_;
}
void CrashReporter::Start(const std::string& product_name,
const std::string& company_name,
const std::string& submit_url,
void CrashReporter::Start(const std::string& submit_url,
const base::FilePath& crashes_dir,
bool upload_to_server,
bool skip_system_crash_handler,
@@ -58,8 +56,8 @@ void CrashReporter::Start(const std::string& product_name,
is_initialized_ = true;
SetUploadParameters(extra_parameters);
Init(product_name, company_name, submit_url, crashes_dir, upload_to_server,
skip_system_crash_handler, rate_limit, compress);
Init(submit_url, crashes_dir, upload_to_server, skip_system_crash_handler,
rate_limit, compress);
}
void CrashReporter::SetUploadParameters(const StringMap& parameters) {
@@ -73,12 +71,6 @@ void CrashReporter::SetUploadParameters(const StringMap& parameters) {
SetUploadParameters();
}
void CrashReporter::SetUploadToServer(const bool upload_to_server) {}
bool CrashReporter::GetUploadToServer() {
return true;
}
std::vector<CrashReporter::UploadReportResult>
CrashReporter::GetUploadedReports(const base::FilePath& crashes_dir) {
base::ThreadRestrictions::ScopedAllowIO allow_io;
@@ -102,30 +94,33 @@ CrashReporter::GetUploadedReports(const base::FilePath& crashes_dir) {
return result;
}
void CrashReporter::Init(const std::string& product_name,
const std::string& company_name,
const std::string& submit_url,
const base::FilePath& crashes_dir,
bool auto_submit,
bool skip_system_crash_handler,
bool rate_limit,
bool compress) {}
void CrashReporter::SetUploadParameters() {}
void CrashReporter::AddExtraParameter(const std::string& key,
const std::string& value) {}
void CrashReporter::RemoveExtraParameter(const std::string& key) {}
std::map<std::string, std::string> CrashReporter::GetParameters() const {
return upload_parameters_;
}
#if defined(OS_MACOSX) && defined(MAS_BUILD)
class DummyCrashReporter : public CrashReporter {
public:
~DummyCrashReporter() override {}
void SetUploadToServer(bool upload_to_server) override {}
bool GetUploadToServer() override { return false; }
void AddExtraParameter(const std::string& key,
const std::string& value) override {}
void RemoveExtraParameter(const std::string& key) override {}
void Init(const std::string& submit_url,
const base::FilePath& crashes_dir,
bool upload_to_server,
bool skip_system_crash_handler,
bool rate_limit,
bool compress) override {}
void SetUploadParameters() override {}
};
// static
CrashReporter* CrashReporter::GetInstance() {
static CrashReporter crash_reporter;
static DummyCrashReporter crash_reporter;
return &crash_reporter;
}
#endif
@@ -156,9 +151,9 @@ void CrashReporter::StartInstance(const gin_helper::Dictionary& options) {
bool upload_to_server = true;
bool skip_system_crash_handler = false;
reporter->Start(product_name, company_name, submit_url, crashes_dir,
upload_to_server, skip_system_crash_handler, rate_limit,
compress, extra_parameters);
reporter->Start(submit_url, crashes_dir, upload_to_server,
skip_system_crash_handler, rate_limit, compress,
extra_parameters);
}
} // namespace crash_reporter

View File

@@ -34,9 +34,7 @@ class CrashReporter {
static void StartInstance(const gin_helper::Dictionary& options);
bool IsInitialized();
void Start(const std::string& product_name,
const std::string& company_name,
const std::string& submit_url,
void Start(const std::string& submit_url,
const base::FilePath& crashes_dir,
bool upload_to_server,
bool skip_system_crash_handler,
@@ -47,26 +45,24 @@ class CrashReporter {
virtual std::vector<CrashReporter::UploadReportResult> GetUploadedReports(
const base::FilePath& crashes_dir);
virtual void SetUploadToServer(bool upload_to_server);
virtual bool GetUploadToServer();
virtual void SetUploadToServer(bool upload_to_server) = 0;
virtual bool GetUploadToServer() = 0;
virtual void AddExtraParameter(const std::string& key,
const std::string& value);
virtual void RemoveExtraParameter(const std::string& key);
const std::string& value) = 0;
virtual void RemoveExtraParameter(const std::string& key) = 0;
virtual std::map<std::string, std::string> GetParameters() const;
protected:
CrashReporter();
virtual ~CrashReporter();
virtual void Init(const std::string& product_name,
const std::string& company_name,
const std::string& submit_url,
virtual void Init(const std::string& submit_url,
const base::FilePath& crashes_dir,
bool upload_to_server,
bool skip_system_crash_handler,
bool rate_limit,
bool compress);
virtual void SetUploadParameters();
bool compress) = 0;
virtual void SetUploadParameters() = 0;
StringMap upload_parameters_;
std::string process_type_;

View File

@@ -56,9 +56,7 @@ CrashReporterLinux::CrashReporterLinux() : pid_(getpid()) {
CrashReporterLinux::~CrashReporterLinux() = default;
void CrashReporterLinux::Init(const std::string& product_name,
const std::string& company_name,
const std::string& submit_url,
void CrashReporterLinux::Init(const std::string& submit_url,
const base::FilePath& crashes_dir,
bool upload_to_server,
bool skip_system_crash_handler,
@@ -87,6 +85,11 @@ bool CrashReporterLinux::GetUploadToServer() {
return upload_to_server_;
}
void CrashReporterLinux::AddExtraParameter(const std::string& key,
const std::string& value) {}
void CrashReporterLinux::RemoveExtraParameter(const std::string& key) {}
void CrashReporterLinux::EnableCrashDumping(const base::FilePath& crashes_dir) {
{
base::ThreadRestrictions::ScopedAllowIO allow_io;

View File

@@ -28,9 +28,7 @@ class CrashReporterLinux : public CrashReporter {
public:
static CrashReporterLinux* GetInstance();
void Init(const std::string& product_name,
const std::string& company_name,
const std::string& submit_url,
void Init(const std::string& submit_url,
const base::FilePath& crashes_dir,
bool upload_to_server,
bool skip_system_crash_handler,
@@ -39,6 +37,9 @@ class CrashReporterLinux : public CrashReporter {
void SetUploadToServer(bool upload_to_server) override;
void SetUploadParameters() override;
bool GetUploadToServer() override;
void AddExtraParameter(const std::string& key,
const std::string& value) override;
void RemoveExtraParameter(const std::string& key) override;
private:
friend struct base::DefaultSingletonTraits<CrashReporterLinux>;

View File

@@ -21,9 +21,7 @@ class CrashReporterMac : public CrashReporterCrashpad {
public:
static CrashReporterMac* GetInstance();
void Init(const std::string& product_name,
const std::string& company_name,
const std::string& submit_url,
void Init(const std::string& submit_url,
const base::FilePath& crashes_dir,
bool upload_to_server,
bool skip_system_crash_handler,

View File

@@ -22,9 +22,7 @@ CrashReporterMac::CrashReporterMac() {}
CrashReporterMac::~CrashReporterMac() {}
void CrashReporterMac::Init(const std::string& product_name,
const std::string& company_name,
const std::string& submit_url,
void CrashReporterMac::Init(const std::string& submit_url,
const base::FilePath& crashes_dir,
bool upload_to_server,
bool skip_system_crash_handler,

View File

@@ -57,9 +57,7 @@ void CrashReporterWin::SetUnhandledExceptionFilter() {
}
#endif
void CrashReporterWin::Init(const std::string& product_name,
const std::string& company_name,
const std::string& submit_url,
void CrashReporterWin::Init(const std::string& submit_url,
const base::FilePath& crashes_dir,
bool upload_to_server,
bool skip_system_crash_handler,

View File

@@ -25,9 +25,7 @@ class CrashReporterWin : public CrashReporterCrashpad {
static void SetUnhandledExceptionFilter();
#endif
void Init(const std::string& product_name,
const std::string& company_name,
const std::string& submit_url,
void Init(const std::string& submit_url,
const base::FilePath& crashes_dir,
bool upload_to_server,
bool skip_system_crash_handler,

View File

@@ -32,6 +32,16 @@ void RenderFrameFunctionStore::OnDestruct() {
delete this;
}
void RenderFrameFunctionStore::WillReleaseScriptContext(
v8::Local<v8::Context> context,
int32_t world_id) {
base::EraseIf(functions_, [context](auto const& pair) {
v8::Local<v8::Context> func_owning_context =
std::get<1>(pair.second).Get(context->GetIsolate());
return func_owning_context == context;
});
}
} // namespace context_bridge
} // namespace api

View File

@@ -29,6 +29,8 @@ class RenderFrameFunctionStore final : public content::RenderFrameObserver {
// RenderFrameObserver implementation.
void OnDestruct() override;
void WillReleaseScriptContext(v8::Local<v8::Context> context,
int32_t world_id) override;
size_t take_func_id() { return next_func_id_++; }

View File

@@ -398,19 +398,19 @@ v8::MaybeLocal<v8::Object> CreateProxyForAPI(
context_bridge::ObjectCache* object_cache,
int recursion_depth) {
gin_helper::Dictionary api(source_context->GetIsolate(), api_object);
gin_helper::Dictionary proxy =
gin::Dictionary::CreateEmpty(destination_context->GetIsolate());
object_cache->CacheProxiedObject(api.GetHandle(), proxy.GetHandle());
auto maybe_keys = api.GetHandle()->GetOwnPropertyNames(
source_context,
static_cast<v8::PropertyFilter>(v8::ONLY_ENUMERABLE | v8::SKIP_SYMBOLS),
v8::KeyConversionMode::kConvertToString);
if (maybe_keys.IsEmpty())
return v8::MaybeLocal<v8::Object>(proxy.GetHandle());
auto keys = maybe_keys.ToLocalChecked();
v8::Context::Scope destination_context_scope(destination_context);
{
gin_helper::Dictionary proxy =
gin::Dictionary::CreateEmpty(destination_context->GetIsolate());
object_cache->CacheProxiedObject(api.GetHandle(), proxy.GetHandle());
auto maybe_keys = api.GetHandle()->GetOwnPropertyNames(
source_context,
static_cast<v8::PropertyFilter>(v8::ONLY_ENUMERABLE | v8::SKIP_SYMBOLS),
v8::KeyConversionMode::kConvertToString);
if (maybe_keys.IsEmpty())
return v8::MaybeLocal<v8::Object>(proxy.GetHandle());
auto keys = maybe_keys.ToLocalChecked();
uint32_t length = keys->Length();
std::string key_str;
for (uint32_t i = 0; i < length; i++) {

View File

@@ -185,7 +185,8 @@ describe('BrowserWindow module', () => {
expect(content).to.equal('close');
});
it('should emit beforeunload event', async () => {
w.loadFile(path.join(__dirname, 'fixtures', 'api', 'close-beforeunload-false.html'));
await w.loadFile(path.join(__dirname, 'fixtures', 'api', 'close-beforeunload-false.html'));
w.webContents.executeJavaScript('run()', true);
const [e] = await emittedOnce(ipcMain, 'onbeforeunload');
e.returnValue = null;
});
@@ -1009,27 +1010,78 @@ describe('BrowserWindow module', () => {
});
ifdescribe(process.platform === 'win32')(`Fullscreen state`, () => {
it(`checks normal bounds when fullscreen'ed`, (done) => {
const bounds = w.getBounds();
w.once('enter-full-screen', () => {
expectBoundsEqual(w.getNormalBounds(), bounds);
done();
it('with properties', () => {
it('can be set with the fullscreen constructor option', () => {
w = new BrowserWindow({ fullscreen: true });
expect(w.fullScreen).to.be.true();
});
it('can be changed', () => {
w.fullScreen = false;
expect(w.fullScreen).to.be.false();
w.fullScreen = true;
expect(w.fullScreen).to.be.true();
});
it(`checks normal bounds when fullscreen'ed`, (done) => {
const bounds = w.getBounds();
w.once('enter-full-screen', () => {
expectBoundsEqual(w.getNormalBounds(), bounds);
done();
});
w.show();
w.fullScreen = true;
});
it(`checks normal bounds when unfullscreen'ed`, (done) => {
const bounds = w.getBounds();
w.once('enter-full-screen', () => {
w.fullScreen = false;
});
w.once('leave-full-screen', () => {
expectBoundsEqual(w.getNormalBounds(), bounds);
done();
});
w.show();
w.fullScreen = true;
});
w.show();
w.setFullScreen(true);
});
it(`checks normal bounds when unfullscreen'ed`, (done) => {
const bounds = w.getBounds();
w.once('enter-full-screen', () => {
it('with functions', () => {
it('can be set with the fullscreen constructor option', () => {
w = new BrowserWindow({ fullscreen: true });
expect(w.isFullScreen()).to.be.true();
});
it('can be changed', () => {
w.setFullScreen(false);
expect(w.isFullScreen()).to.be.false();
w.setFullScreen(true);
expect(w.isFullScreen()).to.be.true();
});
w.once('leave-full-screen', () => {
expectBoundsEqual(w.getNormalBounds(), bounds);
done();
it(`checks normal bounds when fullscreen'ed`, (done) => {
const bounds = w.getBounds();
w.once('enter-full-screen', () => {
expectBoundsEqual(w.getNormalBounds(), bounds);
done();
});
w.show();
w.setFullScreen(true);
});
it(`checks normal bounds when unfullscreen'ed`, (done) => {
const bounds = w.getBounds();
w.once('enter-full-screen', () => {
w.setFullScreen(false);
});
w.once('leave-full-screen', () => {
expectBoundsEqual(w.getNormalBounds(), bounds);
done();
});
w.show();
w.setFullScreen(true);
});
w.show();
w.setFullScreen(true);
});
});
});
@@ -2590,7 +2642,8 @@ describe('BrowserWindow module', () => {
w.loadFile(path.join(__dirname, 'fixtures', 'api', 'close-beforeunload-undefined.html'));
});
it('returning false would prevent close', async () => {
w.loadFile(path.join(__dirname, 'fixtures', 'api', 'close-beforeunload-false.html'));
await w.loadFile(path.join(__dirname, 'fixtures', 'api', 'close-beforeunload-false.html'));
w.webContents.executeJavaScript('run()', true);
const [e] = await emittedOnce(ipcMain, 'onbeforeunload');
e.returnValue = null;
});
@@ -2598,57 +2651,103 @@ describe('BrowserWindow module', () => {
ipcMain.once('onbeforeunload', (e) => { e.returnValue = null; done(); });
w.loadFile(path.join(__dirname, 'fixtures', 'api', 'close-beforeunload-empty-string.html'));
});
it('emits for each close attempt', (done) => {
let beforeUnloadCount = 0;
ipcMain.on('onbeforeunload', (e) => {
it('emits for each close attempt', async () => {
await w.loadFile(path.join(__dirname, 'fixtures', 'api', 'beforeunload-false-prevent3.html'));
const destroyListener = () => { expect.fail('Close was not prevented'); };
w.webContents.once('destroyed', destroyListener);
await w.webContents.executeJavaScript('preventNextBeforeUnload()', true);
{
const p = emittedOnce(ipcMain, 'onbeforeunload');
w.close();
const [e] = await p;
e.returnValue = null;
beforeUnloadCount += 1;
if (beforeUnloadCount < 3) {
w.close();
} else if (beforeUnloadCount === 3) {
done();
}
});
w.webContents.once('did-finish-load', () => { w.webContents.executeJavaScript('window.close()', true); });
w.loadFile(path.join(__dirname, 'fixtures', 'api', 'beforeunload-false-prevent3.html'));
}
await w.webContents.executeJavaScript('preventNextBeforeUnload()', true);
// Hi future test refactorer! I don't know what event this timeout allows
// to occur, but without it, this test becomes flaky at this point and
// sometimes the window gets closed even though a `beforeunload` handler
// has been installed. I looked for events being emitted by the
// `webContents` during this timeout period and found nothing, so it
// might be some sort of internal timeout being applied by the content/
// layer, or blink?
//
// In any case, this incantation reduces flakiness. I'm going to add a
// summoning circle for good measure.
//
// 🕯 🕯
// 🕯 🕯
// 🕯 🕯
await new Promise(resolve => setTimeout(resolve, 1000));
// 🕯 🕯
// 🕯 🕯
// 🕯 🕯
{
const p = emittedOnce(ipcMain, 'onbeforeunload');
w.close();
const [e] = await p;
e.returnValue = null;
}
w.webContents.removeListener('destroyed', destroyListener);
const p = emittedOnce(w.webContents, 'destroyed');
w.close();
await p;
});
it('emits for each reload attempt', (done) => {
let beforeUnloadCount = 0;
ipcMain.on('onbeforeunload', (e) => {
it('emits for each reload attempt', async () => {
await w.loadFile(path.join(__dirname, 'fixtures', 'api', 'beforeunload-false-prevent3.html'));
const navigationListener = () => { expect.fail('Reload was not prevented'); };
w.webContents.once('did-start-navigation', navigationListener);
await w.webContents.executeJavaScript('preventNextBeforeUnload()', true);
w.reload();
{
const [e] = await emittedOnce(ipcMain, 'onbeforeunload');
e.returnValue = null;
beforeUnloadCount += 1;
if (beforeUnloadCount < 3) {
w.reload();
} else if (beforeUnloadCount === 3) {
done();
}
});
w.webContents.once('did-finish-load', () => {
w.webContents.once('did-finish-load', () => {
expect.fail('Reload was not prevented');
});
w.reload();
});
w.loadFile(path.join(__dirname, 'fixtures', 'api', 'beforeunload-false-prevent3.html'));
}
await w.webContents.executeJavaScript('preventNextBeforeUnload()', true);
w.reload();
{
const [e] = await emittedOnce(ipcMain, 'onbeforeunload');
e.returnValue = null;
}
w.webContents.removeListener('did-start-navigation', navigationListener);
w.reload();
await emittedOnce(w.webContents, 'did-finish-load');
});
it('emits for each navigation attempt', (done) => {
let beforeUnloadCount = 0;
ipcMain.on('onbeforeunload', (e) => {
it('emits for each navigation attempt', async () => {
await w.loadFile(path.join(__dirname, 'fixtures', 'api', 'beforeunload-false-prevent3.html'));
const navigationListener = () => { expect.fail('Reload was not prevented'); };
w.webContents.once('did-start-navigation', navigationListener);
await w.webContents.executeJavaScript('preventNextBeforeUnload()', true);
w.loadURL('about:blank');
{
const [e] = await emittedOnce(ipcMain, 'onbeforeunload');
e.returnValue = null;
beforeUnloadCount += 1;
if (beforeUnloadCount < 3) {
w.loadURL('about:blank');
} else if (beforeUnloadCount === 3) {
done();
}
});
w.webContents.once('did-finish-load', () => {
w.webContents.once('did-finish-load', () => {
expect.fail('Navigation was not prevented');
});
w.loadURL('about:blank');
});
w.loadFile(path.join(__dirname, 'fixtures', 'api', 'beforeunload-false-prevent3.html'));
}
await w.webContents.executeJavaScript('preventNextBeforeUnload()', true);
w.loadURL('about:blank');
{
const [e] = await emittedOnce(ipcMain, 'onbeforeunload');
e.returnValue = null;
}
w.webContents.removeListener('did-start-navigation', navigationListener);
w.loadURL('about:blank');
await emittedOnce(w.webContents, 'did-finish-load');
});
});

View File

@@ -2,17 +2,33 @@ import { BrowserWindow, ipcMain } from 'electron/main';
import { contextBridge } from 'electron/renderer';
import { expect } from 'chai';
import * as fs from 'fs-extra';
import * as http from 'http';
import * as os from 'os';
import * as path from 'path';
import { closeWindow } from './window-helpers';
import { emittedOnce } from './events-helpers';
import { AddressInfo } from 'net';
const fixturesPath = path.resolve(__dirname, 'fixtures', 'api', 'context-bridge');
describe('contextBridge', () => {
let w: BrowserWindow;
let dir: string;
let server: http.Server;
before(async () => {
server = http.createServer((req, res) => {
res.setHeader('Content-Type', 'text/html');
res.end('');
});
await new Promise(resolve => server.listen(0, resolve));
});
after(async () => {
if (server) await new Promise(resolve => server.close(resolve));
server = null as any;
});
afterEach(async () => {
await closeWindow(w);
@@ -65,7 +81,7 @@ describe('contextBridge', () => {
preload: path.resolve(tmpDir, 'preload.js')
}
});
await w.loadFile(path.resolve(fixturesPath, 'empty.html'));
await w.loadURL(`http://127.0.0.1:${(server.address() as AddressInfo).port}`);
};
const callWithBindings = (fn: Function) =>
@@ -343,6 +359,27 @@ describe('contextBridge', () => {
});
}
if (useSandbox) {
it('should not leak the global hold on methods sent across contexts when reloading a sandboxed renderer', async () => {
await makeBindingWindow(() => {
require('electron').ipcRenderer.on('get-gc-info', e => e.sender.send('gc-info', (contextBridge as any).debugGC()));
contextBridge.exposeInMainWorld('example', {
getFunction: () => () => 123
});
require('electron').ipcRenderer.send('window-ready-for-tasking');
});
const loadPromise = emittedOnce(ipcMain, 'window-ready-for-tasking');
expect((await getGCInfo()).functionCount).to.equal(1);
await callWithBindings((root: any) => {
root.location.reload();
});
await loadPromise;
// If this is ever "2" it means we leaked the exposed function and
// therefore the entire context after a reload
expect((await getGCInfo()).functionCount).to.equal(1);
});
}
it('it should not let you overwrite existing exposed things', async () => {
await makeBindingWindow(() => {
let threw = false;
@@ -422,6 +459,7 @@ describe('contextBridge', () => {
string: 'string',
boolean: true,
arr: [123, 'string', true, ['foo']],
getObject: () => ({ thing: 123 }),
getNumber: () => 123,
getString: () => 'string',
getBoolean: () => true,
@@ -455,6 +493,7 @@ describe('contextBridge', () => {
[example.arr[3][0], String],
[example.getNumber, Function],
[example.getNumber(), Number],
[example.getObject(), Object],
[example.getString(), String],
[example.getBoolean(), Boolean],
[example.getArr(), Array],

View File

@@ -54,14 +54,16 @@ describe('webContents module', () => {
it('emits if beforeunload returns false', async () => {
const w = new BrowserWindow({ show: false });
w.loadFile(path.join(__dirname, 'fixtures', 'api', 'close-beforeunload-false.html'));
await w.loadFile(path.join(__dirname, 'fixtures', 'api', 'close-beforeunload-false.html'));
w.webContents.executeJavaScript('run()', true);
await emittedOnce(w.webContents, 'will-prevent-unload');
});
it('supports calling preventDefault on will-prevent-unload events', async () => {
const w = new BrowserWindow({ show: false });
w.webContents.once('will-prevent-unload', event => event.preventDefault());
w.loadFile(path.join(__dirname, 'fixtures', 'api', 'close-beforeunload-false.html'));
await w.loadFile(path.join(__dirname, 'fixtures', 'api', 'close-beforeunload-false.html'));
w.webContents.executeJavaScript('run()', true);
await emittedOnce(w, 'closed');
});
});
@@ -382,7 +384,7 @@ describe('webContents module', () => {
const devToolsOpened = emittedOnce(w.webContents, 'devtools-opened');
w.webContents.openDevTools();
await devToolsOpened;
expect(webContents.getFocusedWebContents().id).to.equal(w.webContents.devToolsWebContents.id);
expect(webContents.getFocusedWebContents().id).to.equal(w.webContents.devToolsWebContents!.id);
const devToolsClosed = emittedOnce(w.webContents, 'devtools-closed');
w.webContents.closeDevTools();
await devToolsClosed;
@@ -466,7 +468,7 @@ describe('webContents module', () => {
const w = new BrowserWindow({ show: false });
w.webContents.openDevTools();
w.webContents.once('devtools-opened', () => {
expect(w.webContents.devToolsWebContents.getWebPreferences()).to.be.null();
expect(w.webContents.devToolsWebContents!.getWebPreferences()).to.be.null();
done();
});
});
@@ -1654,11 +1656,11 @@ describe('webContents module', () => {
const opened = emittedOnce(w.webContents, 'devtools-opened');
w.webContents.openDevTools();
await opened;
await emittedOnce(w.webContents.devToolsWebContents, 'did-finish-load');
w.webContents.devToolsWebContents.focus();
await emittedOnce(w.webContents.devToolsWebContents!, 'did-finish-load');
w.webContents.devToolsWebContents!.focus();
// Focus an input field
await w.webContents.devToolsWebContents.executeJavaScript(`
await w.webContents.devToolsWebContents!.executeJavaScript(`
const input = document.createElement('input')
document.body.innerHTML = ''
document.body.appendChild(input)
@@ -1668,7 +1670,7 @@ describe('webContents module', () => {
// Write something to the clipboard
clipboard.writeText('test value');
const pasted = w.webContents.devToolsWebContents.executeJavaScript(`new Promise(resolve => {
const pasted = w.webContents.devToolsWebContents!.executeJavaScript(`new Promise(resolve => {
document.querySelector('input').addEventListener('paste', (e) => {
resolve(e.target.value)
})

View File

@@ -0,0 +1,28 @@
import { BrowserWindow } from 'electron';
import * as path from 'path';
import { delay } from './spec-helpers';
import { expect } from 'chai';
import { closeAllWindows } from './window-helpers';
const fixturesPath = path.resolve(__dirname, '..', 'spec-main', 'fixtures');
describe('autofill', () => {
afterEach(closeAllWindows);
it('can be selected via keyboard', async () => {
const w = new BrowserWindow({ show: true });
await w.loadFile(path.join(fixturesPath, 'pages', 'datalist.html'));
w.webContents.sendInputEvent({ type: 'keyDown', keyCode: 'Tab' });
const inputText = 'clap';
for (const keyCode of inputText) {
w.webContents.sendInputEvent({ type: 'char', keyCode });
await delay(100);
}
w.webContents.sendInputEvent({ type: 'keyDown', keyCode: 'Down' });
w.webContents.sendInputEvent({ type: 'keyDown', keyCode: 'Enter' });
const value = await w.webContents.executeJavaScript("document.querySelector('input').value");
expect(value).to.equal('Eric Clapton');
});
});

View File

@@ -1,16 +1,16 @@
<html>
<body>
<script type="text/javascript" charset="utf-8">
// Only prevent unload on the first three window closes
var unloadPreventedCount = 0;
window.onbeforeunload = function() {
setTimeout(function() {
require('electron').ipcRenderer.sendSync('onbeforeunload')
}, 0);
if (unloadPreventedCount < 3) {
unloadPreventedCount++;
function preventNextBeforeUnload() {
window.addEventListener('beforeunload', function handler(e) {
e.preventDefault();
e.returnValue = '';
window.removeEventListener('beforeunload', handler)
setTimeout(function() {
require('electron').ipcRenderer.sendSync('onbeforeunload')
}, 0);
return false;
}
})
}
</script>
</body>

View File

@@ -1,19 +1,24 @@
<html>
<body>
<script type="text/javascript" charset="utf-8">
// Only prevent unload on the first window close
var unloadPrevented = false;
window.onbeforeunload = function() {
setTimeout(function() {
require('electron').ipcRenderer.sendSync('onbeforeunload');
}, 0);
if (!unloadPrevented) {
unloadPrevented = true;
return false;
function run() {
// Only prevent unload on the first window close
var unloadPrevented = false;
window.onbeforeunload = function() {
setTimeout(function() {
require('electron').ipcRenderer.sendSync('onbeforeunload');
}, 0);
if (!unloadPrevented) {
unloadPrevented = true;
return false;
}
}
// unload events don't get run unless load events have run.
if (document.readyState === 'complete')
window.close()
else
window.onload = () => window.close()
}
// unload events don't get run unless load events have run.
window.onload = () => window.close()
</script>
</body>
</html>

View File

@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<body>
<input type="text" list="guitarists" />
<datalist id="guitarists">
<select>
<option value="John Mayer"></option>
<option value="Eric Clapton"></option>
<option value="Django Reinhardt"></option>
</select>
</datalist>
</body>
</html>

View File

@@ -0,0 +1,184 @@
[
[
"top=5,left=10,resizable=no",
{
"sender": "[WebContents]",
"returnValue": "placeholder-guest-contents-id"
},
"about:blank",
"frame name",
"new-window",
{
"show": true,
"width": 800,
"height": 600,
"webContents": "[WebContents]",
"title": "frame name",
"webPreferences": {
"nativeWindowOpen": true,
"sandbox": true,
"backgroundColor": "blue",
"nodeIntegration": false,
"webviewTag": false,
"nodeIntegrationInSubFrames": false
},
"top": 5,
"left": 10,
"resizable": false,
"x": 10,
"y": 5,
"backgroundColor": "blue",
"focusable": false
},
[],
{
"url": "",
"policy": "no-referrer-when-downgrade"
},
null
],
[
"zoomFactor=2,resizable=0,x=0,y=10",
{
"sender": "[WebContents]",
"returnValue": "placeholder-guest-contents-id"
},
"about:blank",
"frame name",
"new-window",
{
"show": true,
"width": 800,
"height": 600,
"webContents": "[WebContents]",
"title": "frame name",
"webPreferences": {
"zoomFactor": "2",
"nativeWindowOpen": true,
"sandbox": true,
"backgroundColor": "blue",
"nodeIntegration": false,
"webviewTag": false,
"nodeIntegrationInSubFrames": false
},
"resizable": false,
"x": 0,
"y": 10,
"backgroundColor": "blue",
"focusable": false
},
[],
{
"url": "",
"policy": "no-referrer-when-downgrade"
},
null
],
[
"backgroundColor=gray,webPreferences=0,x=100,y=100",
{
"sender": "[WebContents]",
"returnValue": "placeholder-guest-contents-id"
},
"about:blank",
"frame name",
"new-window",
{
"show": true,
"width": 800,
"height": 600,
"webContents": "[WebContents]",
"title": "frame name",
"webPreferences": {
"nativeWindowOpen": true,
"sandbox": true,
"backgroundColor": "gray",
"nodeIntegration": false,
"webviewTag": false,
"nodeIntegrationInSubFrames": false
},
"backgroundColor": "gray",
"x": 100,
"y": 100,
"focusable": false
},
[],
{
"url": "",
"policy": "no-referrer-when-downgrade"
},
null
],
[
"x=50,y=20,title=sup",
{
"sender": "[WebContents]",
"returnValue": "placeholder-guest-contents-id"
},
"about:blank",
"frame name",
"new-window",
{
"show": true,
"width": 800,
"height": 600,
"webContents": "[WebContents]",
"title": "sup",
"webPreferences": {
"nativeWindowOpen": true,
"sandbox": true,
"backgroundColor": "blue",
"nodeIntegration": false,
"webviewTag": false,
"nodeIntegrationInSubFrames": false
},
"x": 50,
"y": 20,
"backgroundColor": "blue",
"focusable": false
},
[],
{
"url": "",
"policy": "no-referrer-when-downgrade"
},
null
],
[
"show=false,top=1,left=1",
{
"sender": "[WebContents]",
"returnValue": "placeholder-guest-contents-id"
},
"about:blank",
"frame name",
"new-window",
{
"show": false,
"width": 800,
"height": 600,
"webContents": "[WebContents]",
"title": "frame name",
"webPreferences": {
"nativeWindowOpen": true,
"sandbox": true,
"backgroundColor": "blue",
"nodeIntegration": false,
"webviewTag": false,
"nodeIntegrationInSubFrames": false
},
"top": 1,
"left": 1,
"x": 1,
"y": 1,
"backgroundColor": "blue",
"focusable": false
},
[],
{
"url": "",
"policy": "no-referrer-when-downgrade"
},
null
]
]

View File

@@ -0,0 +1,161 @@
[
[
"top=5,left=10,resizable=no",
{
"sender": "[WebContents]",
"frameId": 1
},
"about:blank",
"frame name",
"new-window",
{
"top": 5,
"left": 10,
"resizable": false,
"x": 10,
"y": 5,
"title": "frame name",
"webPreferences": {
"nodeIntegration": false,
"webviewTag": false,
"nodeIntegrationInSubFrames": false,
"openerId": "placeholder-opener-id"
},
"width": 800,
"height": 600,
"show": false
},
[],
{
"url": "",
"policy": "default"
},
null
],
[
"zoomFactor=2,resizable=0,x=0,y=10",
{
"sender": "[WebContents]",
"frameId": 1
},
"about:blank",
"frame name",
"new-window",
{
"resizable": false,
"x": 0,
"y": 10,
"title": "frame name",
"webPreferences": {
"zoomFactor": "2",
"nodeIntegration": false,
"webviewTag": false,
"nodeIntegrationInSubFrames": false,
"openerId": "placeholder-opener-id"
},
"width": 800,
"height": 600,
"show": false
},
[],
{
"url": "",
"policy": "default"
},
null
],
[
"backgroundColor=gray,webPreferences=0,x=100,y=100",
{
"sender": "[WebContents]",
"frameId": 1
},
"about:blank",
"frame name",
"new-window",
{
"backgroundColor": "gray",
"webPreferences": {
"nodeIntegration": false,
"webviewTag": false,
"nodeIntegrationInSubFrames": false,
"openerId": "placeholder-opener-id",
"backgroundColor": "gray"
},
"x": 100,
"y": 100,
"title": "frame name",
"width": 800,
"height": 600,
"show": false
},
[],
{
"url": "",
"policy": "default"
},
null
],
[
"x=50,y=20,title=sup",
{
"sender": "[WebContents]",
"frameId": 1
},
"about:blank",
"frame name",
"new-window",
{
"x": 50,
"y": 20,
"title": "sup",
"webPreferences": {
"nodeIntegration": false,
"webviewTag": false,
"nodeIntegrationInSubFrames": false,
"openerId": "placeholder-opener-id"
},
"width": 800,
"height": 600,
"show": false
},
[],
{
"url": "",
"policy": "default"
},
null
],
[
"show=false,top=1,left=1",
{
"sender": "[WebContents]",
"frameId": 1
},
"about:blank",
"frame name",
"new-window",
{
"show": false,
"top": 1,
"left": 1,
"x": 1,
"y": 1,
"title": "frame name",
"webPreferences": {
"nodeIntegration": false,
"webviewTag": false,
"nodeIntegrationInSubFrames": false,
"openerId": "placeholder-opener-id"
},
"width": 800,
"height": 600
},
[],
{
"url": "",
"policy": "default"
},
null
]
]

View File

@@ -0,0 +1,109 @@
import { BrowserWindow } from 'electron';
import { writeFileSync, readFileSync } from 'fs';
import { resolve } from 'path';
import { expect } from 'chai';
import { closeAllWindows } from './window-helpers';
function genSnapshot (browserWindow: BrowserWindow, features: string) {
return new Promise((resolve) => {
browserWindow.webContents.on('new-window', (...args: any[]) => {
resolve([features, ...args]);
});
browserWindow.webContents.executeJavaScript(`window.open('about:blank', 'frame name', '${features}')`);
});
}
describe('new-window event', () => {
const testConfig = {
native: {
snapshotFileName: 'native-window-open.snapshot.txt',
browserWindowOptions: {
show: false,
width: 200,
title: 'cool',
backgroundColor: 'blue',
focusable: false,
webPreferences: {
nativeWindowOpen: true,
sandbox: true
}
}
},
proxy: {
snapshotFileName: 'proxy-window-open.snapshot.txt',
browserWindowOptions: {
show: false
}
}
};
for (const testName of Object.keys(testConfig) as (keyof typeof testConfig)[]) {
const { snapshotFileName, browserWindowOptions } = testConfig[testName];
describe(`for ${testName} window opening`, () => {
const snapshotFile = resolve(__dirname, 'fixtures', 'snapshots', snapshotFileName);
let browserWindow: BrowserWindow;
let existingSnapshots: any[];
before(() => {
existingSnapshots = parseSnapshots(readFileSync(snapshotFile, { encoding: 'utf8' }));
});
beforeEach((done) => {
browserWindow = new BrowserWindow(browserWindowOptions);
browserWindow.loadURL('about:blank');
browserWindow.on('ready-to-show', () => done());
});
afterEach(closeAllWindows);
const newSnapshots: any[] = [];
[
'top=5,left=10,resizable=no',
'zoomFactor=2,resizable=0,x=0,y=10',
'backgroundColor=gray,webPreferences=0,x=100,y=100',
'x=50,y=20,title=sup',
'show=false,top=1,left=1'
].forEach((features, index) => {
/**
* ATTN: If this test is failing, you likely just need to change
* `shouldOverwriteSnapshot` to true and then evaluate the snapshot diff
* to see if the change is harmless.
*/
it(`matches snapshot for ${features}`, async () => {
const newSnapshot = await genSnapshot(browserWindow, features);
newSnapshots.push(newSnapshot);
// TODO: The output when these fail could be friendlier.
expect(stringifySnapshots(newSnapshot)).to.equal(stringifySnapshots(existingSnapshots[index]));
});
});
after(() => {
const shouldOverwriteSnapshot = false;
if (shouldOverwriteSnapshot) writeFileSync(snapshotFile, stringifySnapshots(newSnapshots, true));
});
});
}
});
function stringifySnapshots (snapshots: any, pretty = false) {
return JSON.stringify(snapshots, (key, value) => {
if (['sender', 'webContents'].includes(key)) {
return '[WebContents]';
}
if (key === 'openerId' && typeof value === 'number') {
return 'placeholder-opener-id';
}
if (key === 'returnValue') {
return 'placeholder-guest-contents-id';
}
return value;
}, pretty ? 2 : undefined);
}
function parseSnapshots (snapshotsJson: string) {
return JSON.parse(snapshotsJson, (key, value) => {
if (key === 'openerId' && value === 'placeholder-opener-id') return 1;
return value;
});
}

View File

@@ -2,10 +2,9 @@ import { expect } from 'chai';
describe('feature-string parsing', () => {
it('is indifferent to whitespace around keys and values', () => {
const { parseFeaturesString } = require('../lib/common/parse-features-string');
const { parseCommaSeparatedKeyValue } = require('../lib/common/parse-features-string');
const checkParse = (string: string, parsed: Record<string, string | boolean>) => {
const features: Record<string, string | boolean> = {};
parseFeaturesString(string, (k: string, v: any) => { features[k] = v; });
const features = parseCommaSeparatedKeyValue(string, true).parsed;
expect(features).to.deep.equal(parsed);
};
checkParse('a=yes,c=d', { a: true, c: 'd' });

View File

@@ -307,4 +307,17 @@ describe('node feature', () => {
const result = childProcess.spawnSync(process.execPath, [path.resolve(fixtures, 'api', 'electron-main-module', 'app.asar')]);
expect(result.status).to.equal(0);
});
it('handles Promise timeouts correctly', (done) => {
const scriptPath = path.join(fixtures, 'module', 'node-promise-timer.js');
const child = childProcess.spawn(process.execPath, [scriptPath], {
env: { ELECTRON_RUN_AS_NODE: 'true' }
});
emittedOnce(child, 'exit').then(([code, signal]) => {
expect(code).to.equal(0);
expect(signal).to.equal(null);
child.kill();
done();
});
});
});

View File

@@ -0,0 +1,23 @@
const waitMs = (msec) => new Promise((resolve) => setTimeout(resolve, msec));
const intervalMsec = 100;
const numIterations = 2;
let curIteration = 0;
let promise;
for (let i = 0; i < numIterations; i++) {
promise = (promise || waitMs(intervalMsec)).then(() => {
++curIteration;
return waitMs(intervalMsec);
});
}
// https://github.com/electron/electron/issues/21515 was about electron
// exiting before promises finished. This test sets the pending exitCode
// to failure, then resets it to success only if all promises finish.
process.exitCode = 1;
promise.then(() => {
if (curIteration === numIterations) {
process.exitCode = 0;
}
});