mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
Compare commits
77 Commits
v11.0.0-ni
...
v11.0.0-ni
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3d2afa45c3 | ||
|
|
4080b04911 | ||
|
|
b09c828dd3 | ||
|
|
f3363bde26 | ||
|
|
f136bf406f | ||
|
|
77ee3da77c | ||
|
|
47f88b65b7 | ||
|
|
d7909b507f | ||
|
|
14aba3f0de | ||
|
|
7ded768743 | ||
|
|
47d451ae52 | ||
|
|
7e84d3a2c1 | ||
|
|
29a7b8f805 | ||
|
|
16c32d2eb2 | ||
|
|
047650b564 | ||
|
|
8311078a96 | ||
|
|
a9eaebb7f4 | ||
|
|
01c9113e2b | ||
|
|
481b19bee6 | ||
|
|
433956ce4f | ||
|
|
b0ea1e14e1 | ||
|
|
4d50f3f62c | ||
|
|
2028492356 | ||
|
|
3fa250d6da | ||
|
|
854b74809a | ||
|
|
cbdfeb1979 | ||
|
|
2224d94c75 | ||
|
|
b6f8cd39e5 | ||
|
|
075a7adcc0 | ||
|
|
14256ee697 | ||
|
|
aaa971ff19 | ||
|
|
5bf423b646 | ||
|
|
4f4c383ec5 | ||
|
|
5ed8afbdb6 | ||
|
|
5f447e4b4f | ||
|
|
4523c90dcd | ||
|
|
6cb23e1d36 | ||
|
|
a2c82f2342 | ||
|
|
9274117e12 | ||
|
|
99874fd71f | ||
|
|
06c47c650a | ||
|
|
30cd9cdf2a | ||
|
|
9c234f3f3f | ||
|
|
01a2e23194 | ||
|
|
15ee34a1f2 | ||
|
|
f53aac97f5 | ||
|
|
1350dc46ed | ||
|
|
6fd302f745 | ||
|
|
e5c721eafc | ||
|
|
a342ab7ce7 | ||
|
|
c3258d6c4e | ||
|
|
b5cd9ce0b3 | ||
|
|
e7fc19c98e | ||
|
|
948cc08265 | ||
|
|
d93bb34ac4 | ||
|
|
01023435c0 | ||
|
|
06cb550c75 | ||
|
|
1b175a0609 | ||
|
|
75372e933f | ||
|
|
f859d4ce44 | ||
|
|
9c37e12e2d | ||
|
|
834408a50f | ||
|
|
b6321cc22d | ||
|
|
38fafe4986 | ||
|
|
e6cf5906f6 | ||
|
|
362da77c0a | ||
|
|
3f45fc24bb | ||
|
|
75c3a426ea | ||
|
|
4e15273b9f | ||
|
|
c6c986648f | ||
|
|
bac232689d | ||
|
|
76e3ee6fe6 | ||
|
|
4829b0f816 | ||
|
|
a612fb00c8 | ||
|
|
2f02a469f4 | ||
|
|
b39a5b71fe | ||
|
|
91f5837344 |
@@ -336,7 +336,9 @@ step-get-more-space-on-mac: &step-get-more-space-on-mac
|
||||
if [ "`uname`" == "Darwin" ]; then
|
||||
sudo mkdir -p $TMPDIR/del-target
|
||||
tmpify() {
|
||||
sudo mv $1 $TMPDIR/del-target/$(echo $1|shasum -a 256|head -n1|cut -d " " -f1)
|
||||
if [ -d "$1" ]; then
|
||||
sudo mv $1 $TMPDIR/del-target/$(echo $1|shasum -a 256|head -n1|cut -d " " -f1)
|
||||
fi
|
||||
}
|
||||
tmpify /Library/Developer/CoreSimulator
|
||||
tmpify $(xcode-select -p)/Platforms/AppleTVOS.platform
|
||||
@@ -743,8 +745,6 @@ step-maybe-generate-breakpad-symbols: &step-maybe-generate-breakpad-symbols
|
||||
if [ "$GENERATE_SYMBOLS" == "true" ]; then
|
||||
cd src
|
||||
ninja -C out/Default electron:electron_symbols
|
||||
cd out/Default/breakpad_symbols
|
||||
find . -name \*.sym -print0 | xargs -0 npx @sentry/cli@1.51.1 difutil bundle-sources
|
||||
fi
|
||||
|
||||
step-maybe-zip-symbols: &step-maybe-zip-symbols
|
||||
@@ -1037,6 +1037,11 @@ steps-lint: &steps-lint
|
||||
cd src/electron
|
||||
node script/yarn install --frozen-lockfile
|
||||
node script/yarn lint
|
||||
- run:
|
||||
name: Run Script Typechecker
|
||||
command: |
|
||||
cd src/electron
|
||||
node script/yarn tsc -p tsconfig.script.json
|
||||
|
||||
steps-checkout-and-save-cache: &steps-checkout-and-save-cache
|
||||
steps:
|
||||
|
||||
15
BUILD.gn
15
BUILD.gn
@@ -170,7 +170,7 @@ action("electron_js2c") {
|
||||
inputs = sources + [ "//third_party/electron_node/tools/js2c.py" ]
|
||||
outputs = [ "$root_gen_dir/electron_natives.cc" ]
|
||||
|
||||
script = "tools/js2c.py"
|
||||
script = "build/js2c.py"
|
||||
args = [ rebase_path("//third_party/electron_node") ] +
|
||||
rebase_path(outputs, root_build_dir) +
|
||||
rebase_path(sources, root_build_dir)
|
||||
@@ -360,6 +360,7 @@ source_set("electron_lib") {
|
||||
"//services/viz/privileged/mojom/compositing",
|
||||
"//skia",
|
||||
"//third_party/blink/public:blink",
|
||||
"//third_party/blink/public:blink_devtools_inspector_resources",
|
||||
"//third_party/boringssl",
|
||||
"//third_party/electron_node:node_lib",
|
||||
"//third_party/inspector_protocol:crdtp",
|
||||
@@ -813,6 +814,9 @@ if (is_mac) {
|
||||
"-Wl,-install_name,@rpath/$output_name.framework/$output_name",
|
||||
"-rpath",
|
||||
"@loader_path/Libraries",
|
||||
|
||||
# Required for exporting all symbols of libuv.
|
||||
"-Wl,-force_load,obj/third_party/electron_node/deps/uv/libuv.a",
|
||||
]
|
||||
if (is_component_build) {
|
||||
ldflags += [
|
||||
@@ -1144,7 +1148,14 @@ if (is_mac) {
|
||||
]
|
||||
}
|
||||
if (is_linux) {
|
||||
ldflags = [ "-pie" ]
|
||||
ldflags = [
|
||||
"-pie",
|
||||
|
||||
# Required for exporting all symbols of libuv.
|
||||
"-Wl,--whole-archive",
|
||||
"obj/third_party/electron_node/deps/uv/libuv.a",
|
||||
"-Wl,--no-whole-archive",
|
||||
]
|
||||
|
||||
if (!is_component_build && is_component_ffmpeg) {
|
||||
configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
|
||||
|
||||
2
DEPS
2
DEPS
@@ -16,7 +16,7 @@ vars = {
|
||||
'chromium_version':
|
||||
'93a6ebbe22f1a093e6a0cb5e72ba78990fe39824',
|
||||
'node_version':
|
||||
'v12.18.2',
|
||||
'v12.18.3',
|
||||
'nan_version':
|
||||
'2c4ee8a32a299eada3cd6e468bbd0a473bfea96d',
|
||||
'squirrel.mac_version':
|
||||
|
||||
@@ -1 +1 @@
|
||||
11.0.0-nightly.20200724
|
||||
11.0.0-nightly.20200812
|
||||
@@ -1216,6 +1216,13 @@ Returns `Object`:
|
||||
should restore the state from the previous session. This indicates that the
|
||||
app should restore the windows that were open the last time the app was
|
||||
closed. This setting is not available on [MAS builds][mas-builds].
|
||||
* `executableWillLaunchAtLogin` Boolean _Windows_ - `true` if app is set to open at login and its run key is not deactivated. This differs from `openAtLogin` as it ignores the `args` option, this property will be true if the given executable would be launched at login with **any** arguments.
|
||||
* `launchItems` Object[] _Windows_
|
||||
* `name` String _Windows_ - name value of a registry entry.
|
||||
* `path` String _Windows_ - The executable to an app that corresponds to a registry entry.
|
||||
* `args` String[] _Windows_ - the command-line arguments to pass to the executable.
|
||||
* `scope` String _Windows_ - one of `user` or `machine`. Indicates whether the registry entry is under `HKEY_CURRENT USER` or `HKEY_LOCAL_MACHINE`.
|
||||
* `enabled` Boolean _Windows_ - `true` if the app registry key is startup approved and therfore shows as `enabled` in Task Manager and Windows settings.
|
||||
|
||||
### `app.setLoginItemSettings(settings)` _macOS_ _Windows_
|
||||
|
||||
@@ -1231,7 +1238,9 @@ Returns `Object`:
|
||||
* `args` String[] (optional) _Windows_ - The command-line arguments to pass to
|
||||
the executable. Defaults to an empty array. Take care to wrap paths in
|
||||
quotes.
|
||||
|
||||
* `enabled` Boolean (optional) _Windows_ - `true` will change the startup approved registry key and `enable / disable` the App in Task Manager and Windows Settings.
|
||||
Defaults to `true`.
|
||||
* `name` String (optional) _Windows_ - value name to write into registry. Defaults to the app's AppUserModelId().
|
||||
Set the app's login item settings.
|
||||
|
||||
To work with Electron's `autoUpdater` on Windows, which uses [Squirrel][Squirrel-Windows],
|
||||
|
||||
@@ -156,10 +156,16 @@ parameters in a renderer process will not result in those parameters being sent
|
||||
with crashes that occur in other renderer processes or in the main process.
|
||||
|
||||
**Note:** Parameters have limits on the length of the keys and values. Key
|
||||
names must be no longer than 39 bytes, and values must be no longer than 127
|
||||
names must be no longer than 39 bytes, and values must be no longer than 20320
|
||||
bytes. Keys with names longer than the maximum will be silently ignored. Key
|
||||
values longer than the maximum length will be truncated.
|
||||
|
||||
**Note:** On linux values that are longer than 127 bytes will be chunked into
|
||||
multiple keys, each 127 bytes in length. E.g. `addExtraParameter('foo', 'a'.repeat(130))`
|
||||
will result in two chunked keys `foo__1` and `foo__2`, the first will contain
|
||||
the first 127 bytes and the second will contain the remaining 3 bytes. On
|
||||
your crash reporting backend you should stitch together keys in this format.
|
||||
|
||||
### `crashReporter.removeExtraParameter(key)`
|
||||
|
||||
* `key` String - Parameter key, must be no longer than 39 bytes.
|
||||
|
||||
@@ -108,7 +108,7 @@ ipcMain.handle('some-name', async (event, someArgument) => {
|
||||
|
||||
If you need to transfer a [`MessagePort`][] to the main process, use [`ipcRenderer.postMessage`](#ipcrendererpostmessagechannel-message-transfer).
|
||||
|
||||
If you do not need a respons to the message, consider using [`ipcRenderer.send`](#ipcrenderersendchannel-args).
|
||||
If you do not need a response to the message, consider using [`ipcRenderer.send`](#ipcrenderersendchannel-args).
|
||||
|
||||
### `ipcRenderer.sendSync(channel, ...args)`
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# KeyboardEvent Object extends `Event`
|
||||
# KeyboardEvent Object
|
||||
|
||||
* `ctrlKey` Boolean (optional) - whether the Control key was used in an accelerator to trigger the Event
|
||||
* `metaKey` Boolean (optional) - whether a meta key was used in an accelerator to trigger the Event
|
||||
|
||||
@@ -15,7 +15,7 @@ calls, and other compiler optimizations. The only workaround is to build an
|
||||
unoptimized local build.
|
||||
|
||||
The official symbol server URL for Electron is
|
||||
https://electron-symbols.githubapp.com.
|
||||
https://symbols.electronjs.org.
|
||||
You cannot visit this URL directly, you must add it to the symbol path of your
|
||||
debugging tool. In the examples below, a local cache directory is used to avoid
|
||||
repeatedly fetching the PDB from the server. Replace `c:\code\symbols` with an
|
||||
@@ -30,7 +30,7 @@ directory on your computer, if you'd prefer a different location for downloaded
|
||||
symbols):
|
||||
|
||||
```powershell
|
||||
SRV*c:\code\symbols\*https://electron-symbols.githubapp.com
|
||||
SRV*c:\code\symbols\*https://symbols.electronjs.org
|
||||
```
|
||||
|
||||
Set this string as `_NT_SYMBOL_PATH` in the environment, using the Windbg menus,
|
||||
@@ -38,7 +38,7 @@ or by typing the `.sympath` command. If you would like to get symbols from
|
||||
Microsoft's symbol server as well, you should list that first:
|
||||
|
||||
```powershell
|
||||
SRV*c:\code\symbols\*https://msdl.microsoft.com/download/symbols;SRV*c:\code\symbols\*https://electron-symbols.githubapp.com
|
||||
SRV*c:\code\symbols\*https://msdl.microsoft.com/download/symbols;SRV*c:\code\symbols\*https://symbols.electronjs.org
|
||||
```
|
||||
|
||||
## Using the symbol server in Visual Studio
|
||||
|
||||
29
docs/faq.md
29
docs/faq.md
@@ -43,26 +43,14 @@ use HTML5 APIs which are already available in browsers. Good candidates are
|
||||
[Storage API][storage], [`localStorage`][local-storage],
|
||||
[`sessionStorage`][session-storage], and [IndexedDB][indexed-db].
|
||||
|
||||
Or you can use the IPC system, which is specific to Electron, to store objects
|
||||
in the main process as a global variable, and then to access them from the
|
||||
renderers through the `remote` property of `electron` module:
|
||||
|
||||
```javascript
|
||||
// In the main process.
|
||||
global.sharedObject = {
|
||||
someProperty: 'default value'
|
||||
}
|
||||
```
|
||||
|
||||
```javascript
|
||||
// In page 1.
|
||||
require('electron').remote.getGlobal('sharedObject').someProperty = 'new value'
|
||||
```
|
||||
|
||||
```javascript
|
||||
// In page 2.
|
||||
console.log(require('electron').remote.getGlobal('sharedObject').someProperty)
|
||||
```
|
||||
Alternatively, you can use the IPC primitives that are provided by Electron. To
|
||||
share data between the main and renderer processes, you can use the
|
||||
[`ipcMain`](api/ipc-main.md) and [`ipcRenderer`](api/ipc-renderer.md) modules.
|
||||
To communicate directly between web pages, you can send a
|
||||
[`MessagePort`][message-port] from one to the other, possibly via the main process
|
||||
using [`ipcRenderer.postMessage()`](api/ipc-renderer.md#ipcrendererpostmessagechannel-message-transfer).
|
||||
Subsequent communication over message ports is direct and does not detour through
|
||||
the main process.
|
||||
|
||||
## My app's tray disappeared after a few minutes.
|
||||
|
||||
@@ -171,5 +159,6 @@ Notice that just setting the background in the CSS does not have the desired eff
|
||||
[local-storage]: https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage
|
||||
[session-storage]: https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage
|
||||
[indexed-db]: https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API
|
||||
[message-port]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort
|
||||
[browser-window]: api/browser-window.md
|
||||
[subpixel rendering example]: images/subpixel-rendering-screenshot.gif
|
||||
|
||||
@@ -38,11 +38,11 @@ process of the web page must communicate with the main process to request that
|
||||
the main process perform those operations.
|
||||
|
||||
> #### Aside: Communication Between Processes
|
||||
> In Electron, we have several ways to communicate between the main process
|
||||
and renderer processes, such as [`ipcRenderer`](../api/ipc-renderer.md) and
|
||||
[`ipcMain`](../api/ipc-main.md) modules for sending messages, and the
|
||||
[remote](../api/remote.md) module for RPC style communication. There is also
|
||||
an FAQ entry on [how to share data between web pages][share-data].
|
||||
> In Electron, communicating between the main process and renderer processes,
|
||||
> is done through the [`ipcRenderer`](../api/ipc-renderer.md) and
|
||||
> [`ipcMain`](../api/ipc-main.md) modules. There is also an FAQ entry on [how
|
||||
> to share data between web pages][share-data].
|
||||
|
||||
|
||||
## Using Electron APIs
|
||||
|
||||
@@ -71,20 +71,26 @@ const win = new BrowserWindow()
|
||||
```
|
||||
|
||||
Since communication between the processes is possible, a renderer process
|
||||
can call upon the main process to perform tasks. Electron comes with a
|
||||
module called `remote` that exposes APIs usually only available on the
|
||||
main process. In order to create a `BrowserWindow` from a renderer process,
|
||||
we'd use the remote as a middle-man:
|
||||
can call upon the main process to perform tasks through IPC.
|
||||
|
||||
```javascript
|
||||
// This will work in a renderer process, but be `undefined` in the
|
||||
// main process:
|
||||
const { remote } = require('electron')
|
||||
const { BrowserWindow } = remote
|
||||
// In the main process:
|
||||
const { ipcMain } = require('electron')
|
||||
|
||||
const win = new BrowserWindow()
|
||||
ipcMain.handle('perform-action', (event, ...args) => {
|
||||
// ... do something on behalf of the renderer ...
|
||||
})
|
||||
|
||||
// In the renderer process:
|
||||
const { ipcRenderer } = require('electron')
|
||||
|
||||
ipcRenderer.invoke('perform-action', ...args)
|
||||
```
|
||||
|
||||
Note that code in the renderer may not be trustworthy, so it's important
|
||||
to carefully validate in the main process requests that come from renderers,
|
||||
especially if they host third-party content.
|
||||
|
||||
## Using Node.js APIs
|
||||
|
||||
Electron exposes full access to Node.js both in the main and the renderer
|
||||
|
||||
@@ -13,11 +13,11 @@ to automate the `Info.plist` changes during app build time.
|
||||
|
||||
## Automatically updating the native interfaces
|
||||
|
||||
"Native Interfaces" include the file picker, window border, dialogs, context menus and more; basically,
|
||||
"Native Interfaces" include the file picker, window border, dialogs, context menus, and more; basically,
|
||||
anything where the UI comes from macOS and not your app. As of Electron 7.0.0, the default behavior
|
||||
is to opt in to this automatic theming from the OS. If you wish to opt out and are using Electron
|
||||
is to opt into this automatic theming from the OS. If you wish to opt-out and are using Electron
|
||||
> 8.0.0, you must set the `NSRequiresAquaSystemAppearance` key in the `Info.plist` file to `true`.
|
||||
Please note that Electron 8.0.0 and above will not let your opt out of this theming, due to the use
|
||||
Please note that Electron 8.0.0 and above will not let your opt-out of this theming, due to the use
|
||||
of the macOS 10.14 SDK.
|
||||
|
||||
## Automatically updating your own interfaces
|
||||
|
||||
@@ -55,6 +55,7 @@ template("electron_extra_paks") {
|
||||
output = "${invoker.output_dir}/resources.pak"
|
||||
sources = [
|
||||
"$root_gen_dir/chrome/dev_ui_browser_resources.pak",
|
||||
"$root_gen_dir/chrome/print_preview_pdf_resources.pak",
|
||||
"$root_gen_dir/components/components_resources.pak",
|
||||
"$root_gen_dir/content/browser/resources/media/media_internals_resources.pak",
|
||||
"$root_gen_dir/content/browser/tracing/tracing_resources.pak",
|
||||
@@ -64,11 +65,13 @@ template("electron_extra_paks") {
|
||||
"$root_gen_dir/mojo/public/js/mojo_bindings_resources.pak",
|
||||
"$root_gen_dir/net/net_resources.pak",
|
||||
"$root_gen_dir/third_party/blink/public/resources/blink_resources.pak",
|
||||
"$root_gen_dir/third_party/blink/public/resources/inspector_overlay_resources.pak",
|
||||
"$root_gen_dir/ui/resources/webui_resources.pak",
|
||||
"$target_gen_dir/electron_resources.pak",
|
||||
]
|
||||
deps = [
|
||||
"//chrome/browser:dev_ui_browser_resources",
|
||||
"//chrome/browser/resources:print_preview_pdf_resources",
|
||||
"//components/resources",
|
||||
"//content:content_resources",
|
||||
"//content:dev_ui_content_resources",
|
||||
@@ -78,6 +81,7 @@ template("electron_extra_paks") {
|
||||
"//electron:resources",
|
||||
"//mojo/public/js:resources",
|
||||
"//net:net_resources",
|
||||
"//third_party/blink/public:devtools_inspector_resources",
|
||||
"//third_party/blink/public:resources",
|
||||
"//ui/resources",
|
||||
]
|
||||
|
||||
@@ -238,7 +238,6 @@ auto_filenames = {
|
||||
"lib/browser/remote/objects-registry.ts",
|
||||
"lib/browser/remote/server.ts",
|
||||
"lib/browser/rpc-server.ts",
|
||||
"lib/browser/utils.ts",
|
||||
"lib/common/api/clipboard.ts",
|
||||
"lib/common/api/deprecate.ts",
|
||||
"lib/common/api/module-list.ts",
|
||||
|
||||
@@ -529,17 +529,15 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
|
||||
return fs.readFile(realPath, options, callback);
|
||||
}
|
||||
|
||||
const buffer = Buffer.alloc(info.size);
|
||||
const fd = archive.getFd();
|
||||
if (!(fd >= 0)) {
|
||||
const error = createError(AsarError.NOT_FOUND, { asarPath, filePath });
|
||||
nextTick(callback, [error]);
|
||||
return;
|
||||
}
|
||||
|
||||
logASARAccess(asarPath, filePath, info.offset);
|
||||
fs.read(fd, buffer, 0, info.size, info.offset, (error: Error) => {
|
||||
callback(error, encoding ? buffer.toString(encoding) : buffer);
|
||||
archive.read(info.offset, info.size).then((buf) => {
|
||||
const buffer = Buffer.from(buf);
|
||||
callback(null, encoding ? buffer.toString(encoding) : buffer);
|
||||
}, (err) => {
|
||||
const error: AsarErrorObject = new Error(`EINVAL, ${err.message} while reading ${filePath} in ${asarPath}`);
|
||||
error.code = 'EINVAL';
|
||||
error.errno = -22;
|
||||
callback(error);
|
||||
});
|
||||
};
|
||||
|
||||
@@ -572,13 +570,19 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
|
||||
}
|
||||
|
||||
const { encoding } = options;
|
||||
const buffer = Buffer.alloc(info.size);
|
||||
const fd = archive.getFd();
|
||||
if (!(fd >= 0)) throw createError(AsarError.NOT_FOUND, { asarPath, filePath });
|
||||
|
||||
logASARAccess(asarPath, filePath, info.offset);
|
||||
fs.readSync(fd, buffer, 0, info.size, info.offset);
|
||||
return (encoding) ? buffer.toString(encoding) : buffer;
|
||||
let arrayBuffer: ArrayBuffer;
|
||||
try {
|
||||
arrayBuffer = archive.readSync(info.offset, info.size);
|
||||
} catch (err) {
|
||||
const error: AsarErrorObject = new Error(`EINVAL, ${err.message} while reading ${filePath} in ${asarPath}`);
|
||||
error.code = 'EINVAL';
|
||||
error.errno = -22;
|
||||
throw error;
|
||||
}
|
||||
const buffer = Buffer.from(arrayBuffer);
|
||||
return encoding ? buffer.toString(encoding) : buffer;
|
||||
};
|
||||
|
||||
const { readdir } = fs;
|
||||
@@ -675,23 +679,29 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
|
||||
const { asarPath, filePath } = pathInfo;
|
||||
|
||||
const archive = getOrCreateArchive(asarPath);
|
||||
if (!archive) return;
|
||||
if (!archive) return [];
|
||||
|
||||
const info = archive.getFileInfo(filePath);
|
||||
if (!info) return;
|
||||
if (info.size === 0) return '';
|
||||
if (!info) return [];
|
||||
if (info.size === 0) return ['', false];
|
||||
if (info.unpacked) {
|
||||
const realPath = archive.copyFileOut(filePath);
|
||||
return fs.readFileSync(realPath, { encoding: 'utf8' });
|
||||
}
|
||||
|
||||
const buffer = Buffer.alloc(info.size);
|
||||
const fd = archive.getFd();
|
||||
if (!(fd >= 0)) return;
|
||||
|
||||
logASARAccess(asarPath, filePath, info.offset);
|
||||
fs.readSync(fd, buffer, 0, info.size, info.offset);
|
||||
return buffer.toString('utf8');
|
||||
let arrayBuffer: ArrayBuffer;
|
||||
try {
|
||||
arrayBuffer = archive.readSync(info.offset, info.size);
|
||||
} catch (err) {
|
||||
const error: AsarErrorObject = new Error(`EINVAL, ${err.message} while reading ${filePath} in ${asarPath}`);
|
||||
error.code = 'EINVAL';
|
||||
error.errno = -22;
|
||||
throw error;
|
||||
}
|
||||
const buffer = Buffer.from(arrayBuffer);
|
||||
const str = buffer.toString('utf8');
|
||||
return [str, str.length > 0];
|
||||
};
|
||||
|
||||
const { internalModuleStat } = internalBinding('fs');
|
||||
|
||||
@@ -2,40 +2,35 @@ import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
|
||||
import { deprecate, Menu } from 'electron/main';
|
||||
import { EventEmitter } from 'events';
|
||||
|
||||
const bindings = process._linkedBinding('electron_browser_app');
|
||||
const commandLine = process._linkedBinding('electron_common_command_line');
|
||||
const { app, App } = bindings;
|
||||
const { app } = bindings;
|
||||
|
||||
// Only one app object permitted.
|
||||
export default app;
|
||||
|
||||
let dockMenu: Electron.Menu | null = null;
|
||||
|
||||
// App is an EventEmitter.
|
||||
Object.setPrototypeOf(App.prototype, EventEmitter.prototype);
|
||||
EventEmitter.call(app as any);
|
||||
|
||||
// Properties.
|
||||
|
||||
const nativeASGetter = app.isAccessibilitySupportEnabled;
|
||||
const nativeASSetter = app.setAccessibilitySupportEnabled;
|
||||
Object.defineProperty(App.prototype, 'accessibilitySupportEnabled', {
|
||||
Object.defineProperty(app, 'accessibilitySupportEnabled', {
|
||||
get: () => nativeASGetter.call(app),
|
||||
set: (enabled) => nativeASSetter.call(app, enabled)
|
||||
});
|
||||
|
||||
const nativeBCGetter = app.getBadgeCount;
|
||||
const nativeBCSetter = app.setBadgeCount;
|
||||
Object.defineProperty(App.prototype, 'badgeCount', {
|
||||
Object.defineProperty(app, 'badgeCount', {
|
||||
get: () => nativeBCGetter.call(app),
|
||||
set: (count) => nativeBCSetter.call(app, count)
|
||||
});
|
||||
|
||||
const nativeNGetter = app.getName;
|
||||
const nativeNSetter = app.setName;
|
||||
Object.defineProperty(App.prototype, 'name', {
|
||||
Object.defineProperty(app, 'name', {
|
||||
get: () => nativeNGetter.call(app),
|
||||
set: (name) => nativeNSetter.call(app, name)
|
||||
});
|
||||
@@ -60,7 +55,7 @@ Object.defineProperty(app, 'applicationMenu', {
|
||||
}
|
||||
});
|
||||
|
||||
App.prototype.isPackaged = (() => {
|
||||
(app as any).isPackaged = (() => {
|
||||
const execFile = path.basename(process.execPath).toLowerCase();
|
||||
if (process.platform === 'win32') {
|
||||
return execFile !== 'electron.exe';
|
||||
@@ -137,4 +132,4 @@ for (const name of events) {
|
||||
|
||||
// Deprecate allowRendererProcessReuse but only if they set it to false, no need to log if
|
||||
// they are setting it to true
|
||||
deprecate.removeProperty(app, 'allowRendererProcessReuse', [false]);
|
||||
deprecate.removeProperty({ __proto__: app } as any, 'allowRendererProcessReuse', [false]);
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
import { EventEmitter } from 'events';
|
||||
const { autoUpdater, AutoUpdater } = process._linkedBinding('electron_browser_auto_updater');
|
||||
|
||||
// AutoUpdater is an EventEmitter.
|
||||
Object.setPrototypeOf(AutoUpdater.prototype, EventEmitter.prototype);
|
||||
EventEmitter.call(autoUpdater);
|
||||
const { autoUpdater } = process._linkedBinding('electron_browser_auto_updater');
|
||||
|
||||
export default autoUpdater;
|
||||
|
||||
@@ -1,10 +1,20 @@
|
||||
'use strict';
|
||||
const { createScreen } = process._linkedBinding('electron_common_screen');
|
||||
|
||||
import { createLazyInstance } from '@electron/internal/browser/utils';
|
||||
const { EventEmitter } = require('events');
|
||||
const { Screen, createScreen } = process._linkedBinding('electron_common_screen');
|
||||
let _screen: Electron.Screen;
|
||||
|
||||
// Screen is an EventEmitter.
|
||||
Object.setPrototypeOf(Screen.prototype, EventEmitter.prototype);
|
||||
|
||||
module.exports = createLazyInstance(createScreen, Screen, true);
|
||||
// We can't call createScreen until after app.on('ready'), but this module
|
||||
// exposes an instance created by createScreen. In order to avoid
|
||||
// side-effecting and calling createScreen upon import of this module, instead
|
||||
// we export a proxy which lazily calls createScreen on first access.
|
||||
export default new Proxy({}, {
|
||||
get: (target, prop) => {
|
||||
if (_screen === undefined) {
|
||||
_screen = createScreen();
|
||||
}
|
||||
const v = (_screen as any)[prop];
|
||||
if (typeof v === 'function') {
|
||||
return v.bind(_screen);
|
||||
}
|
||||
return v;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
import { EventEmitter } from 'events';
|
||||
import { deprecate } from 'electron/main';
|
||||
const { systemPreferences, SystemPreferences } = process._linkedBinding('electron_browser_system_preferences');
|
||||
|
||||
// SystemPreferences is an EventEmitter.
|
||||
Object.setPrototypeOf(SystemPreferences.prototype, EventEmitter.prototype);
|
||||
EventEmitter.call(systemPreferences);
|
||||
const { systemPreferences } = process._linkedBinding('electron_browser_system_preferences');
|
||||
|
||||
if ('getAppLevelAppearance' in systemPreferences) {
|
||||
const nativeALAGetter = systemPreferences.getAppLevelAppearance;
|
||||
const nativeALASetter = systemPreferences.setAppLevelAppearance;
|
||||
Object.defineProperty(SystemPreferences.prototype, 'appLevelAppearance', {
|
||||
Object.defineProperty(systemPreferences, 'appLevelAppearance', {
|
||||
get: () => nativeALAGetter.call(systemPreferences),
|
||||
set: (appearance) => nativeALASetter.call(systemPreferences, appearance)
|
||||
});
|
||||
@@ -17,25 +12,25 @@ if ('getAppLevelAppearance' in systemPreferences) {
|
||||
|
||||
if ('getEffectiveAppearance' in systemPreferences) {
|
||||
const nativeEAGetter = systemPreferences.getAppLevelAppearance;
|
||||
Object.defineProperty(SystemPreferences.prototype, 'effectiveAppearance', {
|
||||
Object.defineProperty(systemPreferences, 'effectiveAppearance', {
|
||||
get: () => nativeEAGetter.call(systemPreferences)
|
||||
});
|
||||
}
|
||||
|
||||
SystemPreferences.prototype.isDarkMode = deprecate.moveAPI(
|
||||
SystemPreferences.prototype.isDarkMode,
|
||||
systemPreferences.isDarkMode = deprecate.moveAPI(
|
||||
systemPreferences.isDarkMode,
|
||||
'systemPreferences.isDarkMode()',
|
||||
'nativeTheme.shouldUseDarkColors'
|
||||
);
|
||||
SystemPreferences.prototype.isInvertedColorScheme = deprecate.moveAPI(
|
||||
SystemPreferences.prototype.isInvertedColorScheme,
|
||||
systemPreferences.isInvertedColorScheme = deprecate.moveAPI(
|
||||
systemPreferences.isInvertedColorScheme,
|
||||
'systemPreferences.isInvertedColorScheme()',
|
||||
'nativeTheme.shouldUseInvertedColorScheme'
|
||||
);
|
||||
SystemPreferences.prototype.isHighContrastColorScheme = deprecate.moveAPI(
|
||||
SystemPreferences.prototype.isHighContrastColorScheme,
|
||||
systemPreferences.isHighContrastColorScheme = deprecate.moveAPI(
|
||||
systemPreferences.isHighContrastColorScheme,
|
||||
'systemPreferences.isHighContrastColorScheme()',
|
||||
'nativeTheme.shouldUseHighContrastColors'
|
||||
);
|
||||
|
||||
module.exports = systemPreferences;
|
||||
export default systemPreferences;
|
||||
|
||||
@@ -9,7 +9,6 @@ import { ipcMainInternal } from '@electron/internal/browser/ipc-main-internal';
|
||||
import * as ipcMainUtils from '@electron/internal/browser/ipc-main-internal-utils';
|
||||
import { parseFeatures } from '@electron/internal/common/parse-features-string';
|
||||
import { MessagePortMain } from '@electron/internal/browser/message-port-main';
|
||||
import { EventEmitter } from 'events';
|
||||
|
||||
// session is not used here, the purpose is to make sure session is initalized
|
||||
// before the webContents module.
|
||||
@@ -124,8 +123,6 @@ const defaultPrintingSetting = {
|
||||
const binding = process._linkedBinding('electron_browser_web_contents');
|
||||
const { WebContents } = binding as { WebContents: { prototype: Electron.WebContentsInternal } };
|
||||
|
||||
Object.setPrototypeOf(WebContents.prototype, EventEmitter.prototype);
|
||||
|
||||
WebContents.prototype.send = function (channel, ...args) {
|
||||
if (typeof channel !== 'string') {
|
||||
throw new Error('Missing required channel argument');
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
import { EventEmitter } from 'events';
|
||||
|
||||
/**
|
||||
* Creates a lazy instance of modules that can't be required before the
|
||||
* app 'ready' event by returning a proxy object to mitigate side effects
|
||||
* on 'require'
|
||||
*
|
||||
* @param {Function} creator - Function that creates a new module instance
|
||||
* @param {Object} holder - the object holding the module prototype
|
||||
* @param {Boolean} isEventEmitter - whether or not the module is an EventEmitter
|
||||
* @returns {Object} - a proxy object for the
|
||||
*/
|
||||
|
||||
export function createLazyInstance (
|
||||
creator: Function,
|
||||
holder: Object,
|
||||
isEventEmitter: Boolean
|
||||
) {
|
||||
let lazyModule: Object;
|
||||
const module: any = {};
|
||||
for (const method in (holder as any).prototype) { // eslint-disable-line guard-for-in
|
||||
module[method] = (...args: any) => {
|
||||
// create new instance of module at runtime if none exists
|
||||
if (!lazyModule) {
|
||||
lazyModule = creator();
|
||||
if (isEventEmitter) EventEmitter.call(lazyModule as any);
|
||||
}
|
||||
|
||||
// check for properties on the prototype chain that aren't functions
|
||||
if (typeof (lazyModule as any)[method] !== 'function') {
|
||||
return (lazyModule as any)[method];
|
||||
}
|
||||
|
||||
return (lazyModule as any)[method](...args);
|
||||
};
|
||||
}
|
||||
return module;
|
||||
}
|
||||
10
package.json
10
package.json
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "electron",
|
||||
"version": "11.0.0-nightly.20200724",
|
||||
"version": "11.0.0-nightly.20200812",
|
||||
"repository": "https://github.com/electron/electron",
|
||||
"description": "Build cross platform desktop apps with JavaScript, HTML, and CSS",
|
||||
"devDependencies": {
|
||||
"@electron/docs-parser": "^0.9.1",
|
||||
"@electron/typescript-definitions": "^8.7.4",
|
||||
"@octokit/rest": "^16.3.2",
|
||||
"@octokit/rest": "^18.0.3",
|
||||
"@primer/octicons": "^10.0.0",
|
||||
"@types/basic-auth": "^1.1.3",
|
||||
"@types/busboy": "^0.2.3",
|
||||
@@ -108,7 +108,7 @@
|
||||
"node script/lint.js --js --fix --only --"
|
||||
],
|
||||
"*.{js,ts,d.ts}": [
|
||||
"node script/gen-filenames.js"
|
||||
"ts-node script/gen-filenames.ts"
|
||||
],
|
||||
"*.{cc,mm,c,h}": [
|
||||
"python script/run-clang-format.py -r -c --fix"
|
||||
@@ -124,13 +124,13 @@
|
||||
"node script/lint.js --py --fix --only --"
|
||||
],
|
||||
"docs/api/**/*.md": [
|
||||
"node script/gen-filenames.js",
|
||||
"ts-node script/gen-filenames.ts",
|
||||
"python script/check-trailing-whitespace.py --fix",
|
||||
"git add filenames.auto.gni"
|
||||
],
|
||||
"{*.patch,.patches}": [
|
||||
"node script/lint.js --patches --only --",
|
||||
"node script/check-patch-diff.js"
|
||||
"ts-node script/check-patch-diff.ts"
|
||||
],
|
||||
"DEPS": [
|
||||
"node script/gen-hunspell-filenames.js"
|
||||
|
||||
@@ -103,3 +103,6 @@ fix_check_issecureeventinputenabled_in_constructor_before_setting.patch
|
||||
skip_atk_toolchain_check.patch
|
||||
fix_missing_weakptr_check_in_preconnectmanager.patch
|
||||
revert_swiftshader_roll_in_deps.patch
|
||||
worker_feat_add_hook_to_notify_script_ready.patch
|
||||
mac_work_around_xcode_12b3_sdk_bug.patch
|
||||
fix_provide_axtextchangevaluestartmarker_a11y_value_change.patch
|
||||
|
||||
@@ -74,7 +74,7 @@ index 6052fd13ff3d63cf8a4b019b058efb61aad39c3b..42eac7a7b656096c1d2039e340037ac8
|
||||
}
|
||||
return VKEY_UNKNOWN;
|
||||
}
|
||||
@@ -193,7 +199,10 @@ CGEventRef MediaKeysListenerImpl::EventTapCallback(CGEventTapProxy proxy,
|
||||
@@ -193,7 +199,10 @@ static CGEventRef EventTapCallback(CGEventTapProxy proxy,
|
||||
int key_code = (data1 & 0xFFFF0000) >> 16;
|
||||
if (key_code != NX_KEYTYPE_PLAY && key_code != NX_KEYTYPE_NEXT &&
|
||||
key_code != NX_KEYTYPE_PREVIOUS && key_code != NX_KEYTYPE_FAST &&
|
||||
|
||||
@@ -78,7 +78,7 @@ diff --git a/components/crash/core/app/crashpad_mac.mm b/components/crash/core/a
|
||||
index 0b594d053d7c7f2a8eae9a15e62daacab52ffa64..96210530f699a2331f57415beddc20ed19b9cb4b 100644
|
||||
--- a/components/crash/core/app/crashpad_mac.mm
|
||||
+++ b/components/crash/core/app/crashpad_mac.mm
|
||||
@@ -67,6 +67,8 @@ std::map<std::string, std::string> GetProcessSimpleAnnotations() {
|
||||
@@ -67,6 +67,8 @@
|
||||
} // @autoreleasepool
|
||||
return process_annotations;
|
||||
}();
|
||||
@@ -87,7 +87,7 @@ index 0b594d053d7c7f2a8eae9a15e62daacab52ffa64..96210530f699a2331f57415beddc20ed
|
||||
return annotations;
|
||||
}
|
||||
|
||||
@@ -137,6 +139,13 @@ base::FilePath PlatformCrashpadInitialization(
|
||||
@@ -137,6 +139,13 @@ void DumpProcessWithoutCrashing(task_t task_port) {
|
||||
|
||||
std::vector<std::string> arguments;
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/cont
|
||||
index b5e4f8fb0e914078ae40d034e1b785f77607bbea..e8a6199632a3110ae5d0238dfe3568df9224f353 100644
|
||||
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
|
||||
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
|
||||
@@ -478,7 +478,11 @@ void RenderWidgetHostViewMac::WasOccluded() {
|
||||
@@ -478,7 +478,11 @@
|
||||
return;
|
||||
|
||||
host()->WasHidden();
|
||||
|
||||
@@ -0,0 +1,168 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Samuel Attard <samuel.r.attard@gmail.com>
|
||||
Date: Thu, 30 Jul 2020 16:02:55 -0700
|
||||
Subject: fix: provide AXTextChangeValueStartMarker a11y value change
|
||||
notifications
|
||||
|
||||
This will be upstreamed and can be removed once it has landed there.
|
||||
|
||||
Upstream attempt: https://chromium-review.googlesource.com/c/chromium/src/+/2330812
|
||||
|
||||
diff --git a/content/browser/accessibility/browser_accessibility_cocoa.h b/content/browser/accessibility/browser_accessibility_cocoa.h
|
||||
index f56a191cb01fbcf91f60abc312ee5277bf857929..fa5429e2da1124fc1c2ff4fb6fed7aeb4dabdbea 100644
|
||||
--- a/content/browser/accessibility/browser_accessibility_cocoa.h
|
||||
+++ b/content/browser/accessibility/browser_accessibility_cocoa.h
|
||||
@@ -19,13 +19,14 @@ namespace content {
|
||||
// support character echo and other announcements during editing.
|
||||
struct AXTextEdit {
|
||||
AXTextEdit() = default;
|
||||
- AXTextEdit(base::string16 inserted_text, base::string16 deleted_text)
|
||||
- : inserted_text(inserted_text), deleted_text(deleted_text) {}
|
||||
+ AXTextEdit(base::string16 inserted_text, base::string16 deleted_text, id edit_text_marker)
|
||||
+ : inserted_text(inserted_text), deleted_text(deleted_text), edit_text_marker(edit_text_marker) {}
|
||||
|
||||
bool IsEmpty() const { return inserted_text.empty() && deleted_text.empty(); }
|
||||
|
||||
base::string16 inserted_text;
|
||||
base::string16 deleted_text;
|
||||
+ id edit_text_marker;
|
||||
};
|
||||
|
||||
// Returns true if the given object is AXTextMarker object.
|
||||
diff --git a/content/browser/accessibility/browser_accessibility_cocoa.mm b/content/browser/accessibility/browser_accessibility_cocoa.mm
|
||||
index 090c8fdc3b374ed937d3e04ccd5d91772acc7d9d..8a96c55b638b33f390372c2a30228dabad08665a 100644
|
||||
--- a/content/browser/accessibility/browser_accessibility_cocoa.mm
|
||||
+++ b/content/browser/accessibility/browser_accessibility_cocoa.mm
|
||||
@@ -1882,7 +1882,11 @@ - (BOOL)shouldExposeTitleUIElement {
|
||||
|
||||
base::string16 deletedText = oldValue.substr(i, oldValue.length() - i - j);
|
||||
base::string16 insertedText = newValue.substr(i, newValue.length() - i - j);
|
||||
- return content::AXTextEdit(insertedText, deletedText);
|
||||
+#ifndef MAS_BUILD
|
||||
+ return content::AXTextEdit(insertedText, deletedText, CreateTextMarker(_owner->CreatePositionAt(i)));
|
||||
+#else
|
||||
+ return content::AXTextEdit(insertedText, deletedText, nil);
|
||||
+#endif
|
||||
}
|
||||
|
||||
- (BOOL)instanceActive {
|
||||
@@ -2257,7 +2261,7 @@ - (NSValue*)selectedTextRange {
|
||||
- (id)selectedTextMarkerRange {
|
||||
if (![self instanceActive])
|
||||
return nil;
|
||||
- return CreateTextMarkerRange(GetSelectedRange(*_owner));
|
||||
+ return CreateTextMarkerRange(GetSelectedRange(*_owner).AsBackwardRange());
|
||||
}
|
||||
#endif
|
||||
|
||||
diff --git a/content/browser/accessibility/browser_accessibility_manager_mac.h b/content/browser/accessibility/browser_accessibility_manager_mac.h
|
||||
index 8fb447a74cb6e818c221131aba5f57c5f8b8094d..b930963467642738db3ec0109b4a6681ade03b2c 100644
|
||||
--- a/content/browser/accessibility/browser_accessibility_manager_mac.h
|
||||
+++ b/content/browser/accessibility/browser_accessibility_manager_mac.h
|
||||
@@ -60,7 +60,8 @@ class CONTENT_EXPORT BrowserAccessibilityManagerMac
|
||||
NSDictionary* GetUserInfoForValueChangedNotification(
|
||||
const BrowserAccessibilityCocoa* native_node,
|
||||
const base::string16& deleted_text,
|
||||
- const base::string16& inserted_text) const;
|
||||
+ const base::string16& inserted_text,
|
||||
+ id edit_text_marker) const;
|
||||
|
||||
void AnnounceActiveDescendant(BrowserAccessibility* node) const;
|
||||
|
||||
diff --git a/content/browser/accessibility/browser_accessibility_manager_mac.mm b/content/browser/accessibility/browser_accessibility_manager_mac.mm
|
||||
index 5972939a070908521e82845b084d2d3b9f9a73f8..fda1d2f9fdccbff035d05f0dfc39238a8a667522 100644
|
||||
--- a/content/browser/accessibility/browser_accessibility_manager_mac.mm
|
||||
+++ b/content/browser/accessibility/browser_accessibility_manager_mac.mm
|
||||
@@ -94,6 +94,7 @@
|
||||
NSString* const NSAccessibilityTextChangeElement = @"AXTextChangeElement";
|
||||
NSString* const NSAccessibilityTextEditType = @"AXTextEditType";
|
||||
NSString* const NSAccessibilityTextChangeValue = @"AXTextChangeValue";
|
||||
+NSString* const NSAccessibilityChangeValueStartMarker = @"AXTextChangeValueStartMarker";
|
||||
NSString* const NSAccessibilityTextChangeValueLength =
|
||||
@"AXTextChangeValueLength";
|
||||
NSString* const NSAccessibilityTextChangeValues = @"AXTextChangeValues";
|
||||
@@ -313,16 +314,18 @@ void PostAnnouncementNotification(NSString* announcement) {
|
||||
if (base::mac::IsAtLeastOS10_11() && !text_edits_.empty()) {
|
||||
base::string16 deleted_text;
|
||||
base::string16 inserted_text;
|
||||
- int32_t id = node->GetId();
|
||||
- const auto iterator = text_edits_.find(id);
|
||||
+ int32_t id_ = node->GetId();
|
||||
+ id edit_text_marker = nil;
|
||||
+ const auto iterator = text_edits_.find(id_);
|
||||
if (iterator != text_edits_.end()) {
|
||||
AXTextEdit text_edit = iterator->second;
|
||||
deleted_text = text_edit.deleted_text;
|
||||
inserted_text = text_edit.inserted_text;
|
||||
+ edit_text_marker = text_edit.edit_text_marker;
|
||||
}
|
||||
|
||||
NSDictionary* user_info = GetUserInfoForValueChangedNotification(
|
||||
- native_node, deleted_text, inserted_text);
|
||||
+ native_node, deleted_text, inserted_text, edit_text_marker);
|
||||
|
||||
BrowserAccessibility* root = GetRoot();
|
||||
if (!root)
|
||||
@@ -546,27 +549,34 @@ void PostAnnouncementNotification(NSString* announcement) {
|
||||
BrowserAccessibilityManagerMac::GetUserInfoForValueChangedNotification(
|
||||
const BrowserAccessibilityCocoa* native_node,
|
||||
const base::string16& deleted_text,
|
||||
- const base::string16& inserted_text) const {
|
||||
+ const base::string16& inserted_text,
|
||||
+ id edit_text_marker) const {
|
||||
DCHECK(native_node);
|
||||
if (deleted_text.empty() && inserted_text.empty())
|
||||
return nil;
|
||||
|
||||
NSMutableArray* changes = [[[NSMutableArray alloc] init] autorelease];
|
||||
if (!deleted_text.empty()) {
|
||||
- [changes addObject:@{
|
||||
- NSAccessibilityTextEditType : @(AXTextEditTypeDelete),
|
||||
- NSAccessibilityTextChangeValueLength : @(deleted_text.length()),
|
||||
- NSAccessibilityTextChangeValue : base::SysUTF16ToNSString(deleted_text)
|
||||
- }];
|
||||
+ NSMutableDictionary* change = [[[NSMutableDictionary alloc] initWithCapacity:4] autorelease];
|
||||
+ change[NSAccessibilityTextEditType] = @(AXTextEditTypeDelete);
|
||||
+ change[NSAccessibilityTextChangeValueLength] = @(deleted_text.length());
|
||||
+ change[NSAccessibilityTextChangeValue] = base::SysUTF16ToNSString(deleted_text);
|
||||
+ if (edit_text_marker) {
|
||||
+ change[NSAccessibilityChangeValueStartMarker] = edit_text_marker;
|
||||
+ }
|
||||
+ [changes addObject:change];
|
||||
}
|
||||
if (!inserted_text.empty()) {
|
||||
// TODO(nektar): Figure out if this is a paste operation instead of typing.
|
||||
// Changes to Blink would be required.
|
||||
- [changes addObject:@{
|
||||
- NSAccessibilityTextEditType : @(AXTextEditTypeTyping),
|
||||
- NSAccessibilityTextChangeValueLength : @(inserted_text.length()),
|
||||
- NSAccessibilityTextChangeValue : base::SysUTF16ToNSString(inserted_text)
|
||||
- }];
|
||||
+ NSMutableDictionary* change = [[[NSMutableDictionary alloc] initWithCapacity:4] autorelease];
|
||||
+ change[NSAccessibilityTextEditType] = @(AXTextEditTypeTyping);
|
||||
+ change[NSAccessibilityTextChangeValueLength] = @(inserted_text.length());
|
||||
+ change[NSAccessibilityTextChangeValue] = base::SysUTF16ToNSString(inserted_text);
|
||||
+ if (edit_text_marker) {
|
||||
+ change[NSAccessibilityChangeValueStartMarker] = edit_text_marker;
|
||||
+ }
|
||||
+ [changes addObject:change];
|
||||
}
|
||||
|
||||
return @{
|
||||
diff --git a/ui/accessibility/ax_range.h b/ui/accessibility/ax_range.h
|
||||
index 62db9d3c0ff251e40dd5016901e40a3083cb786f..2d263e1c7eaf806a76eba6ee79919ef87d3eb04b 100644
|
||||
--- a/ui/accessibility/ax_range.h
|
||||
+++ b/ui/accessibility/ax_range.h
|
||||
@@ -131,6 +131,12 @@ class AXRange {
|
||||
: AXRange(anchor_->Clone(), focus_->Clone());
|
||||
}
|
||||
|
||||
+ AXRange AsBackwardRange() const {
|
||||
+ return (CompareEndpoints(anchor(), focus()).value_or(0) < 0)
|
||||
+ ? AXRange(focus_->Clone(), anchor_->Clone())
|
||||
+ : AXRange(anchor_->Clone(), focus_->Clone());
|
||||
+ }
|
||||
+
|
||||
bool IsCollapsed() const { return !IsNull() && *anchor_ == *focus_; }
|
||||
|
||||
// We define a "leaf text range" as an AXRange whose endpoints are leaf text
|
||||
@@ -12,7 +12,7 @@ diff --git a/chrome/browser/extensions/global_shortcut_listener_mac.mm b/chrome/
|
||||
index befe726af9c10b1563a7fc0bb77cc55f65943d5c..bac51f33f35f96fe4ecc764cf5ca887176642f74 100644
|
||||
--- a/chrome/browser/extensions/global_shortcut_listener_mac.mm
|
||||
+++ b/chrome/browser/extensions/global_shortcut_listener_mac.mm
|
||||
@@ -39,7 +39,7 @@ GlobalShortcutListenerMac::GlobalShortcutListenerMac()
|
||||
@@ -39,7 +39,7 @@
|
||||
// global MediaKeysListener to receive media keys.
|
||||
if (!content::MediaKeysListenerManager::IsMediaKeysListenerManagerEnabled()) {
|
||||
media_keys_listener_ = ui::MediaKeysListener::Create(
|
||||
|
||||
56
patches/chromium/mac_work_around_xcode_12b3_sdk_bug.patch
Normal file
56
patches/chromium/mac_work_around_xcode_12b3_sdk_bug.patch
Normal file
@@ -0,0 +1,56 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Mark Mentovai <mark@chromium.org>
|
||||
Date: Thu, 23 Jul 2020 02:02:37 +0000
|
||||
Subject: mac: Work around Xcode 12b3 SDK bug
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The macOS 11.0 20A5323l SDK in Xcode 12b3 12A8169g totally hides the
|
||||
kCGColorSpaceITUR_2020_PQ_EOTF declaration in an #if whenever the SDK
|
||||
version is ≥ 10.16, which of course it always is. Chrome does use that
|
||||
constant, so work around the SDK bug by providing our a local
|
||||
declaration when that SDK version is in use.
|
||||
|
||||
Bug: 1108561
|
||||
Change-Id: I6ed31d30705bc754616e413c38fb250a7934484d
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2315078
|
||||
Reviewed-by: Avi Drissman <avi@chromium.org>
|
||||
Commit-Queue: Avi Drissman <avi@chromium.org>
|
||||
Commit-Queue: Mark Mentovai <mark@chromium.org>
|
||||
Auto-Submit: Mark Mentovai <mark@chromium.org>
|
||||
Cr-Commit-Position: refs/heads/master@{#791119}
|
||||
|
||||
diff --git a/ui/gfx/mac/io_surface.cc b/ui/gfx/mac/io_surface.cc
|
||||
index 93a9652b71d86441e15b87aafd7a6b1a13f45830..5e06d0b7804e90cd044c64188ed113c9593dd8be 100644
|
||||
--- a/ui/gfx/mac/io_surface.cc
|
||||
+++ b/ui/gfx/mac/io_surface.cc
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
#include "ui/gfx/mac/io_surface.h"
|
||||
|
||||
+#include <Availability.h>
|
||||
+#include <CoreGraphics/CoreGraphics.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -18,6 +20,19 @@
|
||||
#include "ui/gfx/icc_profile.h"
|
||||
#include "ui/gfx/switches.h"
|
||||
|
||||
+#if defined(__MAC_11_0) && __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_10_16
|
||||
+// https://crbug.com/1108561: This is supposed to be deprecated (but available)
|
||||
+// through 10.15.4, but the macOS 11.0 20A5323l SDK from Xcode 12b3 12A8169g
|
||||
+// doesn’t declare it at all when the SDK version is 10.16 or later, which of
|
||||
+// course it always is. It’s a bug in the SDK. Work around it with the
|
||||
+// declaration that’s hidden.
|
||||
+//
|
||||
+// TODO(https://crbug.com/1108627): remove this workaround if and when the SDK
|
||||
+// bug is fixed.
|
||||
+CG_EXTERN const CFStringRef kCGColorSpaceITUR_2020_PQ_EOTF
|
||||
+CG_AVAILABLE_BUT_DEPRECATED(10.14.6, 10.15.4, 12.6, 13.4);
|
||||
+#endif
|
||||
+
|
||||
namespace gfx {
|
||||
|
||||
namespace {
|
||||
@@ -9,7 +9,7 @@ diff --git a/base/mac/foundation_util.mm b/base/mac/foundation_util.mm
|
||||
index be12912dcd0ef0cf046ee2d4033a18ecfdf1e992..d2af322a9d5751105e2c8fe023aad9a91027bf05 100644
|
||||
--- a/base/mac/foundation_util.mm
|
||||
+++ b/base/mac/foundation_util.mm
|
||||
@@ -28,12 +28,6 @@ CFTypeID SecKeyGetTypeID();
|
||||
@@ -28,12 +28,6 @@
|
||||
#if !defined(OS_IOS)
|
||||
CFTypeID SecACLGetTypeID();
|
||||
CFTypeID SecTrustedApplicationGetTypeID();
|
||||
@@ -22,7 +22,7 @@ index be12912dcd0ef0cf046ee2d4033a18ecfdf1e992..d2af322a9d5751105e2c8fe023aad9a9
|
||||
#endif
|
||||
} // extern "C"
|
||||
|
||||
@@ -326,8 +320,7 @@ NSFont* CFToNSCast(CTFontRef cf_val) {
|
||||
@@ -326,8 +320,7 @@ void SetBaseBundleID(const char* new_base_bundle_id) {
|
||||
const_cast<NSFont*>(reinterpret_cast<const NSFont*>(cf_val));
|
||||
DCHECK(!cf_val ||
|
||||
CTFontGetTypeID() == CFGetTypeID(cf_val) ||
|
||||
@@ -32,7 +32,7 @@ index be12912dcd0ef0cf046ee2d4033a18ecfdf1e992..d2af322a9d5751105e2c8fe023aad9a9
|
||||
return ns_val;
|
||||
}
|
||||
|
||||
@@ -398,9 +391,6 @@ CFCast<CTFontRef>(const CFTypeRef& cf_val) {
|
||||
@@ -398,9 +391,6 @@ CTFontRef NSToCFCast(NSFont* ns_val) {
|
||||
return (CTFontRef)(cf_val);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ index 94afefcee81b87c05bf9b1199d90d3d4b5ea84a6..2ec7f04c71824b47de1ddbf1f0e8625d
|
||||
extern "C" {
|
||||
|
||||
// Kill ring calls. Would be better to use NSKillRing.h, but that's not
|
||||
@@ -39,38 +40,53 @@ NSString* _NSYankFromKillRing();
|
||||
@@ -39,38 +40,53 @@
|
||||
void _NSNewKillRingSequence();
|
||||
void _NSSetKillRingToYankedState();
|
||||
}
|
||||
@@ -92,7 +92,7 @@ index 8f4ae94bc1d8188d041654c50511f3346eee79de..fa06f47abbff3dcda937bf0b794f616e
|
||||
|
||||
namespace blink {
|
||||
|
||||
@@ -95,10 +97,12 @@ bool ThemePainterMac::PaintTextField(const Node* node,
|
||||
@@ -95,10 +97,12 @@ void _NSDrawCarbonThemeListBox(NSRect frame,
|
||||
// behavior change while remaining a fragile solution.
|
||||
// https://bugs.chromium.org/p/chromium/issues/detail?id=658085#c3
|
||||
if (!use_ns_text_field_cell) {
|
||||
@@ -105,7 +105,7 @@ index 8f4ae94bc1d8188d041654c50511f3346eee79de..fa06f47abbff3dcda937bf0b794f616e
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -186,10 +190,12 @@ bool ThemePainterMac::PaintTextArea(const Node* node,
|
||||
@@ -186,10 +190,12 @@ void _NSDrawCarbonThemeListBox(NSRect frame,
|
||||
const IntRect& r) {
|
||||
ScopedColorSchemeAppearance appearance(style.UsedColorScheme());
|
||||
LocalCurrentGraphicsContext local_context(paint_info.context, r);
|
||||
|
||||
@@ -18,7 +18,7 @@ index 69580888047c4ac6abb68873315bcafb78dda706..aa347913a75084f669bf7d89fbcc919b
|
||||
@interface NSWindow (PrivateBrowserNativeWidgetAPI)
|
||||
+ (Class)frameViewClassForStyleMask:(NSUInteger)windowStyle;
|
||||
@end
|
||||
@@ -63,6 +64,8 @@
|
||||
@@ -63,6 +64,8 @@ - (NSRect)_draggableFrame NS_DEPRECATED_MAC(10_10, 10_11) {
|
||||
|
||||
@end
|
||||
|
||||
@@ -27,7 +27,7 @@ index 69580888047c4ac6abb68873315bcafb78dda706..aa347913a75084f669bf7d89fbcc919b
|
||||
@implementation BrowserNativeWidgetWindow
|
||||
|
||||
// Prevent detached tabs from glitching when the window is partially offscreen.
|
||||
@@ -84,6 +87,7 @@
|
||||
@@ -84,6 +87,7 @@ - (NSRect)constrainFrameRect:(NSRect)rect toScreen:(NSScreen*)screen {
|
||||
|
||||
// NSWindow (PrivateAPI) overrides.
|
||||
|
||||
@@ -35,7 +35,7 @@ index 69580888047c4ac6abb68873315bcafb78dda706..aa347913a75084f669bf7d89fbcc919b
|
||||
+ (Class)frameViewClassForStyleMask:(NSUInteger)windowStyle {
|
||||
// - NSThemeFrame and its subclasses will be nil if it's missing at runtime.
|
||||
if ([BrowserWindowFrame class])
|
||||
@@ -98,6 +102,8 @@
|
||||
@@ -98,6 +102,8 @@ - (BOOL)_usesCustomDrawing {
|
||||
return NO;
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ index 8416c7c6e052dafb2aad61c0bd3224c36e945d23..cd356beda023ab2409b16d58ca38c70b
|
||||
@interface NSWindow (PrivateAPI)
|
||||
+ (Class)frameViewClassForStyleMask:(NSUInteger)windowStyle;
|
||||
@end
|
||||
@@ -18,8 +20,12 @@
|
||||
@@ -18,8 +20,12 @@ - (CGFloat)_titlebarHeight {
|
||||
}
|
||||
@end
|
||||
|
||||
@@ -70,7 +70,7 @@ index 8416c7c6e052dafb2aad61c0bd3224c36e945d23..cd356beda023ab2409b16d58ca38c70b
|
||||
+ (Class)frameViewClassForStyleMask:(NSUInteger)windowStyle {
|
||||
if ([NativeWidgetMacFramelessNSWindowFrame class]) {
|
||||
return [NativeWidgetMacFramelessNSWindowFrame class];
|
||||
@@ -27,4 +33,6 @@
|
||||
@@ -27,4 +33,6 @@ + (Class)frameViewClassForStyleMask:(NSUInteger)windowStyle {
|
||||
return [super frameViewClassForStyleMask:windowStyle];
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ index 757c72d98de11f611309f4f5af8d0d9aab639181..a6319a0760308df6bac6b39ad3500ad7
|
||||
- (BOOL)hasKeyAppearance;
|
||||
- (long long)_resizeDirectionForMouseLocation:(CGPoint)location;
|
||||
- (BOOL)_isConsideredOpenForPersistentState;
|
||||
@@ -58,6 +60,8 @@
|
||||
@@ -58,6 +60,8 @@ - (void)cr_mouseDownOnFrameView:(NSEvent*)event {
|
||||
}
|
||||
@end
|
||||
|
||||
@@ -120,7 +120,7 @@ index 757c72d98de11f611309f4f5af8d0d9aab639181..a6319a0760308df6bac6b39ad3500ad7
|
||||
@implementation NativeWidgetMacNSWindowTitledFrame
|
||||
- (void)mouseDown:(NSEvent*)event {
|
||||
if (base::mac::IsAtMostOS10_11() && self.window.isMovable)
|
||||
@@ -84,6 +88,8 @@
|
||||
@@ -84,6 +88,8 @@ - (BOOL)usesCustomDrawing {
|
||||
}
|
||||
@end
|
||||
|
||||
@@ -129,7 +129,7 @@ index 757c72d98de11f611309f4f5af8d0d9aab639181..a6319a0760308df6bac6b39ad3500ad7
|
||||
@implementation NativeWidgetMacNSWindow {
|
||||
@private
|
||||
base::scoped_nsobject<CommandDispatcher> _commandDispatcher;
|
||||
@@ -165,6 +171,8 @@
|
||||
@@ -165,6 +171,8 @@ - (BOOL)hasViewsMenuActive {
|
||||
|
||||
// NSWindow overrides.
|
||||
|
||||
@@ -138,7 +138,7 @@ index 757c72d98de11f611309f4f5af8d0d9aab639181..a6319a0760308df6bac6b39ad3500ad7
|
||||
+ (Class)frameViewClassForStyleMask:(NSWindowStyleMask)windowStyle {
|
||||
if (windowStyle & NSWindowStyleMaskTitled) {
|
||||
if (Class customFrame = [NativeWidgetMacNSWindowTitledFrame class])
|
||||
@@ -176,6 +184,8 @@
|
||||
@@ -176,6 +184,8 @@ + (Class)frameViewClassForStyleMask:(NSWindowStyleMask)windowStyle {
|
||||
return [super frameViewClassForStyleMask:windowStyle];
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ diff --git a/components/remote_cocoa/app_shim/application_bridge.mm b/components
|
||||
index 9ddda9116e7284cbccde8a51e23ad7560dd06367..e846091ad99b0154636489e53491209ff3cbfaaa 100644
|
||||
--- a/components/remote_cocoa/app_shim/application_bridge.mm
|
||||
+++ b/components/remote_cocoa/app_shim/application_bridge.mm
|
||||
@@ -49,6 +49,7 @@ class NativeWidgetBridgeOwner : public NativeWidgetNSWindowHostHelper {
|
||||
@@ -49,6 +49,7 @@
|
||||
|
||||
// NativeWidgetNSWindowHostHelper:
|
||||
id GetNativeViewAccessible() override {
|
||||
@@ -25,7 +25,7 @@ index 9ddda9116e7284cbccde8a51e23ad7560dd06367..e846091ad99b0154636489e53491209f
|
||||
if (!remote_accessibility_element_) {
|
||||
int64_t browser_pid = 0;
|
||||
std::vector<uint8_t> element_token;
|
||||
@@ -59,6 +60,9 @@ class NativeWidgetBridgeOwner : public NativeWidgetNSWindowHostHelper {
|
||||
@@ -59,6 +60,9 @@ id GetNativeViewAccessible() override {
|
||||
ui::RemoteAccessibility::GetRemoteElementFromToken(element_token);
|
||||
}
|
||||
return remote_accessibility_element_.get();
|
||||
@@ -35,7 +35,7 @@ index 9ddda9116e7284cbccde8a51e23ad7560dd06367..e846091ad99b0154636489e53491209f
|
||||
}
|
||||
void DispatchKeyEvent(ui::KeyEvent* event) override {
|
||||
bool event_handled = false;
|
||||
@@ -96,8 +100,10 @@ class NativeWidgetBridgeOwner : public NativeWidgetNSWindowHostHelper {
|
||||
@@ -96,8 +100,10 @@ void GetWordAt(const gfx::Point& location_in_content,
|
||||
mojo::AssociatedRemote<mojom::TextInputHost> text_input_host_remote_;
|
||||
|
||||
std::unique_ptr<NativeWidgetNSWindowBridge> bridge_;
|
||||
@@ -50,7 +50,7 @@ diff --git a/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm
|
||||
index 2ee45cb069ec5d78d9c7a3f61fdd1d444a590f41..badc4323b910f8e3957583e05af303472cb204f6 100644
|
||||
--- a/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm
|
||||
+++ b/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm
|
||||
@@ -543,10 +543,12 @@ void NativeWidgetNSWindowBridge::CreateContentView(uint64_t ns_view_id,
|
||||
@@ -543,10 +543,12 @@ NSUInteger CountBridgedWindows(NSArray* child_windows) {
|
||||
// this should be treated as an error and caught early.
|
||||
CHECK(bridged_view_);
|
||||
|
||||
@@ -67,7 +67,7 @@ diff --git a/content/app_shim_remote_cocoa/ns_view_bridge_factory_impl.mm b/cont
|
||||
index c3a9fbf0f9d2b80c1de42a22ad094a286f0b559b..02493d4b62c98a3aebd3e460c459218a4dc4ea8e 100644
|
||||
--- a/content/app_shim_remote_cocoa/ns_view_bridge_factory_impl.mm
|
||||
+++ b/content/app_shim_remote_cocoa/ns_view_bridge_factory_impl.mm
|
||||
@@ -70,8 +70,10 @@ class RenderWidgetHostNSViewBridgeOwner
|
||||
@@ -70,8 +70,10 @@ id GetFocusedBrowserAccessibilityElement() override {
|
||||
return nil;
|
||||
}
|
||||
void SetAccessibilityWindow(NSWindow* window) override {
|
||||
@@ -78,7 +78,7 @@ index c3a9fbf0f9d2b80c1de42a22ad094a286f0b559b..02493d4b62c98a3aebd3e460c459218a
|
||||
}
|
||||
|
||||
void ForwardKeyboardEvent(const content::NativeWebKeyboardEvent& key_event,
|
||||
@@ -133,8 +135,10 @@ class RenderWidgetHostNSViewBridgeOwner
|
||||
@@ -133,8 +135,10 @@ void SmartMagnify(const blink::WebGestureEvent& web_event) override {
|
||||
|
||||
mojo::AssociatedRemote<mojom::RenderWidgetHostNSViewHost> host_;
|
||||
std::unique_ptr<RenderWidgetHostNSViewBridge> bridge_;
|
||||
@@ -120,7 +120,7 @@ diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/cont
|
||||
index ed223cdb6ea7a0f6130547b7988982bb44aa157d..b5e4f8fb0e914078ae40d034e1b785f77607bbea 100644
|
||||
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
|
||||
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
|
||||
@@ -233,8 +233,10 @@ RenderWidgetHostViewMac::~RenderWidgetHostViewMac() {
|
||||
@@ -233,8 +233,10 @@
|
||||
void RenderWidgetHostViewMac::MigrateNSViewBridge(
|
||||
remote_cocoa::mojom::Application* remote_cocoa_application,
|
||||
uint64_t parent_ns_view_id) {
|
||||
@@ -131,7 +131,7 @@ index ed223cdb6ea7a0f6130547b7988982bb44aa157d..b5e4f8fb0e914078ae40d034e1b785f7
|
||||
|
||||
// Disconnect from the previous bridge (this will have the effect of
|
||||
// destroying the associated bridge), and close the receiver (to allow it
|
||||
@@ -1377,8 +1379,10 @@ RenderWidgetHostViewMac::AccessibilityGetNativeViewAccessible() {
|
||||
@@ -1377,8 +1379,10 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback,
|
||||
|
||||
gfx::NativeViewAccessible
|
||||
RenderWidgetHostViewMac::AccessibilityGetNativeViewAccessibleForWindow() {
|
||||
@@ -142,7 +142,7 @@ index ed223cdb6ea7a0f6130547b7988982bb44aa157d..b5e4f8fb0e914078ae40d034e1b785f7
|
||||
return [GetInProcessNSView() window];
|
||||
}
|
||||
|
||||
@@ -1410,9 +1414,11 @@ id RenderWidgetHostViewMac::GetFocusedBrowserAccessibilityElement() {
|
||||
@@ -1410,9 +1414,11 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback,
|
||||
}
|
||||
|
||||
void RenderWidgetHostViewMac::SetAccessibilityWindow(NSWindow* window) {
|
||||
@@ -154,7 +154,7 @@ index ed223cdb6ea7a0f6130547b7988982bb44aa157d..b5e4f8fb0e914078ae40d034e1b785f7
|
||||
}
|
||||
|
||||
bool RenderWidgetHostViewMac::SyncIsWidgetForMainFrame(
|
||||
@@ -1899,12 +1905,14 @@ void RenderWidgetHostViewMac::StopSpeaking() {
|
||||
@@ -1899,12 +1905,14 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback,
|
||||
|
||||
void RenderWidgetHostViewMac::SetRemoteAccessibilityWindowToken(
|
||||
const std::vector<uint8_t>& window_token) {
|
||||
@@ -239,7 +239,7 @@ diff --git a/ui/views/cocoa/native_widget_mac_ns_window_host.mm b/ui/views/cocoa
|
||||
index 2256c365af5b1af79458fdcb0cb9d44c9ff641fd..f4949b071a177452b0074a2436669e9846558d1a 100644
|
||||
--- a/ui/views/cocoa/native_widget_mac_ns_window_host.mm
|
||||
+++ b/ui/views/cocoa/native_widget_mac_ns_window_host.mm
|
||||
@@ -282,14 +282,22 @@ gfx::NativeViewAccessible
|
||||
@@ -282,14 +282,22 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
|
||||
NativeWidgetMacNSWindowHost::GetNativeViewAccessibleForNSView() const {
|
||||
if (in_process_ns_window_bridge_)
|
||||
return in_process_ns_window_bridge_->ns_view();
|
||||
@@ -262,7 +262,7 @@ index 2256c365af5b1af79458fdcb0cb9d44c9ff641fd..f4949b071a177452b0074a2436669e98
|
||||
}
|
||||
|
||||
remote_cocoa::mojom::NativeWidgetNSWindow*
|
||||
@@ -1118,6 +1126,7 @@ void NativeWidgetMacNSWindowHost::OnFocusWindowToolbar() {
|
||||
@@ -1118,6 +1126,7 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
|
||||
void NativeWidgetMacNSWindowHost::SetRemoteAccessibilityTokens(
|
||||
const std::vector<uint8_t>& window_token,
|
||||
const std::vector<uint8_t>& view_token) {
|
||||
@@ -270,7 +270,7 @@ index 2256c365af5b1af79458fdcb0cb9d44c9ff641fd..f4949b071a177452b0074a2436669e98
|
||||
remote_window_accessible_ =
|
||||
ui::RemoteAccessibility::GetRemoteElementFromToken(window_token);
|
||||
remote_view_accessible_ =
|
||||
@@ -1125,14 +1134,17 @@ void NativeWidgetMacNSWindowHost::SetRemoteAccessibilityTokens(
|
||||
@@ -1125,14 +1134,17 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
|
||||
[remote_view_accessible_ setWindowUIElement:remote_window_accessible_.get()];
|
||||
[remote_view_accessible_
|
||||
setTopLevelUIElement:remote_window_accessible_.get()];
|
||||
|
||||
@@ -44,7 +44,7 @@ diff --git a/gpu/ipc/service/image_transport_surface_overlay_mac.mm b/gpu/ipc/se
|
||||
index 67e0efb23c717c3194f27695215a8bd20dbbb957..cf02fab328d9fe7a6e9f53c712a7c1c871b8b304 100644
|
||||
--- a/gpu/ipc/service/image_transport_surface_overlay_mac.mm
|
||||
+++ b/gpu/ipc/service/image_transport_surface_overlay_mac.mm
|
||||
@@ -51,7 +51,7 @@ ImageTransportSurfaceOverlayMacBase<BaseClass>::
|
||||
@@ -51,7 +51,7 @@
|
||||
|
||||
ca_layer_tree_coordinator_.reset(new ui::CALayerTreeCoordinator(
|
||||
use_remote_layer_api_, allow_av_sample_buffer_display_layer));
|
||||
@@ -53,7 +53,7 @@ index 67e0efb23c717c3194f27695215a8bd20dbbb957..cf02fab328d9fe7a6e9f53c712a7c1c8
|
||||
// Create the CAContext to send this to the GPU process, and the layer for
|
||||
// the context.
|
||||
if (use_remote_layer_api_) {
|
||||
@@ -60,6 +60,7 @@ ImageTransportSurfaceOverlayMacBase<BaseClass>::
|
||||
@@ -60,6 +60,7 @@
|
||||
options:@{}] retain]);
|
||||
[ca_context_ setLayer:ca_layer_tree_coordinator_->GetCALayerForDisplay()];
|
||||
}
|
||||
@@ -61,7 +61,7 @@ index 67e0efb23c717c3194f27695215a8bd20dbbb957..cf02fab328d9fe7a6e9f53c712a7c1c8
|
||||
}
|
||||
|
||||
template <typename BaseClass>
|
||||
@@ -140,7 +141,9 @@ ImageTransportSurfaceOverlayMacBase<BaseClass>::SwapBuffersInternal(
|
||||
@@ -140,7 +141,9 @@
|
||||
"GLImpl", static_cast<int>(gl::GetGLImplementation()),
|
||||
"width", pixel_size_.width());
|
||||
if (use_remote_layer_api_) {
|
||||
@@ -75,7 +75,7 @@ diff --git a/ui/accelerated_widget_mac/display_ca_layer_tree.mm b/ui/accelerated
|
||||
index 0db8f3e223e3cb8e289af63a50104fb6823ed46a..d7969cf08317731bf8e1c8545a07734412593e37 100644
|
||||
--- a/ui/accelerated_widget_mac/display_ca_layer_tree.mm
|
||||
+++ b/ui/accelerated_widget_mac/display_ca_layer_tree.mm
|
||||
@@ -98,6 +98,7 @@ void DisplayCALayerTree::UpdateCALayerTree(
|
||||
@@ -98,6 +98,7 @@ - (void)setContentsChanged;
|
||||
}
|
||||
|
||||
void DisplayCALayerTree::GotCALayerFrame(uint32_t ca_context_id) {
|
||||
@@ -83,7 +83,7 @@ index 0db8f3e223e3cb8e289af63a50104fb6823ed46a..d7969cf08317731bf8e1c8545a077344
|
||||
// Early-out if the remote layer has not changed.
|
||||
if ([remote_layer_ contextId] == ca_context_id)
|
||||
return;
|
||||
@@ -122,6 +123,9 @@ void DisplayCALayerTree::GotCALayerFrame(uint32_t ca_context_id) {
|
||||
@@ -122,6 +123,9 @@ - (void)setContentsChanged;
|
||||
[io_surface_layer_ removeFromSuperlayer];
|
||||
io_surface_layer_.reset();
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ diff --git a/content/browser/accessibility/accessibility_tree_formatter_mac.mm b
|
||||
index 6074fd6fb7da7c0e927fa81e8095729349520417..d6e93ab7cea23fe9592110967a1c9cfa0481551d 100644
|
||||
--- a/content/browser/accessibility/accessibility_tree_formatter_mac.mm
|
||||
+++ b/content/browser/accessibility/accessibility_tree_formatter_mac.mm
|
||||
@@ -341,11 +341,13 @@ AccessibilityTreeFormatterMac::ParamByPropertyNode(
|
||||
@@ -341,11 +341,13 @@ id PropertyNodeToTextMarkerRange(const PropertyNode&,
|
||||
param = PropertyNodeToRange(property_node);
|
||||
} else if (property_name == "AXIndexForChildUIElement") { // UIElement
|
||||
param = PropertyNodeToUIElement(property_node, line_indexes_map);
|
||||
@@ -24,7 +24,7 @@ index 6074fd6fb7da7c0e927fa81e8095729349520417..d6e93ab7cea23fe9592110967a1c9cfa
|
||||
}
|
||||
|
||||
return param;
|
||||
@@ -433,6 +435,7 @@ AccessibilityTreeFormatterMac::PropertyNodeToUIElement(
|
||||
@@ -433,6 +435,7 @@ id PropertyNodeToTextMarkerRange(const PropertyNode&,
|
||||
return uielement;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ index 6074fd6fb7da7c0e927fa81e8095729349520417..d6e93ab7cea23fe9592110967a1c9cfa
|
||||
id AccessibilityTreeFormatterMac::DictNodeToTextMarker(
|
||||
const PropertyNode& dictnode,
|
||||
const LineIndexesMap& line_indexes_map) const {
|
||||
@@ -512,6 +515,7 @@ id AccessibilityTreeFormatterMac::PropertyNodeToTextMarkerRange(
|
||||
@@ -512,6 +515,7 @@ id PropertyNodeToTextMarkerRange(const PropertyNode&,
|
||||
|
||||
return content::AXTextMarkerRangeFrom(anchor_textmarker, focus_textmarker);
|
||||
}
|
||||
@@ -40,7 +40,7 @@ index 6074fd6fb7da7c0e927fa81e8095729349520417..d6e93ab7cea23fe9592110967a1c9cfa
|
||||
|
||||
base::Value AccessibilityTreeFormatterMac::PopulateSize(
|
||||
const BrowserAccessibilityCocoa* cocoa_node) const {
|
||||
@@ -573,7 +577,7 @@ base::Value AccessibilityTreeFormatterMac::PopulateObject(
|
||||
@@ -573,7 +577,7 @@ id PropertyNodeToTextMarkerRange(const PropertyNode&,
|
||||
0 == strcmp([value objCType], @encode(NSRange))) {
|
||||
return PopulateRange([value rangeValue]);
|
||||
}
|
||||
@@ -49,7 +49,7 @@ index 6074fd6fb7da7c0e927fa81e8095729349520417..d6e93ab7cea23fe9592110967a1c9cfa
|
||||
// AXTextMarker
|
||||
if (content::IsAXTextMarker(value)) {
|
||||
return PopulateTextPosition(content::AXTextMarkerToPosition(value).get(),
|
||||
@@ -584,7 +588,7 @@ base::Value AccessibilityTreeFormatterMac::PopulateObject(
|
||||
@@ -584,7 +588,7 @@ id PropertyNodeToTextMarkerRange(const PropertyNode&,
|
||||
if (content::IsAXTextMarkerRange(value)) {
|
||||
return PopulateTextMarkerRange(value, line_indexes_map);
|
||||
}
|
||||
@@ -58,7 +58,7 @@ index 6074fd6fb7da7c0e927fa81e8095729349520417..d6e93ab7cea23fe9592110967a1c9cfa
|
||||
// Accessible object
|
||||
if ([value isKindOfClass:[BrowserAccessibilityCocoa class]]) {
|
||||
return base::Value(NodeToLineIndex(value, line_indexes_map));
|
||||
@@ -635,7 +639,7 @@ base::Value AccessibilityTreeFormatterMac::PopulateTextPosition(
|
||||
@@ -635,7 +639,7 @@ id PropertyNodeToTextMarkerRange(const PropertyNode&,
|
||||
kConstValuePrefix + affinity);
|
||||
return set;
|
||||
}
|
||||
@@ -67,7 +67,7 @@ index 6074fd6fb7da7c0e927fa81e8095729349520417..d6e93ab7cea23fe9592110967a1c9cfa
|
||||
base::Value AccessibilityTreeFormatterMac::PopulateTextMarkerRange(
|
||||
id object,
|
||||
const LineIndexesMap& line_indexes_map) const {
|
||||
@@ -650,7 +654,7 @@ base::Value AccessibilityTreeFormatterMac::PopulateTextMarkerRange(
|
||||
@@ -650,7 +654,7 @@ id PropertyNodeToTextMarkerRange(const PropertyNode&,
|
||||
dict.SetPath("focus", PopulateTextPosition(range.focus(), line_indexes_map));
|
||||
return dict;
|
||||
}
|
||||
@@ -123,7 +123,7 @@ diff --git a/content/browser/accessibility/browser_accessibility_cocoa.mm b/cont
|
||||
index 474ae88c323e9a10bd8486482507f0d749214963..090c8fdc3b374ed937d3e04ccd5d91772acc7d9d 100644
|
||||
--- a/content/browser/accessibility/browser_accessibility_cocoa.mm
|
||||
+++ b/content/browser/accessibility/browser_accessibility_cocoa.mm
|
||||
@@ -208,6 +208,7 @@ NSString* const
|
||||
@@ -208,6 +208,7 @@
|
||||
NSString* const NSAccessibilityLengthForTextMarkerRangeParameterizedAttribute =
|
||||
@"AXLengthForTextMarkerRange";
|
||||
|
||||
@@ -131,7 +131,7 @@ index 474ae88c323e9a10bd8486482507f0d749214963..090c8fdc3b374ed937d3e04ccd5d9177
|
||||
// Private attributes that can be used for testing text markers, e.g. in dump
|
||||
// tree tests.
|
||||
NSString* const
|
||||
@@ -219,6 +220,7 @@ NSString* const
|
||||
@@ -219,6 +220,7 @@
|
||||
NSString* const
|
||||
NSAccessibilityTextMarkerNodeDebugDescriptionParameterizedAttribute =
|
||||
@"AXTextMarkerNodeDebugDescription";
|
||||
@@ -139,7 +139,7 @@ index 474ae88c323e9a10bd8486482507f0d749214963..090c8fdc3b374ed937d3e04ccd5d9177
|
||||
|
||||
// Other private attributes.
|
||||
NSString* const NSAccessibilitySelectTextWithCriteriaParameterizedAttribute =
|
||||
@@ -242,6 +244,7 @@ NSDictionary* attributeToMethodNameMap = nil;
|
||||
@@ -242,6 +244,7 @@
|
||||
// VoiceOver uses -1 to mean "no limit" for AXResultsLimit.
|
||||
const int kAXResultsLimitNoLimit = -1;
|
||||
|
||||
@@ -147,7 +147,7 @@ index 474ae88c323e9a10bd8486482507f0d749214963..090c8fdc3b374ed937d3e04ccd5d9177
|
||||
extern "C" {
|
||||
|
||||
// The following are private accessibility APIs required for cursor navigation
|
||||
@@ -470,6 +473,7 @@ NSAttributedString* GetAttributedTextForTextMarkerRange(id marker_range) {
|
||||
@@ -470,6 +473,7 @@ void AddMisspelledTextAttributes(const AXPlatformRange& ax_range,
|
||||
AddMisspelledTextAttributes(ax_range, attributed_text);
|
||||
return attributed_text;
|
||||
}
|
||||
@@ -155,7 +155,7 @@ index 474ae88c323e9a10bd8486482507f0d749214963..090c8fdc3b374ed937d3e04ccd5d9177
|
||||
|
||||
// Returns an autoreleased copy of the AXNodeData's attribute.
|
||||
NSString* NSStringForStringAttribute(BrowserAccessibility* browserAccessibility,
|
||||
@@ -727,6 +731,7 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired";
|
||||
@@ -727,6 +731,7 @@ bool IsSelectedStateRelevant(BrowserAccessibility* item) {
|
||||
#define NSAccessibilityLanguageAttribute @"AXLanguage"
|
||||
#endif
|
||||
|
||||
@@ -163,7 +163,7 @@ index 474ae88c323e9a10bd8486482507f0d749214963..090c8fdc3b374ed937d3e04ccd5d9177
|
||||
bool content::IsAXTextMarker(id object) {
|
||||
if (object == nil)
|
||||
return false;
|
||||
@@ -770,6 +775,7 @@ id content::AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker) {
|
||||
@@ -770,6 +775,7 @@ bool IsSelectedStateRelevant(BrowserAccessibility* item) {
|
||||
kCFAllocatorDefault, anchor_textmarker, focus_textmarker);
|
||||
return [static_cast<id>(cf_marker_range) autorelease];
|
||||
}
|
||||
@@ -171,7 +171,7 @@ index 474ae88c323e9a10bd8486482507f0d749214963..090c8fdc3b374ed937d3e04ccd5d9177
|
||||
|
||||
@implementation BrowserAccessibilityCocoa
|
||||
|
||||
@@ -807,7 +813,9 @@ id content::AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker) {
|
||||
@@ -807,7 +813,9 @@ + (void)initialize {
|
||||
{NSAccessibilityEditableAncestorAttribute, @"editableAncestor"},
|
||||
{NSAccessibilityElementBusyAttribute, @"elementBusy"},
|
||||
{NSAccessibilityEnabledAttribute, @"enabled"},
|
||||
@@ -181,7 +181,7 @@ index 474ae88c323e9a10bd8486482507f0d749214963..090c8fdc3b374ed937d3e04ccd5d9177
|
||||
{NSAccessibilityExpandedAttribute, @"expanded"},
|
||||
{NSAccessibilityFocusableAncestorAttribute, @"focusableAncestor"},
|
||||
{NSAccessibilityFocusedAttribute, @"focused"},
|
||||
@@ -819,8 +827,10 @@ id content::AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker) {
|
||||
@@ -819,8 +827,10 @@ + (void)initialize {
|
||||
{NSAccessibilityHighestEditableAncestorAttribute,
|
||||
@"highestEditableAncestor"},
|
||||
{NSAccessibilityIndexAttribute, @"index"},
|
||||
@@ -192,7 +192,7 @@ index 474ae88c323e9a10bd8486482507f0d749214963..090c8fdc3b374ed937d3e04ccd5d9177
|
||||
{NSAccessibilityInvalidAttribute, @"invalid"},
|
||||
{NSAccessibilityIsMultiSelectableAttribute, @"isMultiSelectable"},
|
||||
{NSAccessibilityLanguageAttribute, @"language"},
|
||||
@@ -842,13 +852,17 @@ id content::AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker) {
|
||||
@@ -842,13 +852,17 @@ + (void)initialize {
|
||||
{NSAccessibilityRowsAttribute, @"rows"},
|
||||
// TODO(aboxhall): expose
|
||||
// NSAccessibilityServesAsTitleForUIElementsAttribute
|
||||
@@ -210,7 +210,7 @@ index 474ae88c323e9a10bd8486482507f0d749214963..090c8fdc3b374ed937d3e04ccd5d9177
|
||||
{NSAccessibilitySizeAttribute, @"size"},
|
||||
{NSAccessibilitySortDirectionAttribute, @"sortDirection"},
|
||||
{NSAccessibilitySubroleAttribute, @"subrole"},
|
||||
@@ -1336,6 +1350,7 @@ id content::AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker) {
|
||||
@@ -1336,6 +1350,7 @@ - (NSNumber*)enabled {
|
||||
ax::mojom::Restriction::kDisabled];
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ index 474ae88c323e9a10bd8486482507f0d749214963..090c8fdc3b374ed937d3e04ccd5d9177
|
||||
// Returns a text marker that points to the last character in the document that
|
||||
// can be selected with VoiceOver.
|
||||
- (id)endTextMarker {
|
||||
@@ -1346,6 +1361,7 @@ id content::AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker) {
|
||||
@@ -1346,6 +1361,7 @@ - (id)endTextMarker {
|
||||
BrowserAccessibilityPositionInstance position = root->CreatePositionAt(0);
|
||||
return CreateTextMarker(position->CreatePositionAtEndOfAnchor());
|
||||
}
|
||||
@@ -226,7 +226,7 @@ index 474ae88c323e9a10bd8486482507f0d749214963..090c8fdc3b374ed937d3e04ccd5d9177
|
||||
|
||||
- (NSNumber*)expanded {
|
||||
if (![self instanceActive])
|
||||
@@ -1495,6 +1511,8 @@ id content::AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker) {
|
||||
@@ -1495,6 +1511,8 @@ - (NSNumber*)index {
|
||||
return nil;
|
||||
}
|
||||
|
||||
@@ -235,7 +235,7 @@ index 474ae88c323e9a10bd8486482507f0d749214963..090c8fdc3b374ed937d3e04ccd5d9177
|
||||
- (NSNumber*)insertionPointLineNumber {
|
||||
if (![self instanceActive])
|
||||
return nil;
|
||||
@@ -1517,6 +1535,7 @@ id content::AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker) {
|
||||
@@ -1517,6 +1535,7 @@ - (NSNumber*)insertionPointLineNumber {
|
||||
caretPosition->AsTextPosition()->text_offset());
|
||||
return @(std::distance(lineBreaks.begin(), iterator));
|
||||
}
|
||||
@@ -243,7 +243,7 @@ index 474ae88c323e9a10bd8486482507f0d749214963..090c8fdc3b374ed937d3e04ccd5d9177
|
||||
|
||||
// Returns whether or not this node should be ignored in the
|
||||
// accessibility tree.
|
||||
@@ -2193,6 +2212,7 @@ id content::AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker) {
|
||||
@@ -2193,6 +2212,7 @@ - (NSArray*)selectedChildren {
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -251,7 +251,7 @@ index 474ae88c323e9a10bd8486482507f0d749214963..090c8fdc3b374ed937d3e04ccd5d9177
|
||||
- (NSString*)selectedText {
|
||||
if (![self instanceActive])
|
||||
return nil;
|
||||
@@ -2204,11 +2224,13 @@ id content::AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker) {
|
||||
@@ -2204,11 +2224,13 @@ - (NSString*)selectedText {
|
||||
return nil;
|
||||
return base::SysUTF16ToNSString(range.GetText());
|
||||
}
|
||||
@@ -265,7 +265,7 @@ index 474ae88c323e9a10bd8486482507f0d749214963..090c8fdc3b374ed937d3e04ccd5d9177
|
||||
- (NSValue*)selectedTextRange {
|
||||
if (![self instanceActive])
|
||||
return nil;
|
||||
@@ -2229,12 +2251,15 @@ id content::AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker) {
|
||||
@@ -2229,12 +2251,15 @@ - (NSValue*)selectedTextRange {
|
||||
int selLength = range.GetText().length();
|
||||
return [NSValue valueWithRange:NSMakeRange(selStart, selLength)];
|
||||
}
|
||||
@@ -281,7 +281,7 @@ index 474ae88c323e9a10bd8486482507f0d749214963..090c8fdc3b374ed937d3e04ccd5d9177
|
||||
|
||||
- (NSValue*)size {
|
||||
if (![self instanceActive])
|
||||
@@ -2267,6 +2292,7 @@ id content::AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker) {
|
||||
@@ -2267,6 +2292,7 @@ - (NSString*)sortDirection {
|
||||
return nil;
|
||||
}
|
||||
|
||||
@@ -289,7 +289,7 @@ index 474ae88c323e9a10bd8486482507f0d749214963..090c8fdc3b374ed937d3e04ccd5d9177
|
||||
// Returns a text marker that points to the first character in the document that
|
||||
// can be selected with VoiceOver.
|
||||
- (id)startTextMarker {
|
||||
@@ -2277,6 +2303,7 @@ id content::AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker) {
|
||||
@@ -2277,6 +2303,7 @@ - (id)startTextMarker {
|
||||
BrowserAccessibilityPositionInstance position = root->CreatePositionAt(0);
|
||||
return CreateTextMarker(position->CreatePositionAtStartOfAnchor());
|
||||
}
|
||||
@@ -297,7 +297,7 @@ index 474ae88c323e9a10bd8486482507f0d749214963..090c8fdc3b374ed937d3e04ccd5d9177
|
||||
|
||||
// Returns a subrole based upon the role.
|
||||
- (NSString*)subrole {
|
||||
@@ -2599,11 +2626,13 @@ id content::AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker) {
|
||||
@@ -2599,11 +2626,13 @@ - (NSAttributedString*)attributedValueForRange:(NSRange)range {
|
||||
NSMutableAttributedString* attributedInnerText =
|
||||
[[[NSMutableAttributedString alloc]
|
||||
initWithString:base::SysUTF16ToNSString(innerText)] autorelease];
|
||||
@@ -311,7 +311,7 @@ index 474ae88c323e9a10bd8486482507f0d749214963..090c8fdc3b374ed937d3e04ccd5d9177
|
||||
|
||||
return [attributedInnerText attributedSubstringFromRange:range];
|
||||
}
|
||||
@@ -2707,9 +2736,8 @@ id content::AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker) {
|
||||
@@ -2707,9 +2736,8 @@ - (id)accessibilityAttributeValue:(NSString*)attribute
|
||||
return ToBrowserAccessibilityCocoa(cell);
|
||||
}
|
||||
|
||||
@@ -323,7 +323,7 @@ index 474ae88c323e9a10bd8486482507f0d749214963..090c8fdc3b374ed937d3e04ccd5d9177
|
||||
BrowserAccessibilityPositionInstance position =
|
||||
CreatePositionFromTextMarker(parameter);
|
||||
if (!position->IsNullPosition())
|
||||
@@ -3022,6 +3050,7 @@ id content::AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker) {
|
||||
@@ -3022,6 +3050,7 @@ AXPlatformRange range(std::move(lineStartPosition),
|
||||
|
||||
return CreateTextMarker(root->CreatePositionAt(index));
|
||||
}
|
||||
@@ -331,7 +331,7 @@ index 474ae88c323e9a10bd8486482507f0d749214963..090c8fdc3b374ed937d3e04ccd5d9177
|
||||
|
||||
if ([attribute isEqualToString:
|
||||
NSAccessibilityBoundsForRangeParameterizedAttribute]) {
|
||||
@@ -3057,6 +3086,7 @@ id content::AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker) {
|
||||
@@ -3057,6 +3086,7 @@ AXPlatformRange range(std::move(lineStartPosition),
|
||||
return nil;
|
||||
}
|
||||
|
||||
@@ -339,7 +339,7 @@ index 474ae88c323e9a10bd8486482507f0d749214963..090c8fdc3b374ed937d3e04ccd5d9177
|
||||
if ([attribute
|
||||
isEqualToString:
|
||||
NSAccessibilityLineTextMarkerRangeForTextMarkerParameterizedAttribute]) {
|
||||
@@ -3171,6 +3201,7 @@ id content::AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker) {
|
||||
@@ -3171,6 +3201,7 @@ AXPlatformRange range(std::move(lineStartPosition),
|
||||
|
||||
return @(child->GetIndexInParent());
|
||||
}
|
||||
@@ -351,7 +351,7 @@ diff --git a/content/browser/accessibility/browser_accessibility_manager_mac.mm
|
||||
index aaf53dd214037f103ea7399d0702b1e2ffff1b56..5972939a070908521e82845b084d2d3b9f9a73f8 100644
|
||||
--- a/content/browser/accessibility/browser_accessibility_manager_mac.mm
|
||||
+++ b/content/browser/accessibility/browser_accessibility_manager_mac.mm
|
||||
@@ -527,6 +527,7 @@ NSDictionary* BrowserAccessibilityManagerMac::
|
||||
@@ -527,6 +527,7 @@ void PostAnnouncementNotification(NSString* announcement) {
|
||||
[user_info setObject:native_focus_object
|
||||
forKey:NSAccessibilityTextChangeElement];
|
||||
|
||||
@@ -359,7 +359,7 @@ index aaf53dd214037f103ea7399d0702b1e2ffff1b56..5972939a070908521e82845b084d2d3b
|
||||
id selected_text = [native_focus_object selectedTextMarkerRange];
|
||||
if (selected_text) {
|
||||
NSString* const NSAccessibilitySelectedTextMarkerRangeAttribute =
|
||||
@@ -534,6 +535,7 @@ NSDictionary* BrowserAccessibilityManagerMac::
|
||||
@@ -534,6 +535,7 @@ void PostAnnouncementNotification(NSString* announcement) {
|
||||
[user_info setObject:selected_text
|
||||
forKey:NSAccessibilitySelectedTextMarkerRangeAttribute];
|
||||
}
|
||||
@@ -383,7 +383,7 @@ index 28ca1646af0b0cce40d27baec71cbe65adc334fa..bae65c1f485bc02eb9ef2ebf7018af4a
|
||||
|
||||
namespace content {
|
||||
|
||||
@@ -22,6 +24,7 @@ namespace {
|
||||
@@ -22,6 +24,7 @@
|
||||
// verifies there are no existing open connections), and then indicates that
|
||||
// Chrome should continue execution without access to launchservicesd.
|
||||
void DisableSystemServices() {
|
||||
@@ -411,7 +411,7 @@ index 3aec8bc1fe1a619f2c4ec42ef438ae49fe0f5812..76dc23dfa26beb3b92bd87eb60fe3868
|
||||
extern "C" {
|
||||
// Undocumented IOBluetooth Preference API [1]. Used by `blueutil` [2] and
|
||||
// `Karabiner` [3] to programmatically control the Bluetooth state. Calling the
|
||||
@@ -49,6 +50,7 @@ extern "C" {
|
||||
@@ -49,6 +50,7 @@
|
||||
// [4] https://support.apple.com/kb/PH25091
|
||||
void IOBluetoothPreferenceSetControllerPowerState(int state);
|
||||
}
|
||||
@@ -419,7 +419,7 @@ index 3aec8bc1fe1a619f2c4ec42ef438ae49fe0f5812..76dc23dfa26beb3b92bd87eb60fe3868
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -118,8 +120,10 @@ BluetoothAdapterMac::BluetoothAdapterMac()
|
||||
@@ -118,8 +120,10 @@ CBCentralManagerState GetCBManagerState(CBCentralManager* manager) {
|
||||
controller_state_function_(
|
||||
base::BindRepeating(&BluetoothAdapterMac::GetHostControllerState,
|
||||
base::Unretained(this))),
|
||||
@@ -430,7 +430,7 @@ index 3aec8bc1fe1a619f2c4ec42ef438ae49fe0f5812..76dc23dfa26beb3b92bd87eb60fe3868
|
||||
should_update_name_(true),
|
||||
classic_discovery_manager_(
|
||||
BluetoothDiscoveryManagerMac::CreateClassic(this)),
|
||||
@@ -306,8 +310,12 @@ base::WeakPtr<BluetoothAdapter> BluetoothAdapterMac::GetWeakPtr() {
|
||||
@@ -306,8 +310,12 @@ CBCentralManagerState GetCBManagerState(CBCentralManager* manager) {
|
||||
}
|
||||
|
||||
bool BluetoothAdapterMac::SetPoweredImpl(bool powered) {
|
||||
|
||||
@@ -25,7 +25,7 @@ index bd3c6c1724bee8f06544a2aece0ae5e45c145e4d..d84160a3ce7d08e64053b4634f490669
|
||||
// These are not documented, so use only after checking -respondsToSelector:.
|
||||
@interface NSApplication (UndocumentedSpeechMethods)
|
||||
- (void)speakString:(NSString*)string;
|
||||
@@ -645,6 +650,9 @@ void ExtractUnderlines(NSAttributedString* string,
|
||||
@@ -645,6 +650,9 @@ - (BOOL)acceptsMouseEventsWhenInactive {
|
||||
}
|
||||
|
||||
- (BOOL)acceptsFirstMouse:(NSEvent*)theEvent {
|
||||
@@ -35,7 +35,7 @@ index bd3c6c1724bee8f06544a2aece0ae5e45c145e4d..d84160a3ce7d08e64053b4634f490669
|
||||
return [self acceptsMouseEventsWhenInactive];
|
||||
}
|
||||
|
||||
@@ -1078,6 +1086,10 @@ void ExtractUnderlines(NSAttributedString* string,
|
||||
@@ -1078,6 +1086,10 @@ - (void)keyEvent:(NSEvent*)theEvent wasKeyEquivalent:(BOOL)equiv {
|
||||
eventType == NSKeyDown &&
|
||||
!(modifierFlags & NSCommandKeyMask);
|
||||
|
||||
@@ -46,7 +46,7 @@ index bd3c6c1724bee8f06544a2aece0ae5e45c145e4d..d84160a3ce7d08e64053b4634f490669
|
||||
// We only handle key down events and just simply forward other events.
|
||||
if (eventType != NSKeyDown) {
|
||||
_hostHelper->ForwardKeyboardEvent(event, latency_info);
|
||||
@@ -1854,9 +1866,11 @@ void ExtractUnderlines(NSAttributedString* string,
|
||||
@@ -1854,9 +1866,11 @@ - (NSAccessibilityRole)accessibilityRole {
|
||||
// Since this implementation doesn't have to wait any IPC calls, this doesn't
|
||||
// make any key-typing jank. --hbono 7/23/09
|
||||
//
|
||||
@@ -58,7 +58,7 @@ index bd3c6c1724bee8f06544a2aece0ae5e45c145e4d..d84160a3ce7d08e64053b4634f490669
|
||||
|
||||
- (NSArray*)validAttributesForMarkedText {
|
||||
// This code is just copied from WebKit except renaming variables.
|
||||
@@ -1865,7 +1879,10 @@ extern NSString* NSTextInputReplacementRangeAttributeName;
|
||||
@@ -1865,7 +1879,10 @@ - (NSArray*)validAttributesForMarkedText {
|
||||
initWithObjects:NSUnderlineStyleAttributeName,
|
||||
NSUnderlineColorAttributeName,
|
||||
NSMarkedClauseSegmentAttributeName,
|
||||
|
||||
@@ -26,7 +26,7 @@ diff --git a/content/browser/web_contents/web_drag_dest_mac.mm b/content/browser
|
||||
index a964f38b830f62bf694646033e1c24e0cf4557c5..61e69fdebaca038d09b5ebab71fd20e2e13188f0 100644
|
||||
--- a/content/browser/web_contents/web_drag_dest_mac.mm
|
||||
+++ b/content/browser/web_contents/web_drag_dest_mac.mm
|
||||
@@ -384,9 +384,7 @@ void DropCompletionCallback(
|
||||
@@ -384,9 +384,7 @@ - (void)setDragStartTrackersForProcess:(int)processID {
|
||||
}
|
||||
|
||||
- (bool)isValidDragTarget:(content::RenderWidgetHostImpl*)targetRWH {
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: deepak1556 <hop2deep@gmail.com>
|
||||
Date: Thu, 17 Oct 2019 18:00:32 -0700
|
||||
Subject: feat: add hook to notify script ready from WorkerScriptController
|
||||
|
||||
In Off-the-main-thread fetch, the WorkerGlobalScope will be in a half
|
||||
initialized state until the script is finished downloading.
|
||||
|
||||
Doc: https://docs.google.com/document/d/1JCv8TD2nPLNC2iRCp_D1OM4I3uTS0HoEobuTymaMqgw/edit
|
||||
|
||||
During this stage if the global object is transformed for ex: copying properties
|
||||
in DidInitializeWorkerContextOnWorkerThread hook then an access to property like
|
||||
location will result in a crash WorkerGlobalScope::Url() because the script has
|
||||
not been set with response URL yet.
|
||||
|
||||
This issue cannot happen in chromium with existing usage, but can surface when an
|
||||
embedder tries to integrate Node.js in the worker. Hence, this new hook is proposed
|
||||
that clearly establishes the worker script is ready for evaluation with the scope
|
||||
initialized.
|
||||
|
||||
diff --git a/content/public/renderer/content_renderer_client.h b/content/public/renderer/content_renderer_client.h
|
||||
index 8309bb7f3f284b0930c13a7e75a7f9de64fedb73..7c5c925cadc5caca5ef69eda80ccc04797b2c803 100644
|
||||
--- a/content/public/renderer/content_renderer_client.h
|
||||
+++ b/content/public/renderer/content_renderer_client.h
|
||||
@@ -405,6 +405,11 @@ class CONTENT_EXPORT ContentRendererClient {
|
||||
virtual void DidInitializeWorkerContextOnWorkerThread(
|
||||
v8::Local<v8::Context> context) {}
|
||||
|
||||
+ // Notifies that a worker script has been downloaded, scope initialized and
|
||||
+ // ready for evaluation. This function is called from the worker thread.
|
||||
+ virtual void WorkerScriptReadyForEvaluationOnWorkerThread(
|
||||
+ v8::Local<v8::Context> context) {}
|
||||
+
|
||||
// Notifies that a worker context will be destroyed. This function is called
|
||||
// from the worker thread.
|
||||
virtual void WillDestroyWorkerContextOnWorkerThread(
|
||||
diff --git a/content/renderer/renderer_blink_platform_impl.cc b/content/renderer/renderer_blink_platform_impl.cc
|
||||
index 906e86480872394d33608a954440cbc92273d0ff..27bf2e12e5f2a150fca992f1bfed88936c7cee35 100644
|
||||
--- a/content/renderer/renderer_blink_platform_impl.cc
|
||||
+++ b/content/renderer/renderer_blink_platform_impl.cc
|
||||
@@ -877,6 +877,12 @@ void RendererBlinkPlatformImpl::WorkerContextCreated(
|
||||
worker);
|
||||
}
|
||||
|
||||
+void RendererBlinkPlatformImpl::WorkerScriptReadyForEvaluation(
|
||||
+ const v8::Local<v8::Context>& worker) {
|
||||
+ GetContentClient()->renderer()->WorkerScriptReadyForEvaluationOnWorkerThread(
|
||||
+ worker);
|
||||
+}
|
||||
+
|
||||
bool RendererBlinkPlatformImpl::AllowScriptExtensionForServiceWorker(
|
||||
const blink::WebSecurityOrigin& script_origin) {
|
||||
return GetContentClient()->renderer()->AllowScriptExtensionForServiceWorker(
|
||||
diff --git a/content/renderer/renderer_blink_platform_impl.h b/content/renderer/renderer_blink_platform_impl.h
|
||||
index db58cb0be064b7944b17dd12f1d1e6c12cecfff7..5c80537e6020ae5845728130b46825f5db745a5e 100644
|
||||
--- a/content/renderer/renderer_blink_platform_impl.h
|
||||
+++ b/content/renderer/renderer_blink_platform_impl.h
|
||||
@@ -191,6 +191,8 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl {
|
||||
void DidStartWorkerThread() override;
|
||||
void WillStopWorkerThread() override;
|
||||
void WorkerContextCreated(const v8::Local<v8::Context>& worker) override;
|
||||
+ void WorkerScriptReadyForEvaluation(
|
||||
+ const v8::Local<v8::Context>& worker) override;
|
||||
void WorkerContextWillDestroy(const v8::Local<v8::Context>& worker) override;
|
||||
bool AllowScriptExtensionForServiceWorker(
|
||||
const blink::WebSecurityOrigin& script_origin) override;
|
||||
diff --git a/third_party/blink/public/platform/platform.h b/third_party/blink/public/platform/platform.h
|
||||
index 754634fd4935cdf38168361f1491cf3aedaf8cdb..513cdea72aba0082d43268bdbfc5328fb21afb76 100644
|
||||
--- a/third_party/blink/public/platform/platform.h
|
||||
+++ b/third_party/blink/public/platform/platform.h
|
||||
@@ -638,6 +638,8 @@ class BLINK_PLATFORM_EXPORT Platform {
|
||||
virtual void DidStartWorkerThread() {}
|
||||
virtual void WillStopWorkerThread() {}
|
||||
virtual void WorkerContextCreated(const v8::Local<v8::Context>& worker) {}
|
||||
+ virtual void WorkerScriptReadyForEvaluation(
|
||||
+ const v8::Local<v8::Context>& worker) {}
|
||||
virtual void WorkerContextWillDestroy(const v8::Local<v8::Context>& worker) {}
|
||||
virtual bool AllowScriptExtensionForServiceWorker(
|
||||
const WebSecurityOrigin& script_origin) {
|
||||
diff --git a/third_party/blink/renderer/bindings/core/v8/worker_or_worklet_script_controller.cc b/third_party/blink/renderer/bindings/core/v8/worker_or_worklet_script_controller.cc
|
||||
index 72b80a13cc7845236b58a4944be0ac8b314dc5fe..c227343c1c58acf94c7be2a9a2a12e921c1b5943 100644
|
||||
--- a/third_party/blink/renderer/bindings/core/v8/worker_or_worklet_script_controller.cc
|
||||
+++ b/third_party/blink/renderer/bindings/core/v8/worker_or_worklet_script_controller.cc
|
||||
@@ -328,6 +328,8 @@ void WorkerOrWorkletScriptController::PrepareForEvaluation() {
|
||||
wrapper_type_info->InstallConditionalFeatures(
|
||||
context, *world_, global_object, v8::Local<v8::Object>(),
|
||||
v8::Local<v8::Function>(), global_interface_template);
|
||||
+
|
||||
+ Platform::Current()->WorkerScriptReadyForEvaluation(context);
|
||||
#endif // USE_BLINK_V8_BINDING_NEW_IDL_INTERFACE
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ feat_add_flags_for_low-level_hooks_and_exceptions.patch
|
||||
fix_expose_tracing_agent_and_use_tracing_tracingcontroller_instead.patch
|
||||
pass_all_globals_through_require.patch
|
||||
call_process_log_from_fallback_stream_on_windows.patch
|
||||
fixme_use_redefined_version_of_internalmodulestat.patch
|
||||
fixme_remove_async_id_assertion_check.patch
|
||||
fixme_comment_trace_event_macro.patch
|
||||
fix_key_gen_apis_are_not_available_in_boringssl.patch
|
||||
@@ -35,11 +34,10 @@ weakrefs_rename_finalizationgroup_to_finalizationregistry_for_js.patch
|
||||
weakrefs_split_out_finalizationregistry_cleanupsome.patch
|
||||
fix_window_c-ares_incompatibilities.patch
|
||||
chore_sethostcleanupfinalizationgroupcallback_has_been_removed_from.patch
|
||||
fix_remove_bad_semicolon_outside_fn.patch
|
||||
fix_comment_out_incompatible_crypto_modules.patch
|
||||
test_account_for_non-node_basename.patch
|
||||
lib_src_switch_buffer_kmaxlength_to_size_t.patch
|
||||
update_tests_after_increasing_typed_array_size.patch
|
||||
darwin_work_around_clock_jumping_back_in_time.patch
|
||||
fix_do_not_register_the_esm_loader_in_renderer_processes.patch
|
||||
fix_allow_preventing_setpromiserejectcallback.patch
|
||||
lib_use_non-symbols_in_isurlinstance_check.patch
|
||||
|
||||
@@ -866,10 +866,10 @@ index 0000000000000000000000000000000000000000..2c9d2826c85bdd033f1df1d6188df636
|
||||
+}
|
||||
diff --git a/filenames.json b/filenames.json
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..94816008fb2aeb4c8453f87ca8d612afdc6d9e1a
|
||||
index 0000000000000000000000000000000000000000..964255d66b8c77ccd919853c8fceb53789756255
|
||||
--- /dev/null
|
||||
+++ b/filenames.json
|
||||
@@ -0,0 +1,518 @@
|
||||
@@ -0,0 +1,519 @@
|
||||
+// This file is automatically generated by generate_gn_filenames_json.py
|
||||
+// DO NOT EDIT
|
||||
+{
|
||||
@@ -926,6 +926,7 @@ index 0000000000000000000000000000000000000000..94816008fb2aeb4c8453f87ca8d612af
|
||||
+ {
|
||||
+ "dest_dir": "include/node//",
|
||||
+ "files": [
|
||||
+ "//v8/include/v8-cppgc.h",
|
||||
+ "//v8/include/v8-fast-api-calls.h",
|
||||
+ "//v8/include/v8-internal.h",
|
||||
+ "//v8/include/v8-platform.h",
|
||||
@@ -1105,6 +1106,7 @@ index 0000000000000000000000000000000000000000..94816008fb2aeb4c8453f87ca8d612af
|
||||
+ "lib/internal/main/run_third_party_main.js",
|
||||
+ "lib/internal/main/worker_thread.js",
|
||||
+ "lib/internal/modules/run_main.js",
|
||||
+ "lib/internal/modules/package_json_reader.js",
|
||||
+ "lib/internal/modules/cjs/helpers.js",
|
||||
+ "lib/internal/modules/cjs/loader.js",
|
||||
+ "lib/internal/modules/esm/loader.js",
|
||||
@@ -1231,7 +1233,6 @@ index 0000000000000000000000000000000000000000..94816008fb2aeb4c8453f87ca8d612af
|
||||
+ "src/node_contextify.cc",
|
||||
+ "src/node_credentials.cc",
|
||||
+ "src/node_dir.cc",
|
||||
+ "src/node_domain.cc",
|
||||
+ "src/node_env_var.cc",
|
||||
+ "src/node_errors.cc",
|
||||
+ "src/node_file.cc",
|
||||
@@ -1594,7 +1595,7 @@ index 0000000000000000000000000000000000000000..f3c5c798c0aefcb8cf9b1570a7b4817c
|
||||
+ args = rebase_path(inputs + outputs, root_build_dir)
|
||||
+}
|
||||
diff --git a/src/node_version.h b/src/node_version.h
|
||||
index a43e451ab0cd5f2bc24453d5821deb380d2ab6d0..190479619f188bd05d1faac4696670fe18425a53 100644
|
||||
index 9252d51555f0e1bf0957bc4f8bc6e399c1ac6c23..431dd57a7dddc7476a179a5f30ce9e66814006ec 100644
|
||||
--- a/src/node_version.h
|
||||
+++ b/src/node_version.h
|
||||
@@ -89,7 +89,10 @@
|
||||
@@ -1750,7 +1751,7 @@ index 655802980a6ea94d1d4ca1dc63c8c8e905fbb83a..ab1a18a215cb7393310324c6dbcacc66
|
||||
if 'false' == variables.get('node_shared_libuv'):
|
||||
subdir_files('deps/uv/include', 'include/node/', action)
|
||||
diff --git a/tools/js2c.py b/tools/js2c.py
|
||||
index 4594694a2cab0d878d86127a72714ed60c251b6e..9e9883129bed62c591d23f71d139514c5034ac8d 100755
|
||||
index 195e6a6189a98916bcfb7abb1b73595b8bc8eb38..d5109fcae5542730623f5ec3ca244ec0973109f2 100755
|
||||
--- a/tools/js2c.py
|
||||
+++ b/tools/js2c.py
|
||||
@@ -130,6 +130,14 @@ def NormalizeFileName(filename):
|
||||
|
||||
@@ -14,10 +14,10 @@ renderer/browser/worker/sandboxed bootstrap scripts). These are loaded
|
||||
through LoadEmbedderJavaScriptSource()
|
||||
|
||||
diff --git a/src/node_native_module.cc b/src/node_native_module.cc
|
||||
index 1b916d645d863929710ce5e4e930ec72fb426844..6d39a8858e093199fb935b68ff84388d48d6c35e 100644
|
||||
index 7362207412efa49bddfab4e32a64c7e07cf29074..acd9afa62d3aa1b01ce54f189a7261e7e61aa60d 100644
|
||||
--- a/src/node_native_module.cc
|
||||
+++ b/src/node_native_module.cc
|
||||
@@ -23,6 +23,7 @@ NativeModuleLoader NativeModuleLoader::instance_;
|
||||
@@ -20,6 +20,7 @@ NativeModuleLoader NativeModuleLoader::instance_;
|
||||
|
||||
NativeModuleLoader::NativeModuleLoader() : config_(GetConfig()) {
|
||||
LoadJavaScriptSource();
|
||||
@@ -38,7 +38,7 @@ index c0bce3bce42c848d63a10147ef483c9d4465f5ce..7f296e459d46b4cda51baf9887df060f
|
||||
|
||||
bool Exists(const char* id);
|
||||
diff --git a/tools/js2c.py b/tools/js2c.py
|
||||
index 9e9883129bed62c591d23f71d139514c5034ac8d..ad073bd7f023c8436985f177011a7d29829098b4 100755
|
||||
index d5109fcae5542730623f5ec3ca244ec0973109f2..8537f7fd50b0441307f91cad3bf9f730c2cb8cdf 100755
|
||||
--- a/tools/js2c.py
|
||||
+++ b/tools/js2c.py
|
||||
@@ -56,13 +56,15 @@ namespace native_module {{
|
||||
@@ -118,7 +118,7 @@ index 9e9883129bed62c591d23f71d139514c5034ac8d..ad073bd7f023c8436985f177011a7d29
|
||||
write_if_chaged(out, target)
|
||||
|
||||
|
||||
@@ -208,17 +223,21 @@ def main():
|
||||
@@ -209,17 +224,21 @@ def main():
|
||||
)
|
||||
parser.add_argument('--target', help='output file')
|
||||
parser.add_argument('--verbose', action='store_true', help='output file')
|
||||
|
||||
@@ -23,10 +23,10 @@ index 0a7c4a47c11eb4bb360b6a46fccb4692241bd2dc..b4a0f71af5853f427a10449b52509052
|
||||
|
||||
// TODO(joyeecheung): most of these should be deprecated and removed,
|
||||
diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js
|
||||
index e478c57af873da717c00db73d6719f806280efe1..1c949cab49224a6f1be7685acfd3ed19e11526c3 100644
|
||||
index 7d08fb05e9a0abeb82d416891968b23002dc3685..1f6f5e0cee36fb2a07963264f513a930c349b8fa 100644
|
||||
--- a/lib/internal/modules/cjs/loader.js
|
||||
+++ b/lib/internal/modules/cjs/loader.js
|
||||
@@ -1109,6 +1109,13 @@ Module.prototype._compile = function(content, filename) {
|
||||
@@ -1111,6 +1111,13 @@ Module.prototype._compile = function(content, filename) {
|
||||
if (getOptionValue('--inspect-brk') && process._eval == null) {
|
||||
if (!resolvedArgv) {
|
||||
// We enter the repl if we're not given a filename argument.
|
||||
@@ -41,7 +41,7 @@ index e478c57af873da717c00db73d6719f806280efe1..1c949cab49224a6f1be7685acfd3ed19
|
||||
try {
|
||||
resolvedArgv = Module._resolveFilename(process.argv[1], null, false);
|
||||
diff --git a/src/env.h b/src/env.h
|
||||
index 6de5ba9b192dd1ec23afe7a7736373acb59a6c4e..b6e02a2910cd8fe5ff3a17d6e1a98b937323ae3a 100644
|
||||
index d22b579b25ce4e6af8ec042e282e94248ea14162..67cefbe35f390ba25b49e422d10bca8b423a49a8 100644
|
||||
--- a/src/env.h
|
||||
+++ b/src/env.h
|
||||
@@ -890,6 +890,15 @@ class Environment : public MemoryRetainer {
|
||||
@@ -60,7 +60,7 @@ index 6de5ba9b192dd1ec23afe7a7736373acb59a6c4e..b6e02a2910cd8fe5ff3a17d6e1a98b93
|
||||
void InitializeLibuv(bool start_profiler_idle_notifier);
|
||||
inline const std::vector<std::string>& exec_argv();
|
||||
inline const std::vector<std::string>& argv();
|
||||
@@ -1273,6 +1282,9 @@ class Environment : public MemoryRetainer {
|
||||
@@ -1271,6 +1280,9 @@ class Environment : public MemoryRetainer {
|
||||
inline void ThrowError(v8::Local<v8::Value> (*fun)(v8::Local<v8::String>),
|
||||
const char* errmsg);
|
||||
|
||||
@@ -71,7 +71,7 @@ index 6de5ba9b192dd1ec23afe7a7736373acb59a6c4e..b6e02a2910cd8fe5ff3a17d6e1a98b93
|
||||
v8::Isolate* const isolate_;
|
||||
IsolateData* const isolate_data_;
|
||||
diff --git a/src/node_binding.cc b/src/node_binding.cc
|
||||
index 565a3fff85a25ef25ccf5c74d2ade7f5a6994b05..814f01f6144c0a0e053d2100f88e29ca2179b4a0 100644
|
||||
index 5291858bb164a262ca1d69d2582e037aeab23d55..a9ce41fbba4e8b0c4704c1d7795308ce18916739 100644
|
||||
--- a/src/node_binding.cc
|
||||
+++ b/src/node_binding.cc
|
||||
@@ -3,6 +3,7 @@
|
||||
@@ -82,7 +82,7 @@ index 565a3fff85a25ef25ccf5c74d2ade7f5a6994b05..814f01f6144c0a0e053d2100f88e29ca
|
||||
#include "util.h"
|
||||
|
||||
#if HAVE_OPENSSL
|
||||
@@ -462,10 +463,22 @@ void DLOpen(const FunctionCallbackInfo<Value>& args) {
|
||||
@@ -461,10 +462,22 @@ void DLOpen(const FunctionCallbackInfo<Value>& args) {
|
||||
|
||||
if (mp != nullptr) {
|
||||
if (mp->nm_context_register_func == nullptr) {
|
||||
|
||||
@@ -5,7 +5,7 @@ Subject: chore: SetHostCleanupFinalizationGroupCallback has been removed from
|
||||
V8
|
||||
|
||||
diff --git a/src/api/environment.cc b/src/api/environment.cc
|
||||
index 60d30b7eff7329c4235024c31525107216d70d7a..21980987644c6e83029157785dea463070456c77 100644
|
||||
index e2aa9c821de685a022fd78935399b7d219468403..2bfba8a011c2b902932e6b1714bbb55b945cd96d 100644
|
||||
--- a/src/api/environment.cc
|
||||
+++ b/src/api/environment.cc
|
||||
@@ -12,7 +12,6 @@ using errors::TryCatchScope;
|
||||
@@ -16,7 +16,7 @@ index 60d30b7eff7329c4235024c31525107216d70d7a..21980987644c6e83029157785dea4630
|
||||
using v8::Function;
|
||||
using v8::FunctionCallbackInfo;
|
||||
using v8::HandleScope;
|
||||
@@ -78,15 +77,6 @@ static MaybeLocal<Value> PrepareStackTraceCallback(Local<Context> context,
|
||||
@@ -72,15 +71,6 @@ static MaybeLocal<Value> PrepareStackTraceCallback(Local<Context> context,
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ index 60d30b7eff7329c4235024c31525107216d70d7a..21980987644c6e83029157785dea4630
|
||||
void* NodeArrayBufferAllocator::Allocate(size_t size) {
|
||||
void* ret;
|
||||
if (zero_fill_field_ || per_process::cli_options->zero_fill_all_buffers)
|
||||
@@ -255,11 +245,6 @@ void SetIsolateMiscHandlers(v8::Isolate* isolate, const IsolateSettings& s) {
|
||||
@@ -249,11 +239,6 @@ void SetIsolateMiscHandlers(v8::Isolate* isolate, const IsolateSettings& s) {
|
||||
s.promise_reject_callback : task_queue::PromiseRejectCallback;
|
||||
isolate->SetPromiseRejectCallback(promise_reject_cb);
|
||||
|
||||
@@ -62,7 +62,7 @@ index c6ef9dc13ab6f1d1a778871a62a0a98a01d84ec6..222555831aa1bf0b7b29b4b46e235c98
|
||||
const CleanupHookCallback& cb) const {
|
||||
return std::hash<void*>()(cb.arg_);
|
||||
diff --git a/src/env.cc b/src/env.cc
|
||||
index 657d711e539d81bfd03166bbaaae7f0b5db91a5f..02c5ba259c94bb160972005998007d66731d9dde 100644
|
||||
index 18788e4ceaf208c13704c9c43f017bb1b6dfb0b6..ee76d5889e5672716ac2f0c586f1ddc47fa56be7 100644
|
||||
--- a/src/env.cc
|
||||
+++ b/src/env.cc
|
||||
@@ -30,7 +30,6 @@ using v8::ArrayBuffer;
|
||||
@@ -73,7 +73,7 @@ index 657d711e539d81bfd03166bbaaae7f0b5db91a5f..02c5ba259c94bb160972005998007d66
|
||||
using v8::Function;
|
||||
using v8::FunctionTemplate;
|
||||
using v8::HandleScope;
|
||||
@@ -494,7 +493,6 @@ void Environment::InitializeLibuv(bool start_profiler_idle_notifier) {
|
||||
@@ -487,7 +486,6 @@ void Environment::InitializeLibuv(bool start_profiler_idle_notifier) {
|
||||
[](uv_async_t* async) {
|
||||
Environment* env = ContainerOf(
|
||||
&Environment::task_queues_async_, async);
|
||||
@@ -81,7 +81,7 @@ index 657d711e539d81bfd03166bbaaae7f0b5db91a5f..02c5ba259c94bb160972005998007d66
|
||||
env->RunAndClearNativeImmediates();
|
||||
});
|
||||
uv_unref(reinterpret_cast<uv_handle_t*>(&idle_prepare_handle_));
|
||||
@@ -1121,25 +1119,6 @@ void Environment::RunWeakRefCleanup() {
|
||||
@@ -1085,25 +1083,6 @@ void Environment::RunWeakRefCleanup() {
|
||||
isolate()->ClearKeptObjects();
|
||||
}
|
||||
|
||||
@@ -108,10 +108,10 @@ index 657d711e539d81bfd03166bbaaae7f0b5db91a5f..02c5ba259c94bb160972005998007d66
|
||||
void BaseObject::DeleteMe(void* data) {
|
||||
BaseObject* self = static_cast<BaseObject*>(data);
|
||||
diff --git a/src/env.h b/src/env.h
|
||||
index b6e02a2910cd8fe5ff3a17d6e1a98b937323ae3a..c1966a9f55126bdd65d8c9d529d934977bb4ad65 100644
|
||||
index 67cefbe35f390ba25b49e422d10bca8b423a49a8..9420bdf3f71e2df1011ddd7e583071f5c99beac8 100644
|
||||
--- a/src/env.h
|
||||
+++ b/src/env.h
|
||||
@@ -1132,9 +1132,7 @@ class Environment : public MemoryRetainer {
|
||||
@@ -1130,9 +1130,7 @@ class Environment : public MemoryRetainer {
|
||||
void AtExit(void (*cb)(void* arg), void* arg);
|
||||
void RunAtExitCallbacks();
|
||||
|
||||
@@ -121,7 +121,7 @@ index b6e02a2910cd8fe5ff3a17d6e1a98b937323ae3a..c1966a9f55126bdd65d8c9d529d93497
|
||||
|
||||
// Strings and private symbols are shared across shared contexts
|
||||
// The getters simply proxy to the per-isolate primitive.
|
||||
@@ -1357,8 +1355,6 @@ class Environment : public MemoryRetainer {
|
||||
@@ -1355,8 +1353,6 @@ class Environment : public MemoryRetainer {
|
||||
uint64_t thread_id_;
|
||||
std::unordered_set<worker::Worker*> sub_worker_contexts_;
|
||||
|
||||
|
||||
@@ -9,10 +9,10 @@ modules to sandboxed renderers.
|
||||
TODO(codebytere): remove and replace with a public facing API.
|
||||
|
||||
diff --git a/src/node_binding.cc b/src/node_binding.cc
|
||||
index 91ae3530d09b162c910eef4199d89c33c9feb379..565a3fff85a25ef25ccf5c74d2ade7f5a6994b05 100644
|
||||
index 0b5f6cfa038369be758e3b0857ee6fa594358b58..5291858bb164a262ca1d69d2582e037aeab23d55 100644
|
||||
--- a/src/node_binding.cc
|
||||
+++ b/src/node_binding.cc
|
||||
@@ -606,6 +606,10 @@ void GetInternalBinding(const FunctionCallbackInfo<Value>& args) {
|
||||
@@ -605,6 +605,10 @@ void GetInternalBinding(const FunctionCallbackInfo<Value>& args) {
|
||||
args.GetReturnValue().Set(exports);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ Environment on the V8 context of blink, so no new V8 context is created.
|
||||
As a result, a renderer process may have multiple Node Environments in it.
|
||||
|
||||
diff --git a/src/node.cc b/src/node.cc
|
||||
index 4ff7824b0011685289716d61b02427c3e264965d..f2b0b1585a14eaf6ffdb69a28888b42a4928f36b 100644
|
||||
index 728785d5d2773df68a891a4c81e7b0ebfa6021bb..15abe45edb39597d4fcc686cca4d79314090fa6f 100644
|
||||
--- a/src/node.cc
|
||||
+++ b/src/node.cc
|
||||
@@ -122,6 +122,8 @@ using v8::Undefined;
|
||||
@@ -36,7 +36,7 @@ index 4ff7824b0011685289716d61b02427c3e264965d..f2b0b1585a14eaf6ffdb69a28888b42a
|
||||
namespace per_process {
|
||||
|
||||
// node_revert.h
|
||||
@@ -733,7 +735,9 @@ int InitializeNodeWithArgs(std::vector<std::string>* argv,
|
||||
@@ -736,7 +738,9 @@ int InitializeNodeWithArgs(std::vector<std::string>* argv,
|
||||
binding::RegisterBuiltinModules();
|
||||
|
||||
// Make inherited handles noninheritable.
|
||||
@@ -47,7 +47,7 @@ index 4ff7824b0011685289716d61b02427c3e264965d..f2b0b1585a14eaf6ffdb69a28888b42a
|
||||
|
||||
// Cache the original command line to be
|
||||
// used in diagnostic reports.
|
||||
@@ -767,6 +771,8 @@ int InitializeNodeWithArgs(std::vector<std::string>* argv,
|
||||
@@ -770,6 +774,8 @@ int InitializeNodeWithArgs(std::vector<std::string>* argv,
|
||||
if (exit_code != 0) return exit_code;
|
||||
}
|
||||
#endif
|
||||
@@ -56,7 +56,7 @@ index 4ff7824b0011685289716d61b02427c3e264965d..f2b0b1585a14eaf6ffdb69a28888b42a
|
||||
|
||||
const int exit_code = ProcessGlobalArgs(argv,
|
||||
exec_argv,
|
||||
@@ -811,6 +817,7 @@ int InitializeNodeWithArgs(std::vector<std::string>* argv,
|
||||
@@ -814,6 +820,7 @@ int InitializeNodeWithArgs(std::vector<std::string>* argv,
|
||||
}
|
||||
per_process::metadata.versions.InitializeIntlVersions();
|
||||
#endif
|
||||
|
||||
@@ -9,10 +9,10 @@ We need to use the one Blink already provides, and so we need to
|
||||
slightly augment IsolateSettings to allow for that.
|
||||
|
||||
diff --git a/src/api/environment.cc b/src/api/environment.cc
|
||||
index 21980987644c6e83029157785dea463070456c77..20d9f91dcf6b5def05a706cf3389d64e9edbcf3e 100644
|
||||
index 2bfba8a011c2b902932e6b1714bbb55b945cd96d..28851b8a8f8bdd6dec0f54c62f79fd75a3be08ed 100644
|
||||
--- a/src/api/environment.cc
|
||||
+++ b/src/api/environment.cc
|
||||
@@ -241,9 +241,11 @@ void SetIsolateMiscHandlers(v8::Isolate* isolate, const IsolateSettings& s) {
|
||||
@@ -235,9 +235,11 @@ void SetIsolateMiscHandlers(v8::Isolate* isolate, const IsolateSettings& s) {
|
||||
s.allow_wasm_code_generation_callback : AllowWasmCodeGenerationCallback;
|
||||
isolate->SetAllowWasmCodeGenerationCallback(allow_wasm_codegen_cb);
|
||||
|
||||
|
||||
@@ -6,10 +6,10 @@ Subject: fix: build and expose inspector agent
|
||||
Node inspector initialization happens in a different start-up function in node.cc, which we don't call in Electron. This allows for us to use the inspector agent in electron/atom/browser/node_debugger.cc
|
||||
|
||||
diff --git a/src/inspector_agent.cc b/src/inspector_agent.cc
|
||||
index 94433b75d0fdb2ef902e20a60288995fcbf2bbac..3e865357f409470f15ed29a3f87b717812637c37 100644
|
||||
index 7712a62d7cbeb0975f00877be36b55da150f1459..1e990059198de3fedc912bfbd5eb6eae8e5c3eea 100644
|
||||
--- a/src/inspector_agent.cc
|
||||
+++ b/src/inspector_agent.cc
|
||||
@@ -222,7 +222,7 @@ const int CONTEXT_GROUP_ID = 1;
|
||||
@@ -220,7 +220,7 @@ const int CONTEXT_GROUP_ID = 1;
|
||||
|
||||
std::string GetWorkerLabel(node::Environment* env) {
|
||||
std::ostringstream result;
|
||||
@@ -18,7 +18,7 @@ index 94433b75d0fdb2ef902e20a60288995fcbf2bbac..3e865357f409470f15ed29a3f87b7178
|
||||
return result.str();
|
||||
}
|
||||
|
||||
@@ -470,7 +470,7 @@ class NodeInspectorClient : public V8InspectorClient {
|
||||
@@ -468,7 +468,7 @@ class NodeInspectorClient : public V8InspectorClient {
|
||||
client_ = V8Inspector::create(env->isolate(), this);
|
||||
// TODO(bnoordhuis) Make name configurable from src/node.cc.
|
||||
std::string name =
|
||||
|
||||
@@ -9,10 +9,10 @@ with what's exposed through BoringSSL. I plan to upstream parts of this or
|
||||
otherwise introduce shims to reduce friction.
|
||||
|
||||
diff --git a/src/node_crypto.cc b/src/node_crypto.cc
|
||||
index cd763fd3755357b36e753cf778550cf2d498ed57..dad343e15d0f76bdef9d9cc4e78c7e20b1b58bb0 100644
|
||||
index c373533ce85241f86d64eab8a49af79f935acdeb..454fff5ada0c271db7fb975f809c84d87773dcd6 100644
|
||||
--- a/src/node_crypto.cc
|
||||
+++ b/src/node_crypto.cc
|
||||
@@ -5142,6 +5142,7 @@ bool DiffieHellman::Init(int primeLength, int g) {
|
||||
@@ -5145,6 +5145,7 @@ bool DiffieHellman::Init(int primeLength, int g) {
|
||||
|
||||
bool DiffieHellman::Init(const char* p, int p_len, int g) {
|
||||
dh_.reset(DH_new());
|
||||
@@ -20,7 +20,7 @@ index cd763fd3755357b36e753cf778550cf2d498ed57..dad343e15d0f76bdef9d9cc4e78c7e20
|
||||
if (p_len <= 0) {
|
||||
BNerr(BN_F_BN_GENERATE_PRIME_EX, BN_R_BITS_TOO_SMALL);
|
||||
return false;
|
||||
@@ -5150,6 +5151,7 @@ bool DiffieHellman::Init(const char* p, int p_len, int g) {
|
||||
@@ -5153,6 +5154,7 @@ bool DiffieHellman::Init(const char* p, int p_len, int g) {
|
||||
DHerr(DH_F_DH_BUILTIN_GENPARAMS, DH_R_BAD_GENERATOR);
|
||||
return false;
|
||||
}
|
||||
@@ -28,7 +28,7 @@ index cd763fd3755357b36e753cf778550cf2d498ed57..dad343e15d0f76bdef9d9cc4e78c7e20
|
||||
BIGNUM* bn_p =
|
||||
BN_bin2bn(reinterpret_cast<const unsigned char*>(p), p_len, nullptr);
|
||||
BIGNUM* bn_g = BN_new();
|
||||
@@ -5165,6 +5167,7 @@ bool DiffieHellman::Init(const char* p, int p_len, int g) {
|
||||
@@ -5168,6 +5170,7 @@ bool DiffieHellman::Init(const char* p, int p_len, int g) {
|
||||
|
||||
bool DiffieHellman::Init(const char* p, int p_len, const char* g, int g_len) {
|
||||
dh_.reset(DH_new());
|
||||
@@ -36,7 +36,7 @@ index cd763fd3755357b36e753cf778550cf2d498ed57..dad343e15d0f76bdef9d9cc4e78c7e20
|
||||
if (p_len <= 0) {
|
||||
BNerr(BN_F_BN_GENERATE_PRIME_EX, BN_R_BITS_TOO_SMALL);
|
||||
return false;
|
||||
@@ -5187,6 +5190,7 @@ bool DiffieHellman::Init(const char* p, int p_len, const char* g, int g_len) {
|
||||
@@ -5190,6 +5193,7 @@ bool DiffieHellman::Init(const char* p, int p_len, const char* g, int g_len) {
|
||||
BN_free(bn_g);
|
||||
return false;
|
||||
}
|
||||
@@ -44,7 +44,7 @@ index cd763fd3755357b36e753cf778550cf2d498ed57..dad343e15d0f76bdef9d9cc4e78c7e20
|
||||
return VerifyContext();
|
||||
}
|
||||
|
||||
@@ -6154,6 +6158,7 @@ class DHKeyPairGenerationConfig : public KeyPairGenerationConfig {
|
||||
@@ -6157,6 +6161,7 @@ class DHKeyPairGenerationConfig : public KeyPairGenerationConfig {
|
||||
EVPKeyCtxPointer Setup() override {
|
||||
EVPKeyPointer params;
|
||||
if (prime_info_.fixed_value_) {
|
||||
@@ -52,7 +52,7 @@ index cd763fd3755357b36e753cf778550cf2d498ed57..dad343e15d0f76bdef9d9cc4e78c7e20
|
||||
DHPointer dh(DH_new());
|
||||
if (!dh)
|
||||
return nullptr;
|
||||
@@ -6170,6 +6175,7 @@ class DHKeyPairGenerationConfig : public KeyPairGenerationConfig {
|
||||
@@ -6173,6 +6178,7 @@ class DHKeyPairGenerationConfig : public KeyPairGenerationConfig {
|
||||
params = EVPKeyPointer(EVP_PKEY_new());
|
||||
CHECK(params);
|
||||
EVP_PKEY_assign_DH(params.get(), dh.release());
|
||||
@@ -60,7 +60,7 @@ index cd763fd3755357b36e753cf778550cf2d498ed57..dad343e15d0f76bdef9d9cc4e78c7e20
|
||||
} else {
|
||||
EVPKeyCtxPointer param_ctx(EVP_PKEY_CTX_new_id(EVP_PKEY_DH, nullptr));
|
||||
if (!param_ctx)
|
||||
@@ -6177,7 +6183,7 @@ class DHKeyPairGenerationConfig : public KeyPairGenerationConfig {
|
||||
@@ -6180,7 +6186,7 @@ class DHKeyPairGenerationConfig : public KeyPairGenerationConfig {
|
||||
|
||||
if (EVP_PKEY_paramgen_init(param_ctx.get()) <= 0)
|
||||
return nullptr;
|
||||
@@ -69,7 +69,7 @@ index cd763fd3755357b36e753cf778550cf2d498ed57..dad343e15d0f76bdef9d9cc4e78c7e20
|
||||
if (EVP_PKEY_CTX_set_dh_paramgen_prime_len(param_ctx.get(),
|
||||
prime_info_.prime_size_) <= 0)
|
||||
return nullptr;
|
||||
@@ -6185,7 +6191,7 @@ class DHKeyPairGenerationConfig : public KeyPairGenerationConfig {
|
||||
@@ -6188,7 +6194,7 @@ class DHKeyPairGenerationConfig : public KeyPairGenerationConfig {
|
||||
if (EVP_PKEY_CTX_set_dh_paramgen_generator(param_ctx.get(),
|
||||
generator_) <= 0)
|
||||
return nullptr;
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: fix: expose tracing::Agent and use tracing::TracingController instead
|
||||
of v8::TracingController
|
||||
|
||||
diff --git a/src/api/environment.cc b/src/api/environment.cc
|
||||
index 09d71b34581268bfe17c3182029cb3949d857d48..60d30b7eff7329c4235024c31525107216d70d7a 100644
|
||||
index 5526859e551c10b31e9999d1f8ba89a94db9abfc..e2aa9c821de685a022fd78935399b7d219468403 100644
|
||||
--- a/src/api/environment.cc
|
||||
+++ b/src/api/environment.cc
|
||||
@@ -358,6 +358,10 @@ MultiIsolatePlatform* GetMainThreadMultiIsolatePlatform() {
|
||||
@@ -352,6 +352,10 @@ MultiIsolatePlatform* GetMainThreadMultiIsolatePlatform() {
|
||||
return per_process::v8_platform.Platform();
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ Subject: fix: key gen APIs are not available in BoringSSL
|
||||
This will make Node's key pair generation APIs fail.
|
||||
|
||||
diff --git a/src/node_crypto.cc b/src/node_crypto.cc
|
||||
index f08d68d6b6e6303485e2c53aebc0d42708bd022a..17aeb99d586161d0af69376811b42e84a80553e3 100644
|
||||
index c132e6a089b3cb7119910131fe740574d7917b89..82afaee6e2b929faac76fc5d930a8c0fd6558df3 100644
|
||||
--- a/src/node_crypto.cc
|
||||
+++ b/src/node_crypto.cc
|
||||
@@ -267,24 +267,14 @@ Maybe<bool> Decorate(Environment* env, Local<Object> obj,
|
||||
@@ -34,7 +34,7 @@ index f08d68d6b6e6303485e2c53aebc0d42708bd022a..17aeb99d586161d0af69376811b42e84
|
||||
V(USER) \
|
||||
|
||||
#define V(name) case ERR_LIB_##name: lib = #name "_"; break;
|
||||
@@ -6082,6 +6072,7 @@ class DSAKeyPairGenerationConfig : public KeyPairGenerationConfig {
|
||||
@@ -6085,6 +6075,7 @@ class DSAKeyPairGenerationConfig : public KeyPairGenerationConfig {
|
||||
if (EVP_PKEY_paramgen_init(param_ctx.get()) <= 0)
|
||||
return nullptr;
|
||||
|
||||
@@ -42,7 +42,7 @@ index f08d68d6b6e6303485e2c53aebc0d42708bd022a..17aeb99d586161d0af69376811b42e84
|
||||
if (EVP_PKEY_CTX_set_dsa_paramgen_bits(param_ctx.get(), modulus_bits_) <= 0)
|
||||
return nullptr;
|
||||
|
||||
@@ -6092,6 +6083,7 @@ class DSAKeyPairGenerationConfig : public KeyPairGenerationConfig {
|
||||
@@ -6095,6 +6086,7 @@ class DSAKeyPairGenerationConfig : public KeyPairGenerationConfig {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Wed, 27 May 2020 12:57:43 -0700
|
||||
Subject: fix: remove bad semicolon outside fn
|
||||
|
||||
Node.js introduced a bad semicolon style in
|
||||
https://github.com/nodejs/node/pull/29207. Upstreamed in
|
||||
https://github.com/nodejs/node/pull/33592.
|
||||
|
||||
diff --git a/src/node_watchdog.cc b/src/node_watchdog.cc
|
||||
index 107a25bc977bd38e97a2310b272e495d09847ecb..3ed390678962890d90d385cf2bca9deaca023c89 100644
|
||||
--- a/src/node_watchdog.cc
|
||||
+++ b/src/node_watchdog.cc
|
||||
@@ -432,4 +432,4 @@ static void Initialize(Local<Object> target,
|
||||
|
||||
} // namespace node
|
||||
|
||||
-NODE_MODULE_CONTEXT_AWARE_INTERNAL(watchdog, node::watchdog::Initialize);
|
||||
+NODE_MODULE_CONTEXT_AWARE_INTERNAL(watchdog, node::watchdog::Initialize)
|
||||
@@ -8,10 +8,10 @@ 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 14029692e57b219d245d529a0be175c80f3a32de..cd763fd3755357b36e753cf778550cf2d498ed57 100644
|
||||
index ce64dbca7ce6555bd37d3b6f85ecf41a98e3dd29..c373533ce85241f86d64eab8a49af79f935acdeb 100644
|
||||
--- a/src/node_crypto.cc
|
||||
+++ b/src/node_crypto.cc
|
||||
@@ -4522,7 +4522,7 @@ static unsigned int GetBytesOfRS(const ManagedEVPPKey& pkey) {
|
||||
@@ -4525,7 +4525,7 @@ static unsigned int GetBytesOfRS(const ManagedEVPPKey& pkey) {
|
||||
if (base_id == EVP_PKEY_DSA) {
|
||||
DSA* dsa_key = EVP_PKEY_get0_DSA(pkey.get());
|
||||
// Both r and s are computed mod q, so their width is limited by that of q.
|
||||
|
||||
@@ -7,7 +7,7 @@ async hooks are hella broken in Electron. This was checking that they weren't,
|
||||
but they are, so we just disabled the check. YOLO.
|
||||
|
||||
diff --git a/src/api/callback.cc b/src/api/callback.cc
|
||||
index a03a2587b4c7963a7f356b6b3af8654405bcfd36..cd0050978d387c2d2228653a8e812a31a1145819 100644
|
||||
index 9f52c25cf0d9005c2e70b76eb52eae1bd15f0a53..e151871dc90b6c29dc3fc3db162e24baeb45923d 100644
|
||||
--- a/src/api/callback.cc
|
||||
+++ b/src/api/callback.cc
|
||||
@@ -117,12 +117,14 @@ void InternalCallbackScope::Close() {
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Wed, 21 Aug 2019 11:06:16 -0700
|
||||
Subject: FIXME: use redefined version of internalModuleStat
|
||||
|
||||
Instantiate redefined version of the internalModuleStat function
|
||||
(see lib/common/asar.js in the electron/electron repo). For some reason
|
||||
this has to be done after the upgrade to the Node.js v8.7.0. in the very beginning of the file holds a reference
|
||||
to a native Node.js implementation of the function.
|
||||
|
||||
diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js
|
||||
index b1f453442bc2a35fabaa6f259091660aedad9a07..92554a374d189b3b284546b0e122940e9a175de8 100644
|
||||
--- a/lib/internal/modules/cjs/loader.js
|
||||
+++ b/lib/internal/modules/cjs/loader.js
|
||||
@@ -144,6 +144,8 @@ function enrichCJSError(err) {
|
||||
}
|
||||
|
||||
function stat(filename) {
|
||||
+ // FIXME(codebytere): determine why this needs to be done and remove
|
||||
+ const internalModuleStat = process.binding('fs').internalModuleStat;
|
||||
filename = path.toNamespacedPath(filename);
|
||||
if (statCache !== null) {
|
||||
const result = statCache.get(filename);
|
||||
@@ -26,7 +26,7 @@ Reviewed-By: Tobias Nießen <tniessen@tnie.de>
|
||||
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
|
||||
|
||||
diff --git a/lib/fs.js b/lib/fs.js
|
||||
index 4a19e3b6033711d8c77d1ac9ea7e0f2cd9742ce9..59a41fe62c68c05ab09ad280e4e9ecdb2ca23349 100644
|
||||
index 9b70b237ef00e19983b39902b50233c682492771..7e1cb0e9e72078340e1f2cc77cd70e7a1f6bf595 100644
|
||||
--- a/lib/fs.js
|
||||
+++ b/lib/fs.js
|
||||
@@ -24,6 +24,10 @@
|
||||
@@ -40,7 +40,7 @@ index 4a19e3b6033711d8c77d1ac9ea7e0f2cd9742ce9..59a41fe62c68c05ab09ad280e4e9ecdb
|
||||
const {
|
||||
Map,
|
||||
MathMax,
|
||||
@@ -52,7 +56,7 @@ const {
|
||||
@@ -53,7 +57,7 @@ const {
|
||||
const pathModule = require('path');
|
||||
const { isArrayBufferView } = require('internal/util/types');
|
||||
const binding = internalBinding('fs');
|
||||
@@ -49,7 +49,7 @@ index 4a19e3b6033711d8c77d1ac9ea7e0f2cd9742ce9..59a41fe62c68c05ab09ad280e4e9ecdb
|
||||
const {
|
||||
codes: {
|
||||
ERR_FS_FILE_TOO_LARGE,
|
||||
@@ -274,7 +278,7 @@ function readFileAfterStat(err, stats) {
|
||||
@@ -278,7 +282,7 @@ function readFileAfterStat(err, stats) {
|
||||
|
||||
const size = context.size = isFileType(stats, S_IFREG) ? stats[8] : 0;
|
||||
|
||||
@@ -58,7 +58,7 @@ index 4a19e3b6033711d8c77d1ac9ea7e0f2cd9742ce9..59a41fe62c68c05ab09ad280e4e9ecdb
|
||||
err = new ERR_FS_FILE_TOO_LARGE(size);
|
||||
return context.close(err);
|
||||
}
|
||||
@@ -331,7 +335,7 @@ function tryCreateBuffer(size, fd, isUserFd) {
|
||||
@@ -335,7 +339,7 @@ function tryCreateBuffer(size, fd, isUserFd) {
|
||||
let threw = true;
|
||||
let buffer;
|
||||
try {
|
||||
@@ -68,10 +68,10 @@ index 4a19e3b6033711d8c77d1ac9ea7e0f2cd9742ce9..59a41fe62c68c05ab09ad280e4e9ecdb
|
||||
}
|
||||
buffer = Buffer.allocUnsafe(size);
|
||||
diff --git a/lib/internal/errors.js b/lib/internal/errors.js
|
||||
index 1e987cefb156df8e7a494bcb80547ae8e0ea649f..567d82c7bd12a7233481d80042d331afd7471674 100644
|
||||
index a3d99a79c6340c3bc2955bf3b36d11e8676d1aa1..4e2d1e48257acff20131ee998a0774b709d5dbcc 100644
|
||||
--- a/lib/internal/errors.js
|
||||
+++ b/lib/internal/errors.js
|
||||
@@ -822,9 +822,7 @@ E('ERR_FALSY_VALUE_REJECTION', function(reason) {
|
||||
@@ -827,9 +827,7 @@ E('ERR_FALSY_VALUE_REJECTION', function(reason) {
|
||||
this.reason = reason;
|
||||
return 'Promise was rejected with falsy value';
|
||||
}, Error);
|
||||
@@ -83,7 +83,7 @@ index 1e987cefb156df8e7a494bcb80547ae8e0ea649f..567d82c7bd12a7233481d80042d331af
|
||||
'Symlink type must be one of "dir", "file", or "junction". Received "%s"',
|
||||
Error); // Switch to TypeError. The current implementation does not seem right
|
||||
diff --git a/lib/internal/fs/promises.js b/lib/internal/fs/promises.js
|
||||
index d653724474f314cd1c6bebe0a2d9285439d54928..98335fdc1027409a2f17ae50fba378f5d78b2cab 100644
|
||||
index 31eaeef28462166036c5a71a474e1b3c018cfa53..91cf9f6be52d47ba7353ca19f687ab2bb41cbd22 100644
|
||||
--- a/lib/internal/fs/promises.js
|
||||
+++ b/lib/internal/fs/promises.js
|
||||
@@ -1,5 +1,9 @@
|
||||
@@ -115,7 +115,7 @@ index d653724474f314cd1c6bebe0a2d9285439d54928..98335fdc1027409a2f17ae50fba378f5
|
||||
|
||||
const chunks = [];
|
||||
diff --git a/lib/internal/fs/utils.js b/lib/internal/fs/utils.js
|
||||
index 6f096336f20e10727b6328af9f0130b37de74050..ff26568bd95e0c966b7f3a7c63d3f594b411fbab 100644
|
||||
index ed4e9bb66ad79ffd542b769ab17a28bb801764c6..84f9e3b806a237c599f85dcb8fb93bfe9a098eda 100644
|
||||
--- a/lib/internal/fs/utils.js
|
||||
+++ b/lib/internal/fs/utils.js
|
||||
@@ -12,7 +12,7 @@ const {
|
||||
@@ -138,7 +138,7 @@ index 6f096336f20e10727b6328af9f0130b37de74050..ff26568bd95e0c966b7f3a7c63d3f594
|
||||
let fs;
|
||||
function lazyLoadFs() {
|
||||
if (!fs) {
|
||||
@@ -525,7 +529,7 @@ const validateOffsetLengthWrite = hideStackFrames(
|
||||
@@ -569,7 +573,7 @@ const validateOffsetLengthWrite = hideStackFrames(
|
||||
throw new ERR_OUT_OF_RANGE('offset', `<= ${byteLength}`, offset);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Tue, 4 Aug 2020 09:17:06 -0700
|
||||
Subject: lib: use non-symbols in isURLInstance check
|
||||
|
||||
This slightly changes the conditional used to determine whether or
|
||||
not something is a URL instance. Since Node.js adds symbols to the URL
|
||||
not specified by the WHATWG, those symbols are not present in other
|
||||
implementations (like Blink's) and therefore can cause false negatives.
|
||||
|
||||
This fixes that by slightly changing the check to properties present
|
||||
in all URL instances as specified in the WHATWG spec.
|
||||
|
||||
Upstreamed at: https://github.com/nodejs/node/pull/34622.
|
||||
|
||||
diff --git a/lib/internal/url.js b/lib/internal/url.js
|
||||
index 78f5b32745a0436337233e8a4b57b89263effad6..ace274501f2c1f6bb06f600abb850e737c988338 100644
|
||||
--- a/lib/internal/url.js
|
||||
+++ b/lib/internal/url.js
|
||||
@@ -1394,8 +1394,8 @@ function pathToFileURL(filepath) {
|
||||
}
|
||||
|
||||
function isURLInstance(fileURLOrPath) {
|
||||
- return fileURLOrPath != null && fileURLOrPath[searchParams] &&
|
||||
- fileURLOrPath[searchParams][searchParams];
|
||||
+ return fileURLOrPath != null && fileURLOrPath['href'] &&
|
||||
+ fileURLOrPath['origin'];
|
||||
}
|
||||
|
||||
function toPathIfFileURL(fileURLOrPath) {
|
||||
@@ -10,10 +10,10 @@ node's module code.
|
||||
(cherry picked from commit 76ba048c37588ee32636817fa7b8dffc64330cbf)
|
||||
|
||||
diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js
|
||||
index fc42eb033c923fcdb7eb79e6676a191be6eb1d91..a8adb63a2e42929d040f6cdea6f01bd4c2cb1d2d 100644
|
||||
index 98668573db651a42876c3369e6fa7c2ef97d6e73..d041ce0470ee48d44897fb77f37f6013d9cc108a 100644
|
||||
--- a/lib/internal/modules/cjs/loader.js
|
||||
+++ b/lib/internal/modules/cjs/loader.js
|
||||
@@ -1255,8 +1255,8 @@ Module._initPaths = function() {
|
||||
@@ -1254,8 +1254,8 @@ Module._initPaths = function() {
|
||||
|
||||
modulePaths = paths;
|
||||
|
||||
|
||||
@@ -6,10 +6,10 @@ Subject: Pass all globals through "require"
|
||||
(cherry picked from commit 7d015419cb7a0ecfe6728431a4ed2056cd411d62)
|
||||
|
||||
diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js
|
||||
index a8adb63a2e42929d040f6cdea6f01bd4c2cb1d2d..b1f453442bc2a35fabaa6f259091660aedad9a07 100644
|
||||
index d041ce0470ee48d44897fb77f37f6013d9cc108a..0ef46569924354ea3ef59f3220637e30b316a761 100644
|
||||
--- a/lib/internal/modules/cjs/loader.js
|
||||
+++ b/lib/internal/modules/cjs/loader.js
|
||||
@@ -104,6 +104,13 @@ const {
|
||||
@@ -102,6 +102,13 @@ const {
|
||||
CHAR_COLON
|
||||
} = require('internal/constants');
|
||||
|
||||
@@ -23,7 +23,7 @@ index a8adb63a2e42929d040f6cdea6f01bd4c2cb1d2d..b1f453442bc2a35fabaa6f259091660a
|
||||
const isWindows = process.platform === 'win32';
|
||||
|
||||
const relativeResolveCache = ObjectCreate(null);
|
||||
@@ -1133,10 +1140,12 @@ Module.prototype._compile = function(content, filename) {
|
||||
@@ -1132,10 +1139,12 @@ Module.prototype._compile = function(content, filename) {
|
||||
if (requireDepth === 0) statCache = new Map();
|
||||
if (inspectorWrapper) {
|
||||
result = inspectorWrapper(compiledWrapper, thisValue, exports,
|
||||
|
||||
@@ -22,29 +22,19 @@ index c872941b974216d94863bcbf0e597b9c09ca50e2..4e7c3c10255a0eae4d5333f88e51cf71
|
||||
process.config = JSONParse(internalBinding('native_module').config);
|
||||
|
||||
diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js
|
||||
index 92554a374d189b3b284546b0e122940e9a175de8..e478c57af873da717c00db73d6719f806280efe1 100644
|
||||
index 0ef46569924354ea3ef59f3220637e30b316a761..7d08fb05e9a0abeb82d416891968b23002dc3685 100644
|
||||
--- a/lib/internal/modules/cjs/loader.js
|
||||
+++ b/lib/internal/modules/cjs/loader.js
|
||||
@@ -55,10 +55,7 @@ const assert = require('internal/assert');
|
||||
@@ -55,7 +55,7 @@ const assert = require('internal/assert');
|
||||
const fs = require('fs');
|
||||
const internalFS = require('internal/fs/utils');
|
||||
const path = require('path');
|
||||
-const {
|
||||
- internalModuleReadJSON,
|
||||
- internalModuleStat
|
||||
-} = internalBinding('fs');
|
||||
-const { internalModuleStat } = internalBinding('fs');
|
||||
+const internalFsBinding = internalBinding('fs');
|
||||
const packageJsonReader = require('internal/modules/package_json_reader');
|
||||
const { safeGetenv } = internalBinding('credentials');
|
||||
const {
|
||||
makeRequireFunction,
|
||||
@@ -144,14 +141,12 @@ function enrichCJSError(err) {
|
||||
}
|
||||
|
||||
function stat(filename) {
|
||||
- // FIXME(codebytere): determine why this needs to be done and remove
|
||||
- const internalModuleStat = process.binding('fs').internalModuleStat;
|
||||
filename = path.toNamespacedPath(filename);
|
||||
if (statCache !== null) {
|
||||
@@ -147,7 +147,7 @@ function stat(filename) {
|
||||
const result = statCache.get(filename);
|
||||
if (result !== undefined) return result;
|
||||
}
|
||||
@@ -53,12 +43,25 @@ index 92554a374d189b3b284546b0e122940e9a175de8..e478c57af873da717c00db73d6719f80
|
||||
if (statCache !== null) statCache.set(filename, result);
|
||||
return result;
|
||||
}
|
||||
@@ -257,7 +252,7 @@ function readPackage(requestPath) {
|
||||
const existing = packageJsonCache.get(jsonPath);
|
||||
if (existing !== undefined) return existing;
|
||||
diff --git a/lib/internal/modules/package_json_reader.js b/lib/internal/modules/package_json_reader.js
|
||||
index 066047b55eb9d82bc1eea66dc54aa68abd116b6b..4fcc65e235692d7d5fe2643571f006c593c4e173 100644
|
||||
--- a/lib/internal/modules/package_json_reader.js
|
||||
+++ b/lib/internal/modules/package_json_reader.js
|
||||
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
- const json = internalModuleReadJSON(path.toNamespacedPath(jsonPath));
|
||||
+ const json = internalFsBinding.internalModuleReadJSON(path.toNamespacedPath(jsonPath));
|
||||
if (json === undefined) {
|
||||
packageJsonCache.set(jsonPath, false);
|
||||
return false;
|
||||
const { SafeMap } = primordials;
|
||||
-const { internalModuleReadJSON } = internalBinding('fs');
|
||||
+const internalFsBinding = internalBinding('fs');
|
||||
|
||||
const cache = new SafeMap();
|
||||
|
||||
@@ -14,7 +14,7 @@ function read(path) {
|
||||
return cache.get(path);
|
||||
}
|
||||
|
||||
- const [string, containsKeys] = internalModuleReadJSON(path);
|
||||
+ const [string, containsKeys] = internalFsBinding.internalModuleReadJSON(path);
|
||||
const result = { string, containsKeys };
|
||||
cache.set(path, result);
|
||||
return result;
|
||||
|
||||
@@ -7,10 +7,10 @@ Subject: refactor: TransferrableModule is deprecated, use CompiledWasmModule
|
||||
This is already present in Node.js v14 and can be removed when we upgrade.
|
||||
|
||||
diff --git a/src/node_messaging.cc b/src/node_messaging.cc
|
||||
index 16b1a97eec2dfc236d54e76ef795ce1c0b958fb8..9ed2526fc04f63d857942684dd63b1b93ef2969e 100644
|
||||
index f19e541bff08fb69209a50f4b21257de77efaf9f..f42ed9661500d862545c09cdb233ca8a99cafd35 100644
|
||||
--- a/src/node_messaging.cc
|
||||
+++ b/src/node_messaging.cc
|
||||
@@ -57,7 +57,7 @@ class DeserializerDelegate : public ValueDeserializer::Delegate {
|
||||
@@ -56,7 +56,7 @@ class DeserializerDelegate : public ValueDeserializer::Delegate {
|
||||
Environment* env,
|
||||
const std::vector<MessagePort*>& message_ports,
|
||||
const std::vector<Local<SharedArrayBuffer>>& shared_array_buffers,
|
||||
@@ -19,7 +19,7 @@ index 16b1a97eec2dfc236d54e76ef795ce1c0b958fb8..9ed2526fc04f63d857942684dd63b1b9
|
||||
: message_ports_(message_ports),
|
||||
shared_array_buffers_(shared_array_buffers),
|
||||
wasm_modules_(wasm_modules) {}
|
||||
@@ -81,7 +81,7 @@ class DeserializerDelegate : public ValueDeserializer::Delegate {
|
||||
@@ -80,7 +80,7 @@ class DeserializerDelegate : public ValueDeserializer::Delegate {
|
||||
MaybeLocal<WasmModuleObject> GetWasmModuleFromId(
|
||||
Isolate* isolate, uint32_t transfer_id) override {
|
||||
CHECK_LE(transfer_id, wasm_modules_.size());
|
||||
@@ -28,7 +28,7 @@ index 16b1a97eec2dfc236d54e76ef795ce1c0b958fb8..9ed2526fc04f63d857942684dd63b1b9
|
||||
isolate, wasm_modules_[transfer_id]);
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ class DeserializerDelegate : public ValueDeserializer::Delegate {
|
||||
@@ -89,7 +89,7 @@ class DeserializerDelegate : public ValueDeserializer::Delegate {
|
||||
private:
|
||||
const std::vector<MessagePort*>& message_ports_;
|
||||
const std::vector<Local<SharedArrayBuffer>>& shared_array_buffers_;
|
||||
@@ -37,7 +37,7 @@ index 16b1a97eec2dfc236d54e76ef795ce1c0b958fb8..9ed2526fc04f63d857942684dd63b1b9
|
||||
};
|
||||
|
||||
} // anonymous namespace
|
||||
@@ -180,7 +180,7 @@ void Message::AddMessagePort(std::unique_ptr<MessagePortData>&& data) {
|
||||
@@ -179,7 +179,7 @@ void Message::AddMessagePort(std::unique_ptr<MessagePortData>&& data) {
|
||||
message_ports_.emplace_back(std::move(data));
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ index 16b1a97eec2dfc236d54e76ef795ce1c0b958fb8..9ed2526fc04f63d857942684dd63b1b9
|
||||
wasm_modules_.emplace_back(std::move(mod));
|
||||
return wasm_modules_.size() - 1;
|
||||
}
|
||||
@@ -277,7 +277,7 @@ class SerializerDelegate : public ValueSerializer::Delegate {
|
||||
@@ -276,7 +276,7 @@ class SerializerDelegate : public ValueSerializer::Delegate {
|
||||
|
||||
Maybe<uint32_t> GetWasmModuleTransferId(
|
||||
Isolate* isolate, Local<WasmModuleObject> module) override {
|
||||
|
||||
@@ -8,10 +8,10 @@ The BoringSSL incompatibilities (OPENSSL_memdup) will be shimmed in and this sho
|
||||
be removed when the associated update is rolled into Chromium.
|
||||
|
||||
diff --git a/src/node_crypto.cc b/src/node_crypto.cc
|
||||
index 17aeb99d586161d0af69376811b42e84a80553e3..14029692e57b219d245d529a0be175c80f3a32de 100644
|
||||
index 82afaee6e2b929faac76fc5d930a8c0fd6558df3..ce64dbca7ce6555bd37d3b6f85ecf41a98e3dd29 100644
|
||||
--- a/src/node_crypto.cc
|
||||
+++ b/src/node_crypto.cc
|
||||
@@ -5011,18 +5011,6 @@ bool PublicKeyCipher::Cipher(Environment* env,
|
||||
@@ -5014,18 +5014,6 @@ bool PublicKeyCipher::Cipher(Environment* env,
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Thu, 18 Jun 2020 14:40:35 -0700
|
||||
Subject: test: account for non-node basename
|
||||
|
||||
Refs https://github.com/nodejs/node/commit/edf75e4299219d57e53f98956b8e27e4945dd5d6.
|
||||
|
||||
Because Electron smoketests with Node.js' own specs, it's the case for us that the basename is
|
||||
`Electron`. These tests were failing as they're hardcoded to assume it's `node` so this makes
|
||||
them more flexible for embedders.
|
||||
|
||||
Upstreamed at https://github.com/nodejs/node/pull/33952.
|
||||
|
||||
diff --git a/test/message/eval_messages.out b/test/message/eval_messages.out
|
||||
index 8840633959a18baf9b40305d73511d47ae213978..64743d4ae67acf1f8cb28b832b1f7204ace48952 100644
|
||||
--- a/test/message/eval_messages.out
|
||||
+++ b/test/message/eval_messages.out
|
||||
@@ -55,11 +55,11 @@ ReferenceError: y is not defined
|
||||
var ______________________________________________; throw 10
|
||||
^
|
||||
10
|
||||
-(Use `node --trace-uncaught ...` to show where the exception was thrown)
|
||||
+(Use `* --trace-uncaught ...` to show where the exception was thrown)
|
||||
|
||||
[eval]:1
|
||||
var ______________________________________________; throw 10
|
||||
^
|
||||
10
|
||||
-(Use `node --trace-uncaught ...` to show where the exception was thrown)
|
||||
+(Use `* --trace-uncaught ...` to show where the exception was thrown)
|
||||
done
|
||||
diff --git a/test/message/stdin_messages.out b/test/message/stdin_messages.out
|
||||
index 72edb0b00b28cd6cf6bac51519be4fde4708b161..3c71c5683b7d949bc7b1a46e7cbd4473c40cf871 100644
|
||||
--- a/test/message/stdin_messages.out
|
||||
+++ b/test/message/stdin_messages.out
|
||||
@@ -67,11 +67,11 @@ ReferenceError: y is not defined
|
||||
let ______________________________________________; throw 10
|
||||
^
|
||||
10
|
||||
-(Use `node --trace-uncaught ...` to show where the exception was thrown)
|
||||
+(Use `* --trace-uncaught ...` to show where the exception was thrown)
|
||||
|
||||
[stdin]:1
|
||||
let ______________________________________________; throw 10
|
||||
^
|
||||
10
|
||||
-(Use `node --trace-uncaught ...` to show where the exception was thrown)
|
||||
+(Use `* --trace-uncaught ...` to show where the exception was thrown)
|
||||
done
|
||||
diff --git a/test/message/throw_error_with_getter_throw.out b/test/message/throw_error_with_getter_throw.out
|
||||
index 5daf35aad44ce37e3681d73d19c7e0eb7e7c3439..2162185e7845fcc5f716aa652e253db95462a622 100644
|
||||
--- a/test/message/throw_error_with_getter_throw.out
|
||||
+++ b/test/message/throw_error_with_getter_throw.out
|
||||
@@ -3,4 +3,4 @@
|
||||
throw { // eslint-disable-line no-throw-literal
|
||||
^
|
||||
[object Object]
|
||||
-(Use `node --trace-uncaught ...` to show where the exception was thrown)
|
||||
+(Use `* --trace-uncaught ...` to show where the exception was thrown)
|
||||
diff --git a/test/message/throw_null.out b/test/message/throw_null.out
|
||||
index db6cc3edf583eff7c815ea4fe24c3ecc60b03888..c97dcbfe134a22721d68f2bb5570d8e59450c3bb 100644
|
||||
--- a/test/message/throw_null.out
|
||||
+++ b/test/message/throw_null.out
|
||||
@@ -3,4 +3,4 @@
|
||||
throw null;
|
||||
^
|
||||
null
|
||||
-(Use `node --trace-uncaught ...` to show where the exception was thrown)
|
||||
+(Use `* --trace-uncaught ...` to show where the exception was thrown)
|
||||
diff --git a/test/message/throw_undefined.out b/test/message/throw_undefined.out
|
||||
index 016eb8ffd95e3389c93e24912d71ccb152fd99d7..4b2bfdbc5907085b19f43ba1306aaa6efc41beee 100644
|
||||
--- a/test/message/throw_undefined.out
|
||||
+++ b/test/message/throw_undefined.out
|
||||
@@ -3,4 +3,4 @@
|
||||
throw undefined;
|
||||
^
|
||||
undefined
|
||||
-(Use `node --trace-uncaught ...` to show where the exception was thrown)
|
||||
+(Use `* --trace-uncaught ...` to show where the exception was thrown)
|
||||
@@ -9,7 +9,7 @@ diff --git a/Squirrel/SQRLZipArchiver.m b/Squirrel/SQRLZipArchiver.m
|
||||
index 478509cdd528db4fcfa340c6f93fa58a446957e6..7c279bf73c368453bff4f922d76908c06dc378cd 100644
|
||||
--- a/Squirrel/SQRLZipArchiver.m
|
||||
+++ b/Squirrel/SQRLZipArchiver.m
|
||||
@@ -134,7 +134,7 @@ const NSInteger SQRLZipArchiverShellTaskFailed = 1;
|
||||
@@ -134,7 +134,7 @@ - (RACSignal *)launchWithArguments:(NSArray *)arguments {
|
||||
return [RACSignal
|
||||
zip:@[ self.taskTerminated, self.standardErrorData ]
|
||||
reduce:^(NSNumber *exitStatus, NSData *errorData) {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
const { spawnSync } = require('child_process');
|
||||
const path = require('path');
|
||||
const { inspect } = require('util');
|
||||
import { spawnSync } from 'child_process';
|
||||
import * as path from 'path';
|
||||
|
||||
const srcPath = path.resolve(__dirname, '..', '..', '..');
|
||||
const patchExportFnPath = path.resolve(__dirname, 'export_all_patches.py');
|
||||
@@ -1,6 +1,6 @@
|
||||
const cp = require('child_process');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
import * as cp from 'child_process';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
|
||||
const certificatePath = process.argv[2];
|
||||
const outPath = process.argv[3];
|
||||
@@ -40,7 +40,7 @@ DevToolsSecurity -enable
|
||||
# security import "$dir"/public.key -k $KEY_CHAIN
|
||||
|
||||
# Generate Trust Settings
|
||||
node "$(dirname $0)"/gen-trust.js "$dir"/certificate.cer "$dir"/trust.xml
|
||||
npx ts-node "$(dirname $0)"/gen-trust.ts "$dir"/certificate.cer "$dir"/trust.xml
|
||||
|
||||
# Import Trust Settings
|
||||
sudo security trust-settings-import -d "$dir/trust.xml"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
const args = require('minimist')(process.argv.slice(2));
|
||||
const octokit = require('@octokit/rest')();
|
||||
const { Octokit } = require('@octokit/rest');
|
||||
const octokit = new Octokit();
|
||||
const path = require('path');
|
||||
|
||||
const SOURCE_ROOT = path.normalize(path.dirname(__dirname));
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const cp = require('child_process');
|
||||
const fs = require('fs-extra');
|
||||
const os = require('os');
|
||||
const path = require('path');
|
||||
import * as cp from 'child_process';
|
||||
import * as fs from 'fs-extra';
|
||||
import * as os from 'os';
|
||||
import * as path from 'path';
|
||||
|
||||
const rootPath = path.resolve(__dirname, '..');
|
||||
const gniPath = path.resolve(__dirname, '../filenames.auto.gni');
|
||||
@@ -43,7 +43,7 @@ const main = async () => {
|
||||
}
|
||||
];
|
||||
|
||||
await Promise.all(webpackTargets.map(async webpackTarget => {
|
||||
const webpackTargetsWithDeps = await Promise.all(webpackTargets.map(async webpackTarget => {
|
||||
const tmpDir = await fs.mkdtemp(path.resolve(os.tmpdir(), 'electron-filenames-'));
|
||||
const child = cp.spawn('node', [
|
||||
'build/webpack/get-outputs.js',
|
||||
@@ -66,20 +66,24 @@ const main = async () => {
|
||||
resolve();
|
||||
}));
|
||||
|
||||
webpackTarget.dependencies = JSON.parse(output)
|
||||
// Remove whitespace
|
||||
.map(line => line.trim())
|
||||
// Get the relative path
|
||||
.map(line => path.relative(rootPath, line).replace(/\\/g, '/'))
|
||||
// Only care about files in //electron
|
||||
.filter(line => !line.startsWith('..'))
|
||||
// Only care about our own files
|
||||
.filter(line => !line.startsWith('node_modules'))
|
||||
// All webpack builds depend on the tsconfig and package json files
|
||||
.concat(['tsconfig.json', 'tsconfig.electron.json', 'package.json', ...typingFiles])
|
||||
// Make the generated list easier to read
|
||||
.sort();
|
||||
const webpackTargetWithDeps = {
|
||||
...webpackTarget,
|
||||
dependencies: (JSON.parse(output) as string[])
|
||||
// Remove whitespace
|
||||
.map(line => line.trim())
|
||||
// Get the relative path
|
||||
.map(line => path.relative(rootPath, line).replace(/\\/g, '/'))
|
||||
// Only care about files in //electron
|
||||
.filter(line => !line.startsWith('..'))
|
||||
// Only care about our own files
|
||||
.filter(line => !line.startsWith('node_modules'))
|
||||
// All webpack builds depend on the tsconfig and package json files
|
||||
.concat(['tsconfig.json', 'tsconfig.electron.json', 'package.json', ...typingFiles])
|
||||
// Make the generated list easier to read
|
||||
.sort()
|
||||
};
|
||||
await fs.remove(tmpDir);
|
||||
return webpackTargetWithDeps;
|
||||
}));
|
||||
|
||||
fs.writeFileSync(
|
||||
@@ -90,7 +94,7 @@ auto_filenames = {
|
||||
${allDocs.map(doc => ` "${doc}",`).join('\n')}
|
||||
]
|
||||
|
||||
${webpackTargets.map(target => ` ${target.name} = [
|
||||
${webpackTargetsWithDeps.map(target => ` ${target.name} = [
|
||||
${target.dependencies.map(dep => ` "${dep}",`).join('\n')}
|
||||
]`).join('\n\n')}
|
||||
}
|
||||
@@ -190,7 +190,7 @@ def format_patch(repo, since):
|
||||
'-C',
|
||||
repo,
|
||||
'-c',
|
||||
'core.attributesfile=' + os.path.join(os.path.dirname(os.path.realpath(__file__)), '.electron.attributes'),
|
||||
'core.attributesfile=' + os.path.join(os.path.dirname(os.path.realpath(__file__)), 'electron.gitattributes'),
|
||||
# Ensure it is not possible to match anything
|
||||
# Disabled for now as we have consistent chunk headers
|
||||
# '-c',
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
if (!process.env.CI) require('dotenv-safe').load();
|
||||
|
||||
const octokit = require('@octokit/rest')({
|
||||
const { Octokit } = require('@octokit/rest');
|
||||
const octokit = new Octokit({
|
||||
auth: process.env.ELECTRON_GITHUB_TOKEN
|
||||
});
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ const notesGenerator = require('./notes.js');
|
||||
const semverify = version => version.replace(/^origin\//, '').replace(/[xy]/g, '0').replace(/-/g, '.');
|
||||
|
||||
const runGit = async (args) => {
|
||||
console.info(`Running: git ${args.join(' ')}`);
|
||||
const response = await GitProcess.exec(args, ELECTRON_DIR);
|
||||
if (response.exitCode !== 0) {
|
||||
throw new Error(response.stderr.trim());
|
||||
@@ -19,15 +20,20 @@ const runGit = async (args) => {
|
||||
};
|
||||
|
||||
const tagIsSupported = tag => tag && !tag.includes('nightly') && !tag.includes('unsupported');
|
||||
const tagIsBeta = tag => tag.includes('beta');
|
||||
const tagIsBeta = tag => tag && tag.includes('beta');
|
||||
const tagIsStable = tag => tagIsSupported(tag) && !tagIsBeta(tag);
|
||||
|
||||
const getTagsOf = async (point) => {
|
||||
return (await runGit(['tag', '--merged', point]))
|
||||
.split('\n')
|
||||
.map(tag => tag.trim())
|
||||
.filter(tag => semver.valid(tag))
|
||||
.sort(semver.compare);
|
||||
try {
|
||||
const tags = await runGit(['tag', '--merged', point]);
|
||||
return tags.split('\n')
|
||||
.map(tag => tag.trim())
|
||||
.filter(tag => semver.valid(tag))
|
||||
.sort(semver.compare);
|
||||
} catch (err) {
|
||||
console.error(`Failed to fetch tags for point ${point}`);
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
|
||||
const getTagsOnBranch = async (point) => {
|
||||
@@ -41,21 +47,31 @@ const getTagsOnBranch = async (point) => {
|
||||
};
|
||||
|
||||
const getBranchOf = async (point) => {
|
||||
const branches = (await runGit(['branch', '-a', '--contains', point]))
|
||||
.split('\n')
|
||||
.map(branch => branch.trim())
|
||||
.filter(branch => !!branch);
|
||||
const current = branches.find(branch => branch.startsWith('* '));
|
||||
return current ? current.slice(2) : branches.shift();
|
||||
try {
|
||||
const branches = (await runGit(['branch', '-a', '--contains', point]))
|
||||
.split('\n')
|
||||
.map(branch => branch.trim())
|
||||
.filter(branch => !!branch);
|
||||
const current = branches.find(branch => branch.startsWith('* '));
|
||||
return current ? current.slice(2) : branches.shift();
|
||||
} catch (err) {
|
||||
console.error(`Failed to fetch branch for ${point}: `, err);
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
|
||||
const getAllBranches = async () => {
|
||||
return (await runGit(['branch', '--remote']))
|
||||
.split('\n')
|
||||
.map(branch => branch.trim())
|
||||
.filter(branch => !!branch)
|
||||
.filter(branch => branch !== 'origin/HEAD -> origin/master')
|
||||
.sort();
|
||||
try {
|
||||
const branches = await runGit(['branch', '--remote']);
|
||||
return branches.split('\n')
|
||||
.map(branch => branch.trim())
|
||||
.filter(branch => !!branch)
|
||||
.filter(branch => branch !== 'origin/HEAD -> origin/master')
|
||||
.sort();
|
||||
} catch (err) {
|
||||
console.error('Failed to fetch all branches');
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
|
||||
const getStabilizationBranches = async () => {
|
||||
@@ -120,7 +136,7 @@ const getPreviousPoint = async (point) => {
|
||||
}
|
||||
};
|
||||
|
||||
async function getReleaseNotes (range, newVersion, explicitLinks) {
|
||||
async function getReleaseNotes (range, newVersion) {
|
||||
const rangeList = range.split('..') || ['HEAD'];
|
||||
const to = rangeList.pop();
|
||||
const from = rangeList.pop() || (await getPreviousPoint(to));
|
||||
@@ -129,10 +145,9 @@ async function getReleaseNotes (range, newVersion, explicitLinks) {
|
||||
newVersion = to;
|
||||
}
|
||||
|
||||
console.log(`Generating release notes between ${from} and ${to} for version ${newVersion}`);
|
||||
const notes = await notesGenerator.get(from, to, newVersion);
|
||||
const ret = {
|
||||
text: notesGenerator.render(notes, explicitLinks)
|
||||
text: notesGenerator.render(notes)
|
||||
};
|
||||
|
||||
if (notes.unknown.length) {
|
||||
@@ -144,7 +159,7 @@ async function getReleaseNotes (range, newVersion, explicitLinks) {
|
||||
|
||||
async function main () {
|
||||
const opts = minimist(process.argv.slice(2), {
|
||||
boolean: ['explicit-links', 'help'],
|
||||
boolean: ['help'],
|
||||
string: ['version']
|
||||
});
|
||||
opts.range = opts._.shift();
|
||||
@@ -153,14 +168,13 @@ async function main () {
|
||||
console.log(`
|
||||
easy usage: ${name} version
|
||||
|
||||
full usage: ${name} [begin..]end [--version version] [--explicit-links]
|
||||
full usage: ${name} [begin..]end [--version version]
|
||||
|
||||
* 'begin' and 'end' are two git references -- tags, branches, etc --
|
||||
from which the release notes are generated.
|
||||
* if omitted, 'begin' defaults to the previous tag in end's branch.
|
||||
* if omitted, 'version' defaults to 'end'. Specifying a version is
|
||||
useful if you're making notes on a new version that isn't tagged yet.
|
||||
* 'explicit-links' makes every note's issue, commit, or pull an MD link
|
||||
|
||||
For example, these invocations are equivalent:
|
||||
${process.argv[1]} v4.0.1
|
||||
@@ -169,7 +183,7 @@ For example, these invocations are equivalent:
|
||||
return 0;
|
||||
}
|
||||
|
||||
const notes = await getReleaseNotes(opts.range, opts.version, opts['explicit-links']);
|
||||
const notes = await getReleaseNotes(opts.range, opts.version);
|
||||
console.log(notes.text);
|
||||
if (notes.warning) {
|
||||
throw new Error(notes.warning);
|
||||
|
||||
@@ -2,24 +2,23 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
const childProcess = require('child_process');
|
||||
const fs = require('fs');
|
||||
const os = require('os');
|
||||
const path = require('path');
|
||||
|
||||
const { GitProcess } = require('dugite');
|
||||
const octokit = require('@octokit/rest')({
|
||||
const { Octokit } = require('@octokit/rest');
|
||||
const octokit = new Octokit({
|
||||
auth: process.env.ELECTRON_GITHUB_TOKEN
|
||||
});
|
||||
const semver = require('semver');
|
||||
|
||||
const { ELECTRON_VERSION, SRC_DIR } = require('../../lib/utils');
|
||||
const { ELECTRON_DIR } = require('../../lib/utils');
|
||||
|
||||
const MAX_FAIL_COUNT = 3;
|
||||
const CHECK_INTERVAL = 5000;
|
||||
|
||||
const TROP_LOGIN = 'trop[bot]';
|
||||
|
||||
const NO_NOTES = 'No notes';
|
||||
const FOLLOW_REPOS = ['electron/electron', 'electron/node'];
|
||||
|
||||
const docTypes = new Set(['doc', 'docs']);
|
||||
const featTypes = new Set(['feat', 'feature']);
|
||||
@@ -57,6 +56,11 @@ class Commit {
|
||||
|
||||
this.isBreakingChange = false;
|
||||
this.note = null; // string
|
||||
|
||||
// A set of branches to which this change has been merged.
|
||||
// '8-x-y' => GHKey { owner: 'electron', repo: 'electron', number: 23714 }
|
||||
this.trops = new Map(); // Map<string,GHKey>
|
||||
|
||||
this.prKeys = new Set(); // GHKey
|
||||
this.revertHash = null; // string
|
||||
this.semanticType = null; // string
|
||||
@@ -107,7 +111,7 @@ const getNoteFromClerk = async (ghKey) => {
|
||||
if (comment.body.startsWith(PERSIST_LEAD)) {
|
||||
return comment.body
|
||||
.slice(PERSIST_LEAD.length).trim() // remove PERSIST_LEAD
|
||||
.split('\r?\n') // break into lines
|
||||
.split(/\r?\n/) // split into lines
|
||||
.map(line => line.trim())
|
||||
.filter(line => line.startsWith(QUOTE_LEAD)) // notes are quoted
|
||||
.map(line => line.slice(QUOTE_LEAD.length)) // unquote the lines
|
||||
@@ -117,18 +121,6 @@ const getNoteFromClerk = async (ghKey) => {
|
||||
}
|
||||
};
|
||||
|
||||
// copied from https://github.com/electron/clerk/blob/master/src/index.ts#L4-L13
|
||||
const OMIT_FROM_RELEASE_NOTES_KEYS = [
|
||||
'no-notes',
|
||||
'no notes',
|
||||
'no_notes',
|
||||
'none',
|
||||
'no',
|
||||
'nothing',
|
||||
'empty',
|
||||
'blank'
|
||||
];
|
||||
|
||||
/**
|
||||
* Looks for our project's conventions in the commit message:
|
||||
*
|
||||
@@ -206,7 +198,9 @@ const parsePullText = (pull, commit) => parseCommitMessage(`${pull.data.title}\n
|
||||
|
||||
const getLocalCommitHashes = async (dir, ref) => {
|
||||
const args = ['log', '--format=%H', ref];
|
||||
return (await runGit(dir, args)).split(/[\r\n]+/).map(hash => hash.trim());
|
||||
return (await runGit(dir, args))
|
||||
.split(/\r?\n/) // split into lines
|
||||
.map(hash => hash.trim());
|
||||
};
|
||||
|
||||
// return an array of Commits
|
||||
@@ -216,7 +210,9 @@ const getLocalCommits = async (module, point1, point2) => {
|
||||
const fieldSep = ',';
|
||||
const format = ['%H', '%s'].join(fieldSep);
|
||||
const args = ['log', '--cherry-pick', '--right-only', '--first-parent', `--format=${format}`, `${point1}..${point2}`];
|
||||
const logs = (await runGit(dir, args)).split(/[\r\n]+/).map(field => field.trim());
|
||||
const logs = (await runGit(dir, args))
|
||||
.split(/\r?\n/) // split into lines
|
||||
.map(field => field.trim());
|
||||
|
||||
const commits = [];
|
||||
for (const log of logs) {
|
||||
@@ -332,92 +328,52 @@ const addRepoToPool = async (pool, repo, from, to) => {
|
||||
}
|
||||
};
|
||||
|
||||
/***
|
||||
**** Other Repos
|
||||
***/
|
||||
// @return Map<string,GHKey>
|
||||
// where the key is a branch name (e.g. '7-1-x' or '8-x-y')
|
||||
// and the value is a GHKey to the PR
|
||||
async function getMergedTrops (commit, pool) {
|
||||
const branches = new Map();
|
||||
|
||||
// other repos - gn
|
||||
for (const prKey of commit.prKeys.values()) {
|
||||
const pull = pool.pulls[prKey.number];
|
||||
const mergedBranches = new Set(
|
||||
((pull && pull.data && pull.data.labels) ? pull.data.labels : [])
|
||||
.map(label => ((label && label.name) ? label.name : '').match(/merged\/([0-9]+-[x0-9]-[xy0-9])/))
|
||||
.filter(match => match)
|
||||
.map(match => match[1])
|
||||
);
|
||||
|
||||
const getDepsVariable = async (ref, key) => {
|
||||
// get a copy of that reference point's DEPS file
|
||||
const deps = await runGit(ELECTRON_VERSION, ['show', `${ref}:DEPS`]);
|
||||
const filename = path.resolve(os.tmpdir(), 'DEPS');
|
||||
fs.writeFileSync(filename, deps);
|
||||
if (mergedBranches.size > 0) {
|
||||
const isTropComment = (comment) => comment && comment.user && comment.user.login === TROP_LOGIN;
|
||||
|
||||
// query the DEPS file
|
||||
const response = childProcess.spawnSync(
|
||||
'gclient',
|
||||
['getdep', '--deps-file', filename, '--var', key],
|
||||
{ encoding: 'utf8' }
|
||||
);
|
||||
const ghKey = GHKey.NewFromPull(pull.data);
|
||||
const backportRegex = /backported this PR to "(.*)",\s+please check out #(\d+)/;
|
||||
const getBranchNameAndPullKey = (comment) => {
|
||||
const match = ((comment && comment.body) ? comment.body : '').match(backportRegex);
|
||||
return match ? [match[1], new GHKey(ghKey.owner, ghKey.repo, parseInt(match[2]))] : null;
|
||||
};
|
||||
|
||||
// cleanup
|
||||
fs.unlinkSync(filename);
|
||||
return response.stdout.trim();
|
||||
};
|
||||
|
||||
const getDependencyCommitsGN = async (pool, fromRef, toRef) => {
|
||||
const repos = [{ // just node
|
||||
owner: 'electron',
|
||||
repo: 'node',
|
||||
dir: path.resolve(SRC_DIR, 'third_party', 'electron_node'),
|
||||
deps_variable_name: 'node_version'
|
||||
}];
|
||||
|
||||
for (const repo of repos) {
|
||||
// the 'DEPS' file holds the dependency reference point
|
||||
const key = repo.deps_variable_name;
|
||||
const from = await getDepsVariable(fromRef, key);
|
||||
const to = await getDepsVariable(toRef, key);
|
||||
await addRepoToPool(pool, repo, from, to);
|
||||
}
|
||||
};
|
||||
|
||||
// Changes are interesting if they make a change relative to a previous
|
||||
// release in the same series. For example if you fix a Y.0.0 bug, that
|
||||
// should be included in the Y.0.1 notes even if it's also tropped back
|
||||
// to X.0.1.
|
||||
//
|
||||
// The phrase 'previous release' is important: if this is the first
|
||||
// prerelease or first stable release in a series, we omit previous
|
||||
// branches' changes. Otherwise we will have an overwhelmingly long
|
||||
// list of mostly-irrelevant changes.
|
||||
const shouldIncludeMultibranchChanges = (version) => {
|
||||
let show = true;
|
||||
|
||||
if (semver.valid(version)) {
|
||||
const prerelease = semver.prerelease(version);
|
||||
show = prerelease
|
||||
? parseInt(prerelease.pop()) > 1
|
||||
: semver.patch(version) > 0;
|
||||
const comments = await getComments(ghKey);
|
||||
((comments && comments.data) ? comments.data : [])
|
||||
.filter(isTropComment)
|
||||
.map(getBranchNameAndPullKey)
|
||||
.filter(pair => pair)
|
||||
.filter(([branch]) => mergedBranches.has(branch))
|
||||
.forEach(([branch, key]) => branches.set(branch, key));
|
||||
}
|
||||
}
|
||||
|
||||
return show;
|
||||
};
|
||||
|
||||
function getOldestMajorBranchOfPull (pull) {
|
||||
return pull.data.labels
|
||||
.map(label => label.name.match(/merged\/(\d+)-(\d+)-x/) || label.name.match(/merged\/(\d+)-x-y/))
|
||||
.filter(label => !!label)
|
||||
.map(label => parseInt(label[1]))
|
||||
.filter(major => !!major)
|
||||
.sort()
|
||||
.shift();
|
||||
return branches;
|
||||
}
|
||||
|
||||
function getOldestMajorBranchOfCommit (commit, pool) {
|
||||
return [...commit.prKeys.values()]
|
||||
.map(prKey => pool.pulls[prKey.number])
|
||||
.filter(pull => !!pull)
|
||||
.map(pull => getOldestMajorBranchOfPull(pull))
|
||||
.filter(major => !!major)
|
||||
.sort()
|
||||
.shift();
|
||||
}
|
||||
|
||||
function commitExistsBeforeMajor (commit, pool, major) {
|
||||
const firstAppearance = getOldestMajorBranchOfCommit(commit, pool);
|
||||
return firstAppearance && (firstAppearance < major);
|
||||
// @return the shorthand name of the branch that `ref` is on,
|
||||
// e.g. a ref of '10.0.0-beta.1' will return '10-x-y'
|
||||
async function getBranchNameOfRef (ref, dir) {
|
||||
return (await runGit(dir, ['branch', '--all', '--contains', ref, '--sort', 'version:refname']))
|
||||
.split(/\r?\n/) // split into lines
|
||||
.shift() // we sorted by refname and want the first result
|
||||
.match(/(?:.*\/)?(.*)/)[1] // 'remote/origins/10-x-y' -> '10-x-y'
|
||||
.trim();
|
||||
}
|
||||
|
||||
/***
|
||||
@@ -431,21 +387,14 @@ const getNotes = async (fromRef, toRef, newVersion) => {
|
||||
}
|
||||
|
||||
const pool = new Pool();
|
||||
const toBranch = await getBranchNameOfRef(toRef, ELECTRON_DIR);
|
||||
|
||||
console.log(`Generating release notes between ${fromRef} and ${toRef} for version ${newVersion} in branch ${toBranch}`);
|
||||
|
||||
// get the electron/electron commits
|
||||
const electron = { owner: 'electron', repo: 'electron', dir: path.resolve(SRC_DIR, 'electron') };
|
||||
const electron = { owner: 'electron', repo: 'electron', dir: ELECTRON_DIR };
|
||||
await addRepoToPool(pool, electron, fromRef, toRef);
|
||||
|
||||
// Don't include submodules if comparing across major versions;
|
||||
// there's just too much churn otherwise.
|
||||
const includeDeps = semver.valid(fromRef) &&
|
||||
semver.valid(toRef) &&
|
||||
semver.major(fromRef) === semver.major(toRef);
|
||||
|
||||
if (includeDeps) {
|
||||
await getDependencyCommitsGN(pool, fromRef, toRef);
|
||||
}
|
||||
|
||||
// remove any old commits
|
||||
pool.commits = pool.commits.filter(commit => !pool.processedHashes.has(commit.hash));
|
||||
|
||||
@@ -479,12 +428,12 @@ const getNotes = async (fromRef, toRef, newVersion) => {
|
||||
|
||||
// remove non-user-facing commits
|
||||
pool.commits = pool.commits
|
||||
.filter(commit => commit.note && (commit.note !== NO_NOTES))
|
||||
.filter(commit => !((commit.note || commit.subject).match(/^[Bb]ump v\d+\.\d+\.\d+/)));
|
||||
.filter(commit => commit && commit.note)
|
||||
.filter(commit => commit.note !== NO_NOTES)
|
||||
.filter(commit => commit.note.match(/^[Bb]ump v\d+\.\d+\.\d+/) === null);
|
||||
|
||||
if (!shouldIncludeMultibranchChanges(newVersion)) {
|
||||
const { major } = semver.parse(newVersion);
|
||||
pool.commits = pool.commits.filter(commit => !commitExistsBeforeMajor(commit, pool, major));
|
||||
for (const commit of pool.commits) {
|
||||
commit.trops = await getMergedTrops(commit, pool);
|
||||
}
|
||||
|
||||
pool.commits = removeSupercededStackUpdates(pool.commits);
|
||||
@@ -496,7 +445,8 @@ const getNotes = async (fromRef, toRef, newVersion) => {
|
||||
fix: [],
|
||||
other: [],
|
||||
unknown: [],
|
||||
name: newVersion
|
||||
name: newVersion,
|
||||
toBranch
|
||||
};
|
||||
|
||||
pool.commits.forEach(commit => {
|
||||
@@ -545,31 +495,42 @@ const removeSupercededStackUpdates = (commits) => {
|
||||
**** Render
|
||||
***/
|
||||
|
||||
const renderLink = (commit, explicitLinks) => {
|
||||
let link;
|
||||
const { owner, repo } = commit;
|
||||
const keyIt = commit.prKeys.values().next();
|
||||
if (keyIt.done) /* no PRs */ {
|
||||
const { hash } = commit;
|
||||
const url = `https://github.com/${owner}/${repo}/commit/${hash}`;
|
||||
const text = owner === 'electron' && repo === 'electron'
|
||||
? `${hash.slice(0, 8)}`
|
||||
: `${owner}/${repo}@${hash.slice(0, 8)}`;
|
||||
link = explicitLinks ? `[${text}](${url})` : text;
|
||||
} else {
|
||||
const { number } = keyIt.value;
|
||||
const url = `https://github.com/${owner}/${repo}/pull/${number}`;
|
||||
const text = owner === 'electron' && repo === 'electron'
|
||||
? `#${number}`
|
||||
: `${owner}/${repo}#${number}`;
|
||||
link = explicitLinks ? `[${text}](${url})` : text;
|
||||
}
|
||||
return link;
|
||||
};
|
||||
// @return the pull request's GitHub URL
|
||||
const buildPullURL = ghKey => `https://github.com/${ghKey.owner}/${ghKey.repo}/pull/${ghKey.number}`;
|
||||
|
||||
const renderCommit = (commit, explicitLinks) => {
|
||||
// clean up the note
|
||||
let note = commit.note || commit.subject;
|
||||
const renderPull = ghKey => `[#${ghKey.number}](${buildPullURL(ghKey)})`;
|
||||
|
||||
// @return the commit's GitHub URL
|
||||
const buildCommitURL = commit => `https://github.com/${commit.owner}/${commit.repo}/commit/${commit.hash}`;
|
||||
|
||||
const renderCommit = commit => `[${commit.hash.slice(0, 8)}](${buildCommitURL(commit)})`;
|
||||
|
||||
// @return a markdown link to the PR if available; otherwise, the git commit
|
||||
function renderLink (commit) {
|
||||
const maybePull = commit.prKeys.values().next();
|
||||
return maybePull.value ? renderPull(maybePull.value) : renderCommit(commit);
|
||||
}
|
||||
|
||||
// @return a terser branch name,
|
||||
// e.g. '7-2-x' -> '7.2' and '8-x-y' -> '8'
|
||||
const renderBranchName = name => name.replace(/-[a-zA-Z]/g, '').replace('-', '.');
|
||||
|
||||
const renderTrop = (branch, ghKey) => `[${renderBranchName(branch)}](${buildPullURL(ghKey)})`;
|
||||
|
||||
// @return markdown-formatted links to other branches' trops,
|
||||
// e.g. "(Also in 7.2, 8, 9)"
|
||||
function renderTrops (commit, excludeBranch) {
|
||||
const body = [...commit.trops.entries()]
|
||||
.filter(([branch]) => branch !== excludeBranch)
|
||||
.sort(([branchA], [branchB]) => parseInt(branchA) - parseInt(branchB)) // sort by semver major
|
||||
.map(([branch, key]) => renderTrop(branch, key))
|
||||
.join(', ');
|
||||
return body ? `<span style="font-size:small;">(Also in ${body})</span>` : body;
|
||||
}
|
||||
|
||||
// @return a slightly cleaned-up human-readable change description
|
||||
function renderDescription (commit) {
|
||||
let note = commit.note || commit.subject || '';
|
||||
note = note.trim();
|
||||
if (note.length !== 0) {
|
||||
note = note[0].toUpperCase() + note.substr(1);
|
||||
@@ -606,30 +567,24 @@ const renderCommit = (commit, explicitLinks) => {
|
||||
}
|
||||
}
|
||||
|
||||
const link = renderLink(commit, explicitLinks);
|
||||
return note;
|
||||
}
|
||||
|
||||
return { note, link };
|
||||
};
|
||||
// @return markdown-formatted release note line item,
|
||||
// e.g. '* Fixed a foo. #12345 (Also in 7.2, 8, 9)'
|
||||
const renderNote = (commit, excludeBranch) =>
|
||||
`* ${renderDescription(commit)} ${renderLink(commit)} ${renderTrops(commit, excludeBranch)}\n`;
|
||||
|
||||
const renderNotes = (notes, explicitLinks) => {
|
||||
const renderNotes = (notes) => {
|
||||
const rendered = [`# Release Notes for ${notes.name}\n\n`];
|
||||
|
||||
const renderSection = (title, commits) => {
|
||||
if (commits.length === 0) {
|
||||
return;
|
||||
if (commits.length > 0) {
|
||||
rendered.push(
|
||||
`## ${title}\n\n`,
|
||||
...(commits.map(commit => renderNote(commit, notes.toBranch)).sort())
|
||||
);
|
||||
}
|
||||
const notes = new Map();
|
||||
for (const note of commits.map(commit => renderCommit(commit, explicitLinks))) {
|
||||
if (!notes.has(note.note)) {
|
||||
notes.set(note.note, [note.link]);
|
||||
} else {
|
||||
notes.get(note.note).push(note.link);
|
||||
}
|
||||
}
|
||||
rendered.push(`## ${title}\n\n`);
|
||||
const lines = [];
|
||||
notes.forEach((links, key) => lines.push(` * ${key} ${links.map(link => link.toString()).sort().join(', ')}\n`));
|
||||
rendered.push(...lines.sort(), '\n');
|
||||
};
|
||||
|
||||
renderSection('Breaking Changes', notes.breaking);
|
||||
@@ -638,7 +593,7 @@ const renderNotes = (notes, explicitLinks) => {
|
||||
renderSection('Other Changes', notes.other);
|
||||
|
||||
if (notes.docs.length) {
|
||||
const docs = notes.docs.map(commit => renderLink(commit, explicitLinks)).sort();
|
||||
const docs = notes.docs.map(commit => renderLink(commit)).sort();
|
||||
rendered.push('## Documentation\n\n', ` * Documentation changes: ${docs.join(', ')}\n`, '\n');
|
||||
}
|
||||
|
||||
|
||||
@@ -5,9 +5,7 @@ const args = require('minimist')(process.argv.slice(2), {
|
||||
boolean: ['automaticRelease', 'notesOnly', 'stable']
|
||||
});
|
||||
const ciReleaseBuild = require('./ci-release-build');
|
||||
const octokit = require('@octokit/rest')({
|
||||
auth: process.env.ELECTRON_GITHUB_TOKEN
|
||||
});
|
||||
const { Octokit } = require('@octokit/rest');
|
||||
const { execSync } = require('child_process');
|
||||
const { GitProcess } = require('dugite');
|
||||
|
||||
@@ -18,6 +16,10 @@ const { getCurrentBranch, ELECTRON_DIR } = require('../lib/utils.js');
|
||||
const bumpType = args._[0];
|
||||
const targetRepo = bumpType === 'nightly' ? 'nightlies' : 'electron';
|
||||
|
||||
const octokit = new Octokit({
|
||||
auth: process.env.ELECTRON_GITHUB_TOKEN
|
||||
});
|
||||
|
||||
require('colors');
|
||||
const pass = '✓'.green;
|
||||
const fail = '✗'.red;
|
||||
@@ -211,4 +213,8 @@ async function prepareRelease (isBeta, notesOnly) {
|
||||
}
|
||||
}
|
||||
|
||||
prepareRelease(!args.stable, args.notesOnly);
|
||||
prepareRelease(!args.stable, args.notesOnly)
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
@@ -6,8 +6,10 @@ const { getCurrentBranch, ELECTRON_DIR } = require('../lib/utils');
|
||||
const request = require('request');
|
||||
const semver = require('semver');
|
||||
const rootPackageJson = require('../../package.json');
|
||||
const octokit = require('@octokit/rest')({
|
||||
headers: { 'User-Agent': 'electron-npm-publisher' }
|
||||
|
||||
const { Octokit } = require('@octokit/rest');
|
||||
const octokit = new Octokit({
|
||||
userAgent: 'electron-npm-publisher'
|
||||
});
|
||||
|
||||
if (!process.env.ELECTRON_NPM_OTP) {
|
||||
|
||||
@@ -9,8 +9,9 @@ const path = require('path');
|
||||
const { execSync } = require('child_process');
|
||||
const { GitProcess } = require('dugite');
|
||||
const { getCurrentBranch, ELECTRON_DIR } = require('../lib/utils.js');
|
||||
const { Octokit } = require('@octokit/rest');
|
||||
|
||||
const octokit = require('@octokit/rest')({
|
||||
const octokit = new Octokit({
|
||||
auth: process.env.ELECTRON_GITHUB_TOKEN
|
||||
});
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ const path = require('path');
|
||||
const sumchecker = require('sumchecker');
|
||||
const temp = require('temp').track();
|
||||
const { URL } = require('url');
|
||||
const { Octokit } = require('@octokit/rest');
|
||||
|
||||
require('colors');
|
||||
const pass = '✓'.green;
|
||||
@@ -28,7 +29,7 @@ const fail = '✗'.red;
|
||||
|
||||
const { ELECTRON_DIR } = require('../lib/utils');
|
||||
|
||||
const octokit = require('@octokit/rest')({
|
||||
const octokit = new Octokit({
|
||||
auth: process.env.ELECTRON_GITHUB_TOKEN
|
||||
});
|
||||
|
||||
@@ -251,7 +252,7 @@ async function uploadShasumFile (filePath, fileName, releaseId) {
|
||||
'content-type': 'text/plain',
|
||||
'content-length': fs.statSync(filePath).size
|
||||
},
|
||||
file: fs.createReadStream(filePath),
|
||||
data: fs.createReadStream(filePath),
|
||||
name: fileName
|
||||
}).catch(err => {
|
||||
console.log(`${fail} Error uploading ${filePath} to GitHub:`, err);
|
||||
|
||||
@@ -1,8 +1,15 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import glob
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
def is_fs_case_sensitive():
|
||||
with tempfile.NamedTemporaryFile(prefix='TmP') as tmp_file:
|
||||
return(not os.path.exists(tmp_file.name.lower()))
|
||||
|
||||
sys.path.append(
|
||||
os.path.abspath(os.path.dirname(os.path.abspath(__file__)) + "/../.."))
|
||||
@@ -22,6 +29,10 @@ PDB_LIST = [
|
||||
os.path.join(RELEASE_DIR, '{0}.exe.pdb'.format(PROJECT_NAME))
|
||||
]
|
||||
|
||||
NPX_CMD = "npx"
|
||||
if sys.platform == "win32":
|
||||
NPX_CMD += ".cmd"
|
||||
|
||||
|
||||
def main():
|
||||
os.chdir(ELECTRON_DIR)
|
||||
@@ -30,7 +41,13 @@ def main():
|
||||
run_symstore(pdb, SYMBOLS_DIR, PRODUCT_NAME)
|
||||
files = glob.glob(SYMBOLS_DIR + '/*.pdb/*/*.pdb')
|
||||
else:
|
||||
files = glob.glob(SYMBOLS_DIR + '/*/*/*.sym') + glob.glob(SYMBOLS_DIR + '/*/*/*.src.zip')
|
||||
files = glob.glob(SYMBOLS_DIR + '/*/*/*.sym')
|
||||
|
||||
for symbol_file in files:
|
||||
print("Generating Sentry src bundle for: " + symbol_file)
|
||||
subprocess.check_output([NPX_CMD, '@sentry/cli@1.51.1', 'difutil', 'bundle-sources', symbol_file])
|
||||
|
||||
files += glob.glob(SYMBOLS_DIR + '/*/*/*.src.zip')
|
||||
|
||||
# The file upload needs to be atom-shell/symbols/:symbol_name/:hash/:symbol
|
||||
os.chdir(SYMBOLS_DIR)
|
||||
@@ -38,7 +55,19 @@ def main():
|
||||
|
||||
# The symbol server needs lowercase paths, it will fail otherwise
|
||||
# So lowercase all the file paths here
|
||||
if is_fs_case_sensitive():
|
||||
for f in files:
|
||||
lower_f = f.lower()
|
||||
if lower_f != f:
|
||||
if os.path.exists(lower_f):
|
||||
shutil.rmtree(lower_f)
|
||||
lower_dir = os.path.dirname(lower_f)
|
||||
if not os.path.exists(lower_dir):
|
||||
os.makedirs(lower_dir)
|
||||
shutil.copy2(f, lower_f)
|
||||
files = [f.lower() for f in files]
|
||||
for f in files:
|
||||
assert os.path.exists(f)
|
||||
|
||||
bucket, access_key, secret_key = s3_config()
|
||||
upload_symbols(bucket, access_key, secret_key, files)
|
||||
|
||||
@@ -2,7 +2,8 @@ if (!process.env.CI) require('dotenv-safe').load();
|
||||
|
||||
const fs = require('fs');
|
||||
|
||||
const octokit = require('@octokit/rest')({
|
||||
const { Octokit } = require('@octokit/rest');
|
||||
const octokit = new Octokit({
|
||||
auth: process.env.ELECTRON_GITHUB_TOKEN
|
||||
});
|
||||
|
||||
@@ -40,7 +41,7 @@ function uploadToGitHub () {
|
||||
octokit.repos.uploadReleaseAsset({
|
||||
url: uploadUrl,
|
||||
headers: getHeaders(filePath, fileName),
|
||||
file: fs.createReadStream(filePath),
|
||||
data: fs.createReadStream(filePath),
|
||||
name: fileName
|
||||
}).then(() => {
|
||||
console.log(`Successfully uploaded ${fileName} to GitHub.`);
|
||||
|
||||
17
script/run-if-exists.js
Normal file
17
script/run-if-exists.js
Normal file
@@ -0,0 +1,17 @@
|
||||
const cp = require('child_process');
|
||||
const fs = require('fs');
|
||||
|
||||
const checkPath = process.argv[2];
|
||||
const command = process.argv.slice(3);
|
||||
|
||||
if (fs.existsSync(checkPath)) {
|
||||
const child = cp.spawn(
|
||||
`${command[0]}${process.platform === 'win32' ? '.cmd' : ''}`,
|
||||
command.slice(1),
|
||||
{
|
||||
stdio: 'inherit',
|
||||
cwd: checkPath
|
||||
}
|
||||
);
|
||||
child.on('exit', code => process.exit(code));
|
||||
}
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "base/command_line.h"
|
||||
#include "base/environment.h"
|
||||
#include "base/files/file_path.h"
|
||||
#include "base/files/file_util.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/path_service.h"
|
||||
#include "base/strings/string_split.h"
|
||||
@@ -147,7 +148,14 @@ bool ElectronCrashReporterClient::GetCrashDumpLocation(
|
||||
#else
|
||||
bool ElectronCrashReporterClient::GetCrashDumpLocation(
|
||||
base::FilePath* crash_dir) {
|
||||
return base::PathService::Get(electron::DIR_CRASH_DUMPS, crash_dir);
|
||||
bool result = base::PathService::Get(electron::DIR_CRASH_DUMPS, crash_dir);
|
||||
{
|
||||
base::ThreadRestrictions::ScopedAllowIO allow_io;
|
||||
if (result && !base::PathExists(*crash_dir)) {
|
||||
return base::CreateDirectory(*crash_dir);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -159,7 +167,7 @@ bool ElectronCrashReporterClient::GetCrashMetricsLocation(
|
||||
#endif // OS_MACOSX || OS_LINUX
|
||||
|
||||
bool ElectronCrashReporterClient::IsRunningUnattended() {
|
||||
return false;
|
||||
return !collect_stats_consent_;
|
||||
}
|
||||
|
||||
bool ElectronCrashReporterClient::GetCollectStatsConsent() {
|
||||
|
||||
@@ -12,5 +12,7 @@
|
||||
<string>APPL</string>
|
||||
<key>LSBackgroundOnly</key>
|
||||
<true/>
|
||||
<key>LSRequiresNativeExecution</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -334,6 +334,37 @@ struct Converter<JumpListResult> {
|
||||
};
|
||||
#endif
|
||||
|
||||
#if defined(OS_WIN)
|
||||
template <>
|
||||
struct Converter<Browser::LaunchItem> {
|
||||
static bool FromV8(v8::Isolate* isolate,
|
||||
v8::Local<v8::Value> val,
|
||||
Browser::LaunchItem* out) {
|
||||
gin_helper::Dictionary dict;
|
||||
if (!ConvertFromV8(isolate, val, &dict))
|
||||
return false;
|
||||
|
||||
dict.Get("name", &(out->name));
|
||||
dict.Get("path", &(out->path));
|
||||
dict.Get("args", &(out->args));
|
||||
dict.Get("scope", &(out->scope));
|
||||
dict.Get("enabled", &(out->enabled));
|
||||
return true;
|
||||
}
|
||||
|
||||
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
|
||||
Browser::LaunchItem val) {
|
||||
gin_helper::Dictionary dict = gin::Dictionary::CreateEmpty(isolate);
|
||||
dict.Set("name", val.name);
|
||||
dict.Set("path", val.path);
|
||||
dict.Set("args", val.args);
|
||||
dict.Set("scope", val.scope);
|
||||
dict.Set("enabled", val.enabled);
|
||||
return dict.GetHandle();
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
template <>
|
||||
struct Converter<Browser::LoginItemSettings> {
|
||||
static bool FromV8(v8::Isolate* isolate,
|
||||
@@ -347,6 +378,10 @@ struct Converter<Browser::LoginItemSettings> {
|
||||
dict.Get("openAsHidden", &(out->open_as_hidden));
|
||||
dict.Get("path", &(out->path));
|
||||
dict.Get("args", &(out->args));
|
||||
#if defined(OS_WIN)
|
||||
dict.Get("enabled", &(out->enabled));
|
||||
dict.Get("name", &(out->name));
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -358,6 +393,11 @@ struct Converter<Browser::LoginItemSettings> {
|
||||
dict.Set("restoreState", val.restore_state);
|
||||
dict.Set("wasOpenedAtLogin", val.opened_at_login);
|
||||
dict.Set("wasOpenedAsHidden", val.opened_as_hidden);
|
||||
#if defined(OS_WIN)
|
||||
dict.Set("launchItems", val.launch_items);
|
||||
dict.Set("executableWillLaunchAtLogin",
|
||||
val.executable_will_launch_at_login);
|
||||
#endif
|
||||
return dict.GetHandle();
|
||||
}
|
||||
};
|
||||
@@ -382,6 +422,8 @@ namespace electron {
|
||||
|
||||
namespace api {
|
||||
|
||||
gin::WrapperInfo App::kWrapperInfo = {gin::kEmbedderNativeGin};
|
||||
|
||||
namespace {
|
||||
|
||||
IconLoader::IconSize GetIconSizeByString(const std::string& size) {
|
||||
@@ -466,7 +508,7 @@ void OnClientCertificateSelected(
|
||||
v8::Isolate* isolate,
|
||||
std::shared_ptr<content::ClientCertificateDelegate> delegate,
|
||||
std::shared_ptr<net::ClientCertIdentityList> identities,
|
||||
gin_helper::Arguments* args) {
|
||||
gin::Arguments* args) {
|
||||
if (args->Length() == 2) {
|
||||
delegate->ContinueWithCertificate(nullptr, nullptr);
|
||||
return;
|
||||
@@ -481,7 +523,8 @@ void OnClientCertificateSelected(
|
||||
|
||||
gin_helper::Dictionary cert_data;
|
||||
if (!gin::ConvertFromV8(isolate, val, &cert_data)) {
|
||||
args->ThrowError("Must pass valid certificate object.");
|
||||
gin_helper::ErrorThrower(isolate).ThrowError(
|
||||
"Must pass valid certificate object.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -548,7 +591,7 @@ void OnIconDataAvailable(gin_helper::Promise<gfx::Image> promise,
|
||||
|
||||
} // namespace
|
||||
|
||||
App::App(v8::Isolate* isolate) {
|
||||
App::App() {
|
||||
static_cast<ElectronBrowserClient*>(ElectronBrowserClient::Get())
|
||||
->set_delegate(this);
|
||||
Browser::Get()->AddObserver(this);
|
||||
@@ -558,7 +601,6 @@ App::App(v8::Isolate* isolate) {
|
||||
content::PROCESS_TYPE_BROWSER, base::GetCurrentProcessHandle(),
|
||||
base::ProcessMetrics::CreateCurrentProcessMetrics());
|
||||
app_metrics_[pid] = std::move(process_metric);
|
||||
Init(isolate);
|
||||
}
|
||||
|
||||
App::~App() {
|
||||
@@ -707,8 +749,9 @@ bool App::CanCreateWindow(
|
||||
bool user_gesture,
|
||||
bool opener_suppressed,
|
||||
bool* no_javascript_access) {
|
||||
v8::Locker locker(isolate());
|
||||
v8::HandleScope handle_scope(isolate());
|
||||
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
|
||||
v8::Locker locker(isolate);
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
content::WebContents* web_contents =
|
||||
content::WebContents::FromRenderFrameHost(opener);
|
||||
if (web_contents) {
|
||||
@@ -732,11 +775,12 @@ void App::AllowCertificateError(
|
||||
bool strict_enforcement,
|
||||
base::OnceCallback<void(content::CertificateRequestResultType)> callback) {
|
||||
auto adapted_callback = base::AdaptCallbackForRepeating(std::move(callback));
|
||||
v8::Locker locker(isolate());
|
||||
v8::HandleScope handle_scope(isolate());
|
||||
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
|
||||
v8::Locker locker(isolate);
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
bool prevent_default =
|
||||
Emit("certificate-error",
|
||||
WebContents::FromOrCreate(isolate(), web_contents), request_url,
|
||||
WebContents::FromOrCreate(isolate, web_contents), request_url,
|
||||
net::ErrorToString(cert_error), ssl_info.cert, adapted_callback);
|
||||
|
||||
// Deny the certificate by default.
|
||||
@@ -761,11 +805,13 @@ base::OnceClosure App::SelectClientCertificate(
|
||||
auto shared_identities =
|
||||
std::make_shared<net::ClientCertIdentityList>(std::move(identities));
|
||||
|
||||
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
bool prevent_default =
|
||||
Emit("select-client-certificate",
|
||||
WebContents::FromOrCreate(isolate(), web_contents),
|
||||
WebContents::FromOrCreate(isolate, web_contents),
|
||||
cert_request_info->host_and_port.ToString(), std::move(client_certs),
|
||||
base::BindOnce(&OnClientCertificateSelected, isolate(),
|
||||
base::BindOnce(&OnClientCertificateSelected, isolate,
|
||||
shared_delegate, shared_identities));
|
||||
|
||||
// Default to first certificate from the platform store.
|
||||
@@ -816,8 +862,9 @@ void App::BrowserChildProcessKilled(
|
||||
void App::BrowserChildProcessCrashedOrKilled(
|
||||
const content::ChildProcessData& data,
|
||||
const content::ChildProcessTerminationInfo& info) {
|
||||
v8::HandleScope handle_scope(isolate());
|
||||
auto details = gin_helper::Dictionary::CreateEmpty(isolate());
|
||||
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
auto details = gin_helper::Dictionary::CreateEmpty(isolate);
|
||||
details.Set("type", content::GetProcessTypeNameInEnglish(data.process_type));
|
||||
details.Set("reason", info.status);
|
||||
details.Set("exitCode", info.exit_code);
|
||||
@@ -1049,7 +1096,7 @@ void App::ReleaseSingleInstanceLock() {
|
||||
}
|
||||
}
|
||||
|
||||
bool App::Relaunch(gin_helper::Arguments* js_args) {
|
||||
bool App::Relaunch(gin::Arguments* js_args) {
|
||||
// Parse parameters.
|
||||
bool override_argv = false;
|
||||
base::FilePath exec_path;
|
||||
@@ -1135,8 +1182,7 @@ void App::SetAccessibilitySupportEnabled(gin_helper::ErrorThrower thrower,
|
||||
Browser::Get()->OnAccessibilitySupportChanged();
|
||||
}
|
||||
|
||||
Browser::LoginItemSettings App::GetLoginItemSettings(
|
||||
gin_helper::Arguments* args) {
|
||||
Browser::LoginItemSettings App::GetLoginItemSettings(gin::Arguments* args) {
|
||||
Browser::LoginItemSettings options;
|
||||
args->GetNext(&options);
|
||||
return Browser::Get()->GetLoginItemSettings(options);
|
||||
@@ -1190,19 +1236,21 @@ v8::Local<v8::Value> App::GetJumpListSettings() {
|
||||
LOG(ERROR) << "Failed to begin Jump List transaction.";
|
||||
}
|
||||
|
||||
gin_helper::Dictionary dict = gin::Dictionary::CreateEmpty(isolate());
|
||||
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
|
||||
gin_helper::Dictionary dict = gin::Dictionary::CreateEmpty(isolate);
|
||||
dict.Set("minItems", min_items);
|
||||
dict.Set("removedItems", gin::ConvertToV8(isolate(), removed_items));
|
||||
dict.Set("removedItems", gin::ConvertToV8(isolate, removed_items));
|
||||
return dict.GetHandle();
|
||||
}
|
||||
|
||||
JumpListResult App::SetJumpList(v8::Local<v8::Value> val,
|
||||
gin_helper::Arguments* args) {
|
||||
gin::Arguments* args) {
|
||||
std::vector<JumpListCategory> categories;
|
||||
bool delete_jump_list = val->IsNull();
|
||||
if (!delete_jump_list &&
|
||||
!gin::ConvertFromV8(args->isolate(), val, &categories)) {
|
||||
args->ThrowError("Argument must be null or an array of categories");
|
||||
gin_helper::ErrorThrower(args->isolate())
|
||||
.ThrowError("Argument must be null or an array of categories");
|
||||
return JumpListResult::ARGUMENT_ERROR;
|
||||
}
|
||||
|
||||
@@ -1234,8 +1282,9 @@ JumpListResult App::SetJumpList(v8::Local<v8::Value> val,
|
||||
#endif // defined(OS_WIN)
|
||||
|
||||
v8::Local<v8::Promise> App::GetFileIcon(const base::FilePath& path,
|
||||
gin_helper::Arguments* args) {
|
||||
gin_helper::Promise<gfx::Image> promise(isolate());
|
||||
gin::Arguments* args) {
|
||||
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
|
||||
gin_helper::Promise<gfx::Image> promise(isolate);
|
||||
v8::Local<v8::Promise> handle = promise.GetHandle();
|
||||
base::FilePath normalized_path = path.NormalizePathSeparators();
|
||||
|
||||
@@ -1427,7 +1476,7 @@ bool App::IsInApplicationsFolder() {
|
||||
return ElectronBundleMover::IsCurrentAppInApplicationsFolder();
|
||||
}
|
||||
|
||||
int DockBounce(gin_helper::Arguments* args) {
|
||||
int DockBounce(gin::Arguments* args) {
|
||||
int request_id = -1;
|
||||
std::string type = "informational";
|
||||
args->GetNext(&type);
|
||||
@@ -1478,7 +1527,7 @@ v8::Local<v8::Value> App::GetDockAPI(v8::Isolate* isolate) {
|
||||
|
||||
// static
|
||||
App* App::Get() {
|
||||
static base::NoDestructor<App> app(v8::Isolate::GetCurrent());
|
||||
static base::NoDestructor<App> app;
|
||||
return app.get();
|
||||
}
|
||||
|
||||
@@ -1487,12 +1536,9 @@ gin::Handle<App> App::Create(v8::Isolate* isolate) {
|
||||
return gin::CreateHandle(isolate, Get());
|
||||
}
|
||||
|
||||
// static
|
||||
void App::BuildPrototype(v8::Isolate* isolate,
|
||||
v8::Local<v8::FunctionTemplate> prototype) {
|
||||
prototype->SetClassName(gin::StringToV8(isolate, "App"));
|
||||
gin::ObjectTemplateBuilder App::GetObjectTemplateBuilder(v8::Isolate* isolate) {
|
||||
auto browser = base::Unretained(Browser::Get());
|
||||
gin_helper::ObjectTemplateBuilder(isolate, prototype->PrototypeTemplate())
|
||||
return gin_helper::EventEmitterMixin<App>::GetObjectTemplateBuilder(isolate)
|
||||
.SetMethod("quit", base::BindRepeating(&Browser::Quit, browser))
|
||||
.SetMethod("exit", base::BindRepeating(&Browser::Exit, browser))
|
||||
.SetMethod("focus", base::BindRepeating(&Browser::Focus, browser))
|
||||
@@ -1622,6 +1668,10 @@ void App::BuildPrototype(v8::Isolate* isolate,
|
||||
&App::SetBrowserClientCanUseCustomSiteInstance);
|
||||
}
|
||||
|
||||
const char* App::GetTypeName() {
|
||||
return "App";
|
||||
}
|
||||
|
||||
} // namespace api
|
||||
|
||||
} // namespace electron
|
||||
@@ -1634,9 +1684,6 @@ void Initialize(v8::Local<v8::Object> exports,
|
||||
void* priv) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
gin_helper::Dictionary dict(isolate, exports);
|
||||
dict.Set("App", electron::api::App::GetConstructor(isolate)
|
||||
->GetFunction(context)
|
||||
.ToLocalChecked());
|
||||
dict.Set("app", electron::api::App::Create(isolate));
|
||||
}
|
||||
|
||||
|
||||
@@ -25,9 +25,9 @@
|
||||
#include "shell/browser/browser.h"
|
||||
#include "shell/browser/browser_observer.h"
|
||||
#include "shell/browser/electron_browser_client.h"
|
||||
#include "shell/browser/event_emitter_mixin.h"
|
||||
#include "shell/common/gin_helper/dictionary.h"
|
||||
#include "shell/common/gin_helper/error_thrower.h"
|
||||
#include "shell/common/gin_helper/event_emitter.h"
|
||||
#include "shell/common/gin_helper/promise.h"
|
||||
|
||||
#if defined(USE_NSS_CERTS)
|
||||
@@ -47,7 +47,8 @@ enum class JumpListResult : int;
|
||||
namespace api {
|
||||
|
||||
class App : public ElectronBrowserClient::Delegate,
|
||||
public gin_helper::EventEmitter<App>,
|
||||
public gin::Wrappable<App>,
|
||||
public gin_helper::EventEmitterMixin<App>,
|
||||
public BrowserObserver,
|
||||
public content::GpuDataManagerObserver,
|
||||
public content::BrowserChildProcessObserver {
|
||||
@@ -58,8 +59,11 @@ class App : public ElectronBrowserClient::Delegate,
|
||||
static gin::Handle<App> Create(v8::Isolate* isolate);
|
||||
static App* Get();
|
||||
|
||||
static void BuildPrototype(v8::Isolate* isolate,
|
||||
v8::Local<v8::FunctionTemplate> prototype);
|
||||
// gin::Wrappable
|
||||
static gin::WrapperInfo kWrapperInfo;
|
||||
gin::ObjectTemplateBuilder GetObjectTemplateBuilder(
|
||||
v8::Isolate* isolate) override;
|
||||
const char* GetTypeName() override;
|
||||
|
||||
#if defined(USE_NSS_CERTS)
|
||||
void OnCertificateManagerModelCreated(
|
||||
@@ -72,7 +76,7 @@ class App : public ElectronBrowserClient::Delegate,
|
||||
void RenderProcessReady(content::RenderProcessHost* host);
|
||||
void RenderProcessDisconnected(base::ProcessId host_pid);
|
||||
|
||||
explicit App(v8::Isolate* isolate);
|
||||
App();
|
||||
|
||||
private:
|
||||
~App() override;
|
||||
@@ -185,20 +189,20 @@ class App : public ElectronBrowserClient::Delegate,
|
||||
bool HasSingleInstanceLock() const;
|
||||
bool RequestSingleInstanceLock();
|
||||
void ReleaseSingleInstanceLock();
|
||||
bool Relaunch(gin_helper::Arguments* args);
|
||||
bool Relaunch(gin::Arguments* args);
|
||||
void DisableHardwareAcceleration(gin_helper::ErrorThrower thrower);
|
||||
void DisableDomainBlockingFor3DAPIs(gin_helper::ErrorThrower thrower);
|
||||
bool IsAccessibilitySupportEnabled();
|
||||
void SetAccessibilitySupportEnabled(gin_helper::ErrorThrower thrower,
|
||||
bool enabled);
|
||||
Browser::LoginItemSettings GetLoginItemSettings(gin_helper::Arguments* args);
|
||||
Browser::LoginItemSettings GetLoginItemSettings(gin::Arguments* args);
|
||||
#if defined(USE_NSS_CERTS)
|
||||
void ImportCertificate(gin_helper::ErrorThrower thrower,
|
||||
base::Value options,
|
||||
net::CompletionOnceCallback callback);
|
||||
#endif
|
||||
v8::Local<v8::Promise> GetFileIcon(const base::FilePath& path,
|
||||
gin_helper::Arguments* args);
|
||||
gin::Arguments* args);
|
||||
|
||||
std::vector<gin_helper::Dictionary> GetAppMetrics(v8::Isolate* isolate);
|
||||
v8::Local<v8::Value> GetGPUFeatureStatus(v8::Isolate* isolate);
|
||||
@@ -221,7 +225,7 @@ class App : public ElectronBrowserClient::Delegate,
|
||||
|
||||
#if defined(MAS_BUILD)
|
||||
base::RepeatingCallback<void()> StartAccessingSecurityScopedResource(
|
||||
gin_helper::Arguments* args);
|
||||
gin::Arguments* args);
|
||||
#endif
|
||||
|
||||
#if defined(OS_WIN)
|
||||
@@ -229,8 +233,7 @@ class App : public ElectronBrowserClient::Delegate,
|
||||
v8::Local<v8::Value> GetJumpListSettings();
|
||||
|
||||
// Set or remove a custom Jump List for the application.
|
||||
JumpListResult SetJumpList(v8::Local<v8::Value> val,
|
||||
gin_helper::Arguments* args);
|
||||
JumpListResult SetJumpList(v8::Local<v8::Value> val, gin::Arguments* args);
|
||||
#endif // defined(OS_WIN)
|
||||
|
||||
std::unique_ptr<ProcessSingleton> process_singleton_;
|
||||
|
||||
@@ -22,7 +22,7 @@ void OnStopAccessingSecurityScopedResource(NSURL* bookmarkUrl) {
|
||||
|
||||
// Get base64 encoded NSData, create a bookmark for it and start accessing it.
|
||||
base::RepeatingCallback<void()> App::StartAccessingSecurityScopedResource(
|
||||
gin_helper::Arguments* args) {
|
||||
gin::Arguments* args) {
|
||||
std::string data;
|
||||
args->GetNext(&data);
|
||||
NSString* base64str = base::SysUTF8ToNSString(data);
|
||||
@@ -42,11 +42,13 @@ base::RepeatingCallback<void()> App::StartAccessingSecurityScopedResource(
|
||||
if (error != nil) {
|
||||
NSString* err =
|
||||
[NSString stringWithFormat:@"NSError: %@ %@", error, [error userInfo]];
|
||||
args->ThrowError(base::SysNSStringToUTF8(err));
|
||||
gin_helper::ErrorThrower(args->isolate())
|
||||
.ThrowError(base::SysNSStringToUTF8(err));
|
||||
}
|
||||
|
||||
if (isStale) {
|
||||
args->ThrowError("bookmarkDataIsStale - try recreating the bookmark");
|
||||
gin_helper::ErrorThrower(args->isolate())
|
||||
.ThrowError("bookmarkDataIsStale - try recreating the bookmark");
|
||||
}
|
||||
|
||||
if (error == nil && isStale == false) {
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include "base/time/time.h"
|
||||
#include "shell/browser/browser.h"
|
||||
#include "shell/browser/javascript_environment.h"
|
||||
#include "shell/browser/native_window.h"
|
||||
#include "shell/browser/window_list.h"
|
||||
#include "shell/common/gin_converters/callback_converter.h"
|
||||
@@ -19,9 +20,10 @@ namespace electron {
|
||||
|
||||
namespace api {
|
||||
|
||||
AutoUpdater::AutoUpdater(v8::Isolate* isolate) {
|
||||
gin::WrapperInfo AutoUpdater::kWrapperInfo = {gin::kEmbedderNativeGin};
|
||||
|
||||
AutoUpdater::AutoUpdater() {
|
||||
auto_updater::AutoUpdater::SetDelegate(this);
|
||||
Init(isolate);
|
||||
}
|
||||
|
||||
AutoUpdater::~AutoUpdater() {
|
||||
@@ -29,38 +31,46 @@ AutoUpdater::~AutoUpdater() {
|
||||
}
|
||||
|
||||
void AutoUpdater::OnError(const std::string& message) {
|
||||
v8::Locker locker(isolate());
|
||||
v8::HandleScope handle_scope(isolate());
|
||||
auto error = v8::Exception::Error(gin::StringToV8(isolate(), message));
|
||||
gin_helper::EmitEvent(
|
||||
isolate(), GetWrapper(), "error",
|
||||
error->ToObject(isolate()->GetCurrentContext()).ToLocalChecked(),
|
||||
// Message is also emitted to keep compatibility with old code.
|
||||
message);
|
||||
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
|
||||
v8::Locker locker(isolate);
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
v8::Local<v8::Object> wrapper;
|
||||
if (GetWrapper(isolate).ToLocal(&wrapper)) {
|
||||
auto error = v8::Exception::Error(gin::StringToV8(isolate, message));
|
||||
gin_helper::EmitEvent(
|
||||
isolate, wrapper, "error",
|
||||
error->ToObject(isolate->GetCurrentContext()).ToLocalChecked(),
|
||||
// Message is also emitted to keep compatibility with old code.
|
||||
message);
|
||||
}
|
||||
}
|
||||
|
||||
void AutoUpdater::OnError(const std::string& message,
|
||||
const int code,
|
||||
const std::string& domain) {
|
||||
v8::Locker locker(isolate());
|
||||
v8::HandleScope handle_scope(isolate());
|
||||
auto error = v8::Exception::Error(gin::StringToV8(isolate(), message));
|
||||
auto errorObject =
|
||||
error->ToObject(isolate()->GetCurrentContext()).ToLocalChecked();
|
||||
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
|
||||
v8::Locker locker(isolate);
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
v8::Local<v8::Object> wrapper;
|
||||
if (GetWrapper(isolate).ToLocal(&wrapper)) {
|
||||
auto error = v8::Exception::Error(gin::StringToV8(isolate, message));
|
||||
auto errorObject =
|
||||
error->ToObject(isolate->GetCurrentContext()).ToLocalChecked();
|
||||
|
||||
auto context = isolate()->GetCurrentContext();
|
||||
auto context = isolate->GetCurrentContext();
|
||||
|
||||
// add two new params for better error handling
|
||||
errorObject
|
||||
->Set(context, gin::StringToV8(isolate(), "code"),
|
||||
v8::Integer::New(isolate(), code))
|
||||
.Check();
|
||||
errorObject
|
||||
->Set(context, gin::StringToV8(isolate(), "domain"),
|
||||
gin::StringToV8(isolate(), domain))
|
||||
.Check();
|
||||
// add two new params for better error handling
|
||||
errorObject
|
||||
->Set(context, gin::StringToV8(isolate, "code"),
|
||||
v8::Integer::New(isolate, code))
|
||||
.Check();
|
||||
errorObject
|
||||
->Set(context, gin::StringToV8(isolate, "domain"),
|
||||
gin::StringToV8(isolate, domain))
|
||||
.Check();
|
||||
|
||||
gin_helper::EmitEvent(isolate(), GetWrapper(), "error", errorObject, message);
|
||||
gin_helper::EmitEvent(isolate, wrapper, "error", errorObject, message);
|
||||
}
|
||||
}
|
||||
|
||||
void AutoUpdater::OnCheckingForUpdate() {
|
||||
@@ -89,7 +99,7 @@ void AutoUpdater::OnWindowAllClosed() {
|
||||
QuitAndInstall();
|
||||
}
|
||||
|
||||
void AutoUpdater::SetFeedURL(gin_helper::Arguments* args) {
|
||||
void AutoUpdater::SetFeedURL(gin::Arguments* args) {
|
||||
auto_updater::AutoUpdater::SetFeedURL(args);
|
||||
}
|
||||
|
||||
@@ -109,20 +119,23 @@ void AutoUpdater::QuitAndInstall() {
|
||||
|
||||
// static
|
||||
gin::Handle<AutoUpdater> AutoUpdater::Create(v8::Isolate* isolate) {
|
||||
return gin::CreateHandle(isolate, new AutoUpdater(isolate));
|
||||
return gin::CreateHandle(isolate, new AutoUpdater());
|
||||
}
|
||||
|
||||
// static
|
||||
void AutoUpdater::BuildPrototype(v8::Isolate* isolate,
|
||||
v8::Local<v8::FunctionTemplate> prototype) {
|
||||
prototype->SetClassName(gin::StringToV8(isolate, "AutoUpdater"));
|
||||
gin_helper::ObjectTemplateBuilder(isolate, prototype->PrototypeTemplate())
|
||||
gin::ObjectTemplateBuilder AutoUpdater::GetObjectTemplateBuilder(
|
||||
v8::Isolate* isolate) {
|
||||
return gin_helper::EventEmitterMixin<AutoUpdater>::GetObjectTemplateBuilder(
|
||||
isolate)
|
||||
.SetMethod("checkForUpdates", &auto_updater::AutoUpdater::CheckForUpdates)
|
||||
.SetMethod("getFeedURL", &auto_updater::AutoUpdater::GetFeedURL)
|
||||
.SetMethod("setFeedURL", &AutoUpdater::SetFeedURL)
|
||||
.SetMethod("quitAndInstall", &AutoUpdater::QuitAndInstall);
|
||||
}
|
||||
|
||||
const char* AutoUpdater::GetTypeName() {
|
||||
return "AutoUpdater";
|
||||
}
|
||||
|
||||
} // namespace api
|
||||
|
||||
} // namespace electron
|
||||
@@ -138,9 +151,6 @@ void Initialize(v8::Local<v8::Object> exports,
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
gin_helper::Dictionary dict(isolate, exports);
|
||||
dict.Set("autoUpdater", AutoUpdater::Create(isolate));
|
||||
dict.Set("AutoUpdater", AutoUpdater::GetConstructor(isolate)
|
||||
->GetFunction(context)
|
||||
.ToLocalChecked());
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -8,25 +8,30 @@
|
||||
#include <string>
|
||||
|
||||
#include "gin/handle.h"
|
||||
#include "gin/wrappable.h"
|
||||
#include "shell/browser/auto_updater.h"
|
||||
#include "shell/browser/event_emitter_mixin.h"
|
||||
#include "shell/browser/window_list_observer.h"
|
||||
#include "shell/common/gin_helper/event_emitter.h"
|
||||
|
||||
namespace electron {
|
||||
|
||||
namespace api {
|
||||
|
||||
class AutoUpdater : public gin_helper::EventEmitter<AutoUpdater>,
|
||||
class AutoUpdater : public gin::Wrappable<AutoUpdater>,
|
||||
public gin_helper::EventEmitterMixin<AutoUpdater>,
|
||||
public auto_updater::Delegate,
|
||||
public WindowListObserver {
|
||||
public:
|
||||
static gin::Handle<AutoUpdater> Create(v8::Isolate* isolate);
|
||||
|
||||
static void BuildPrototype(v8::Isolate* isolate,
|
||||
v8::Local<v8::FunctionTemplate> prototype);
|
||||
// gin::Wrappable
|
||||
static gin::WrapperInfo kWrapperInfo;
|
||||
gin::ObjectTemplateBuilder GetObjectTemplateBuilder(
|
||||
v8::Isolate* isolate) override;
|
||||
const char* GetTypeName() override;
|
||||
|
||||
protected:
|
||||
explicit AutoUpdater(v8::Isolate* isolate);
|
||||
AutoUpdater();
|
||||
~AutoUpdater() override;
|
||||
|
||||
// Delegate implementations.
|
||||
@@ -47,7 +52,7 @@ class AutoUpdater : public gin_helper::EventEmitter<AutoUpdater>,
|
||||
|
||||
private:
|
||||
std::string GetFeedURL();
|
||||
void SetFeedURL(gin_helper::Arguments* args);
|
||||
void SetFeedURL(gin::Arguments* args);
|
||||
void QuitAndInstall();
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(AutoUpdater);
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "shell/browser/api/electron_api_menu.h"
|
||||
#include "shell/browser/api/electron_api_view.h"
|
||||
#include "shell/browser/api/electron_api_web_contents.h"
|
||||
#include "shell/browser/javascript_environment.h"
|
||||
#include "shell/common/color_util.h"
|
||||
#include "shell/common/gin_converters/callback_converter.h"
|
||||
#include "shell/common/gin_converters/file_path_converter.h"
|
||||
@@ -296,9 +297,12 @@ void BaseWindow::OnNewWindowForTab() {
|
||||
#if defined(OS_WIN)
|
||||
void BaseWindow::OnWindowMessage(UINT message, WPARAM w_param, LPARAM l_param) {
|
||||
if (IsWindowMessageHooked(message)) {
|
||||
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
|
||||
v8::Locker locker(isolate);
|
||||
v8::HandleScope scope(isolate);
|
||||
messages_callback_map_[message].Run(
|
||||
ToBuffer(isolate(), static_cast<void*>(&w_param), sizeof(WPARAM)),
|
||||
ToBuffer(isolate(), static_cast<void*>(&l_param), sizeof(LPARAM)));
|
||||
ToBuffer(isolate, static_cast<void*>(&w_param), sizeof(WPARAM)),
|
||||
ToBuffer(isolate, static_cast<void*>(&l_param), sizeof(LPARAM)));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -78,7 +78,7 @@ BrowserWindow::BrowserWindow(gin::Arguments* args,
|
||||
Observe(api_web_contents_->web_contents());
|
||||
|
||||
// Keep a copy of the options for later use.
|
||||
gin_helper::Dictionary(isolate, web_contents->GetWrapper())
|
||||
gin_helper::Dictionary(isolate, web_contents.ToV8().As<v8::Object>())
|
||||
.Set("browserWindowOptions", options);
|
||||
|
||||
// Associate with BrowserWindow.
|
||||
|
||||
@@ -40,7 +40,11 @@
|
||||
#endif
|
||||
|
||||
#if defined(OS_LINUX)
|
||||
#include "base/containers/span.h"
|
||||
#include "base/files/file_util.h"
|
||||
#include "base/guid.h"
|
||||
#include "components/crash/core/app/breakpad_linux.h"
|
||||
#include "components/crash/core/common/crash_keys.h"
|
||||
#include "v8/include/v8-wasm-trap-handler-posix.h"
|
||||
#include "v8/include/v8.h"
|
||||
#endif
|
||||
@@ -81,6 +85,40 @@ bool IsCrashReporterEnabled() {
|
||||
const std::map<std::string, std::string>& GetGlobalCrashKeys() {
|
||||
return GetGlobalCrashKeysMutable();
|
||||
}
|
||||
|
||||
base::FilePath GetClientIdPath() {
|
||||
base::FilePath path;
|
||||
base::PathService::Get(electron::DIR_CRASH_DUMPS, &path);
|
||||
return path.Append("client_id");
|
||||
}
|
||||
|
||||
std::string ReadClientId() {
|
||||
base::ThreadRestrictions::ScopedAllowIO allow_io;
|
||||
std::string client_id;
|
||||
// "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".length == 36
|
||||
if (!base::ReadFileToStringWithMaxSize(GetClientIdPath(), &client_id, 36) ||
|
||||
client_id.size() != 36)
|
||||
return std::string();
|
||||
return client_id;
|
||||
}
|
||||
|
||||
void WriteClientId(const std::string& client_id) {
|
||||
DCHECK_EQ(client_id.size(), 36u);
|
||||
base::ThreadRestrictions::ScopedAllowIO allow_io;
|
||||
base::WriteFile(GetClientIdPath(), client_id);
|
||||
}
|
||||
|
||||
std::string GetClientId() {
|
||||
static base::NoDestructor<std::string> client_id;
|
||||
if (!client_id->empty())
|
||||
return *client_id;
|
||||
*client_id = ReadClientId();
|
||||
if (client_id->empty()) {
|
||||
*client_id = base::GenerateGUID();
|
||||
WriteClientId(*client_id);
|
||||
}
|
||||
return *client_id;
|
||||
}
|
||||
#endif
|
||||
|
||||
void Start(const std::string& submit_url,
|
||||
@@ -107,6 +145,7 @@ void Start(const std::string& submit_url,
|
||||
? "node"
|
||||
: command_line->GetSwitchValueASCII(::switches::kProcessType);
|
||||
#if defined(OS_LINUX)
|
||||
::crash_keys::SetMetricsClientIdFromGUID(GetClientId());
|
||||
auto& global_crash_keys = GetGlobalCrashKeysMutable();
|
||||
for (const auto& pair : global_extra) {
|
||||
global_crash_keys[pair.first] = pair.second;
|
||||
|
||||
@@ -19,6 +19,7 @@ bool IsCrashReporterEnabled();
|
||||
|
||||
#if defined(OS_LINUX)
|
||||
const std::map<std::string, std::string>& GetGlobalCrashKeys();
|
||||
std::string GetClientId();
|
||||
#endif
|
||||
|
||||
// JS bindings API; exposed publicly because it's also called from node_main.cc
|
||||
|
||||
@@ -24,29 +24,27 @@
|
||||
if ((self = [super init])) {
|
||||
NSDistributedNotificationCenter* distCenter =
|
||||
[NSDistributedNotificationCenter defaultCenter];
|
||||
// A notification that the screen was locked.
|
||||
[distCenter addObserver:self
|
||||
selector:@selector(onScreenLocked:)
|
||||
name:@"com.apple.screenIsLocked"
|
||||
object:nil];
|
||||
// A notification that the screen was unlocked by the user.
|
||||
[distCenter addObserver:self
|
||||
selector:@selector(onScreenUnlocked:)
|
||||
name:@"com.apple.screenIsUnlocked"
|
||||
object:nil];
|
||||
|
||||
// A notification that the workspace posts before the machine goes to sleep.
|
||||
[[[NSWorkspace sharedWorkspace] notificationCenter]
|
||||
addObserver:self
|
||||
selector:@selector(isSuspending:)
|
||||
name:NSWorkspaceWillSleepNotification
|
||||
object:nil];
|
||||
|
||||
[distCenter addObserver:self
|
||||
selector:@selector(isSuspending:)
|
||||
name:NSWorkspaceWillSleepNotification
|
||||
object:nil];
|
||||
// A notification that the workspace posts when the machine wakes from
|
||||
// sleep.
|
||||
[[[NSWorkspace sharedWorkspace] notificationCenter]
|
||||
addObserver:self
|
||||
selector:@selector(isResuming:)
|
||||
name:NSWorkspaceDidWakeNotification
|
||||
object:nil];
|
||||
[distCenter addObserver:self
|
||||
selector:@selector(isResuming:)
|
||||
name:NSWorkspaceDidWakeNotification
|
||||
object:nil];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -29,6 +29,8 @@ namespace electron {
|
||||
|
||||
namespace api {
|
||||
|
||||
gin::WrapperInfo Screen::kWrapperInfo = {gin::kEmbedderNativeGin};
|
||||
|
||||
namespace {
|
||||
|
||||
// Find an item in container according to its ID.
|
||||
@@ -72,7 +74,6 @@ void DelayEmitWithMetrics(Screen* screen,
|
||||
Screen::Screen(v8::Isolate* isolate, display::Screen* screen)
|
||||
: screen_(screen) {
|
||||
screen_->AddObserver(this);
|
||||
Init(isolate);
|
||||
}
|
||||
|
||||
Screen::~Screen() {
|
||||
@@ -154,11 +155,10 @@ v8::Local<v8::Value> Screen::Create(gin_helper::ErrorThrower error_thrower) {
|
||||
.ToV8();
|
||||
}
|
||||
|
||||
// static
|
||||
void Screen::BuildPrototype(v8::Isolate* isolate,
|
||||
v8::Local<v8::FunctionTemplate> prototype) {
|
||||
prototype->SetClassName(gin::StringToV8(isolate, "Screen"));
|
||||
gin_helper::ObjectTemplateBuilder(isolate, prototype->PrototypeTemplate())
|
||||
gin::ObjectTemplateBuilder Screen::GetObjectTemplateBuilder(
|
||||
v8::Isolate* isolate) {
|
||||
return gin_helper::EventEmitterMixin<Screen>::GetObjectTemplateBuilder(
|
||||
isolate)
|
||||
.SetMethod("getCursorScreenPoint", &Screen::GetCursorScreenPoint)
|
||||
.SetMethod("getPrimaryDisplay", &Screen::GetPrimaryDisplay)
|
||||
.SetMethod("getAllDisplays", &Screen::GetAllDisplays)
|
||||
@@ -172,6 +172,10 @@ void Screen::BuildPrototype(v8::Isolate* isolate,
|
||||
.SetMethod("getDisplayMatching", &Screen::GetDisplayMatching);
|
||||
}
|
||||
|
||||
const char* Screen::GetTypeName() {
|
||||
return "Screen";
|
||||
}
|
||||
|
||||
} // namespace api
|
||||
|
||||
} // namespace electron
|
||||
@@ -187,9 +191,6 @@ void Initialize(v8::Local<v8::Object> exports,
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
gin_helper::Dictionary dict(isolate, exports);
|
||||
dict.SetMethod("createScreen", base::BindRepeating(&Screen::Create));
|
||||
dict.Set(
|
||||
"Screen",
|
||||
Screen::GetConstructor(isolate)->GetFunction(context).ToLocalChecked());
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -7,8 +7,9 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "gin/wrappable.h"
|
||||
#include "shell/browser/event_emitter_mixin.h"
|
||||
#include "shell/common/gin_helper/error_thrower.h"
|
||||
#include "shell/common/gin_helper/event_emitter.h"
|
||||
#include "ui/display/display_observer.h"
|
||||
#include "ui/display/screen.h"
|
||||
|
||||
@@ -22,13 +23,16 @@ namespace electron {
|
||||
|
||||
namespace api {
|
||||
|
||||
class Screen : public gin_helper::EventEmitter<Screen>,
|
||||
class Screen : public gin::Wrappable<Screen>,
|
||||
public gin_helper::EventEmitterMixin<Screen>,
|
||||
public display::DisplayObserver {
|
||||
public:
|
||||
static v8::Local<v8::Value> Create(gin_helper::ErrorThrower error_thrower);
|
||||
|
||||
static void BuildPrototype(v8::Isolate* isolate,
|
||||
v8::Local<v8::FunctionTemplate> prototype);
|
||||
static gin::WrapperInfo kWrapperInfo;
|
||||
gin::ObjectTemplateBuilder GetObjectTemplateBuilder(
|
||||
v8::Isolate* isolate) override;
|
||||
const char* GetTypeName() override;
|
||||
|
||||
protected:
|
||||
Screen(v8::Isolate* isolate, display::Screen* screen);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "shell/common/gin_converters/callback_converter.h"
|
||||
#include "shell/common/gin_converters/value_converter.h"
|
||||
#include "shell/common/gin_helper/dictionary.h"
|
||||
#include "shell/common/gin_helper/object_template_builder.h"
|
||||
#include "shell/common/gin_helper/function_template_extensions.h"
|
||||
#include "shell/common/node_includes.h"
|
||||
#include "ui/gfx/animation/animation.h"
|
||||
#include "ui/gfx/color_utils.h"
|
||||
@@ -17,8 +17,9 @@ namespace electron {
|
||||
|
||||
namespace api {
|
||||
|
||||
SystemPreferences::SystemPreferences(v8::Isolate* isolate) {
|
||||
Init(isolate);
|
||||
gin::WrapperInfo SystemPreferences::kWrapperInfo = {gin::kEmbedderNativeGin};
|
||||
|
||||
SystemPreferences::SystemPreferences() {
|
||||
#if defined(OS_WIN)
|
||||
InitializeWindow();
|
||||
#endif
|
||||
@@ -61,15 +62,13 @@ v8::Local<v8::Value> SystemPreferences::GetAnimationSettings(
|
||||
|
||||
// static
|
||||
gin::Handle<SystemPreferences> SystemPreferences::Create(v8::Isolate* isolate) {
|
||||
return gin::CreateHandle(isolate, new SystemPreferences(isolate));
|
||||
return gin::CreateHandle(isolate, new SystemPreferences());
|
||||
}
|
||||
|
||||
// static
|
||||
void SystemPreferences::BuildPrototype(
|
||||
v8::Isolate* isolate,
|
||||
v8::Local<v8::FunctionTemplate> prototype) {
|
||||
prototype->SetClassName(gin::StringToV8(isolate, "SystemPreferences"));
|
||||
gin_helper::ObjectTemplateBuilder(isolate, prototype->PrototypeTemplate())
|
||||
gin::ObjectTemplateBuilder SystemPreferences::GetObjectTemplateBuilder(
|
||||
v8::Isolate* isolate) {
|
||||
return gin_helper::EventEmitterMixin<
|
||||
SystemPreferences>::GetObjectTemplateBuilder(isolate)
|
||||
#if defined(OS_WIN) || defined(OS_MACOSX)
|
||||
.SetMethod("getColor", &SystemPreferences::GetColor)
|
||||
.SetMethod("getAccentColor", &SystemPreferences::GetAccentColor)
|
||||
@@ -125,6 +124,10 @@ void SystemPreferences::BuildPrototype(
|
||||
&SystemPreferences::GetAnimationSettings);
|
||||
}
|
||||
|
||||
const char* SystemPreferences::GetTypeName() {
|
||||
return "SystemPreferences";
|
||||
}
|
||||
|
||||
} // namespace api
|
||||
|
||||
} // namespace electron
|
||||
@@ -140,9 +143,6 @@ void Initialize(v8::Local<v8::Object> exports,
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
gin_helper::Dictionary dict(isolate, exports);
|
||||
dict.Set("systemPreferences", SystemPreferences::Create(isolate));
|
||||
dict.Set("SystemPreferences", SystemPreferences::GetConstructor(isolate)
|
||||
->GetFunction(context)
|
||||
.ToLocalChecked());
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -10,8 +10,9 @@
|
||||
|
||||
#include "base/values.h"
|
||||
#include "gin/handle.h"
|
||||
#include "gin/wrappable.h"
|
||||
#include "shell/browser/event_emitter_mixin.h"
|
||||
#include "shell/common/gin_helper/error_thrower.h"
|
||||
#include "shell/common/gin_helper/event_emitter.h"
|
||||
#include "shell/common/gin_helper/promise.h"
|
||||
|
||||
#if defined(OS_WIN)
|
||||
@@ -32,25 +33,30 @@ enum NotificationCenterKind {
|
||||
};
|
||||
#endif
|
||||
|
||||
class SystemPreferences : public gin_helper::EventEmitter<SystemPreferences>
|
||||
class SystemPreferences
|
||||
: public gin::Wrappable<SystemPreferences>,
|
||||
public gin_helper::EventEmitterMixin<SystemPreferences>
|
||||
#if defined(OS_WIN)
|
||||
,
|
||||
public BrowserObserver,
|
||||
public gfx::SysColorChangeListener
|
||||
public BrowserObserver,
|
||||
public gfx::SysColorChangeListener
|
||||
#endif
|
||||
{
|
||||
public:
|
||||
static gin::Handle<SystemPreferences> Create(v8::Isolate* isolate);
|
||||
|
||||
static void BuildPrototype(v8::Isolate* isolate,
|
||||
v8::Local<v8::FunctionTemplate> prototype);
|
||||
// gin::Wrappable
|
||||
static gin::WrapperInfo kWrapperInfo;
|
||||
gin::ObjectTemplateBuilder GetObjectTemplateBuilder(
|
||||
v8::Isolate* isolate) override;
|
||||
const char* GetTypeName() override;
|
||||
|
||||
#if defined(OS_WIN) || defined(OS_MACOSX)
|
||||
std::string GetAccentColor();
|
||||
std::string GetColor(gin_helper::ErrorThrower thrower,
|
||||
const std::string& color);
|
||||
std::string GetMediaAccessStatus(const std::string& media_type,
|
||||
gin_helper::Arguments* args);
|
||||
std::string GetMediaAccessStatus(gin_helper::ErrorThrower thrower,
|
||||
const std::string& media_type);
|
||||
#endif
|
||||
#if defined(OS_WIN)
|
||||
bool IsAeroGlassEnabled();
|
||||
@@ -69,7 +75,7 @@ class SystemPreferences : public gin_helper::EventEmitter<SystemPreferences>
|
||||
|
||||
void PostNotification(const std::string& name,
|
||||
base::DictionaryValue user_info,
|
||||
gin_helper::Arguments* args);
|
||||
gin::Arguments* args);
|
||||
int SubscribeNotification(const std::string& name,
|
||||
const NotificationCallback& callback);
|
||||
void UnsubscribeNotification(int id);
|
||||
@@ -83,12 +89,13 @@ class SystemPreferences : public gin_helper::EventEmitter<SystemPreferences>
|
||||
int SubscribeWorkspaceNotification(const std::string& name,
|
||||
const NotificationCallback& callback);
|
||||
void UnsubscribeWorkspaceNotification(int request_id);
|
||||
v8::Local<v8::Value> GetUserDefault(const std::string& name,
|
||||
v8::Local<v8::Value> GetUserDefault(v8::Isolate* isolate,
|
||||
const std::string& name,
|
||||
const std::string& type);
|
||||
void RegisterDefaults(gin_helper::Arguments* args);
|
||||
void RegisterDefaults(gin::Arguments* args);
|
||||
void SetUserDefault(const std::string& name,
|
||||
const std::string& type,
|
||||
gin_helper::Arguments* args);
|
||||
gin::Arguments* args);
|
||||
void RemoveUserDefault(const std::string& name);
|
||||
bool IsSwipeTrackingFromScrollEventsEnabled();
|
||||
|
||||
@@ -108,7 +115,7 @@ class SystemPreferences : public gin_helper::EventEmitter<SystemPreferences>
|
||||
// are running tests on a Mojave machine
|
||||
v8::Local<v8::Value> GetEffectiveAppearance(v8::Isolate* isolate);
|
||||
v8::Local<v8::Value> GetAppLevelAppearance(v8::Isolate* isolate);
|
||||
void SetAppLevelAppearance(gin_helper::Arguments* args);
|
||||
void SetAppLevelAppearance(gin::Arguments* args);
|
||||
#endif
|
||||
bool IsDarkMode();
|
||||
bool IsInvertedColorScheme();
|
||||
@@ -116,7 +123,7 @@ class SystemPreferences : public gin_helper::EventEmitter<SystemPreferences>
|
||||
v8::Local<v8::Value> GetAnimationSettings(v8::Isolate* isolate);
|
||||
|
||||
protected:
|
||||
explicit SystemPreferences(v8::Isolate* isolate);
|
||||
SystemPreferences();
|
||||
~SystemPreferences() override;
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
|
||||
@@ -125,7 +125,7 @@ std::string ConvertSystemPermission(
|
||||
|
||||
void SystemPreferences::PostNotification(const std::string& name,
|
||||
base::DictionaryValue user_info,
|
||||
gin_helper::Arguments* args) {
|
||||
gin::Arguments* args) {
|
||||
bool immediate = false;
|
||||
args->GetNext(&immediate);
|
||||
|
||||
@@ -257,60 +257,61 @@ void SystemPreferences::DoUnsubscribeNotification(int request_id,
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> SystemPreferences::GetUserDefault(
|
||||
v8::Isolate* isolate,
|
||||
const std::string& name,
|
||||
const std::string& type) {
|
||||
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
|
||||
NSString* key = base::SysUTF8ToNSString(name);
|
||||
if (type == "string") {
|
||||
return gin::StringToV8(
|
||||
isolate(), base::SysNSStringToUTF8([defaults stringForKey:key]));
|
||||
isolate, base::SysNSStringToUTF8([defaults stringForKey:key]));
|
||||
} else if (type == "boolean") {
|
||||
return v8::Boolean::New(isolate(), [defaults boolForKey:key]);
|
||||
return v8::Boolean::New(isolate, [defaults boolForKey:key]);
|
||||
} else if (type == "float") {
|
||||
return v8::Number::New(isolate(), [defaults floatForKey:key]);
|
||||
return v8::Number::New(isolate, [defaults floatForKey:key]);
|
||||
} else if (type == "integer") {
|
||||
return v8::Integer::New(isolate(), [defaults integerForKey:key]);
|
||||
return v8::Integer::New(isolate, [defaults integerForKey:key]);
|
||||
} else if (type == "double") {
|
||||
return v8::Number::New(isolate(), [defaults doubleForKey:key]);
|
||||
return v8::Number::New(isolate, [defaults doubleForKey:key]);
|
||||
} else if (type == "url") {
|
||||
return gin::ConvertToV8(isolate(),
|
||||
return gin::ConvertToV8(isolate,
|
||||
net::GURLWithNSURL([defaults URLForKey:key]));
|
||||
} else if (type == "array") {
|
||||
return gin::ConvertToV8(isolate(),
|
||||
return gin::ConvertToV8(isolate,
|
||||
NSArrayToListValue([defaults arrayForKey:key]));
|
||||
} else if (type == "dictionary") {
|
||||
return gin::ConvertToV8(isolate(), NSDictionaryToDictionaryValue(
|
||||
[defaults dictionaryForKey:key]));
|
||||
return gin::ConvertToV8(isolate, NSDictionaryToDictionaryValue(
|
||||
[defaults dictionaryForKey:key]));
|
||||
} else {
|
||||
return v8::Undefined(isolate());
|
||||
return v8::Undefined(isolate);
|
||||
}
|
||||
}
|
||||
|
||||
void SystemPreferences::RegisterDefaults(gin_helper::Arguments* args) {
|
||||
void SystemPreferences::RegisterDefaults(gin::Arguments* args) {
|
||||
base::DictionaryValue value;
|
||||
|
||||
if (!args->GetNext(&value)) {
|
||||
args->ThrowError("Invalid userDefault data provided");
|
||||
args->ThrowError();
|
||||
} else {
|
||||
@try {
|
||||
NSDictionary* dict = DictionaryValueToNSDictionary(value);
|
||||
for (id key in dict) {
|
||||
id value = [dict objectForKey:key];
|
||||
if ([value isKindOfClass:[NSNull class]] || value == nil) {
|
||||
args->ThrowError("Invalid userDefault data provided");
|
||||
args->ThrowError();
|
||||
return;
|
||||
}
|
||||
}
|
||||
[[NSUserDefaults standardUserDefaults] registerDefaults:dict];
|
||||
} @catch (NSException* exception) {
|
||||
args->ThrowError("Invalid userDefault data provided");
|
||||
args->ThrowError();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SystemPreferences::SetUserDefault(const std::string& name,
|
||||
const std::string& type,
|
||||
gin_helper::Arguments* args) {
|
||||
gin::Arguments* args) {
|
||||
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
|
||||
NSString* key = base::SysUTF8ToNSString(name);
|
||||
if (type == "string") {
|
||||
@@ -321,7 +322,8 @@ void SystemPreferences::SetUserDefault(const std::string& name,
|
||||
}
|
||||
} else if (type == "boolean") {
|
||||
bool value;
|
||||
if (args->GetNext(&value)) {
|
||||
v8::Local<v8::Value> next = args->PeekNext();
|
||||
if (!next.IsEmpty() && next->IsBoolean() && args->GetNext(&value)) {
|
||||
[defaults setBool:value forKey:key];
|
||||
return;
|
||||
}
|
||||
@@ -368,11 +370,13 @@ void SystemPreferences::SetUserDefault(const std::string& name,
|
||||
}
|
||||
}
|
||||
} else {
|
||||
args->ThrowError("Invalid type: " + type);
|
||||
gin_helper::ErrorThrower(args->isolate())
|
||||
.ThrowTypeError("Invalid type: " + type);
|
||||
return;
|
||||
}
|
||||
|
||||
args->ThrowError("Unable to convert value to: " + type);
|
||||
gin_helper::ErrorThrower(args->isolate())
|
||||
.ThrowTypeError("Unable to convert value to: " + type);
|
||||
}
|
||||
|
||||
std::string SystemPreferences::GetAccentColor() {
|
||||
@@ -572,8 +576,8 @@ std::string SystemPreferences::GetColor(gin_helper::ErrorThrower thrower,
|
||||
}
|
||||
|
||||
std::string SystemPreferences::GetMediaAccessStatus(
|
||||
const std::string& media_type,
|
||||
gin_helper::Arguments* args) {
|
||||
gin_helper::ErrorThrower thrower,
|
||||
const std::string& media_type) {
|
||||
if (media_type == "camera") {
|
||||
return ConvertSystemPermission(
|
||||
system_media_permissions::CheckSystemVideoCapturePermission());
|
||||
@@ -584,7 +588,7 @@ std::string SystemPreferences::GetMediaAccessStatus(
|
||||
return ConvertSystemPermission(
|
||||
system_media_permissions::CheckSystemScreenCapturePermission());
|
||||
} else {
|
||||
args->ThrowError("Invalid media type");
|
||||
thrower.ThrowError("Invalid media type");
|
||||
return std::string();
|
||||
}
|
||||
}
|
||||
@@ -651,13 +655,13 @@ v8::Local<v8::Value> SystemPreferences::GetAppLevelAppearance(
|
||||
return v8::Null(isolate);
|
||||
}
|
||||
|
||||
void SystemPreferences::SetAppLevelAppearance(gin_helper::Arguments* args) {
|
||||
void SystemPreferences::SetAppLevelAppearance(gin::Arguments* args) {
|
||||
if (@available(macOS 10.14, *)) {
|
||||
NSAppearance* appearance;
|
||||
if (args->GetNext(&appearance)) {
|
||||
[[NSApplication sharedApplication] setAppearance:appearance];
|
||||
} else {
|
||||
args->ThrowError("Invalid app appearance provided as first argument");
|
||||
args->ThrowError();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,8 +167,8 @@ std::string SystemPreferences::GetColor(gin_helper::ErrorThrower thrower,
|
||||
}
|
||||
|
||||
std::string SystemPreferences::GetMediaAccessStatus(
|
||||
const std::string& media_type,
|
||||
gin_helper::Arguments* args) {
|
||||
gin_helper::ErrorThrower thrower,
|
||||
const std::string& media_type) {
|
||||
if (media_type == "camera") {
|
||||
return ConvertDeviceAccessStatus(
|
||||
GetDeviceAccessStatus(DeviceClass::DeviceClass_VideoCapture));
|
||||
@@ -179,7 +179,7 @@ std::string SystemPreferences::GetMediaAccessStatus(
|
||||
return ConvertDeviceAccessStatus(
|
||||
DeviceAccessStatus::DeviceAccessStatus_Allowed);
|
||||
} else {
|
||||
args->ThrowError("Invalid media type");
|
||||
thrower.ThrowError("Invalid media type");
|
||||
return std::string();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "base/containers/id_map.h"
|
||||
#include "base/no_destructor.h"
|
||||
#include "base/optional.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
@@ -332,6 +333,11 @@ namespace api {
|
||||
|
||||
namespace {
|
||||
|
||||
base::IDMap<WebContents*>& GetAllWebContents() {
|
||||
static base::NoDestructor<base::IDMap<WebContents*>> s_all_web_contents;
|
||||
return *s_all_web_contents;
|
||||
}
|
||||
|
||||
// Called when CapturePage is done.
|
||||
void OnCapturePageDone(gin_helper::Promise<gfx::Image> promise,
|
||||
const SkBitmap& bitmap) {
|
||||
@@ -389,12 +395,21 @@ base::string16 GetDefaultPrinterAsync() {
|
||||
}
|
||||
#endif
|
||||
|
||||
struct UserDataLink : public base::SupportsUserData::Data {
|
||||
explicit UserDataLink(base::WeakPtr<WebContents> contents)
|
||||
: web_contents(contents) {}
|
||||
|
||||
base::WeakPtr<WebContents> web_contents;
|
||||
};
|
||||
const void* kElectronApiWebContentsKey = &kElectronApiWebContentsKey;
|
||||
|
||||
} // namespace
|
||||
|
||||
WebContents::WebContents(v8::Isolate* isolate,
|
||||
content::WebContents* web_contents)
|
||||
: content::WebContentsObserver(web_contents),
|
||||
type_(Type::REMOTE),
|
||||
id_(GetAllWebContents().Add(this)),
|
||||
weak_factory_(this) {
|
||||
auto session = Session::CreateFrom(isolate, GetBrowserContext());
|
||||
session_.Reset(isolate, session.ToV8());
|
||||
@@ -402,8 +417,8 @@ WebContents::WebContents(v8::Isolate* isolate,
|
||||
web_contents->SetUserAgentOverride(blink::UserAgentOverride::UserAgentOnly(
|
||||
GetBrowserContext()->GetUserAgent()),
|
||||
false);
|
||||
Init(isolate);
|
||||
AttachAsUserData(web_contents);
|
||||
web_contents->SetUserData(kElectronApiWebContentsKey,
|
||||
std::make_unique<UserDataLink>(GetWeakPtr()));
|
||||
InitZoomController(web_contents, gin::Dictionary::CreateEmpty(isolate));
|
||||
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
||||
extensions::ElectronExtensionWebContentsObserver::CreateForWebContents(
|
||||
@@ -421,6 +436,7 @@ WebContents::WebContents(v8::Isolate* isolate,
|
||||
Type type)
|
||||
: content::WebContentsObserver(web_contents.get()),
|
||||
type_(type),
|
||||
id_(GetAllWebContents().Add(this)),
|
||||
weak_factory_(this) {
|
||||
DCHECK(type != Type::REMOTE)
|
||||
<< "Can't take ownership of a remote WebContents";
|
||||
@@ -432,7 +448,7 @@ WebContents::WebContents(v8::Isolate* isolate,
|
||||
|
||||
WebContents::WebContents(v8::Isolate* isolate,
|
||||
const gin_helper::Dictionary& options)
|
||||
: weak_factory_(this) {
|
||||
: id_(GetAllWebContents().Add(this)), weak_factory_(this) {
|
||||
// Read options.
|
||||
options.Get("backgroundThrottling", &background_throttling_);
|
||||
|
||||
@@ -610,11 +626,12 @@ void WebContents::InitWithSessionAndOptions(
|
||||
SetOwnerWindow(owner_window);
|
||||
}
|
||||
|
||||
Init(isolate);
|
||||
AttachAsUserData(web_contents());
|
||||
web_contents()->SetUserData(kElectronApiWebContentsKey,
|
||||
std::make_unique<UserDataLink>(GetWeakPtr()));
|
||||
}
|
||||
|
||||
WebContents::~WebContents() {
|
||||
MarkDestroyed();
|
||||
// The destroy() is called.
|
||||
if (managed_web_contents()) {
|
||||
managed_web_contents()->GetView()->SetDelegate(nullptr);
|
||||
@@ -740,19 +757,19 @@ void WebContents::AddNewContents(
|
||||
content::WebContents* WebContents::OpenURLFromTab(
|
||||
content::WebContents* source,
|
||||
const content::OpenURLParams& params) {
|
||||
auto weak_this = GetWeakPtr();
|
||||
if (params.disposition != WindowOpenDisposition::CURRENT_TAB) {
|
||||
Emit("-new-window", params.url, "", params.disposition, "", params.referrer,
|
||||
params.post_data);
|
||||
return nullptr;
|
||||
}
|
||||
if (!weak_this)
|
||||
return nullptr;
|
||||
|
||||
// Give user a chance to cancel navigation.
|
||||
if (Emit("will-navigate", params.url))
|
||||
return nullptr;
|
||||
|
||||
// Don't load the URL if the web contents was marked as destroyed from a
|
||||
// will-navigate event listener
|
||||
if (IsDestroyed())
|
||||
if (!weak_this)
|
||||
return nullptr;
|
||||
|
||||
return CommonWebContentsDelegate::OpenURLFromTab(source, params);
|
||||
@@ -1217,9 +1234,7 @@ void WebContents::MessageTo(bool internal,
|
||||
const std::string& channel,
|
||||
blink::CloneableMessage arguments) {
|
||||
TRACE_EVENT1("electron", "WebContents::MessageTo", "channel", channel);
|
||||
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
|
||||
auto* web_contents = gin_helper::TrackableObject<WebContents>::FromWeakMapID(
|
||||
isolate, web_contents_id);
|
||||
auto* web_contents = FromID(web_contents_id);
|
||||
|
||||
if (web_contents) {
|
||||
web_contents->SendIPCMessageWithSender(internal, send_to_all, channel,
|
||||
@@ -1398,6 +1413,17 @@ bool WebContents::OnMessageReceived(const IPC::Message& message) {
|
||||
return handled;
|
||||
}
|
||||
|
||||
void WebContents::MarkDestroyed() {
|
||||
if (GetAllWebContents().Lookup(id_))
|
||||
GetAllWebContents().Remove(id_);
|
||||
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
|
||||
v8::HandleScope scope(isolate);
|
||||
v8::Local<v8::Object> wrapper;
|
||||
if (!GetWrapper(isolate).ToLocal(&wrapper))
|
||||
return;
|
||||
wrapper->SetAlignedPointerInInternalField(0, nullptr);
|
||||
}
|
||||
|
||||
// There are three ways of destroying a webContents:
|
||||
// 1. call webContents.destroy();
|
||||
// 2. garbage collection;
|
||||
@@ -1413,8 +1439,12 @@ bool WebContents::OnMessageReceived(const IPC::Message& message) {
|
||||
// we need to make sure the api::WebContents is also deleted.
|
||||
// For #4, the WebContents will be destroyed by embedder.
|
||||
void WebContents::WebContentsDestroyed() {
|
||||
// Give chance for guest delegate to cleanup its observers
|
||||
// since the native class is only destroyed in the next tick.
|
||||
if (guest_delegate_)
|
||||
guest_delegate_->WillDestroy();
|
||||
|
||||
// Cleanup relationships with other parts.
|
||||
RemoveFromWeakMap();
|
||||
|
||||
// We can not call Destroy here because we need to call Emit first, but we
|
||||
// also do not want any method to be used, so just mark as destroyed here.
|
||||
@@ -1430,7 +1460,13 @@ void WebContents::WebContentsDestroyed() {
|
||||
}
|
||||
|
||||
// Destroy the native class in next tick.
|
||||
base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, GetDestroyClosure());
|
||||
base::ThreadTaskRunnerHandle::Get()->PostTask(
|
||||
FROM_HERE, base::BindOnce(
|
||||
[](base::WeakPtr<WebContents> wc) {
|
||||
if (wc)
|
||||
delete wc.get();
|
||||
},
|
||||
GetWeakPtr()));
|
||||
}
|
||||
|
||||
void WebContents::NavigationEntryCommitted(
|
||||
@@ -2627,10 +2663,6 @@ v8::Local<v8::Value> WebContents::GetOwnerBrowserWindow(
|
||||
return v8::Null(isolate);
|
||||
}
|
||||
|
||||
int32_t WebContents::ID() const {
|
||||
return weak_map_id();
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> WebContents::Session(v8::Isolate* isolate) {
|
||||
return v8::Local<v8::Value>::New(isolate, session_);
|
||||
}
|
||||
@@ -2749,11 +2781,28 @@ v8::Local<v8::Promise> WebContents::TakeHeapSnapshot(
|
||||
}
|
||||
|
||||
// static
|
||||
void WebContents::BuildPrototype(v8::Isolate* isolate,
|
||||
v8::Local<v8::FunctionTemplate> prototype) {
|
||||
prototype->SetClassName(gin::StringToV8(isolate, "WebContents"));
|
||||
gin_helper::Destroyable::MakeDestroyable(isolate, prototype);
|
||||
gin_helper::ObjectTemplateBuilder(isolate, prototype->PrototypeTemplate())
|
||||
v8::Local<v8::ObjectTemplate> WebContents::FillObjectTemplate(
|
||||
v8::Isolate* isolate,
|
||||
v8::Local<v8::ObjectTemplate> templ) {
|
||||
gin::InvokerOptions options;
|
||||
options.holder_is_first_argument = true;
|
||||
options.holder_type = "WebContents";
|
||||
templ->Set(
|
||||
gin::StringToSymbol(isolate, "isDestroyed"),
|
||||
gin::CreateFunctionTemplate(
|
||||
isolate, base::BindRepeating(&gin_helper::Destroyable::IsDestroyed),
|
||||
options));
|
||||
templ->Set(
|
||||
gin::StringToSymbol(isolate, "destroy"),
|
||||
gin::CreateFunctionTemplate(
|
||||
isolate, base::BindRepeating([](gin::Handle<WebContents> handle) {
|
||||
delete handle.get();
|
||||
}),
|
||||
options));
|
||||
// We use gin_helper::ObjectTemplateBuilder instead of
|
||||
// gin::ObjectTemplateBuilder here to handle the fact that WebContents is
|
||||
// destroyable.
|
||||
return gin_helper::ObjectTemplateBuilder(isolate, templ)
|
||||
.SetMethod("getBackgroundThrottling",
|
||||
&WebContents::GetBackgroundThrottling)
|
||||
.SetMethod("setBackgroundThrottling",
|
||||
@@ -2865,7 +2914,12 @@ void WebContents::BuildPrototype(v8::Isolate* isolate,
|
||||
.SetProperty("session", &WebContents::Session)
|
||||
.SetProperty("hostWebContents", &WebContents::HostWebContents)
|
||||
.SetProperty("devToolsWebContents", &WebContents::DevToolsWebContents)
|
||||
.SetProperty("debugger", &WebContents::Debugger);
|
||||
.SetProperty("debugger", &WebContents::Debugger)
|
||||
.Build();
|
||||
}
|
||||
|
||||
const char* WebContents::GetTypeName() {
|
||||
return "WebContents";
|
||||
}
|
||||
|
||||
ElectronBrowserContext* WebContents::GetBrowserContext() const {
|
||||
@@ -2877,7 +2931,17 @@ ElectronBrowserContext* WebContents::GetBrowserContext() const {
|
||||
gin::Handle<WebContents> WebContents::Create(
|
||||
v8::Isolate* isolate,
|
||||
const gin_helper::Dictionary& options) {
|
||||
return gin::CreateHandle(isolate, new WebContents(isolate, options));
|
||||
gin::Handle<WebContents> handle =
|
||||
gin::CreateHandle(isolate, new WebContents(isolate, options));
|
||||
gin_helper::CallMethod(isolate, handle.get(), "_init");
|
||||
return handle;
|
||||
}
|
||||
|
||||
// static
|
||||
gin::Handle<WebContents> WebContents::New(
|
||||
v8::Isolate* isolate,
|
||||
const gin_helper::Dictionary& options) {
|
||||
return Create(isolate, options);
|
||||
}
|
||||
|
||||
// static
|
||||
@@ -2885,15 +2949,19 @@ gin::Handle<WebContents> WebContents::CreateAndTake(
|
||||
v8::Isolate* isolate,
|
||||
std::unique_ptr<content::WebContents> web_contents,
|
||||
Type type) {
|
||||
return gin::CreateHandle(
|
||||
gin::Handle<WebContents> handle = gin::CreateHandle(
|
||||
isolate, new WebContents(isolate, std::move(web_contents), type));
|
||||
gin_helper::CallMethod(isolate, handle.get(), "_init");
|
||||
return handle;
|
||||
}
|
||||
|
||||
// static
|
||||
WebContents* WebContents::From(content::WebContents* web_contents) {
|
||||
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
|
||||
auto* existing = TrackableObject::FromWrappedClass(isolate, web_contents);
|
||||
return static_cast<WebContents*>(existing);
|
||||
if (!web_contents)
|
||||
return nullptr;
|
||||
UserDataLink* data = static_cast<UserDataLink*>(
|
||||
web_contents->GetUserData(kElectronApiWebContentsKey));
|
||||
return data ? data->web_contents.get() : nullptr;
|
||||
}
|
||||
|
||||
// static
|
||||
@@ -2901,36 +2969,50 @@ gin::Handle<WebContents> WebContents::FromOrCreate(
|
||||
v8::Isolate* isolate,
|
||||
content::WebContents* web_contents) {
|
||||
WebContents* api_web_contents = From(web_contents);
|
||||
if (!api_web_contents)
|
||||
if (!api_web_contents) {
|
||||
api_web_contents = new WebContents(isolate, web_contents);
|
||||
gin_helper::CallMethod(isolate, api_web_contents, "_init");
|
||||
}
|
||||
return gin::CreateHandle(isolate, api_web_contents);
|
||||
}
|
||||
|
||||
// static
|
||||
WebContents* WebContents::FromID(int32_t id) {
|
||||
return FromWeakMapID(JavascriptEnvironment::GetIsolate(), id);
|
||||
return GetAllWebContents().Lookup(id);
|
||||
}
|
||||
|
||||
// static
|
||||
gin::WrapperInfo WebContents::kWrapperInfo = {gin::kEmbedderNativeGin};
|
||||
|
||||
} // namespace api
|
||||
|
||||
} // namespace electron
|
||||
|
||||
namespace {
|
||||
|
||||
using electron::api::GetAllWebContents;
|
||||
using electron::api::WebContents;
|
||||
|
||||
std::vector<gin::Handle<WebContents>> GetAllWebContentsAsV8(
|
||||
v8::Isolate* isolate) {
|
||||
std::vector<gin::Handle<WebContents>> list;
|
||||
for (auto iter = base::IDMap<WebContents*>::iterator(&GetAllWebContents());
|
||||
!iter.IsAtEnd(); iter.Advance()) {
|
||||
list.push_back(gin::CreateHandle(isolate, iter.GetCurrentValue()));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
void Initialize(v8::Local<v8::Object> exports,
|
||||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
gin_helper::Dictionary dict(isolate, exports);
|
||||
dict.Set("WebContents", WebContents::GetConstructor(isolate)
|
||||
->GetFunction(context)
|
||||
.ToLocalChecked());
|
||||
dict.Set("WebContents", WebContents::GetConstructor(context));
|
||||
dict.SetMethod("create", &WebContents::Create);
|
||||
dict.SetMethod("fromId", &WebContents::FromWeakMapID);
|
||||
dict.SetMethod("getAllWebContents", &WebContents::GetAll);
|
||||
dict.SetMethod("fromId", &WebContents::FromID);
|
||||
dict.SetMethod("getAllWebContents", &GetAllWebContentsAsV8);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user