Compare commits

..

37 Commits

Author SHA1 Message Date
trop[bot]
2d45b7df34 fix: context-menu event with BaseWindows (#44952)
fix: context-menu event with BaseWindows

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2024-12-04 16:03:02 -08:00
trop[bot]
9a7848ced1 feat: Add shared dictionary management APIs (#44950)
* Add bare-bones GetSharedDictionaryUsageInfo

* Add GetSharedDictionaryInfo()

* Improve API, use isolation keys

* Add documentation

* Update docs/api/session.md



* Update shell/browser/api/electron_api_session.cc



* Add tests

* Implement feedback <3

* Improve tests

* chore: lint

* docs: add note about clearing cache in ses.clearData

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Felix Rieseberg <fr@makenotion.com>
2024-12-04 13:35:08 -08:00
electron-roller[bot]
c54f1f98fe chore: bump chromium to 132.0.6834.32 (34-x-y) (#44949)
chore: bump chromium in DEPS to 132.0.6834.32

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
2024-12-04 14:02:31 -05:00
trop[bot]
a7066af0f9 fix: modernize-use-equals-default warnings (#44944)
fix: use '= default' to define a trivial destructor [modernize-use-equals-default]

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-12-03 21:19:32 -06:00
trop[bot]
7f6594654c docs: fix grammar in app.relaunch docs (#44942)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Niklas Wenzel <dev@nikwen.de>
2024-12-03 10:12:47 -08:00
trop[bot]
f383391c0e feat: WebFrameMain.collectJavaScriptCallStack() (#44938)
* feat: WebFrameMain.unresponsiveDocumentJSCallStack

Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>

* Revert "feat: WebFrameMain.unresponsiveDocumentJSCallStack"

This reverts commit e0612bc1a00a5282cba5df97da3c9c90e96ef244.

Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>

* feat: frame.collectJavaScriptCallStack()

Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>

* feat: frame.collectJavaScriptCallStack()

Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>

* Update web-frame-main.md

Co-authored-by: Sam Maddock <smaddock@slack-corp.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>
2024-12-03 09:55:52 -08:00
trop[bot]
ed0946c880 chore: remove unused registry arg from GetPrivilegeRequiredByUrl() (#44931)
this has never been used; introduced by 91071570

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-12-02 15:37:21 -06:00
trop[bot]
d1eee44b19 docs: clarify what session.clearData() with data type 'cache' deletes (#44930)
* docs: clarify what session.clearData() with data type 'cache' deletes

Co-authored-by: Niklas Wenzel <dev@nikwen.de>

* docs: include `shadercache`, too

Co-authored-by: John Kleinschmidt <kleinschmidtorama@gmail.com>

Co-authored-by: Niklas Wenzel <dev@nikwen.de>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Niklas Wenzel <dev@nikwen.de>
2024-12-02 14:03:12 -05:00
trop[bot]
498a7d82cc chore: remove unused arg from BaseWindow::GetBackgroundColor() (#44924)
chore: remove unused gin_helper::Arguments* arg from BaseWindow::GetBackgroundColor()

looks like this was added in db79734b but never used

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-12-02 13:58:52 -05:00
trop[bot]
dc53f6e73b docs: clarify session.clearData() can delete more types than listed (#44927)
docs: warn that session.clearData() might delete more than expected

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Niklas Wenzel <dev@nikwen.de>
2024-12-02 13:51:00 -05:00
trop[bot]
fa98b4d542 fix: don't use deprecated ui::MouseEvent constructor (#44919)
* refactor: do not use deprecated gfx::Point constructor for MouseEvent

Deprecated in https://chromium-review.googlesource.com/c/1444251

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* refactor: use WebInputEvent::GetTypeAsUiEventType() instead of rolling our own

Added in https://chromium-review.googlesource.com/c/chromium/src/+/2180291

Co-authored-by: Charles Kerr <charles@charleskerr.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-12-02 13:30:50 -05:00
trop[bot]
1c2015ed1f chore: remove unused isolate argument from Cookies constructor (#44923)
* chore: remove unused isolate argument from Cookies constructor

unused since the ginify cookies refactor in Mar 2020, commit 22202255

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* fix: constructor only takes one arg now, so mark it explicit

Co-authored-by: Charles Kerr <charles@charleskerr.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-12-02 13:25:44 -05:00
trop[bot]
d0668e6a3a fix: remove unused id argument from TranslateToStock() (#44912)
unused since fb537d91fc

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-12-02 08:36:48 -06:00
trop[bot]
d7284f0262 docs: specify default value for respondToAuthRequestsFromMainProcess (#44901)
docs: specify default value for respondToAuthRequestsFromMainProcess

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Niklas Wenzel <dev@nikwen.de>
2024-12-01 07:13:39 -06:00
trop[bot]
b33ea0d72d docs: fix a syntax issue in document breaking changes (#44905)
fix: syntax issue in docs

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: illusory-dream <37270118+illusory-dream@users.noreply.github.com>
2024-12-01 07:12:11 -06:00
trop[bot]
c63613f290 refactor: return-braced-init-list pt 2 of 2 (#44891)
* refactor: more return-braced-init-list, this time for v8 and gin objects

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* refactor: more return-braced-init-list, this time for v8, gin, std, and base objects

Co-authored-by: Charles Kerr <charles@charleskerr.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-11-30 16:47:30 -06:00
trop[bot]
dc0c6c6f3f refactor: reduce scope of relauncher's internal constants (#44892)
* refactor: make kRelauncherArgSeparator private to relauncher.cc

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* refactor: make kRelauncherTypeArg private to relauncher.cc

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* refactor: remove unused type relauncher::CharType

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* refactor: move private constants into standalone private namespace

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* refactor: move kWaitEventName into the only function that uses it

Co-authored-by: Charles Kerr <charles@charleskerr.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-11-30 16:46:45 -06:00
trop[bot]
a92b3944a1 fix: misc-use-internal-linkage warnings (#44872)
* refactor: fix misc-use-internal-linkage warnings:

move impl functions into anonymous namespace so that they're not visible
to other compilation units
2024-11-27 12:35:37 -06:00
trop[bot]
5ca3f950e9 refactor: use base::Extend in AddAdditionalSchemes() (#44866)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-11-27 10:09:55 -06:00
trop[bot]
99f2bab4a4 refactor: fix modernize-return-braced-init-list warnings (#44856)
* refactor: avoid repeating the return type from the declaration; use a braced initializer list instead [modernize-return-braced-init-list]

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* refactor: avoid repeating the return type from the declaration; use a braced initializer list instead [modernize-return-braced-init-list]

NB: using the braced-initializer list uncovered an error here:
the float returned by std::floor() can't be implicitly cast to
an int. This is solved by using base::ClampFloor<int>() instead.
std::floor()

Co-authored-by: Charles Kerr <charles@charleskerr.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-11-26 22:18:13 -06:00
trop[bot]
c0d1c3481a fix: modernize-use-nodiscard clang-tidy warnings (#44833)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-11-25 13:55:56 -05:00
trop[bot]
5a0e1ccf73 fix: modernize-avoid-c-arrays (#44834)
use string_view for constants used in methods that take string_view args

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-11-25 13:55:19 -05:00
trop[bot]
d8a7c57506 fix: modernize-use-using clang-tidy warnings (#44835)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-11-25 13:53:59 -05:00
trop[bot]
a30cf5b551 docs: correct stable release dates for v34.0.0 (#44829)
* docs: correct stable release dates for v34.0.0

Co-authored-by: Ajay Kemparaj <ajaykemparaj@gmail.com>

* docs: correct stable release dates for v34.0.0

Co-authored-by: Ajay Kemparaj <ajaykemparaj@gmail.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Ajay Kemparaj <ajaykemparaj@gmail.com>
2024-11-25 11:04:30 -05:00
trop[bot]
6208b61a38 refactor: remove unnecessary constructor code (#44827)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-11-24 12:15:04 -06:00
trop[bot]
73243cb9c4 fix: remove unused local variables (#44823)
* chore: remove unused local non-trivial variable relaunch_executable

became unused in June 2016 in 0d066de5

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* chore: only declare program_name local variable if used

We declared it everywhere but only used it on Windows

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* chore: remove unused local non-trivial variable path from UnregisterXWindow

it became unused in 2020 by 72a08926

Co-authored-by: Charles Kerr <charles@charleskerr.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-11-24 08:54:56 -06:00
trop[bot]
5670b17b40 docs: update new GitHub issue link (#44811)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2024-11-22 16:50:54 -06:00
trop[bot]
103a7c1838 fix: crash calling shell.readShortcutLink (#44804)
* fix: crash calling shell.readShortcutLink

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>

* chore: update .patches after trop

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2024-11-22 11:00:12 -06:00
trop[bot]
cfdf7992d3 build: remove duplicate line in gn file (#44792)
style: remove duplicate line in gn file

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: bill.shen <15865969+cucbin@users.noreply.github.com>
2024-11-22 15:36:23 +01:00
trop[bot]
7d260a1305 fix: big endian bug in V8 serialization (#44797)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-11-22 15:35:55 +01:00
trop[bot]
d2bafe870e fix: ensure context-menu emitted for draggable regions (#44799)
* fix: ensure context-menu emitted for draggable regions

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>

* chore: address suggestions from review

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2024-11-22 09:28:12 -05:00
electron-roller[bot]
bbdce52b12 chore: bump node to v20.18.1 (34-x-y) (#44782)
* chore: bump node in DEPS to v20.18.1

* chore: update patches

* lib: remove lib/internal/idna.js

https://github.com/nodejs/node/pull/55050

* buffer: fix out of range for toString

https://github.com/nodejs/node/pull/54553

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2024-11-22 10:21:55 +01:00
electron-roller[bot]
b72b661f3c chore: bump chromium to 132.0.6834.15 (34-x-y) (#44783)
* chore: bump chromium in DEPS to 132.0.6834.15

* chore: update patches

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2024-11-21 16:56:48 -05:00
trop[bot]
b6f97b7952 fix: windows save dialog extension bug (#44770)
* fix: windows save dialog extension bug

* refactor: simplify firstSpec extraction



* refactor: split when necessary



---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: nilaoda <nilaoda@live.com>
2024-11-21 22:36:31 +01:00
trop[bot]
787d4c3859 fix: clang-tidy performance-inefficient-vector-operation warnings (#44775)
* fix: performance-inefficient-vector-operation warning in Clipboard::WriteFilesForTesting()

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* fix: performance-inefficient-vector-operation warning in GetUploadedReports()

Co-authored-by: Charles Kerr <charles@charleskerr.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-11-21 14:30:45 -05:00
trop[bot]
19e6ca921f docs: sync 34.0.0 release date to Chromium 132 release date (#44788)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-11-21 11:32:56 -06:00
trop[bot]
14c705349e fix: performance-no-automatic-move clang-tidy warnings (#44773)
* fix: performance-no-automatic-move in GetLogFileName()

remove `const` from log_filename.

Warning fixed by this commit:

../../electron/shell/common/logging.cc:40:12: warning: constness of 'log_filename' prevents automatic move [performance-no-automatic-move]

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* fix: performance-no-automatic-move in GetBundleResourcePath()

remove `const` from request_relative_path.

Warning fixed by this commit:

electron/shell/browser/extensions/electron_extensions_browser_client.cc:187:10: warning: constness of 'request_relative_path' prevents automatic move [performance-no-automatic-move]

Co-authored-by: Charles Kerr <charles@charleskerr.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-11-21 15:29:52 +01:00
170 changed files with 1326 additions and 641 deletions

View File

@@ -12,7 +12,7 @@ propose changes to this document in a pull request.
## [Issues](https://electronjs.org/docs/development/issues)
Issues are created [here](https://github.com/electron/electron/issues/new).
Issues are created [here](https://github.com/electron/electron/issues/new/choose).
* [How to Contribute in Issues](https://electronjs.org/docs/development/issues#how-to-contribute-in-issues)
* [Asking for General Help](https://electronjs.org/docs/development/issues#asking-for-general-help)

4
DEPS
View File

@@ -2,9 +2,9 @@ gclient_gn_args_from = 'src'
vars = {
'chromium_version':
'132.0.6834.6',
'132.0.6834.32',
'node_version':
'v20.18.0',
'v20.18.1',
'nan_version':
'e14bdcd1f72d62bca1d541b66da43130384ec213',
'squirrel.mac_version':

View File

@@ -160,14 +160,12 @@ static_library("chrome") {
"//chrome/browser/icon_loader_win.cc",
"//chrome/browser/media/webrtc/window_icon_util_win.cc",
"//chrome/browser/process_singleton_win.cc",
"//chrome/browser/ui/frame/window_frame_util.h",
"//chrome/browser/win/chrome_process_finder.cc",
"//chrome/browser/win/chrome_process_finder.h",
"//chrome/browser/win/chrome_select_file_dialog_factory.cc",
"//chrome/browser/win/chrome_select_file_dialog_factory.h",
"//chrome/browser/win/titlebar_config.cc",
"//chrome/browser/win/titlebar_config.h",
"//chrome/browser/win/titlebar_config.h",
"//chrome/browser/win/util_win_service.cc",
"//chrome/browser/win/util_win_service.h",
"//chrome/child/v8_crashpad_support_win.cc",

View File

@@ -514,20 +514,20 @@ and `will-quit` events will not be emitted.
* `args` string[] (optional)
* `execPath` string (optional)
Relaunches the app when current instance exits.
Relaunches the app when the current instance exits.
By default, the new instance will use the same working directory and command line
arguments with current instance. When `args` is specified, the `args` will be
passed as command line arguments instead. When `execPath` is specified, the
`execPath` will be executed for relaunch instead of current app.
arguments as the current instance. When `args` is specified, the `args` will be
passed as the command line arguments instead. When `execPath` is specified, the
`execPath` will be executed for the relaunch instead of the current app.
Note that this method does not quit the app when executed, you have to call
Note that this method does not quit the app when executed. You have to call
`app.quit` or `app.exit` after calling `app.relaunch` to make the app restart.
When `app.relaunch` is called for multiple times, multiple instances will be
started after current instance exited.
When `app.relaunch` is called multiple times, multiple instances will be
started after the current instance exits.
An example of restarting current instance immediately and adding a new command
An example of restarting the current instance immediately and adding a new command
line argument to the new instance:
```js

View File

@@ -72,7 +72,7 @@ The `menu` object has the following instance methods:
#### `menu.popup([options])`
* `options` Object (optional)
* `window` [BrowserWindow](browser-window.md) (optional) - Default is the focused window.
* `window` [BaseWindow](base-window.md) (optional) - Default is the focused window.
* `x` number (optional) - Default is the current mouse cursor position.
Must be declared if `y` is declared.
* `y` number (optional) - Default is the current mouse cursor position.
@@ -86,13 +86,13 @@ The `menu` object has the following instance methods:
Can be `none`, `mouse`, `keyboard`, `touch`, `touchMenu`, `longPress`, `longTap`, `touchHandle`, `stylus`, `adjustSelection`, or `adjustSelectionReset`.
* `callback` Function (optional) - Called when menu is closed.
Pops up this menu as a context menu in the [`BrowserWindow`](browser-window.md).
Pops up this menu as a context menu in the [`BaseWindow`](base-window.md).
#### `menu.closePopup([browserWindow])`
#### `menu.closePopup([window])`
* `browserWindow` [BrowserWindow](browser-window.md) (optional) - Default is the focused window.
* `window` [BaseWindow](base-window.md) (optional) - Default is the focused window.
Closes the context menu in the `browserWindow`.
Closes the context menu in the `window`.
#### `menu.append(menuItem)`

View File

@@ -1360,6 +1360,36 @@ specified when registering the protocol.
Returns `Promise<void>` - resolves when the code cache clear operation is complete.
#### `ses.getSharedDictionaryUsageInfo()`
Returns `Promise<SharedDictionaryUsageInfo[]>` - an array of shared dictionary information entries in Chromium's networking service's storage.
Shared dictionaries are used to power advanced compression of data sent over the wire, specifically with Brotli and ZStandard. You don't need to call any of the shared dictionary APIs in Electron to make use of this advanced web feature, but if you do, they allow deeper control and inspection of the shared dictionaries used during decompression.
To get detailed information about a specific shared dictionary entry, call `getSharedDictionaryInfo(options)`.
#### `ses.getSharedDictionaryInfo(options)`
* `options` Object
* `frameOrigin` string - The origin of the frame where the request originates. Its specific to the individual frame making the request and is defined by its scheme, host, and port. In practice, will look like a URL.
* `topFrameSite` string - The site of the top-level browsing context (the main frame or tab that contains the request). Its less granular than `frameOrigin` and focuses on the broader "site" scope. In practice, will look like a URL.
Returns `Promise<SharedDictionaryInfo[]>` - an array of shared dictionary information entries in Chromium's networking service's storage.
To get information about all present shared dictionaries, call `getSharedDictionaryUsageInfo()`.
#### `ses.clearSharedDictionaryCache()`
Returns `Promise<void>` - resolves when the dictionary cache has been cleared, both in memory and on disk.
#### `ses.clearSharedDictionaryCacheForIsolationKey(options)`
* `options` Object
* `frameOrigin` string - The origin of the frame where the request originates. Its specific to the individual frame making the request and is defined by its scheme, host, and port. In practice, will look like a URL.
* `topFrameSite` string - The site of the top-level browsing context (the main frame or tab that contains the request). Its less granular than `frameOrigin` and focuses on the broader "site" scope. In practice, will look like a URL.
Returns `Promise<void>` - resolves when the dictionary cache has been cleared for the specified isolation key, both in memory and on disk.
#### `ses.setSpellCheckerEnabled(enable)`
* `enable` boolean
@@ -1509,9 +1539,11 @@ session is persisted on disk. For in memory sessions this returns `null`.
#### `ses.clearData([options])`
* `options` Object (optional)
* `dataTypes` String[] (optional) - The types of data to clear. By default, this will clear all types of data.
* `dataTypes` String[] (optional) - The types of data to clear. By default, this will clear all types of data. This
can potentially include data types not explicitly listed here. (See Chromium's
[`BrowsingDataRemover`][browsing-data-remover] for the full list.)
* `backgroundFetch` - Background Fetch
* `cache` - Cache
* `cache` - Cache (includes `cachestorage` and `shadercache`)
* `cookies` - Cookies
* `downloads` - Downloads
* `fileSystems` - File Systems
@@ -1535,7 +1567,9 @@ This method clears more types of data and is more thorough than the
**Note:** Cookies are stored at a broader scope than origins. When removing cookies and filtering by `origins` (or `excludeOrigins`), the cookies will be removed at the [registrable domain](https://url.spec.whatwg.org/#host-registrable-domain) level. For example, clearing cookies for the origin `https://really.specific.origin.example.com/` will end up clearing all cookies for `example.com`. Clearing cookies for the origin `https://my.website.example.co.uk/` will end up clearing all cookies for `example.co.uk`.
For more information, refer to Chromium's [`BrowsingDataRemover` interface](https://source.chromium.org/chromium/chromium/src/+/main:content/public/browser/browsing_data_remover.h).
**Note:** Clearing cache data will also clear the shared dictionary cache. This means that any dictionaries used for compression may be reloaded after clearing the cache. If you wish to clear the shared dictionary cache but leave other cached data intact, you may want to use the `clearSharedDictionaryCache` method.
For more information, refer to Chromium's [`BrowsingDataRemover` interface][browsing-data-remover].
### Instance Properties
@@ -1601,3 +1635,5 @@ app.whenReady().then(async () => {
console.log('Net-logs written to', path)
})
```
[browsing-data-remover]: https://source.chromium.org/chromium/chromium/src/+/main:content/public/browser/browsing_data_remover.h

View File

@@ -0,0 +1,12 @@
# SharedDictionaryInfo Object
* `match` string - The matching path pattern for the dictionary which was declared in 'use-as-dictionary' response header's `match` option.
* `matchDestinations` string[] - An array of matching destinations for the dictionary which was declared in 'use-as-dictionary' response header's `match-dest` option.
* `id` string - The Id for the dictionary which was declared in 'use-as-dictionary' response header's `id` option.
* `dictionaryUrl` string - URL of the dictionary.
* `lastFetchTime` Date - The time of when the dictionary was received from the network layer.
* `responseTime` Date - The time of when the dictionary was received from the server. For cached responses, this time could be "far" in the past.
* `expirationDuration` number - The expiration time for the dictionary which was declared in 'use-as-dictionary' response header's `expires` option in seconds.
* `lastUsedTime` Date - The time when the dictionary was last used.
* `size` number - The amount of bytes stored for this shared dictionary information object in Chromium's internal storage (usually Sqlite).
* `hash` string - The sha256 hash of the dictionary binary.

View File

@@ -0,0 +1,5 @@
# SharedDictionaryUsageInfo Object
* `frameOrigin` string - The origin of the frame where the request originates. Its specific to the individual frame making the request and is defined by its scheme, host, and port. In practice, will look like a URL.
* `topFrameSite` string - The site of the top-level browsing context (the main frame or tab that contains the request). Its less granular than `frameOrigin` and focuses on the broader "site" scope. In practice, will look like a URL.
* `totalSizeBytes` number - The amount of bytes stored for this shared dictionary information object in Chromium's internal storage (usually Sqlite).

View File

@@ -37,7 +37,10 @@ Process: [Main](../glossary.md#main-process)<br />
to load unsigned libraries. Unless you specifically need this capability, it is best to leave this disabled.
Default is `false`.
* `respondToAuthRequestsFromMainProcess` boolean (optional) - With this flag, all HTTP 401 and 407 network
requests created via the [net module](net.md) will allow responding to them via the [`app#login`](app.md#event-login) event in the main process instead of the default [`login`](client-request.md#event-login) event on the [`ClientRequest`](client-request.md) object.
requests created via the [net module](net.md) will allow responding to them via the
[`app#login`](app.md#event-login) event in the main process instead of the default
[`login`](client-request.md#event-login) event on the [`ClientRequest`](client-request.md) object. Default is
`false`.
Returns [`UtilityProcess`](utility-process.md#class-utilityprocess)

View File

@@ -142,6 +142,29 @@ ipcRenderer.on('port', (e, msg) => {
})
```
#### `frame.collectJavaScriptCallStack()` _Experimental_
Returns `Promise<string> | Promise<void>` - A promise that resolves with the currently running JavaScript call
stack. If no JavaScript runs in the frame, the promise will never resolve. In cases where the call stack is
otherwise unable to be collected, it will return `undefined`.
This can be useful to determine why the frame is unresponsive in cases where there's long-running JavaScript.
For more information, see the [proposed Crash Reporting API.](https://wicg.github.io/crash-reporting/)
```js
const { app } = require('electron')
app.commandLine.appendSwitch('enable-features', 'DocumentPolicyIncludeJSCallStacksInCrashReports')
app.on('web-contents-created', (_, webContents) => {
webContents.on('unresponsive', async () => {
// Interrupt execution and collect call stack from unresponsive renderer
const callStack = await webContents.mainFrame.collectJavaScriptCallStack()
console.log('Renderer unresponsive\n', callStack)
})
})
```
### Instance Properties
#### `frame.ipc` _Readonly_

View File

@@ -111,14 +111,14 @@ The nonstandard `path` property of the Web `File` object was added in an early v
```js
// Before (renderer)
const file = document.querySelector('input[type=file]')
const file = document.querySelector('input[type=file]').files[0]
alert(`Uploaded file path was: ${file.path}`)
```
```js
// After (renderer)
const file = document.querySelector('input[type=file]')
const file = document.querySelector('input[type=file]').files[0]
electron.showFilePath(file)
// (preload)

View File

@@ -9,10 +9,10 @@ check out our [Electron Versioning](./electron-versioning.md) doc.
| Electron | Alpha | Beta | Stable | EOL | Chrome | Node | Supported |
| ------- | ----- | ------- | ------ | ------ | ---- | ---- | ---- |
| 34.0.0 | 2024-Oct-17 | 2024-Nov-13 | 2024-Jan-07 | 2025-Jun-24 | M132 | TBD | ✅ |
| 34.0.0 | 2024-Oct-17 | 2024-Nov-13 | 2025-Jan-14 | 2025-Jun-24 | M132 | TBD | ✅ |
| 33.0.0 | 2024-Aug-22 | 2024-Sep-18 | 2024-Oct-15 | 2025-Apr-29 | M130 | v20.18 | ✅ |
| 32.0.0 | 2024-Jun-14 | 2024-Jul-24 | 2024-Aug-20 | 2025-Mar-04 | M128 | v20.16 | ✅ |
| 31.0.0 | 2024-Apr-18 | 2024-May-15 | 2024-Jun-11 | 2025-Jan-07 | M126 | v20.14 | ✅ |
| 31.0.0 | 2024-Apr-18 | 2024-May-15 | 2024-Jun-11 | 2025-Jan-14 | M126 | v20.14 | ✅ |
| 30.0.0 | 2024-Feb-22 | 2024-Mar-20 | 2024-Apr-16 | 2024-Oct-15 | M124 | v20.11 | 🚫 |
| 29.0.0 | 2023-Dec-07 | 2024-Jan-24 | 2024-Feb-20 | 2024-Aug-20 | M122 | v20.9 | 🚫 |
| 28.0.0 | 2023-Oct-11 | 2023-Nov-06 | 2023-Dec-05 | 2024-Jun-11 | M120 | v18.18 | 🚫 |

View File

@@ -133,6 +133,8 @@ auto_filenames = {
"docs/api/structures/segmented-control-segment.md",
"docs/api/structures/serial-port.md",
"docs/api/structures/service-worker-info.md",
"docs/api/structures/shared-dictionary-info.md",
"docs/api/structures/shared-dictionary-usage-info.md",
"docs/api/structures/shared-worker-info.md",
"docs/api/structures/sharing-item.md",
"docs/api/structures/shortcut-details.md",

View File

@@ -134,3 +134,4 @@ feat_allow_usage_of_sccontentsharingpicker_on_supported_platforms.patch
chore_partial_revert_of.patch
fix_software_compositing_infinite_loop.patch
refactor_unfilter_unresponsive_events.patch
support_bstr_pkey_appusermodel_id_in_windows_shortcuts.patch

View File

@@ -116,10 +116,10 @@ index 083af135d890c2837e72c314e170e81931bd2a20..5245ea88441ef84c15b8052a9011ce70
// Visibility -----------------------------------------------------------
diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc
index f5fe2e061448673c788315a167efff1fb70c3ef0..ed0c77c14e8dcf3e6d7328c8a9c640388b7be92d 100644
index ad134361e0b9c9a9db4cec06c429102d5dbe0c4e..82aef58c0a3c00c818e0d60df9a5296162c57cc3 100644
--- a/third_party/blink/renderer/core/exported/web_view_impl.cc
+++ b/third_party/blink/renderer/core/exported/web_view_impl.cc
@@ -2452,6 +2452,10 @@ void WebViewImpl::SetPageLifecycleStateInternal(
@@ -2456,6 +2456,10 @@ void WebViewImpl::SetPageLifecycleStateInternal(
TRACE_EVENT2("navigation", "WebViewImpl::SetPageLifecycleStateInternal",
"old_state", old_state, "new_state", new_state);
@@ -130,7 +130,7 @@ index f5fe2e061448673c788315a167efff1fb70c3ef0..ed0c77c14e8dcf3e6d7328c8a9c64038
bool storing_in_bfcache = new_state->is_in_back_forward_cache &&
!old_state->is_in_back_forward_cache;
bool restoring_from_bfcache = !new_state->is_in_back_forward_cache &&
@@ -3984,10 +3988,23 @@ PageScheduler* WebViewImpl::Scheduler() const {
@@ -3988,10 +3992,23 @@ PageScheduler* WebViewImpl::Scheduler() const {
return GetPage()->GetPageScheduler();
}
@@ -155,7 +155,7 @@ index f5fe2e061448673c788315a167efff1fb70c3ef0..ed0c77c14e8dcf3e6d7328c8a9c64038
// Do not throttle if the page should be painting.
bool is_visible =
diff --git a/third_party/blink/renderer/core/exported/web_view_impl.h b/third_party/blink/renderer/core/exported/web_view_impl.h
index d5397c53559ba239e46c9485fb30daea89bd392b..4989d9f6a28d519098b16e832c2a36c61ab04c15 100644
index e4784453b357e2a9c18ccf5acfde43f5afd583ae..2c5a9f08ac34ae4106f25c42dca04f78ae703618 100644
--- a/third_party/blink/renderer/core/exported/web_view_impl.h
+++ b/third_party/blink/renderer/core/exported/web_view_impl.h
@@ -448,6 +448,7 @@ class CORE_EXPORT WebViewImpl final : public WebView,
@@ -166,7 +166,7 @@ index d5397c53559ba239e46c9485fb30daea89bd392b..4989d9f6a28d519098b16e832c2a36c6
void SetVisibilityState(mojom::blink::PageVisibilityState visibility_state,
bool is_initial_state) override;
mojom::blink::PageVisibilityState GetVisibilityState() override;
@@ -933,6 +934,8 @@ class CORE_EXPORT WebViewImpl final : public WebView,
@@ -936,6 +937,8 @@ class CORE_EXPORT WebViewImpl final : public WebView,
// If true, we send IPC messages when |preferred_size_| changes.
bool send_preferred_size_changes_ = false;

View File

@@ -49,7 +49,7 @@ index 2f33ec660a975522c473ecd50e633b5edaca707f..65221a51927d9f44bd6adbad88fa1144
// its owning reference back to our owning LocalFrame.
client_->Detached(type);
diff --git a/third_party/blink/renderer/core/frame/local_frame.cc b/third_party/blink/renderer/core/frame/local_frame.cc
index 5c8c50fc2025a160bfb0587cd46ba45f8d58a175..d918e9d165acefa8ba3a225aec261ebf028c40f7 100644
index 6a071e614bfd44fce79bf6db80d026f24eefdd7f..1daf1d65e2e6ac494790aa9201609c9ca9af6828 100644
--- a/third_party/blink/renderer/core/frame/local_frame.cc
+++ b/third_party/blink/renderer/core/frame/local_frame.cc
@@ -746,10 +746,6 @@ bool LocalFrame::DetachImpl(FrameDetachType type) {

View File

@@ -33,7 +33,7 @@ index 9580623c57cb02f7e924742c6cb1638676881115..ad80d8e63dfebbbdb8eaa63bfe38a6f8
"//base",
"//build:branding_buildflags",
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
index 1a136cdeb8aea796a8b3f81e4f791c29ae02cf02..9033419bb880830076835e8400276e738b71f428 100644
index 3914cb63eed91e0e8a6eb8b64092c5dbe5348781..a6a24986f33fb79d3226840ffaa62448026f7383 100644
--- a/chrome/browser/BUILD.gn
+++ b/chrome/browser/BUILD.gn
@@ -4525,7 +4525,7 @@ static_library("browser") {

View File

@@ -9,10 +9,10 @@ potentially prevent a window from being created.
TODO(loc): this patch is currently broken.
diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc
index d29dac893805535bbbd9aefe096a0ca2825a01aa..4f31803e492d0d05b29659f8bf75b6fee7aff25e 100644
index 95b2ad64c83361c452f9256cf96873f2cd82b446..53f96ccd4954972bc78ebccf4bf479ac8564a8d3 100644
--- a/content/browser/renderer_host/render_frame_host_impl.cc
+++ b/content/browser/renderer_host/render_frame_host_impl.cc
@@ -9170,6 +9170,7 @@ void RenderFrameHostImpl::CreateNewWindow(
@@ -9179,6 +9179,7 @@ void RenderFrameHostImpl::CreateNewWindow(
last_committed_origin_, params->window_container_type,
params->target_url, params->referrer.To<Referrer>(),
params->frame_name, params->disposition, *params->features,
@@ -21,10 +21,10 @@ index d29dac893805535bbbd9aefe096a0ca2825a01aa..4f31803e492d0d05b29659f8bf75b6fe
&no_javascript_access);
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index c93722f2fc5340edeeace5a1690d0fa7d84dffb2..e7e47a9aa5a22aea2aa0eeab7bd661b47c9cbdae 100644
index ea5a63ce49a1eb99792be2eafc64c44ad6da0a60..a722f77502e8b896fb5d55df7cb44d45d13df04f 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -4887,6 +4887,12 @@ FrameTree* WebContentsImpl::CreateNewWindow(
@@ -4891,6 +4891,12 @@ FrameTree* WebContentsImpl::CreateNewWindow(
SetPartitionedPopinOpenerOnNewWindowIfNeeded(new_contents_impl, params,
opener);
@@ -37,7 +37,7 @@ index c93722f2fc5340edeeace5a1690d0fa7d84dffb2..e7e47a9aa5a22aea2aa0eeab7bd661b4
// If the new frame has a name, make sure any SiteInstances that can find
// this named frame have proxies for it. Must be called after
// SetSessionStorageNamespace, since this calls CreateRenderView, which uses
@@ -4928,12 +4934,6 @@ FrameTree* WebContentsImpl::CreateNewWindow(
@@ -4932,12 +4938,6 @@ FrameTree* WebContentsImpl::CreateNewWindow(
AddWebContentsDestructionObserver(new_contents_impl);
}

View File

@@ -14,10 +14,10 @@ track down the source of this problem & figure out if we can fix it
by changing something in Electron.
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 1b748a2e0d803217985847014855b095b53c58e5..0e742f196367bbbe8c4e147ef4db4f8dbbe4cbbe 100644
index 5469931a7c4dc7ad8b98f5ac54c5538a7ba23a78..9bd28a4029de17833d5147986736747075ff35bc 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -4813,9 +4813,6 @@ FrameTree* WebContentsImpl::CreateNewWindow(
@@ -4817,9 +4817,6 @@ FrameTree* WebContentsImpl::CreateNewWindow(
bool renderer_started_hidden =
params.disposition == WindowOpenDisposition::NEW_BACKGROUND_TAB;

View File

@@ -218,10 +218,10 @@ index c6838c83ef971b88769b1f3fba8095025ae25464..2da6a4e08340e72ba7de5d03444c2f17
content::WebContents* AddNewContents(
content::WebContents* source,
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index de6b544df67c9702b6771b08b003805b4f5fb5a4..4de45e398ec013714302c8cbaafa3bb6aa01ef8e 100644
index 1f0b9a602a9e6cf565818ad584688b783fe3430b..1d1d761f8c7ff09cbd2c6a567e070ac41d3a1759 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -4782,8 +4782,7 @@ FrameTree* WebContentsImpl::CreateNewWindow(
@@ -4786,8 +4786,7 @@ FrameTree* WebContentsImpl::CreateNewWindow(
if (delegate_ && delegate_->IsWebContentsCreationOverridden(
source_site_instance, params.window_container_type,

View File

@@ -12,7 +12,7 @@ Ideally we could add an embedder observer pattern here but that can be
done in future work.
diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc
index ed0c77c14e8dcf3e6d7328c8a9c640388b7be92d..7bf2296e1a3b48cc3aa7f031d5b835fab8488267 100644
index 82aef58c0a3c00c818e0d60df9a5296162c57cc3..930e6160134897a91d4ed8f1517bc90d708cfd04 100644
--- a/third_party/blink/renderer/core/exported/web_view_impl.cc
+++ b/third_party/blink/renderer/core/exported/web_view_impl.cc
@@ -169,6 +169,7 @@
@@ -23,7 +23,7 @@ index ed0c77c14e8dcf3e6d7328c8a9c640388b7be92d..7bf2296e1a3b48cc3aa7f031d5b835fa
#include "third_party/blink/renderer/platform/graphics/image.h"
#include "third_party/blink/renderer/platform/graphics/paint/cull_rect.h"
#include "third_party/blink/renderer/platform/graphics/paint/paint_record_builder.h"
@@ -1850,6 +1851,7 @@ void WebView::ApplyWebPreferences(const web_pref::WebPreferences& prefs,
@@ -1854,6 +1855,7 @@ void WebView::ApplyWebPreferences(const web_pref::WebPreferences& prefs,
#if BUILDFLAG(IS_MAC)
web_view_impl->SetMaximumLegibleScale(
prefs.default_maximum_page_scale_factor);

View File

@@ -16,13 +16,13 @@ Linux or Windows to un-fullscreen in some circumstances without this
change.
diff --git a/chrome/browser/ui/exclusive_access/fullscreen_controller.cc b/chrome/browser/ui/exclusive_access/fullscreen_controller.cc
index 176f02f0abb4220564caa1d794faabc5b22bd8bc..4b08918cef83a84076e452b41302588efdfb0619 100644
index 47d494f0c3c02bc65ca18521cc1049e766e050cb..40262c3b77980be3208387d64a685beef2035619 100644
--- a/chrome/browser/ui/exclusive_access/fullscreen_controller.cc
+++ b/chrome/browser/ui/exclusive_access/fullscreen_controller.cc
@@ -21,12 +21,16 @@
@@ -20,12 +20,16 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/history/history_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
+#if 0
#include "chrome/browser/ui/blocked_content/popunder_preventer.h"
+#endif
@@ -36,7 +36,7 @@ index 176f02f0abb4220564caa1d794faabc5b22bd8bc..4b08918cef83a84076e452b41302588e
#include "chrome/common/chrome_switches.h"
#include "components/history/core/browser/history_service.h"
#include "components/history/core/browser/history_types.h"
@@ -259,10 +263,12 @@ void FullscreenController::EnterFullscreenModeForTab(
@@ -260,10 +264,12 @@ void FullscreenController::EnterFullscreenModeForTab(
return;
}
@@ -49,7 +49,7 @@ index 176f02f0abb4220564caa1d794faabc5b22bd8bc..4b08918cef83a84076e452b41302588e
// Keep the current state. |SetTabWithExclusiveAccess| may change the return
// value of |IsWindowFullscreenForTabOrPending|.
@@ -374,12 +380,14 @@ void FullscreenController::ExitFullscreenModeForTab(WebContents* web_contents) {
@@ -375,12 +381,14 @@ void FullscreenController::ExitFullscreenModeForTab(WebContents* web_contents) {
void FullscreenController::FullscreenTabOpeningPopup(
content::WebContents* opener,
content::WebContents* popup) {
@@ -64,7 +64,7 @@ index 176f02f0abb4220564caa1d794faabc5b22bd8bc..4b08918cef83a84076e452b41302588e
}
void FullscreenController::OnTabDeactivated(
@@ -465,10 +473,12 @@ void FullscreenController::FullscreenTransitionCompleted() {
@@ -466,10 +474,12 @@ void FullscreenController::FullscreenTransitionCompleted() {
#endif // DCHECK_IS_ON()
tab_fullscreen_target_display_id_ = display::kInvalidDisplayId;
started_fullscreen_transition_ = false;
@@ -77,7 +77,7 @@ index 176f02f0abb4220564caa1d794faabc5b22bd8bc..4b08918cef83a84076e452b41302588e
}
void FullscreenController::RunOrDeferUntilTransitionIsComplete(
@@ -576,18 +586,17 @@ void FullscreenController::EnterFullscreenModeInternal(
@@ -577,18 +587,17 @@ void FullscreenController::EnterFullscreenModeInternal(
// Do not enter fullscreen mode if disallowed by pref. This prevents the user
// from manually entering fullscreen mode and also disables kiosk mode on
// desktop platforms.
@@ -101,7 +101,7 @@ index 176f02f0abb4220564caa1d794faabc5b22bd8bc..4b08918cef83a84076e452b41302588e
if (option == TAB) {
url = GetRequestingOrigin();
tab_fullscreen_ = true;
@@ -620,6 +629,7 @@ void FullscreenController::EnterFullscreenModeInternal(
@@ -621,6 +630,7 @@ void FullscreenController::EnterFullscreenModeInternal(
if (!extension_caused_fullscreen_.is_empty())
url = extension_caused_fullscreen_;
}
@@ -109,7 +109,7 @@ index 176f02f0abb4220564caa1d794faabc5b22bd8bc..4b08918cef83a84076e452b41302588e
fullscreen_start_time_ = base::TimeTicks::Now();
if (option == BROWSER)
@@ -640,6 +650,7 @@ void FullscreenController::ExitFullscreenModeInternal() {
@@ -641,6 +651,7 @@ void FullscreenController::ExitFullscreenModeInternal() {
return;
}
@@ -117,7 +117,7 @@ index 176f02f0abb4220564caa1d794faabc5b22bd8bc..4b08918cef83a84076e452b41302588e
// `fullscreen_start_time_` is null if a fullscreen tab moves to a new window.
if (fullscreen_start_time_ && exclusive_access_tab()) {
ukm::SourceId source_id =
@@ -651,15 +662,16 @@ void FullscreenController::ExitFullscreenModeInternal() {
@@ -652,15 +663,16 @@ void FullscreenController::ExitFullscreenModeInternal() {
.Record(ukm::UkmRecorder::Get());
fullscreen_start_time_.reset();
}
@@ -137,7 +137,7 @@ index 176f02f0abb4220564caa1d794faabc5b22bd8bc..4b08918cef83a84076e452b41302588e
exclusive_access_manager()->context()->ExitFullscreen();
extension_caused_fullscreen_ = GURL();
exclusive_access_manager()->UpdateBubble(base::NullCallback());
@@ -721,8 +733,12 @@ GURL FullscreenController::GetEmbeddingOrigin() const {
@@ -722,8 +734,12 @@ GURL FullscreenController::GetEmbeddingOrigin() const {
void FullscreenController::RecordMetricsOnFullscreenApiRequested(
content::RenderFrameHost* requesting_frame) {
history::HistoryService* service =

View File

@@ -23,10 +23,10 @@ Upstream bug https://bugs.chromium.org/p/chromium/issues/detail?id=1081397.
Upstreamed at https://chromium-review.googlesource.com/c/chromium/src/+/3856266.
diff --git a/content/browser/renderer_host/navigation_request.cc b/content/browser/renderer_host/navigation_request.cc
index f8e18b15a19517b28057dd007adccc0fd222e2e1..6e1656f3bd62b597952528bfee884666111277fc 100644
index 4f76cfa33ea68a49e1c7cec096cd34a1587042a2..0ee902a2ff5f82b75f4b6cb2eb0f96209e260183 100644
--- a/content/browser/renderer_host/navigation_request.cc
+++ b/content/browser/renderer_host/navigation_request.cc
@@ -10802,6 +10802,12 @@ NavigationRequest::GetOriginForURLLoaderFactoryUncheckedWithDebugInfo() {
@@ -10806,6 +10806,12 @@ NavigationRequest::GetOriginForURLLoaderFactoryUncheckedWithDebugInfo() {
"blob");
}

View File

@@ -13,10 +13,10 @@ This patch can be removed should we choose to support chrome.fileSystem
or support it enough to fix the crash.
diff --git a/chrome/browser/resources/pdf/pdf_viewer.ts b/chrome/browser/resources/pdf/pdf_viewer.ts
index f7e98f2c94ac9802062880f9341214f88c85a669..86b0b3b7596e7da68c536c0dea3d95b22bdd9481 100644
index a861c34084b90561beab221ac13929bef295ac6d..94ea00dba8a6bb314421e6bd0ccef32e3ac02829 100644
--- a/chrome/browser/resources/pdf/pdf_viewer.ts
+++ b/chrome/browser/resources/pdf/pdf_viewer.ts
@@ -1076,28 +1076,27 @@ export class PdfViewerElement extends PdfViewerBaseElement {
@@ -1086,28 +1086,27 @@ export class PdfViewerElement extends PdfViewerBaseElement {
dataArray = [result.dataToSave];
}
@@ -65,7 +65,7 @@ index f7e98f2c94ac9802062880f9341214f88c85a669..86b0b3b7596e7da68c536c0dea3d95b2
}
/**
@@ -1288,36 +1287,33 @@ export class PdfViewerElement extends PdfViewerBaseElement {
@@ -1298,36 +1297,33 @@ export class PdfViewerElement extends PdfViewerBaseElement {
fileName = fileName + '.pdf';
}
@@ -128,7 +128,7 @@ index f7e98f2c94ac9802062880f9341214f88c85a669..86b0b3b7596e7da68c536c0dea3d95b2
// <if expr="enable_pdf_ink2">
// Ink2 doesn't need to exit annotation mode after save.
@@ -1464,6 +1460,9 @@ declare global {
@@ -1474,6 +1470,9 @@ declare global {
interface HTMLElementTagNameMap {
'pdf-viewer': PdfViewerElement;
}

View File

@@ -87,10 +87,10 @@ index 51522e60d6dc14f1113cc438558b6b393c3fe73a..153ed02f493a83ef9ca354cc18736f93
// The view with active text input state, i.e., a focused <input> element.
// It will be nullptr if no such view exists. Note that the active view
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 9b84cc06795a5bef730cd81908254cf9ad11c836..1b748a2e0d803217985847014855b095b53c58e5 100644
index f8872945d67dacbdb9c3d610ff3719039eca7c94..5469931a7c4dc7ad8b98f5ac54c5538a7ba23a78 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -9384,7 +9384,7 @@ void WebContentsImpl::OnFocusedElementChangedInFrame(
@@ -9393,7 +9393,7 @@ void WebContentsImpl::OnFocusedElementChangedInFrame(
"WebContentsImpl::OnFocusedElementChangedInFrame",
"render_frame_host", frame);
RenderWidgetHostViewBase* root_view =

View File

@@ -64,10 +64,10 @@ index cba373664bec3a32abad6fe0396bd67b53b7e67f..7a985067b1371604644d48159f2f5aa7
#endif // THIRD_PARTY_BLINK_PUBLIC_WEB_WEB_SCRIPT_EXECUTION_CALLBACK_H_
diff --git a/third_party/blink/renderer/core/frame/local_frame.cc b/third_party/blink/renderer/core/frame/local_frame.cc
index d918e9d165acefa8ba3a225aec261ebf028c40f7..d6cbf553961137429c40fe768f28b104bda0f89b 100644
index 1daf1d65e2e6ac494790aa9201609c9ca9af6828..a4e649e4c63160e6152d3ff0d6a414ccd4f8b4cc 100644
--- a/third_party/blink/renderer/core/frame/local_frame.cc
+++ b/third_party/blink/renderer/core/frame/local_frame.cc
@@ -3130,6 +3130,7 @@ void LocalFrame::RequestExecuteScript(
@@ -3136,6 +3136,7 @@ void LocalFrame::RequestExecuteScript(
mojom::blink::EvaluationTiming evaluation_timing,
mojom::blink::LoadEventBlockingOption blocking_option,
WebScriptExecutionCallback callback,
@@ -75,7 +75,7 @@ index d918e9d165acefa8ba3a225aec261ebf028c40f7..d6cbf553961137429c40fe768f28b104
BackForwardCacheAware back_forward_cache_aware,
mojom::blink::WantResultOption want_result_option,
mojom::blink::PromiseResultOption promise_behavior) {
@@ -3162,7 +3163,7 @@ void LocalFrame::RequestExecuteScript(
@@ -3168,7 +3169,7 @@ void LocalFrame::RequestExecuteScript(
PausableScriptExecutor::CreateAndRun(
script_state, std::move(script_sources), execute_script_policy,
user_gesture, evaluation_timing, blocking_option, want_result_option,
@@ -85,7 +85,7 @@ index d918e9d165acefa8ba3a225aec261ebf028c40f7..d6cbf553961137429c40fe768f28b104
void LocalFrame::SetEvictCachedSessionStorageOnFreezeOrUnload() {
diff --git a/third_party/blink/renderer/core/frame/local_frame.h b/third_party/blink/renderer/core/frame/local_frame.h
index 13d1bea90341efbf51c476d3eacae49c8b960537..f508e3e9df98c167740b0574ef554bd17f41447f 100644
index 7e65f92dbeb987836be447dee2c660cdde8295ed..b5484a84fea067938a9e3d15f49f4c12c3739c20 100644
--- a/third_party/blink/renderer/core/frame/local_frame.h
+++ b/third_party/blink/renderer/core/frame/local_frame.h
@@ -824,6 +824,7 @@ class CORE_EXPORT LocalFrame final
@@ -204,7 +204,7 @@ index fa65331f40b90d812b71a489fd560e9359152d2b..390714d631dc88ef92d59ef9618a5706
const mojom::blink::UserActivationOption user_activation_option_;
const mojom::blink::LoadEventBlockingOption blocking_option_;
diff --git a/third_party/blink/renderer/core/frame/web_frame_test.cc b/third_party/blink/renderer/core/frame/web_frame_test.cc
index 3979c3987da3dd49218407c41977d9ce7d114edb..7e00f6bdd1d398f22d39823088caf5cde3a34dd9 100644
index 0802173ce891bcaca8b6bba2762ad2b80d4d5c75..6d31ccae7e6a9e204999d8475808afc11a0665c8 100644
--- a/third_party/blink/renderer/core/frame/web_frame_test.cc
+++ b/third_party/blink/renderer/core/frame/web_frame_test.cc
@@ -291,6 +291,7 @@ void ExecuteScriptsInMainWorld(

View File

@@ -133,10 +133,10 @@ index 05d3a12dd84c7005d46cc73b312f97ef418d96f5..4765de982802541b3efc7211d106acc7
const GURL& document_url,
const WeakDocumentPtr& weak_document_ptr,
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index 07907372f37d3ef5c9eaef7011ebcd4ed6a2fed6..ec5e553d93caf8a24de97465a870567d95944000 100644
index 09b7137cd3e26a1aef2c93ff7f08641df56704c0..732978b9650cac5102007c27b9226ff053c92d4f 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -2105,7 +2105,7 @@ void RenderProcessHostImpl::CreateNotificationService(
@@ -2106,7 +2106,7 @@ void RenderProcessHostImpl::CreateNotificationService(
case RenderProcessHost::NotificationServiceCreatorType::kSharedWorker:
case RenderProcessHost::NotificationServiceCreatorType::kDedicatedWorker: {
storage_partition_impl_->GetPlatformNotificationContext()->CreateService(
@@ -145,7 +145,7 @@ index 07907372f37d3ef5c9eaef7011ebcd4ed6a2fed6..ec5e553d93caf8a24de97465a870567d
creator_type, std::move(receiver));
break;
}
@@ -2113,7 +2113,7 @@ void RenderProcessHostImpl::CreateNotificationService(
@@ -2114,7 +2114,7 @@ void RenderProcessHostImpl::CreateNotificationService(
CHECK(rfh);
storage_partition_impl_->GetPlatformNotificationContext()->CreateService(

View File

@@ -10,7 +10,7 @@ an about:blank check to this area.
Ref: https://chromium-review.googlesource.com/c/chromium/src/+/5403876
diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc
index 174b6cb9531237528664bcaff06a6e8dc1677349..144490c1ad76dce306e7e4a25270456d60bbb7f5 100644
index 7b7e21c5b4b2e6657965c4433c6f9bc064a4ef9f..5abddf5b5cf2ab5e8e03066143b1824908257e87 100644
--- a/content/browser/renderer_host/render_frame_host_impl.cc
+++ b/content/browser/renderer_host/render_frame_host_impl.cc
@@ -784,8 +784,8 @@ void VerifyThatBrowserAndRendererCalculatedOriginsToCommitMatch(

View File

@@ -44,10 +44,10 @@ index 886d70636aedfa714b29625f58420ad11ede9ffd..7906b94983733a9deb2365fb2a134619
void RenderWidgetHostImpl::ShowContextMenuAtPoint(
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index e7e47a9aa5a22aea2aa0eeab7bd661b47c9cbdae..de6b544df67c9702b6771b08b003805b4f5fb5a4 100644
index a722f77502e8b896fb5d55df7cb44d45d13df04f..1f0b9a602a9e6cf565818ad584688b783fe3430b 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -5612,6 +5612,11 @@ TextInputManager* WebContentsImpl::GetTextInputManager() {
@@ -5616,6 +5616,11 @@ TextInputManager* WebContentsImpl::GetTextInputManager() {
return text_input_manager_.get();
}
@@ -60,10 +60,10 @@ index e7e47a9aa5a22aea2aa0eeab7bd661b47c9cbdae..de6b544df67c9702b6771b08b003805b
RenderWidgetHostImpl* render_widget_host) {
return render_widget_host == GetPrimaryMainFrame()->GetRenderWidgetHost();
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h
index 88282f2880d2443aca30ec1754bf5e43ed67acfc..60c94fd4508e166e0dd1be9c6eb97dd45e418853 100644
index 2a098761bc3b67af3ada46596613152c136583b0..1d0df8595a89642a0eb33cdf76fd9cafc1e4b4b0 100644
--- a/content/browser/web_contents/web_contents_impl.h
+++ b/content/browser/web_contents/web_contents_impl.h
@@ -1128,6 +1128,7 @@ class CONTENT_EXPORT WebContentsImpl
@@ -1130,6 +1130,7 @@ class CONTENT_EXPORT WebContentsImpl
void SendScreenRects() override;
void SendActiveState(bool active) override;
TextInputManager* GetTextInputManager() override;
@@ -72,7 +72,7 @@ index 88282f2880d2443aca30ec1754bf5e43ed67acfc..60c94fd4508e166e0dd1be9c6eb97dd4
RenderWidgetHostImpl* render_widget_host) override;
bool IsShowingContextMenuOnPage() const override;
diff --git a/content/public/browser/web_contents_observer.h b/content/public/browser/web_contents_observer.h
index 0379a5ca835e3e9d1b90543bbbe5971148d6c73e..03ed25d04ff0f54d412e1a3044b7770f75384a96 100644
index f3284b11c2a9d020e85af2fea2057926de4cdd0b..9d58a654ddbabeecef2d9f17e0229c72c0afe6fd 100644
--- a/content/public/browser/web_contents_observer.h
+++ b/content/public/browser/web_contents_observer.h
@@ -37,6 +37,7 @@

View File

@@ -15,10 +15,10 @@ This CL removes these filters so the unresponsive event can still be
accessed from our JS event. The filtering is moved into Electron's code.
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 0e742f196367bbbe8c4e147ef4db4f8dbbe4cbbe..7026b28c4f228971f74a706b6ad99777e4ca0773 100644
index 9bd28a4029de17833d5147986736747075ff35bc..140e94cd6dfba03260ff9e2cf4b38459cdaaf9ba 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -9518,25 +9518,13 @@ void WebContentsImpl::RendererUnresponsive(
@@ -9527,25 +9527,13 @@ void WebContentsImpl::RendererUnresponsive(
base::RepeatingClosure hang_monitor_restarter) {
OPTIONAL_TRACE_EVENT1("content", "WebContentsImpl::RendererUnresponsive",
"render_widget_host", render_widget_host);

View File

@@ -0,0 +1,47 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shelley Vohr <shelley.vohr@gmail.com>
Date: Thu, 21 Nov 2024 14:23:17 +0100
Subject: Support BSTR PKEY_AppUserModel_ID in Windows Shortcuts
It's possible for a shortcut link on Windows to be BSTR format;
this resulted in a DCHECK previously but as of the NOTREACHED
fatal migration now will crash a given app. This has created an
issue for Electron, which allows providing the shortcut information
to end users. This CL thus allows for supporting VT_BSTR variants
for PKEY_AppUserModel_ID and mitigates a crash. One such example
is https://github.com/wez/wezterm, which after this change
correctly gets an appUserModelId of 'org.wezfurlong.wezterm'.
Bug: N/A
Change-Id: I5ad114bc345059637465b68a53a2f3f8c42de898
diff --git a/base/win/shortcut.cc b/base/win/shortcut.cc
index d4a54d1afdc121192f9c0321c6ced584ee066486..02f3e63d16c3324f546f6155d722900f0a81131a 100644
--- a/base/win/shortcut.cc
+++ b/base/win/shortcut.cc
@@ -289,14 +289,22 @@ bool ResolveShortcutProperties(const FilePath& shortcut_path,
return false;
}
switch (pv_app_id.get().vt) {
- case VT_EMPTY:
+ case VT_EMPTY: {
properties->set_app_id(std::wstring());
break;
- case VT_LPWSTR:
+ }
+ case VT_LPWSTR: {
properties->set_app_id(pv_app_id.get().pwszVal);
break;
- default:
+ }
+ case VT_BSTR: {
+ BSTR bs = pv_app_id.get().bstrVal;
+ properties->set_app_id(std::wstring(bs, ::SysStringLen(bs)));
+ break;
+ }
+ default: {
NOTREACHED() << "Unexpected variant type: " << pv_app_id.get().vt;
+ }
}
}

View File

@@ -22,10 +22,10 @@ However, the patch would need to be reviewed by the security team, as it
does touch a security-sensitive class.
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index ec5e553d93caf8a24de97465a870567d95944000..369b4c70bba9363ed8fac184fd843bf1aa49e59e 100644
index 732978b9650cac5102007c27b9226ff053c92d4f..851eff886b5827e362b260f6a954a9081417b067 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -1753,6 +1753,10 @@ bool RenderProcessHostImpl::Init() {
@@ -1754,6 +1754,10 @@ bool RenderProcessHostImpl::Init() {
std::unique_ptr<SandboxedProcessLauncherDelegate> sandbox_delegate =
std::make_unique<RendererSandboxedProcessLauncherDelegateWin>(
*cmd_line, IsPdf(), IsJitDisabled());

View File

@@ -9,10 +9,10 @@ is needed for OSR.
Originally landed in https://github.com/electron/libchromiumcontent/pull/226.
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 4de45e398ec013714302c8cbaafa3bb6aa01ef8e..6d0b5e9a3350108f183e958871928623283cbe23 100644
index 1d1d761f8c7ff09cbd2c6a567e070ac41d3a1759..50dd1fe97063a3d763461fe3ff7af340e7c4ad05 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -3754,6 +3754,13 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params,
@@ -3758,6 +3758,13 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params,
params.main_frame_name, GetOpener(), primary_main_frame_policy,
base::UnguessableToken::Create());
@@ -26,7 +26,7 @@ index 4de45e398ec013714302c8cbaafa3bb6aa01ef8e..6d0b5e9a3350108f183e958871928623
std::unique_ptr<WebContentsViewDelegate> delegate =
GetContentClient()->browser()->GetWebContentsViewDelegate(this);
@@ -3764,6 +3771,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params,
@@ -3768,6 +3775,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params,
view_ = CreateWebContentsView(this, std::move(delegate),
&render_view_host_delegate_view_);
}
@@ -35,7 +35,7 @@ index 4de45e398ec013714302c8cbaafa3bb6aa01ef8e..6d0b5e9a3350108f183e958871928623
CHECK(view_.get());
diff --git a/content/public/browser/web_contents.h b/content/public/browser/web_contents.h
index 825e0d9d641bfa8fc5907a6d479d94206d432fb6..0f2ce0476e9b067ea2f678e5683040e29f10fe81 100644
index 191a98adec4cc5eb1378be40456a11ff5c093a2e..7a3eb2028af908907bd5e72df90534c90884b34e 100644
--- a/content/public/browser/web_contents.h
+++ b/content/public/browser/web_contents.h
@@ -111,10 +111,13 @@ class BrowserPluginGuestDelegate;

View File

@@ -15,10 +15,10 @@ Note that we also need to manually update embedder's
`api::WebContents::IsFullscreenForTabOrPending` value.
diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc
index 4f31803e492d0d05b29659f8bf75b6fee7aff25e..174b6cb9531237528664bcaff06a6e8dc1677349 100644
index 53f96ccd4954972bc78ebccf4bf479ac8564a8d3..7b7e21c5b4b2e6657965c4433c6f9bc064a4ef9f 100644
--- a/content/browser/renderer_host/render_frame_host_impl.cc
+++ b/content/browser/renderer_host/render_frame_host_impl.cc
@@ -8277,6 +8277,17 @@ void RenderFrameHostImpl::EnterFullscreen(
@@ -8286,6 +8286,17 @@ void RenderFrameHostImpl::EnterFullscreen(
}
}
@@ -37,10 +37,10 @@ index 4f31803e492d0d05b29659f8bf75b6fee7aff25e..174b6cb9531237528664bcaff06a6e8d
if (had_fullscreen_token && !GetView()->HasFocus())
GetView()->Focus();
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 6d0b5e9a3350108f183e958871928623283cbe23..9b84cc06795a5bef730cd81908254cf9ad11c836 100644
index 50dd1fe97063a3d763461fe3ff7af340e7c4ad05..f8872945d67dacbdb9c3d610ff3719039eca7c94 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -4011,21 +4011,25 @@ KeyboardEventProcessingResult WebContentsImpl::PreHandleKeyboardEvent(
@@ -4015,21 +4015,25 @@ KeyboardEventProcessingResult WebContentsImpl::PreHandleKeyboardEvent(
const input::NativeWebKeyboardEvent& event) {
OPTIONAL_TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("content.verbose"),
"WebContentsImpl::PreHandleKeyboardEvent");
@@ -78,7 +78,7 @@ index 6d0b5e9a3350108f183e958871928623283cbe23..9b84cc06795a5bef730cd81908254cf9
}
bool WebContentsImpl::HandleMouseEvent(const blink::WebMouseEvent& event) {
@@ -4184,7 +4188,7 @@ void WebContentsImpl::EnterFullscreenMode(
@@ -4188,7 +4192,7 @@ void WebContentsImpl::EnterFullscreenMode(
OPTIONAL_TRACE_EVENT0("content", "WebContentsImpl::EnterFullscreenMode");
DCHECK(CanEnterFullscreenMode(requesting_frame));
DCHECK(requesting_frame->IsActive());

View File

@@ -1268,10 +1268,10 @@ index 0000000000000000000000000000000000000000..af9cbada10203b387fb9732b346583b1
+}
diff --git a/filenames.json b/filenames.json
new file mode 100644
index 0000000000000000000000000000000000000000..889a487e24721a8ecfef91f5a655892a607bb12f
index 0000000000000000000000000000000000000000..c429d4cbfff605ff78c7c8ee3c5ad046594163f3
--- /dev/null
+++ b/filenames.json
@@ -0,0 +1,741 @@
@@ -0,0 +1,740 @@
+// This file is automatically generated by generate_gn_filenames_json.py
+// DO NOT EDIT
+{
@@ -1550,7 +1550,6 @@ index 0000000000000000000000000000000000000000..889a487e24721a8ecfef91f5a655892a
+ "lib/internal/http2/compat.js",
+ "lib/internal/http2/core.js",
+ "lib/internal/http2/util.js",
+ "lib/internal/idna.js",
+ "lib/internal/inspector_async_hook.js",
+ "lib/internal/inspector_network_tracking.js",
+ "lib/internal/js_stream_socket.js",

View File

@@ -40,7 +40,7 @@ index 697b8bba6a55358924d6986f2eb347a99ff73889..bdf1a1f33f3ea09d933757c7fee87c56
# list in v8/BUILD.gn.
['v8_enable_v8_checks == 1', {
diff --git a/configure.py b/configure.py
index a6f66c41f75bffcfaf75d4415c694300b7624136..7ca0762fe3590fef7b88ba684de44d99aaecace4 100755
index 0d089c35d1720e05c4c61d0226a2ebc276b65d6e..cf19b9d092698e1697508e8891926947bc2f7b12 100755
--- a/configure.py
+++ b/configure.py
@@ -1585,6 +1585,7 @@ def configure_library(lib, output, pkgname=None):

View File

@@ -26,7 +26,7 @@ index 364469160af5e348f8890417de16a63c0d1dca67..75d5f58fe02fa8cfa7716ffaf761d567
try {
resolvedArgv = Module._resolveFilename(process.argv[1], null, false);
diff --git a/lib/internal/process/pre_execution.js b/lib/internal/process/pre_execution.js
index ea7afd52fab1cf3fde1674be1429a00562b714c0..02cfc8b3328fedb6306abf6c738bea772c674458 100644
index a05d2846050c2f505eac16320f645e79182a27f6..348bb80ef7fae1e0e5f529b1313093eeadad9276 100644
--- a/lib/internal/process/pre_execution.js
+++ b/lib/internal/process/pre_execution.js
@@ -247,12 +247,14 @@ function patchProcessObject(expandArgv1) {

View File

@@ -9,7 +9,7 @@ This patch can be removed when Node.js upgrades to a version of V8 containing
the above CL.
diff --git a/lib/.eslintrc.yaml b/lib/.eslintrc.yaml
index 74e867ace6207751a96b4da03802b50b620dbd7b..53ceabeb58f56ebd27e60fd49c362d26e361e6d8 100644
index c028204481d44cb5f35ad98413022e7b07ce04b2..230c2378996c5d1ec18a9183ef138bbf70bba22d 100644
--- a/lib/.eslintrc.yaml
+++ b/lib/.eslintrc.yaml
@@ -30,10 +30,6 @@ rules:
@@ -24,10 +24,10 @@ index 74e867ace6207751a96b4da03802b50b620dbd7b..53ceabeb58f56ebd27e60fd49c362d26
message: Use `const { Blob } = require('buffer');` instead of the global.
- name: BroadcastChannel
diff --git a/lib/internal/main/worker_thread.js b/lib/internal/main/worker_thread.js
index 30f7a5f79e50fdeb4e1775a0e56dafa4c6908898..f7250985277c4127425ef36dff566c1fe06603e2 100644
index cfd1d1b6f18e2943e155cf021b566a4673f71ab0..8d1a184ad1936c0d8493d6c54c32bebcf0021d8b 100644
--- a/lib/internal/main/worker_thread.js
+++ b/lib/internal/main/worker_thread.js
@@ -112,7 +112,7 @@ port.on('message', (message) => {
@@ -113,7 +113,7 @@ port.on('message', (message) => {
require('internal/worker').assignEnvironmentData(environmentData);

View File

@@ -21,10 +21,10 @@ index 606a6f5caa3b11b6d2a9068ed2fd65800530a5eb..080dcce21da05ccea398d8a856deb397
typedef void (*FreeCallback)(char* data, void* hint);
diff --git a/src/node_errors.h b/src/node_errors.h
index 1662491bac44311421eeb7ee35bb47c025162abf..a62b18e832986ee38d93b412b36020a2c22255a9 100644
index ac07b96b5cad0f3502468c86745e2b341d338e1f..f51c4309ceec3f0dc5e07982fb789ff6663076ba 100644
--- a/src/node_errors.h
+++ b/src/node_errors.h
@@ -230,7 +230,7 @@ inline v8::Local<v8::Object> ERR_BUFFER_TOO_LARGE(v8::Isolate* isolate) {
@@ -235,7 +235,7 @@ inline v8::Local<v8::Object> ERR_BUFFER_TOO_LARGE(v8::Isolate* isolate) {
char message[128];
snprintf(message, sizeof(message),
"Cannot create a Buffer larger than 0x%zx bytes",

View File

@@ -18,10 +18,10 @@ Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
diff --git a/doc/api/cli.md b/doc/api/cli.md
index ed0a43306e87962cf0e756d9e059ec5c08ad674b..7ada2802b2590e78fa5b9847935866b743cf94ed 100644
index d97682ac2ebcdf145e202325a4642a1bfd3970b2..7c5c08c450b9b4774265ead6a91d3ed76693c290 100644
--- a/doc/api/cli.md
+++ b/doc/api/cli.md
@@ -2868,7 +2868,6 @@ V8 options that are allowed are:
@@ -2869,7 +2869,6 @@ V8 options that are allowed are:
* `--disallow-code-generation-from-strings`
* `--enable-etw-stack-walking`
* `--expose-gc`
@@ -30,7 +30,7 @@ index ed0a43306e87962cf0e756d9e059ec5c08ad674b..7ada2802b2590e78fa5b9847935866b7
* `--jitless`
* `--max-old-space-size`
diff --git a/src/node_options.cc b/src/node_options.cc
index 4e3c82e9528b04fd1a0cc99d30fb885e4b224bc9..38e173f72b446aa2db07f676b6ece26247bbf56b 100644
index 9b5f49ebb478a21acf8f0d6ed012ed6829a8a320..433c8a3c1df125e3d7df414980440c64ffca61d6 100644
--- a/src/node_options.cc
+++ b/src/node_options.cc
@@ -866,11 +866,6 @@ PerIsolateOptionsParser::PerIsolateOptionsParser(
@@ -46,10 +46,10 @@ index 4e3c82e9528b04fd1a0cc99d30fb885e4b224bc9..38e173f72b446aa2db07f676b6ece262
"disable runtime allocation of executable memory",
V8Option{},
diff --git a/test/parallel/test-cli-node-options.js b/test/parallel/test-cli-node-options.js
index 8d614e607177cdd922fef65a85a2ccdcf54116c0..146df3a21a0551e910c46248d2fd97dde8896164 100644
index 9fb6d8af0691108868a3245518edc0f0057557ab..3b9409c3af778fcfe2be0fae2cbb04753dd5c8f1 100644
--- a/test/parallel/test-cli-node-options.js
+++ b/test/parallel/test-cli-node-options.js
@@ -70,7 +70,6 @@ if (common.hasCrypto) {
@@ -72,7 +72,6 @@ if (common.hasCrypto) {
expect('--abort_on-uncaught_exception', 'B\n');
expect('--disallow-code-generation-from-strings', 'B\n');
expect('--expose-gc', 'B\n');

View File

@@ -8,7 +8,7 @@ to child processes spawned with `ELECTRON_RUN_AS_NODE` which is used
by the crashpad client to connect with the handler process.
diff --git a/lib/child_process.js b/lib/child_process.js
index 48870b35ad0f3411f2d509b12d92a9e0d20046f9..e7ef454d2d71207ae7b2788a437b82bf7732716e 100644
index cc81cb373d59dbc1ab18182aa2a0c8ebe63f6245..d3871405e2ecb3917b8ec816490c575891c91d18 100644
--- a/lib/child_process.js
+++ b/lib/child_process.js
@@ -61,6 +61,7 @@ let debug = require('internal/util/debuglog').debuglog(

View File

@@ -58,7 +58,7 @@ index b9098d102b40adad7fafcc331ac62870617019b9..cb9269a31e073caf86164aa39c064037
}
diff --git a/src/node_options.cc b/src/node_options.cc
index 818baf611fcab7838a339f3ea137467653e270d0..4e3c82e9528b04fd1a0cc99d30fb885e4b224bc9 100644
index efbe48e10b8408642a6b5010b1a7a3749068188a..9b5f49ebb478a21acf8f0d6ed012ed6829a8a320 100644
--- a/src/node_options.cc
+++ b/src/node_options.cc
@@ -1405,14 +1405,16 @@ void GetEmbedderOptions(const FunctionCallbackInfo<Value>& args) {

View File

@@ -33,7 +33,7 @@ index f3dfc69cd2cdec50bc3b3f7cb2d63349812d87dd..b6f2d7194cb75ecc8c47869761c63184
if (!loaded) {
module = new CJSModule(filename);
diff --git a/lib/internal/modules/run_main.js b/lib/internal/modules/run_main.js
index ca401044c0178c46db9b439b27c440a5d7924c84..dc1a682f0a3cf1ba1095c60bf6a6ca992d6043b3 100644
index 4ad694debfc72f56dd98a4e56dd0bbc63711242e..73f0e00ad34132e7d2fd37ec321110881e89617f 100644
--- a/lib/internal/modules/run_main.js
+++ b/lib/internal/modules/run_main.js
@@ -2,6 +2,7 @@
@@ -58,7 +58,7 @@ index ca401044c0178c46db9b439b27c440a5d7924c84..dc1a682f0a3cf1ba1095c60bf6a6ca99
const defaultType = getOptionValue('--experimental-default-type');
/** @type {string} */
let mainPath;
@@ -59,6 +67,13 @@ function resolveMainPath(main) {
@@ -58,6 +66,13 @@ function resolveMainPath(main) {
* @param {string} mainPath - Absolute path to the main entry point
*/
function shouldUseESMLoader(mainPath) {

View File

@@ -353,7 +353,7 @@ index 990638ec3993bde40ad3dd40d373d816ebc66a6a..63d971e1fe6b861e29c12f04563701b0
} // namespace
diff --git a/src/env.h b/src/env.h
index 30561ab7a24c734be71ed29d963c11e2ea2c2b22..7cb77fb4f35a60fbda5b868798321ac8b6340bfa 100644
index 2ec0a56e05ff879df8c55bf140677e571a56fafa..a30c25a3a61dfe73944731760404c555f2782d72 100644
--- a/src/env.h
+++ b/src/env.h
@@ -49,7 +49,7 @@
@@ -365,7 +365,7 @@ index 30561ab7a24c734be71ed29d963c11e2ea2c2b22..7cb77fb4f35a60fbda5b868798321ac8
#include <openssl/evp.h>
#endif
@@ -1065,7 +1065,7 @@ class Environment : public MemoryRetainer {
@@ -1051,7 +1051,7 @@ class Environment : public MemoryRetainer {
kExitInfoFieldCount
};
@@ -388,7 +388,7 @@ index cf051585e779e2b03bd7b95fe5008b89cc7f8162..9de49c6828468fdf846dcd4ad445390f
#if NODE_OPENSSL_HAS_QUIC
#include <openssl/quic.h>
diff --git a/src/node_options.cc b/src/node_options.cc
index dba59c5560c22899bd108789360f21fd85dd41bf..818baf611fcab7838a339f3ea137467653e270d0 100644
index e325b082dec6ae891a737a4fa7775937e4d7b7f9..efbe48e10b8408642a6b5010b1a7a3749068188a 100644
--- a/src/node_options.cc
+++ b/src/node_options.cc
@@ -6,7 +6,7 @@

View File

@@ -16,7 +16,7 @@ patch:
(cherry picked from commit 30329d06235a9f9733b1d4da479b403462d1b326)
diff --git a/src/env-inl.h b/src/env-inl.h
index d98a32d6ec311459877bc3b0de33cca4766aeda7..9fc934975b015b97ddd84bf3eea5d53144130035 100644
index 852c82fd7f50c01d08eeddc151b1bec6afa68028..8f4b004d6655acd1c0dac449612316a48cf885c6 100644
--- a/src/env-inl.h
+++ b/src/env-inl.h
@@ -62,31 +62,6 @@ inline uv_loop_t* IsolateData::event_loop() const {
@@ -52,7 +52,7 @@ index d98a32d6ec311459877bc3b0de33cca4766aeda7..9fc934975b015b97ddd84bf3eea5d531
return &(wrapper_data_->cppgc_id);
}
diff --git a/src/env.cc b/src/env.cc
index 38802b1e9acf9b3e99fdc4f39770e896393befe3..e0433e29ca98c42a38d1da6d66085fdea1edde29 100644
index ca75e0360bbf6a20ea18e67dda167d5ec523b075..158b96a9b1ea5553fa74d2429152a5c974d50c03 100644
--- a/src/env.cc
+++ b/src/env.cc
@@ -22,6 +22,7 @@
@@ -146,7 +146,7 @@ index 38802b1e9acf9b3e99fdc4f39770e896393befe3..e0433e29ca98c42a38d1da6d66085fde
void IsolateData::MemoryInfo(MemoryTracker* tracker) const {
diff --git a/src/env.h b/src/env.h
index 7cb77fb4f35a60fbda5b868798321ac8b6340bfa..06746554e1d60a9377ff6d7d970220f3fa88e4ac 100644
index a30c25a3a61dfe73944731760404c555f2782d72..6137551bb8168d8fa9a3e6bc79c3d1e79b306931 100644
--- a/src/env.h
+++ b/src/env.h
@@ -174,10 +174,6 @@ class NODE_EXTERN_PRIVATE IsolateData : public MemoryRetainer {

View File

@@ -298,3 +298,17 @@ index 9787b14352753c5e0f8dc2b90093680e7cd10f1a..31af9e62396368af1b81f8841a705fd3
auto ab = ArrayBuffer::New(isolate, std::move(bs));
v8::Local<Uint8Array> u8 = v8::Uint8Array::New(ab, 0, 1);
diff --git a/test/parallel/test-buffer-tostring-range.js b/test/parallel/test-buffer-tostring-range.js
index 1167654dcf0773be953d09dfcf534e902e75595b..a769ec1fb61916d4285fa9d3559ded5df4f02e9e 100644
--- a/test/parallel/test-buffer-tostring-range.js
+++ b/test/parallel/test-buffer-tostring-range.js
@@ -103,6 +103,8 @@ assert.throws(() => {
// Cannot test on 32bit machine as we are testing the case
// when start and end are above the threshold
common.skipIf32Bits();
+/* Disabled due to incompatiblity with v8 memory cage
const threshold = 0xFFFFFFFF;
const largeBuffer = Buffer.alloc(threshold);
largeBuffer.toString('utf8', threshold + 0xF, threshold + 0xFF);
+*/
\ No newline at end of file

View File

@@ -28,7 +28,7 @@ index 79a953df7da64b7d7580e099a5cc5160e7842999..94616df356cab50c8ef4099e7863f598
test-net-write-fully-async-hex-string: PASS, FLAKY
# https://github.com/nodejs/node/issues/52273
diff --git a/test/sequential/sequential.status b/test/sequential/sequential.status
index a539649d5537376a6a2ac9a7a46051b8648f0cb1..a03c86b752772be7ae36fab31faeccf3b0ccff64 100644
index 073b29cce8dbca4c8d92ad666f9244ad511296db..338d20263f29a630febb96567f3cb708623bd09a 100644
--- a/test/sequential/sequential.status
+++ b/test/sequential/sequential.status
@@ -7,6 +7,18 @@ prefix sequential

View File

@@ -7,10 +7,10 @@ Subject: test: match wpt/streams/transferable/transform-stream-members.any.js
All four of this calls should fail - see third_party/blink/web_tests/external/wpt/streams/transferable/transform-stream-members.any-expected.txt
diff --git a/test/wpt/status/streams.json b/test/wpt/status/streams.json
index 5425c86bba85079a44745779d998337aaa063df1..775661cd59b14132c9a811e448792ea02198f949 100644
index af3646c65ea6609e17638da925f86de8c9d6221c..f1d9e76718c264aafb9c27c516589d9874d8b73f 100644
--- a/test/wpt/status/streams.json
+++ b/test/wpt/status/streams.json
@@ -60,7 +60,9 @@
@@ -53,7 +53,9 @@
"fail": {
"expected": [
"Transferring [object TransformStream],[object ReadableStream] should fail",

View File

@@ -10,6 +10,7 @@
#include <vector>
#include "base/command_line.h"
#include "base/containers/extend.h"
#include "base/files/file_util.h"
#include "base/strings/string_split.h"
#include "content/public/common/content_constants.h"
@@ -98,21 +99,6 @@ bool IsWidevineAvailable(
}
#endif // BUILDFLAG(ENABLE_WIDEVINE)
void AppendDelimitedSwitchToVector(const std::string_view cmd_switch,
std::vector<std::string>* append_me) {
auto* command_line = base::CommandLine::ForCurrentProcess();
auto switch_value = command_line->GetSwitchValueASCII(cmd_switch);
if (!switch_value.empty()) {
constexpr std::string_view delimiter{",", 1};
auto tokens =
base::SplitString(switch_value, delimiter, base::TRIM_WHITESPACE,
base::SPLIT_WANT_NONEMPTY);
append_me->reserve(append_me->size() + tokens.size());
std::move(std::begin(tokens), std::end(tokens),
std::back_inserter(*append_me));
}
}
} // namespace
ElectronContentClient::ElectronContentClient() = default;
@@ -149,16 +135,19 @@ void ElectronContentClient::AddAdditionalSchemes(Schemes* schemes) {
//
// We use this for registration to network utility process
if (IsUtilityProcess()) {
AppendDelimitedSwitchToVector(switches::kServiceWorkerSchemes,
&schemes->service_worker_schemes);
AppendDelimitedSwitchToVector(switches::kStandardSchemes,
&schemes->standard_schemes);
AppendDelimitedSwitchToVector(switches::kSecureSchemes,
&schemes->secure_schemes);
AppendDelimitedSwitchToVector(switches::kBypassCSPSchemes,
&schemes->csp_bypassing_schemes);
AppendDelimitedSwitchToVector(switches::kCORSSchemes,
&schemes->cors_enabled_schemes);
const auto& cmd = *base::CommandLine::ForCurrentProcess();
auto append_cli_schemes = [&cmd](auto& appendme, const auto key) {
base::Extend(appendme, base::SplitString(cmd.GetSwitchValueASCII(key),
",", base::TRIM_WHITESPACE,
base::SPLIT_WANT_NONEMPTY));
};
using namespace switches;
append_cli_schemes(schemes->cors_enabled_schemes, kCORSSchemes);
append_cli_schemes(schemes->csp_bypassing_schemes, kBypassCSPSchemes);
append_cli_schemes(schemes->secure_schemes, kSecureSchemes);
append_cli_schemes(schemes->service_worker_schemes, kServiceWorkerSchemes);
append_cli_schemes(schemes->standard_schemes, kStandardSchemes);
}
if (electron::fuses::IsGrantFileProtocolExtraPrivilegesEnabled()) {

View File

@@ -79,7 +79,7 @@ namespace electron {
namespace {
const char kRelauncherProcess[] = "relauncher";
constexpr std::string_view kRelauncherProcess = "relauncher";
constexpr std::string_view kElectronDisableSandbox{"ELECTRON_DISABLE_SANDBOX"};
constexpr std::string_view kElectronEnableStackDumping{

View File

@@ -776,7 +776,7 @@ base::OnceClosure App::SelectClientCertificate(
std::move((*shared_identities)[0]),
base::BindRepeating(&GotPrivateKey, shared_delegate, std::move(cert)));
}
return base::OnceClosure();
return {};
}
void App::OnGpuInfoUpdate() {
@@ -944,7 +944,7 @@ std::string App::GetSystemLocale(gin_helper::ErrorThrower thrower) const {
thrower.ThrowError(
"app.getSystemLocale() can only be called "
"after app is ready");
return std::string();
return {};
}
return static_cast<BrowserProcessImpl*>(g_browser_process)->GetSystemLocale();
}
@@ -1011,8 +1011,6 @@ bool App::RequestSingleInstanceLock(gin::Arguments* args) {
if (HasSingleInstanceLock())
return true;
std::string program_name = electron::Browser::Get()->GetName();
base::FilePath user_dir;
base::PathService::Get(chrome::DIR_USER_DATA, &user_dir);
// The user_dir may not have been created yet.
@@ -1023,6 +1021,7 @@ bool App::RequestSingleInstanceLock(gin::Arguments* args) {
blink::CloneableMessage additional_data_message;
args->GetNext(&additional_data_message);
#if BUILDFLAG(IS_WIN)
const std::string program_name = electron::Browser::Get()->GetName();
bool app_is_sandboxed =
IsSandboxEnabled(base::CommandLine::ForCurrentProcess());
process_singleton_ = std::make_unique<ProcessSingleton>(

View File

@@ -640,7 +640,7 @@ void BaseWindow::SetBackgroundColor(const std::string& color_name) {
window_->SetBackgroundColor(color);
}
std::string BaseWindow::GetBackgroundColor(gin_helper::Arguments* args) const {
std::string BaseWindow::GetBackgroundColor() const {
return ToRGBHex(window_->GetBackgroundColor());
}

View File

@@ -162,7 +162,7 @@ class BaseWindow : public gin_helper::TrackableObject<BaseWindow>,
bool IsKiosk() const;
bool IsTabletMode() const;
virtual void SetBackgroundColor(const std::string& color_name);
std::string GetBackgroundColor(gin_helper::Arguments* args) const;
std::string GetBackgroundColor() const;
void InvalidateShadow();
void SetHasShadow(bool has_shadow);
bool HasShadow() const;

View File

@@ -168,7 +168,7 @@ void FilterCookieWithStatuses(
// Parse dictionary property to CanonicalCookie time correctly.
base::Time ParseTimeProperty(const std::optional<double>& value) {
if (!value) // empty time means ignoring the parameter
return base::Time();
return {};
if (*value == 0) // FromSecondsSinceUnixEpoch would convert 0 to empty Time
return base::Time::UnixEpoch();
return base::Time::FromSecondsSinceUnixEpoch(*value);
@@ -292,8 +292,8 @@ std::string StringToCookieSameSite(const std::string* str_ptr,
gin::WrapperInfo Cookies::kWrapperInfo = {gin::kEmbedderNativeGin};
Cookies::Cookies(v8::Isolate* isolate, ElectronBrowserContext* browser_context)
: browser_context_(browser_context) {
Cookies::Cookies(ElectronBrowserContext* browser_context)
: browser_context_{browser_context} {
cookie_change_subscription_ =
browser_context_->cookie_change_notifier()->RegisterCookieChangeCallback(
base::BindRepeating(&Cookies::OnCookieChanged,
@@ -458,7 +458,7 @@ void Cookies::OnCookieChanged(const net::CookieChangeInfo& change) {
// static
gin::Handle<Cookies> Cookies::Create(v8::Isolate* isolate,
ElectronBrowserContext* browser_context) {
return gin::CreateHandle(isolate, new Cookies(isolate, browser_context));
return gin::CreateHandle(isolate, new Cookies{browser_context});
}
gin::ObjectTemplateBuilder Cookies::GetObjectTemplateBuilder(

View File

@@ -50,7 +50,7 @@ class Cookies final : public gin::Wrappable<Cookies>,
Cookies& operator=(const Cookies&) = delete;
protected:
Cookies(v8::Isolate* isolate, ElectronBrowserContext* browser_context);
explicit Cookies(ElectronBrowserContext* browser_context);
~Cookies() override;
v8::Local<v8::Promise> Get(v8::Isolate*,

View File

@@ -10,6 +10,7 @@
#include <utility>
#include <vector>
#include "base/containers/to_vector.h"
#include "base/no_destructor.h"
#include "base/path_service.h"
#include "base/strings/utf_string_conversions.h"
@@ -98,7 +99,7 @@ std::string ReadClientId() {
if (GetClientIdPath(&client_id_path) &&
(!base::ReadFileToStringWithMaxSize(client_id_path, &client_id, 36) ||
client_id.size() != 36))
return std::string();
return {};
return client_id;
}
@@ -220,18 +221,17 @@ v8::Local<v8::Value> GetUploadedReports(v8::Isolate* isolate) {
list->LoadSync();
}
auto to_obj = [isolate](const UploadList::UploadInfo* upload) {
return gin::DataObjectBuilder{isolate}
.Set("date", upload->upload_time)
.Set("id", upload->upload_id)
.Build();
};
constexpr size_t kMaxUploadReportsToList = std::numeric_limits<size_t>::max();
const std::vector<const UploadList::UploadInfo*> uploads =
list->GetUploads(kMaxUploadReportsToList);
std::vector<v8::Local<v8::Object>> result;
for (auto* const upload : uploads) {
result.push_back(gin::DataObjectBuilder(isolate)
.Set("date", upload->upload_time)
.Set("id", upload->upload_id)
.Build());
}
v8::Local<v8::Value> v8_result = gin::ConvertToV8(isolate, result);
return v8_result;
return gin::ConvertToV8(
isolate,
base::ToVector(list->GetUploads(kMaxUploadReportsToList), to_obj));
}
#endif

View File

@@ -188,7 +188,7 @@ gin::Handle<DataPipeHolder> DataPipeHolder::From(v8::Isolate* isolate,
if (gin::ConvertFromV8(isolate, object.ToLocalChecked(), &handle))
return handle;
}
return gin::Handle<DataPipeHolder>();
return {};
}
} // namespace electron::api

View File

@@ -209,7 +209,7 @@ const GURL& DownloadItem::GetURL() const {
v8::Local<v8::Value> DownloadItem::GetURLChain() const {
if (!CheckAlive())
return v8::Local<v8::Value>();
return {};
return gin::ConvertToV8(isolate_, download_item_->GetUrlChain());
}

View File

@@ -70,6 +70,8 @@ Menu::~Menu() {
}
}
namespace {
bool InvokeBoolMethod(const Menu* menu,
const char* method,
int command_id,
@@ -84,6 +86,8 @@ bool InvokeBoolMethod(const Menu* menu,
return gin::ConvertFromV8(isolate, val, &ret) ? ret : default_value;
}
} // namespace
bool Menu::IsCommandIdChecked(int command_id) const {
return InvokeBoolMethod(this, "_isCommandIdChecked", command_id);
}

View File

@@ -63,8 +63,7 @@ scoped_refptr<base::SequencedTaskRunner> CreateFileTaskRunner() {
}
base::File OpenFileForWriting(base::FilePath path) {
return base::File(path,
base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE);
return {path, base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE};
}
void ResolvePromiseWithNetError(gin_helper::Promise<void> promise,
@@ -93,7 +92,7 @@ v8::Local<v8::Promise> NetLog::StartLogging(base::FilePath log_path,
gin::Arguments* args) {
if (log_path.empty()) {
args->ThrowTypeError("The first parameter must be a valid string");
return v8::Local<v8::Promise>();
return {};
}
net::NetLogCaptureMode capture_mode = net::NetLogCaptureMode::kDefault;
@@ -106,7 +105,7 @@ v8::Local<v8::Promise> NetLog::StartLogging(base::FilePath log_path,
if (!gin::ConvertFromV8(args->isolate(), capture_mode_v8,
&capture_mode)) {
args->ThrowTypeError("Invalid value for captureMode");
return v8::Local<v8::Promise>();
return {};
}
}
v8::Local<v8::Value> max_file_size_v8;
@@ -114,14 +113,14 @@ v8::Local<v8::Promise> NetLog::StartLogging(base::FilePath log_path,
if (!gin::ConvertFromV8(args->isolate(), max_file_size_v8,
&max_file_size)) {
args->ThrowTypeError("Invalid value for maxFileSize");
return v8::Local<v8::Promise>();
return {};
}
}
}
if (net_log_exporter_) {
args->ThrowTypeError("There is already a net log running");
return v8::Local<v8::Promise>();
return {};
}
pending_start_promise_ =

View File

@@ -81,7 +81,7 @@ gin::Handle<Notification> Notification::New(gin_helper::ErrorThrower thrower,
gin::Arguments* args) {
if (!Browser::Get()->is_ready()) {
thrower.ThrowError("Cannot create Notification before app is ready");
return gin::Handle<Notification>();
return {};
}
return gin::CreateHandle(thrower.isolate(), new Notification(args));
}

View File

@@ -301,7 +301,7 @@ gin::Handle<Protocol> Protocol::Create(
// static
gin::Handle<Protocol> Protocol::New(gin_helper::ErrorThrower thrower) {
thrower.ThrowError("Protocol cannot be created from JS");
return gin::Handle<Protocol>();
return {};
}
// static

View File

@@ -53,13 +53,13 @@ v8::Local<v8::Value> EncryptString(v8::Isolate* isolate,
if (!electron::Browser::Get()->is_ready()) {
gin_helper::ErrorThrower(isolate).ThrowError(
"safeStorage cannot be used before app is ready");
return v8::Local<v8::Value>();
return {};
}
gin_helper::ErrorThrower(isolate).ThrowError(
"Error while encrypting the text provided to "
"safeStorage.encryptString. "
"Encryption is not available.");
return v8::Local<v8::Value>();
return {};
}
std::string ciphertext;
@@ -69,7 +69,7 @@ v8::Local<v8::Value> EncryptString(v8::Isolate* isolate,
gin_helper::ErrorThrower(isolate).ThrowError(
"Error while encrypting the text provided to "
"safeStorage.encryptString.");
return v8::Local<v8::Value>();
return {};
}
return node::Buffer::Copy(isolate, ciphertext.c_str(), ciphertext.size())

View File

@@ -82,7 +82,7 @@ gfx::Point Screen::GetCursorScreenPoint(v8::Isolate* isolate) {
thrower.ThrowError(
"screen.getCursorScreenPoint() cannot be called before a window has "
"been created.");
return gfx::Point();
return {};
}
#endif
return screen_->GetCursorScreenPoint();

View File

@@ -132,7 +132,7 @@ v8::Local<v8::Value> ServiceWorkerContext::GetWorkerInfoFromID(
auto iter = info_map.find(version_id);
if (iter == info_map.end()) {
thrower.ThrowError("Could not find service worker with that version_id");
return v8::Local<v8::Value>();
return {};
}
return ServiceWorkerRunningInfoToDict(thrower.isolate(),
std::move(iter->second));

View File

@@ -54,6 +54,7 @@
#include "net/http/http_util.h"
#include "services/network/network_service.h"
#include "services/network/public/cpp/features.h"
#include "services/network/public/cpp/request_destination.h"
#include "services/network/public/mojom/clear_data_filter.mojom.h"
#include "shell/browser/api/electron_api_app.h"
#include "shell/browser/api/electron_api_cookies.h"
@@ -79,6 +80,7 @@
#include "shell/common/gin_converters/gurl_converter.h"
#include "shell/common/gin_converters/media_converter.h"
#include "shell/common/gin_converters/net_converter.h"
#include "shell/common/gin_converters/time_converter.h"
#include "shell/common/gin_converters/usb_protected_classes_converter.h"
#include "shell/common/gin_converters/value_converter.h"
#include "shell/common/gin_helper/dictionary.h"
@@ -1074,6 +1076,178 @@ std::vector<base::FilePath> Session::GetPreloads() const {
return prefs->preloads();
}
/**
* Exposes the network service's ClearSharedDictionaryCacheForIsolationKey
* method, allowing clearing the Shared Dictionary cache for a given isolation
* key. Details about the feature available at
* https://developer.chrome.com/blog/shared-dictionary-compression
*/
v8::Local<v8::Promise> Session::ClearSharedDictionaryCacheForIsolationKey(
const gin_helper::Dictionary& options) {
gin_helper::Promise<void> promise(isolate_);
auto handle = promise.GetHandle();
GURL frame_origin_url, top_frame_site_url;
if (!options.Get("frameOrigin", &frame_origin_url) ||
!options.Get("topFrameSite", &top_frame_site_url)) {
promise.RejectWithErrorMessage(
"Must provide frameOrigin and topFrameSite strings to "
"`clearSharedDictionaryCacheForIsolationKey`");
return handle;
}
if (!frame_origin_url.is_valid() || !top_frame_site_url.is_valid()) {
promise.RejectWithErrorMessage(
"Invalid URLs provided for frameOrigin or topFrameSite");
return handle;
}
url::Origin frame_origin = url::Origin::Create(frame_origin_url);
net::SchemefulSite top_frame_site(top_frame_site_url);
net::SharedDictionaryIsolationKey isolation_key(frame_origin, top_frame_site);
browser_context_->GetDefaultStoragePartition()
->GetNetworkContext()
->ClearSharedDictionaryCacheForIsolationKey(
isolation_key,
base::BindOnce(gin_helper::Promise<void>::ResolvePromise,
std::move(promise)));
return handle;
}
/**
* Exposes the network service's ClearSharedDictionaryCache
* method, allowing clearing the Shared Dictionary cache.
* https://developer.chrome.com/blog/shared-dictionary-compression
*/
v8::Local<v8::Promise> Session::ClearSharedDictionaryCache() {
gin_helper::Promise<void> promise(isolate_);
auto handle = promise.GetHandle();
browser_context_->GetDefaultStoragePartition()
->GetNetworkContext()
->ClearSharedDictionaryCache(
base::Time(), base::Time::Max(),
nullptr /*mojom::ClearDataFilterPtr*/,
base::BindOnce(gin_helper::Promise<void>::ResolvePromise,
std::move(promise)));
return handle;
}
/**
* Exposes the network service's GetSharedDictionaryInfo method, allowing
* inspection of Shared Dictionary information. Details about the feature
* available at https://developer.chrome.com/blog/shared-dictionary-compression
*/
v8::Local<v8::Promise> Session::GetSharedDictionaryInfo(
const gin_helper::Dictionary& options) {
gin_helper::Promise<std::vector<gin_helper::Dictionary>> promise(isolate_);
auto handle = promise.GetHandle();
GURL frame_origin_url, top_frame_site_url;
if (!options.Get("frameOrigin", &frame_origin_url) ||
!options.Get("topFrameSite", &top_frame_site_url)) {
promise.RejectWithErrorMessage(
"Must provide frameOrigin and topFrameSite strings");
return handle;
}
if (!frame_origin_url.is_valid() || !top_frame_site_url.is_valid()) {
promise.RejectWithErrorMessage(
"Invalid URLs provided for frameOrigin or topFrameSite");
return handle;
}
url::Origin frame_origin = url::Origin::Create(frame_origin_url);
net::SchemefulSite top_frame_site(top_frame_site_url);
net::SharedDictionaryIsolationKey isolation_key(frame_origin, top_frame_site);
browser_context_->GetDefaultStoragePartition()
->GetNetworkContext()
->GetSharedDictionaryInfo(
isolation_key,
base::BindOnce(
[](gin_helper::Promise<std::vector<gin_helper::Dictionary>>
promise,
std::vector<network::mojom::SharedDictionaryInfoPtr> info) {
v8::Isolate* isolate = promise.isolate();
v8::HandleScope handle_scope(isolate);
std::vector<gin_helper::Dictionary> result;
result.reserve(info.size());
for (const auto& item : info) {
gin_helper::Dictionary dict =
gin_helper::Dictionary::CreateEmpty(isolate);
dict.Set("match", item->match);
// Convert RequestDestination enum values to strings
std::vector<std::string> destinations;
for (const auto& dest : item->match_dest) {
destinations.push_back(
network::RequestDestinationToString(dest));
}
dict.Set("matchDestinations", destinations);
dict.Set("id", item->id);
dict.Set("dictionaryUrl", item->dictionary_url.spec());
dict.Set("lastFetchTime", item->last_fetch_time);
dict.Set("responseTime", item->response_time);
dict.Set("expirationDuration",
item->expiration.InMillisecondsF());
dict.Set("lastUsedTime", item->last_used_time);
dict.Set("size", item->size);
dict.Set("hash", net::HashValue(item->hash).ToString());
result.push_back(dict);
}
promise.Resolve(result);
},
std::move(promise)));
return handle;
}
/**
* Exposes the network service's GetSharedDictionaryUsageInfo method, allowing
* inspection of Shared Dictionary information. Details about the feature
* available at https://developer.chrome.com/blog/shared-dictionary-compression
*/
v8::Local<v8::Promise> Session::GetSharedDictionaryUsageInfo() {
gin_helper::Promise<std::vector<gin_helper::Dictionary>> promise(isolate_);
auto handle = promise.GetHandle();
browser_context_->GetDefaultStoragePartition()
->GetNetworkContext()
->GetSharedDictionaryUsageInfo(base::BindOnce(
[](gin_helper::Promise<std::vector<gin_helper::Dictionary>> promise,
const std::vector<net::SharedDictionaryUsageInfo>& info) {
v8::Isolate* isolate = promise.isolate();
v8::HandleScope handle_scope(isolate);
std::vector<gin_helper::Dictionary> result;
result.reserve(info.size());
for (const auto& item : info) {
gin_helper::Dictionary dict =
gin_helper::Dictionary::CreateEmpty(isolate);
dict.Set("frameOrigin",
item.isolation_key.frame_origin().Serialize());
dict.Set("topFrameSite",
item.isolation_key.top_frame_site().Serialize());
dict.Set("totalSizeBytes", item.total_size_bytes);
result.push_back(dict);
}
promise.Resolve(result);
},
std::move(promise)));
return handle;
}
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
v8::Local<v8::Promise> Session::LoadExtension(
const base::FilePath& extension_path,
@@ -1583,7 +1757,7 @@ std::optional<gin::Handle<Session>> Session::FromPath(
gin::Handle<Session> Session::New() {
gin_helper::ErrorThrower(JavascriptEnvironment::GetIsolate())
.ThrowError("Session objects cannot be created with 'new'");
return gin::Handle<Session>();
return {};
}
void Session::FillObjectTemplate(v8::Isolate* isolate,
@@ -1627,6 +1801,13 @@ void Session::FillObjectTemplate(v8::Isolate* isolate,
&Session::CreateInterruptedDownload)
.SetMethod("setPreloads", &Session::SetPreloads)
.SetMethod("getPreloads", &Session::GetPreloads)
.SetMethod("getSharedDictionaryUsageInfo",
&Session::GetSharedDictionaryUsageInfo)
.SetMethod("getSharedDictionaryInfo", &Session::GetSharedDictionaryInfo)
.SetMethod("clearSharedDictionaryCache",
&Session::ClearSharedDictionaryCache)
.SetMethod("clearSharedDictionaryCacheForIsolationKey",
&Session::ClearSharedDictionaryCacheForIsolationKey)
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
.SetMethod("loadExtension", &Session::LoadExtension)
.SetMethod("removeExtension", &Session::RemoveExtension)

View File

@@ -140,6 +140,12 @@ class Session final : public gin::Wrappable<Session>,
void CreateInterruptedDownload(const gin_helper::Dictionary& options);
void SetPreloads(const std::vector<base::FilePath>& preloads);
std::vector<base::FilePath> GetPreloads() const;
v8::Local<v8::Promise> GetSharedDictionaryInfo(
const gin_helper::Dictionary& options);
v8::Local<v8::Promise> GetSharedDictionaryUsageInfo();
v8::Local<v8::Promise> ClearSharedDictionaryCache();
v8::Local<v8::Promise> ClearSharedDictionaryCacheForIsolationKey(
const gin_helper::Dictionary& options);
v8::Local<v8::Value> Cookies(v8::Isolate* isolate);
v8::Local<v8::Value> Protocol(v8::Isolate* isolate);
v8::Local<v8::Value> ServiceWorkerContext(v8::Isolate* isolate);

View File

@@ -154,7 +154,7 @@ std::string SystemPreferences::GetMediaAccessStatus(
DeviceAccessStatus::DeviceAccessStatus_Allowed);
} else {
thrower.ThrowError("Invalid media type");
return std::string();
return {};
}
}

View File

@@ -67,13 +67,13 @@ gin::Handle<Tray> Tray::New(gin_helper::ErrorThrower thrower,
gin::Arguments* args) {
if (!Browser::Get()->is_ready()) {
thrower.ThrowError("Cannot create Tray before app is ready");
return gin::Handle<Tray>();
return {};
}
#if BUILDFLAG(IS_WIN)
if (!guid.has_value() && args->Length() > 1) {
thrower.ThrowError("Invalid GUID format");
return gin::Handle<Tray>();
return {};
}
#endif
@@ -85,7 +85,7 @@ gin::Handle<Tray> Tray::New(gin_helper::ErrorThrower thrower,
if (try_catch.HasCaught()) {
delete tray;
try_catch.ReThrow();
return gin::Handle<Tray>();
return {};
}
auto handle = gin::CreateHandle(args->isolate(), tray);
@@ -264,7 +264,7 @@ void Tray::SetTitle(const std::string& title,
std::string Tray::GetTitle() {
if (!CheckAlive())
return std::string();
return {};
#if BUILDFLAG(IS_MAC)
return tray_icon_->GetTitle();
#else
@@ -388,7 +388,7 @@ void Tray::SetContextMenu(gin_helper::ErrorThrower thrower,
gfx::Rect Tray::GetBounds() {
if (!CheckAlive())
return gfx::Rect();
return {};
return tray_icon_->GetBounds();
}

View File

@@ -44,6 +44,8 @@
namespace electron {
namespace {
base::IDMap<api::UtilityProcessWrapper*, base::ProcessId>&
GetAllUtilityProcessWrappers() {
static base::NoDestructor<
@@ -52,6 +54,8 @@ GetAllUtilityProcessWrappers() {
return *s_all_utility_process_wrappers;
}
} // namespace
namespace api {
gin::WrapperInfo UtilityProcessWrapper::kWrapperInfo = {
@@ -411,7 +415,7 @@ gin::Handle<UtilityProcessWrapper> UtilityProcessWrapper::Create(
gin_helper::Dictionary dict;
if (!args->GetNext(&dict)) {
args->ThrowTypeError("Options must be an object.");
return gin::Handle<UtilityProcessWrapper>();
return {};
}
std::u16string display_name;
@@ -425,19 +429,19 @@ gin::Handle<UtilityProcessWrapper> UtilityProcessWrapper::Create(
dict.Get("modulePath", &params->script);
if (dict.Has("args") && !dict.Get("args", &params->args)) {
args->ThrowTypeError("Invalid value for args");
return gin::Handle<UtilityProcessWrapper>();
return {};
}
gin_helper::Dictionary opts;
if (dict.Get("options", &opts)) {
if (opts.Has("env") && !opts.Get("env", &env_map)) {
args->ThrowTypeError("Invalid value for env");
return gin::Handle<UtilityProcessWrapper>();
return {};
}
if (opts.Has("execArgv") && !opts.Get("execArgv", &params->exec_args)) {
args->ThrowTypeError("Invalid value for execArgv");
return gin::Handle<UtilityProcessWrapper>();
return {};
}
opts.Get("serviceName", &display_name);

View File

@@ -282,7 +282,7 @@ void View::SetBounds(const gfx::Rect& bounds) {
gfx::Rect View::GetBounds() {
if (!view_)
return gfx::Rect();
return {};
return view_->bounds();
}
@@ -429,7 +429,7 @@ gin::Handle<View> View::Create(v8::Isolate* isolate) {
if (gin::ConvertFromV8(isolate, obj, &view))
return view;
}
return gin::Handle<View>();
return {};
}
// static

View File

@@ -540,16 +540,6 @@ const void* kElectronApiWebContentsKey = &kElectronApiWebContentsKey;
const char kRootName[] = "<root>";
struct FileSystem {
FileSystem() = default;
FileSystem(const std::string& type,
const std::string& file_system_name,
const std::string& root_url,
const std::string& file_system_path)
: type(type),
file_system_name(file_system_name),
root_url(root_url),
file_system_path(file_system_path) {}
std::string type;
std::string file_system_name;
std::string root_url;
@@ -1994,7 +1984,7 @@ gin::Handle<gin_helper::internal::Event> WebContents::MakeEventWithSender(
ReplyChannel::Create(isolate, std::move(callback))
->SendError("WebContents was destroyed");
}
return gin::Handle<gin_helper::internal::Event>();
return {};
}
gin::Handle<gin_helper::internal::Event> event =
gin_helper::internal::Event::New(isolate);
@@ -2552,7 +2542,7 @@ std::vector<content::NavigationEntry*> WebContents::GetHistory() const {
// If the history is empty, it contains only one entry and that is
// "InitialEntry"
if (history_length == 1 && controller.GetEntryAtIndex(0)->IsInitialEntry())
return std::vector<content::NavigationEntry*>();
return {};
std::vector<content::NavigationEntry*> history;
history.reserve(history_length);
@@ -2639,7 +2629,7 @@ std::string WebContents::GetMediaSourceID(
content::WebContents* request_web_contents) {
auto* frame_host = web_contents()->GetPrimaryMainFrame();
if (!frame_host)
return std::string();
return {};
content::DesktopMediaID media_id(
content::DesktopMediaID::TYPE_WEB_CONTENTS,
@@ -2649,7 +2639,7 @@ std::string WebContents::GetMediaSourceID(
auto* request_frame_host = request_web_contents->GetPrimaryMainFrame();
if (!request_frame_host)
return std::string();
return {};
std::string id =
content::DesktopStreamsRegistry::GetInstance()->RegisterStream(
@@ -2771,7 +2761,7 @@ bool WebContents::IsDevToolsOpened() {
std::u16string WebContents::GetDevToolsTitle() {
if (type_ == Type::kRemote)
return std::u16string();
return {};
DCHECK(inspectable_web_contents_);
return inspectable_web_contents_->GetDevToolsTitle();
@@ -3651,7 +3641,7 @@ gfx::Size WebContents::GetSizeForNewRenderView(content::WebContents* wc) {
}
}
return gfx::Size();
return {};
}
void WebContents::SetZoomLevel(double level) {

View File

@@ -66,7 +66,7 @@ gin::Handle<WebContents> WebContentsView::GetWebContents(v8::Isolate* isolate) {
if (api_web_contents_)
return gin::CreateHandle(isolate, api_web_contents_.get());
else
return gin::Handle<WebContents>();
return {};
}
void WebContentsView::SetBackgroundColor(std::optional<WrappedSkColor> color) {
@@ -152,7 +152,7 @@ gin::Handle<WebContentsView> WebContentsView::Create(
if (gin::ConvertFromV8(isolate, web_contents_view_obj, &web_contents_view))
return web_contents_view;
}
return gin::Handle<WebContentsView>();
return {};
}
// static

View File

@@ -9,9 +9,11 @@
#include <utility>
#include <vector>
#include "base/feature_list.h"
#include "base/logging.h"
#include "base/no_destructor.h"
#include "content/browser/renderer_host/render_frame_host_impl.h" // nogncheck
#include "content/browser/renderer_host/render_process_host_impl.h" // nogncheck
#include "content/public/browser/frame_tree_node_id.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/common/isolated_world_ids.h"
@@ -91,15 +93,16 @@ namespace electron::api {
// FrameTreeNodeId -> WebFrameMain*
// Using FrameTreeNode allows us to track frame across navigations. This
// is most similar to how <iframe> works.
typedef std::unordered_map<content::FrameTreeNodeId,
WebFrameMain*,
content::FrameTreeNodeId::Hasher>
FrameTreeNodeIdMap;
using FrameTreeNodeIdMap = std::unordered_map<content::FrameTreeNodeId,
WebFrameMain*,
content::FrameTreeNodeId::Hasher>;
// Token -> WebFrameMain*
// Maps exact RFH to a WebFrameMain instance.
typedef std::map<content::GlobalRenderFrameHostToken, WebFrameMain*>
FrameTokenMap;
using FrameTokenMap =
std::map<content::GlobalRenderFrameHostToken, WebFrameMain*>;
namespace {
FrameTreeNodeIdMap& GetFrameTreeNodeIdMap() {
static base::NoDestructor<FrameTreeNodeIdMap> instance;
@@ -110,6 +113,8 @@ FrameTokenMap& GetFrameTokenMap() {
return *instance;
}
} // namespace
// static
WebFrameMain* WebFrameMain::FromFrameTreeNodeId(
content::FrameTreeNodeId frame_tree_node_id) {
@@ -345,7 +350,7 @@ content::FrameTreeNodeId WebFrameMain::FrameTreeNodeID() const {
std::string WebFrameMain::Name() const {
if (!CheckRenderFrame())
return std::string();
return {};
return render_frame_->GetFrameName();
}
@@ -377,7 +382,7 @@ GURL WebFrameMain::URL() const {
std::string WebFrameMain::Origin() const {
if (!CheckRenderFrame())
return std::string();
return {};
return render_frame_->GetLastCommittedOrigin().Serialize();
}
@@ -426,20 +431,75 @@ std::vector<content::RenderFrameHost*> WebFrameMain::FramesInSubtree() const {
return frame_hosts;
}
v8::Local<v8::Promise> WebFrameMain::CollectDocumentJSCallStack(
gin::Arguments* args) {
gin_helper::Promise<base::Value> promise(args->isolate());
v8::Local<v8::Promise> handle = promise.GetHandle();
if (render_frame_disposed_) {
promise.RejectWithErrorMessage(
"Render frame was disposed before WebFrameMain could be accessed");
return handle;
}
if (!base::FeatureList::IsEnabled(
blink::features::kDocumentPolicyIncludeJSCallStacksInCrashReports)) {
promise.RejectWithErrorMessage(
"DocumentPolicyIncludeJSCallStacksInCrashReports is not enabled");
return handle;
}
content::RenderProcessHostImpl* rph_impl =
static_cast<content::RenderProcessHostImpl*>(render_frame_->GetProcess());
rph_impl->GetJavaScriptCallStackGeneratorInterface()
->CollectJavaScriptCallStack(
base::BindOnce(&WebFrameMain::CollectedJavaScriptCallStack,
weak_factory_.GetWeakPtr(), std::move(promise)));
return handle;
}
void WebFrameMain::CollectedJavaScriptCallStack(
gin_helper::Promise<base::Value> promise,
const std::string& untrusted_javascript_call_stack,
const std::optional<blink::LocalFrameToken>& remote_frame_token) {
if (render_frame_disposed_) {
promise.RejectWithErrorMessage(
"Render frame was disposed before call stack was received");
return;
}
const blink::LocalFrameToken& frame_token = render_frame_->GetFrameToken();
if (remote_frame_token == frame_token) {
base::Value base_value(untrusted_javascript_call_stack);
promise.Resolve(base_value);
} else if (!remote_frame_token) {
// Failed to collect call stack. See logic in:
// third_party/blink/renderer/controller/javascript_call_stack_collector.cc
promise.Resolve(base::Value());
} else {
// Requests for call stacks can be initiated on an old RenderProcessHost
// then be received after a frame swap.
LOG(ERROR) << "Received call stack from old RPH";
promise.Resolve(base::Value());
}
}
void WebFrameMain::DOMContentLoaded() {
Emit("dom-ready");
}
// static
gin::Handle<WebFrameMain> WebFrameMain::New(v8::Isolate* isolate) {
return gin::Handle<WebFrameMain>();
return {};
}
// static
gin::Handle<WebFrameMain> WebFrameMain::From(v8::Isolate* isolate,
content::RenderFrameHost* rfh) {
if (!rfh)
return gin::Handle<WebFrameMain>();
return {};
auto* web_frame = FromRenderFrameHost(rfh);
if (web_frame)
@@ -458,6 +518,8 @@ void WebFrameMain::FillObjectTemplate(v8::Isolate* isolate,
v8::Local<v8::ObjectTemplate> templ) {
gin_helper::ObjectTemplateBuilder(isolate, templ)
.SetMethod("executeJavaScript", &WebFrameMain::ExecuteJavaScript)
.SetMethod("collectJavaScriptCallStack",
&WebFrameMain::CollectDocumentJSCallStack)
.SetMethod("reload", &WebFrameMain::Reload)
.SetMethod("isDestroyed", &WebFrameMain::IsDestroyed)
.SetMethod("_send", &WebFrameMain::Send)

View File

@@ -36,6 +36,11 @@ template <typename T>
class Handle;
} // namespace gin
namespace gin_helper {
template <typename T>
class Promise;
} // namespace gin_helper
namespace electron::api {
class WebContents;
@@ -128,6 +133,12 @@ class WebFrameMain final : public gin::Wrappable<WebFrameMain>,
std::vector<content::RenderFrameHost*> Frames() const;
std::vector<content::RenderFrameHost*> FramesInSubtree() const;
v8::Local<v8::Promise> CollectDocumentJSCallStack(gin::Arguments* args);
void CollectedJavaScriptCallStack(
gin_helper::Promise<base::Value> promise,
const std::string& untrusted_javascript_call_stack,
const std::optional<blink::LocalFrameToken>& remote_frame_token);
void DOMContentLoaded();
mojo::Remote<mojom::ElectronRenderer> renderer_api_;

View File

@@ -723,11 +723,11 @@ gin::Handle<WebRequest> WebRequest::From(
v8::Isolate* isolate,
content::BrowserContext* browser_context) {
if (!browser_context)
return gin::Handle<WebRequest>();
return {};
auto* user_data =
static_cast<UserData*>(browser_context->GetUserData(kUserDataKey));
if (!user_data)
return gin::Handle<WebRequest>();
return {};
return gin::CreateHandle(isolate, user_data->data.get());
}

View File

@@ -225,7 +225,7 @@ std::vector<blink::MessagePortChannel> MessagePort::DisentanglePorts(
const std::vector<gin::Handle<MessagePort>>& ports,
bool* threw_exception) {
if (ports.empty())
return std::vector<blink::MessagePortChannel>();
return {};
std::unordered_set<MessagePort*> visited;
@@ -244,7 +244,7 @@ std::vector<blink::MessagePortChannel> MessagePort::DisentanglePorts(
gin_helper::ErrorThrower(isolate).ThrowError(
"Port at index " + base::NumberToString(i) + " is " + type + ".");
*threw_exception = true;
return std::vector<blink::MessagePortChannel>();
return {};
}
visited.insert(port);
}

View File

@@ -43,7 +43,7 @@ class Delegate {
const std::string& update_url) {}
protected:
virtual ~Delegate() {}
virtual ~Delegate() = default;
};
class AutoUpdater {

View File

@@ -66,9 +66,9 @@ std::optional<std::string> GetXdgAppOutput(
&success_code);
if (!ran_ok || success_code != EXIT_SUCCESS)
return std::optional<std::string>();
return {};
return std::make_optional(reply);
return reply;
}
bool SetDefaultWebClient(const std::string& protocol) {

View File

@@ -85,7 +85,7 @@ class BrowserObserver : public base::CheckedObserver {
#endif
protected:
~BrowserObserver() override {}
~BrowserObserver() override = default;
};
} // namespace electron

View File

@@ -97,7 +97,7 @@ bool IsValidCustomProtocol(const std::wstring& scheme) {
std::wstring GetAppInfoHelperForProtocol(ASSOCSTR assoc_str, const GURL& url) {
const std::wstring url_scheme = base::ASCIIToWide(url.scheme_piece());
if (!IsValidCustomProtocol(url_scheme))
return std::wstring();
return {};
wchar_t out_buffer[1024];
DWORD buffer_size = std::size(out_buffer);
@@ -106,7 +106,7 @@ std::wstring GetAppInfoHelperForProtocol(ASSOCSTR assoc_str, const GURL& url) {
nullptr, out_buffer, &buffer_size);
if (FAILED(hr)) {
DLOG(WARNING) << "AssocQueryString failed!";
return std::wstring();
return {};
}
return std::wstring(out_buffer);
}
@@ -251,7 +251,7 @@ std::unique_ptr<FileVersionInfo> FetchFileVersionInfo() {
electron::ScopedAllowBlockingForElectron allow_blocking;
return FileVersionInfo::CreateFileVersionInfo(path);
}
return std::unique_ptr<FileVersionInfo>();
return {};
}
} // namespace

View File

@@ -264,9 +264,7 @@ bool AllowFileAccess(const std::string& extension_id,
extension_id);
}
RenderProcessHostPrivilege GetPrivilegeRequiredByUrl(
const GURL& url,
extensions::ExtensionRegistry* registry) {
RenderProcessHostPrivilege GetPrivilegeRequiredByUrl(const GURL& url) {
// Default to a normal renderer cause it is lower privileged. This should only
// occur if the URL on a site instance is either malformed, or uninitialized.
// If it is malformed, then there is no need for better privileges anyways.
@@ -594,7 +592,7 @@ ElectronBrowserClient::GetGeneratedCodeCacheSettings(
// If we pass 0 for size, disk_cache will pick a default size using the
// heuristics based on available disk size. These are implemented in
// disk_cache::PreferredCacheSize in net/disk_cache/cache_util.cc.
return content::GeneratedCodeCacheSettings(true, 0, cache_path);
return {true, 0, cache_path};
}
void ElectronBrowserClient::AllowCertificateError(
@@ -627,7 +625,7 @@ base::OnceClosure ElectronBrowserClient::SelectClientCertificate(
std::move(client_certs), std::move(delegate));
}
return base::OnceClosure();
return {};
}
bool ElectronBrowserClient::CanCreateWindow(
@@ -731,15 +729,12 @@ bool ElectronBrowserClient::IsSuitableHost(
const GURL& site_url) {
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
auto* browser_context = process_host->GetBrowserContext();
extensions::ExtensionRegistry* registry =
extensions::ExtensionRegistry::Get(browser_context);
extensions::ProcessMap* process_map =
extensions::ProcessMap::Get(browser_context);
// Otherwise, just make sure the process privilege matches the privilege
// required by the site.
RenderProcessHostPrivilege privilege_required =
GetPrivilegeRequiredByUrl(site_url, registry);
const auto privilege_required = GetPrivilegeRequiredByUrl(site_url);
return GetProcessPrivilege(process_host, process_map) == privilege_required;
#else
return content::ContentBrowserClient::IsSuitableHost(process_host, site_url);
@@ -792,7 +787,7 @@ ElectronBrowserClient::CreateClientCertStore(
#elif BUILDFLAG(IS_MAC)
return std::make_unique<net::ClientCertStoreMac>();
#elif defined(USE_OPENSSL)
return std::unique_ptr<net::ClientCertStore>();
return ();
#endif
}
@@ -801,7 +796,7 @@ ElectronBrowserClient::OverrideSystemLocationProvider() {
#if BUILDFLAG(OVERRIDE_LOCATION_PROVIDER)
return std::make_unique<FakeLocationProvider>();
#else
return nullptr;
return {};
#endif
}
@@ -983,7 +978,7 @@ base::FilePath ElectronBrowserClient::GetDefaultDownloadDirectory() {
base::FilePath download_path;
if (base::PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS, &download_path))
return download_path;
return base::FilePath();
return {};
}
scoped_refptr<network::SharedURLLoaderFactory>

View File

@@ -484,7 +484,7 @@ ElectronBrowserContext::CreateZoomLevelDelegate(
if (!IsOffTheRecord()) {
return std::make_unique<ZoomLevelDelegate>(prefs(), partition_path);
}
return std::unique_ptr<content::ZoomLevelDelegate>();
return {};
}
content::DownloadManagerDelegate*

View File

@@ -163,7 +163,7 @@ std::u16string MediaStringProvider(media::MessageId id) {
return u"Communications";
#endif
default:
return std::u16string();
return {};
}
}

View File

@@ -86,7 +86,7 @@ class ElectronPermissionManager::PendingRequest {
return content::RenderFrameHost::FromID(render_frame_host_id_);
}
bool IsComplete() const { return remaining_results_ == 0; }
[[nodiscard]] bool IsComplete() const { return remaining_results_ == 0; }
void RunCallback() {
if (!callback_.is_null()) {
@@ -278,8 +278,7 @@ ElectronPermissionManager::GetPermissionResultForOriginWithoutContext(
const url::Origin& embedding_origin) {
blink::mojom::PermissionStatus status = GetPermissionStatus(
permission, requesting_origin.GetURL(), embedding_origin.GetURL());
return content::PermissionResult(
status, content::PermissionStatusSource::UNSPECIFIED);
return {status, content::PermissionStatusSource::UNSPECIFIED};
}
void ElectronPermissionManager::CheckBluetoothDevicePair(

View File

@@ -54,7 +54,7 @@ ElectronWebUIControllerFactory::CreateWebUIControllerForURL(
if (host == chrome::kChromeUIAccessibilityHost)
return std::make_unique<ElectronAccessibilityUI>(web_ui);
return std::unique_ptr<content::WebUIController>();
return {};
}
} // namespace electron

View File

@@ -26,7 +26,7 @@ class ExtendedWebContentsObserver : public base::CheckedObserver {
virtual void OnDevToolsResized() {}
protected:
~ExtendedWebContentsObserver() override {}
~ExtendedWebContentsObserver() override = default;
};
} // namespace electron

View File

@@ -106,14 +106,14 @@ class ExtensionActionFunction : public ExtensionFunction {
// show
class ExtensionActionShowFunction : public ExtensionActionFunction {
protected:
~ExtensionActionShowFunction() override {}
~ExtensionActionShowFunction() override = default;
ResponseAction RunExtensionAction() override;
};
// hide
class ExtensionActionHideFunction : public ExtensionActionFunction {
protected:
~ExtensionActionHideFunction() override {}
~ExtensionActionHideFunction() override = default;
ResponseAction RunExtensionAction() override;
};
@@ -123,28 +123,28 @@ class ExtensionActionSetIconFunction : public ExtensionActionFunction {
static void SetReportErrorForInvisibleIconForTesting(bool value);
protected:
~ExtensionActionSetIconFunction() override {}
~ExtensionActionSetIconFunction() override = default;
ResponseAction RunExtensionAction() override;
};
// setTitle
class ExtensionActionSetTitleFunction : public ExtensionActionFunction {
protected:
~ExtensionActionSetTitleFunction() override {}
~ExtensionActionSetTitleFunction() override = default;
ResponseAction RunExtensionAction() override;
};
// setPopup
class ExtensionActionSetPopupFunction : public ExtensionActionFunction {
protected:
~ExtensionActionSetPopupFunction() override {}
~ExtensionActionSetPopupFunction() override = default;
ResponseAction RunExtensionAction() override;
};
// setBadgeText
class ExtensionActionSetBadgeTextFunction : public ExtensionActionFunction {
protected:
~ExtensionActionSetBadgeTextFunction() override {}
~ExtensionActionSetBadgeTextFunction() override = default;
ResponseAction RunExtensionAction() override;
};
@@ -152,35 +152,35 @@ class ExtensionActionSetBadgeTextFunction : public ExtensionActionFunction {
class ExtensionActionSetBadgeBackgroundColorFunction
: public ExtensionActionFunction {
protected:
~ExtensionActionSetBadgeBackgroundColorFunction() override {}
~ExtensionActionSetBadgeBackgroundColorFunction() override = default;
ResponseAction RunExtensionAction() override;
};
// getTitle
class ExtensionActionGetTitleFunction : public ExtensionActionFunction {
protected:
~ExtensionActionGetTitleFunction() override {}
~ExtensionActionGetTitleFunction() override = default;
ResponseAction RunExtensionAction() override;
};
// getPopup
class ExtensionActionGetPopupFunction : public ExtensionActionFunction {
protected:
~ExtensionActionGetPopupFunction() override {}
~ExtensionActionGetPopupFunction() override = default;
ResponseAction RunExtensionAction() override;
};
// openPopup
class ExtensionActionOpenPopupFunction : public ExtensionActionFunction {
protected:
~ExtensionActionOpenPopupFunction() override {}
~ExtensionActionOpenPopupFunction() override = default;
ResponseAction RunExtensionAction() override;
};
// getBadgeText
class ExtensionActionGetBadgeTextFunction : public ExtensionActionFunction {
protected:
~ExtensionActionGetBadgeTextFunction() override {}
~ExtensionActionGetBadgeTextFunction() override = default;
ResponseAction RunExtensionAction() override;
};
@@ -188,7 +188,7 @@ class ExtensionActionGetBadgeTextFunction : public ExtensionActionFunction {
class ExtensionActionGetBadgeBackgroundColorFunction
: public ExtensionActionFunction {
protected:
~ExtensionActionGetBadgeBackgroundColorFunction() override {}
~ExtensionActionGetBadgeBackgroundColorFunction() override = default;
ResponseAction RunExtensionAction() override;
};
@@ -201,7 +201,7 @@ class ActionSetIconFunction : public ExtensionActionSetIconFunction {
DECLARE_EXTENSION_FUNCTION("action.setIcon", ACTION_SETICON)
protected:
~ActionSetIconFunction() override {}
~ActionSetIconFunction() override = default;
};
class ActionGetPopupFunction : public ExtensionActionGetPopupFunction {
@@ -209,7 +209,7 @@ class ActionGetPopupFunction : public ExtensionActionGetPopupFunction {
DECLARE_EXTENSION_FUNCTION("action.getPopup", ACTION_GETPOPUP)
protected:
~ActionGetPopupFunction() override {}
~ActionGetPopupFunction() override = default;
};
class ActionSetPopupFunction : public ExtensionActionSetPopupFunction {
@@ -217,7 +217,7 @@ class ActionSetPopupFunction : public ExtensionActionSetPopupFunction {
DECLARE_EXTENSION_FUNCTION("action.setPopup", ACTION_SETPOPUP)
protected:
~ActionSetPopupFunction() override {}
~ActionSetPopupFunction() override = default;
};
class ActionGetTitleFunction : public ExtensionActionGetTitleFunction {
@@ -225,7 +225,7 @@ class ActionGetTitleFunction : public ExtensionActionGetTitleFunction {
DECLARE_EXTENSION_FUNCTION("action.getTitle", ACTION_GETTITLE)
protected:
~ActionGetTitleFunction() override {}
~ActionGetTitleFunction() override = default;
};
class ActionSetTitleFunction : public ExtensionActionSetTitleFunction {
@@ -233,7 +233,7 @@ class ActionSetTitleFunction : public ExtensionActionSetTitleFunction {
DECLARE_EXTENSION_FUNCTION("action.setTitle", ACTION_SETTITLE)
protected:
~ActionSetTitleFunction() override {}
~ActionSetTitleFunction() override = default;
};
class ActionGetBadgeTextFunction : public ExtensionActionGetBadgeTextFunction {
@@ -241,7 +241,7 @@ class ActionGetBadgeTextFunction : public ExtensionActionGetBadgeTextFunction {
DECLARE_EXTENSION_FUNCTION("action.getBadgeText", ACTION_GETBADGETEXT)
protected:
~ActionGetBadgeTextFunction() override {}
~ActionGetBadgeTextFunction() override = default;
};
class ActionSetBadgeTextFunction : public ExtensionActionSetBadgeTextFunction {
@@ -249,7 +249,7 @@ class ActionSetBadgeTextFunction : public ExtensionActionSetBadgeTextFunction {
DECLARE_EXTENSION_FUNCTION("action.setBadgeText", ACTION_SETBADGETEXT)
protected:
~ActionSetBadgeTextFunction() override {}
~ActionSetBadgeTextFunction() override = default;
};
class ActionGetBadgeBackgroundColorFunction
@@ -259,7 +259,7 @@ class ActionGetBadgeBackgroundColorFunction
ACTION_GETBADGEBACKGROUNDCOLOR)
protected:
~ActionGetBadgeBackgroundColorFunction() override {}
~ActionGetBadgeBackgroundColorFunction() override = default;
};
class ActionSetBadgeBackgroundColorFunction
@@ -269,7 +269,7 @@ class ActionSetBadgeBackgroundColorFunction
ACTION_SETBADGEBACKGROUNDCOLOR)
protected:
~ActionSetBadgeBackgroundColorFunction() override {}
~ActionSetBadgeBackgroundColorFunction() override = default;
};
class ActionGetBadgeTextColorFunction : public ExtensionActionFunction {
@@ -297,7 +297,7 @@ class ActionEnableFunction : public ExtensionActionShowFunction {
DECLARE_EXTENSION_FUNCTION("action.enable", ACTION_ENABLE)
protected:
~ActionEnableFunction() override {}
~ActionEnableFunction() override = default;
};
class ActionDisableFunction : public ExtensionActionHideFunction {
@@ -305,7 +305,7 @@ class ActionDisableFunction : public ExtensionActionHideFunction {
DECLARE_EXTENSION_FUNCTION("action.disable", ACTION_DISABLE)
protected:
~ActionDisableFunction() override {}
~ActionDisableFunction() override = default;
};
class ActionIsEnabledFunction : public ExtensionActionFunction {
@@ -350,7 +350,7 @@ class BrowserActionSetIconFunction : public ExtensionActionSetIconFunction {
DECLARE_EXTENSION_FUNCTION("browserAction.setIcon", BROWSERACTION_SETICON)
protected:
~BrowserActionSetIconFunction() override {}
~BrowserActionSetIconFunction() override = default;
};
class BrowserActionSetTitleFunction : public ExtensionActionSetTitleFunction {
@@ -358,7 +358,7 @@ class BrowserActionSetTitleFunction : public ExtensionActionSetTitleFunction {
DECLARE_EXTENSION_FUNCTION("browserAction.setTitle", BROWSERACTION_SETTITLE)
protected:
~BrowserActionSetTitleFunction() override {}
~BrowserActionSetTitleFunction() override = default;
};
class BrowserActionSetPopupFunction : public ExtensionActionSetPopupFunction {
@@ -366,7 +366,7 @@ class BrowserActionSetPopupFunction : public ExtensionActionSetPopupFunction {
DECLARE_EXTENSION_FUNCTION("browserAction.setPopup", BROWSERACTION_SETPOPUP)
protected:
~BrowserActionSetPopupFunction() override {}
~BrowserActionSetPopupFunction() override = default;
};
class BrowserActionGetTitleFunction : public ExtensionActionGetTitleFunction {
@@ -374,7 +374,7 @@ class BrowserActionGetTitleFunction : public ExtensionActionGetTitleFunction {
DECLARE_EXTENSION_FUNCTION("browserAction.getTitle", BROWSERACTION_GETTITLE)
protected:
~BrowserActionGetTitleFunction() override {}
~BrowserActionGetTitleFunction() override = default;
};
class BrowserActionGetPopupFunction : public ExtensionActionGetPopupFunction {
@@ -382,7 +382,7 @@ class BrowserActionGetPopupFunction : public ExtensionActionGetPopupFunction {
DECLARE_EXTENSION_FUNCTION("browserAction.getPopup", BROWSERACTION_GETPOPUP)
protected:
~BrowserActionGetPopupFunction() override {}
~BrowserActionGetPopupFunction() override = default;
};
class BrowserActionSetBadgeTextFunction
@@ -392,7 +392,7 @@ class BrowserActionSetBadgeTextFunction
BROWSERACTION_SETBADGETEXT)
protected:
~BrowserActionSetBadgeTextFunction() override {}
~BrowserActionSetBadgeTextFunction() override = default;
};
class BrowserActionSetBadgeBackgroundColorFunction
@@ -402,7 +402,7 @@ class BrowserActionSetBadgeBackgroundColorFunction
BROWSERACTION_SETBADGEBACKGROUNDCOLOR)
protected:
~BrowserActionSetBadgeBackgroundColorFunction() override {}
~BrowserActionSetBadgeBackgroundColorFunction() override = default;
};
class BrowserActionGetBadgeTextFunction
@@ -412,7 +412,7 @@ class BrowserActionGetBadgeTextFunction
BROWSERACTION_GETBADGETEXT)
protected:
~BrowserActionGetBadgeTextFunction() override {}
~BrowserActionGetBadgeTextFunction() override = default;
};
class BrowserActionGetBadgeBackgroundColorFunction
@@ -422,7 +422,7 @@ class BrowserActionGetBadgeBackgroundColorFunction
BROWSERACTION_GETBADGEBACKGROUNDCOLOR)
protected:
~BrowserActionGetBadgeBackgroundColorFunction() override {}
~BrowserActionGetBadgeBackgroundColorFunction() override = default;
};
class BrowserActionEnableFunction : public ExtensionActionShowFunction {
@@ -430,7 +430,7 @@ class BrowserActionEnableFunction : public ExtensionActionShowFunction {
DECLARE_EXTENSION_FUNCTION("browserAction.enable", BROWSERACTION_ENABLE)
protected:
~BrowserActionEnableFunction() override {}
~BrowserActionEnableFunction() override = default;
};
class BrowserActionDisableFunction : public ExtensionActionHideFunction {
@@ -438,7 +438,7 @@ class BrowserActionDisableFunction : public ExtensionActionHideFunction {
DECLARE_EXTENSION_FUNCTION("browserAction.disable", BROWSERACTION_DISABLE)
protected:
~BrowserActionDisableFunction() override {}
~BrowserActionDisableFunction() override = default;
};
class BrowserActionOpenPopupFunction : public ExtensionActionOpenPopupFunction {
@@ -447,7 +447,7 @@ class BrowserActionOpenPopupFunction : public ExtensionActionOpenPopupFunction {
BROWSERACTION_OPEN_POPUP)
protected:
~BrowserActionOpenPopupFunction() override {}
~BrowserActionOpenPopupFunction() override = default;
};
} // namespace extensions
@@ -461,7 +461,7 @@ class PageActionShowFunction : public extensions::ExtensionActionShowFunction {
DECLARE_EXTENSION_FUNCTION("pageAction.show", PAGEACTION_SHOW)
protected:
~PageActionShowFunction() override {}
~PageActionShowFunction() override = default;
};
class PageActionHideFunction : public extensions::ExtensionActionHideFunction {
@@ -469,7 +469,7 @@ class PageActionHideFunction : public extensions::ExtensionActionHideFunction {
DECLARE_EXTENSION_FUNCTION("pageAction.hide", PAGEACTION_HIDE)
protected:
~PageActionHideFunction() override {}
~PageActionHideFunction() override = default;
};
class PageActionSetIconFunction
@@ -478,7 +478,7 @@ class PageActionSetIconFunction
DECLARE_EXTENSION_FUNCTION("pageAction.setIcon", PAGEACTION_SETICON)
protected:
~PageActionSetIconFunction() override {}
~PageActionSetIconFunction() override = default;
};
class PageActionSetTitleFunction
@@ -487,7 +487,7 @@ class PageActionSetTitleFunction
DECLARE_EXTENSION_FUNCTION("pageAction.setTitle", PAGEACTION_SETTITLE)
protected:
~PageActionSetTitleFunction() override {}
~PageActionSetTitleFunction() override = default;
};
class PageActionSetPopupFunction
@@ -496,7 +496,7 @@ class PageActionSetPopupFunction
DECLARE_EXTENSION_FUNCTION("pageAction.setPopup", PAGEACTION_SETPOPUP)
protected:
~PageActionSetPopupFunction() override {}
~PageActionSetPopupFunction() override = default;
};
class PageActionGetTitleFunction
@@ -505,7 +505,7 @@ class PageActionGetTitleFunction
DECLARE_EXTENSION_FUNCTION("pageAction.getTitle", PAGEACTION_GETTITLE)
protected:
~PageActionGetTitleFunction() override {}
~PageActionGetTitleFunction() override = default;
};
class PageActionGetPopupFunction
@@ -514,7 +514,7 @@ class PageActionGetPopupFunction
DECLARE_EXTENSION_FUNCTION("pageAction.getPopup", PAGEACTION_GETPOPUP)
protected:
~PageActionGetPopupFunction() override {}
~PageActionGetPopupFunction() override = default;
};
#endif // SHELL_BROWSER_EXTENSIONS_API_EXTENSION_ACTION_EXTENSION_ACTION_API_H_

View File

@@ -49,10 +49,10 @@ namespace extensions {
namespace {
constexpr char kCouldNotLoadFileError[] = "Could not load file: '*'.";
constexpr char kDuplicateFileSpecifiedError[] =
constexpr std::string_view kCouldNotLoadFileError = "Could not load file: '*'.";
constexpr std::string_view kDuplicateFileSpecifiedError =
"Duplicate file specified: '*'.";
constexpr char kEmptyMatchesError[] =
constexpr std::string_view kEmptyMatchesError =
"Script with ID '*' must specify 'matches'.";
constexpr char kExactlyOneOfCssAndFilesError[] =
"Exactly one of 'css' and 'files' must be specified.";

View File

@@ -6,6 +6,7 @@
#include <optional>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
@@ -39,7 +40,7 @@ namespace extensions {
namespace tabs = api::tabs;
const char kFrameNotFoundError[] = "No frame with id * in tab *.";
constexpr std::string_view kFrameNotFoundError = "No frame with id * in tab *.";
const char kPerOriginOnlyInAutomaticError[] =
"Can only set scope to "
"\"per-origin\" in \"automatic\" mode.";

View File

@@ -43,13 +43,13 @@ class TabsExecuteScriptFunction : public ExecuteCodeInTabFunction {
bool ShouldRemoveCSS() const override;
private:
~TabsExecuteScriptFunction() override {}
~TabsExecuteScriptFunction() override = default;
DECLARE_EXTENSION_FUNCTION("tabs.executeScript", TABS_EXECUTESCRIPT)
};
class TabsReloadFunction : public ExtensionFunction {
~TabsReloadFunction() override {}
~TabsReloadFunction() override = default;
ResponseAction Run() override;
@@ -57,7 +57,7 @@ class TabsReloadFunction : public ExtensionFunction {
};
class TabsQueryFunction : public ExtensionFunction {
~TabsQueryFunction() override {}
~TabsQueryFunction() override = default;
ResponseAction Run() override;
@@ -65,7 +65,7 @@ class TabsQueryFunction : public ExtensionFunction {
};
class TabsGetFunction : public ExtensionFunction {
~TabsGetFunction() override {}
~TabsGetFunction() override = default;
ResponseAction Run() override;
@@ -74,7 +74,7 @@ class TabsGetFunction : public ExtensionFunction {
class TabsSetZoomFunction : public ExtensionFunction {
private:
~TabsSetZoomFunction() override {}
~TabsSetZoomFunction() override = default;
ResponseAction Run() override;
@@ -83,7 +83,7 @@ class TabsSetZoomFunction : public ExtensionFunction {
class TabsGetZoomFunction : public ExtensionFunction {
private:
~TabsGetZoomFunction() override {}
~TabsGetZoomFunction() override = default;
ResponseAction Run() override;
@@ -92,7 +92,7 @@ class TabsGetZoomFunction : public ExtensionFunction {
class TabsSetZoomSettingsFunction : public ExtensionFunction {
private:
~TabsSetZoomSettingsFunction() override {}
~TabsSetZoomSettingsFunction() override = default;
ResponseAction Run() override;
@@ -101,7 +101,7 @@ class TabsSetZoomSettingsFunction : public ExtensionFunction {
class TabsGetZoomSettingsFunction : public ExtensionFunction {
private:
~TabsGetZoomSettingsFunction() override {}
~TabsGetZoomSettingsFunction() override = default;
ResponseAction Run() override;
@@ -113,7 +113,7 @@ class TabsUpdateFunction : public ExtensionFunction {
TabsUpdateFunction();
protected:
~TabsUpdateFunction() override {}
~TabsUpdateFunction() override = default;
bool UpdateURL(const std::string& url, int tab_id, std::string* error);
ResponseValue GetResult();

View File

@@ -87,6 +87,8 @@ void ElectronExtensionSystem::InitForRegularProfile(bool extensions_enabled) {
management_policy_ = std::make_unique<ManagementPolicy>();
}
namespace {
std::unique_ptr<base::Value::Dict> ParseManifest(
const std::string_view manifest_contents) {
JSONStringValueDeserializer deserializer(manifest_contents);
@@ -95,11 +97,13 @@ std::unique_ptr<base::Value::Dict> ParseManifest(
if (!manifest.get() || !manifest->is_dict()) {
LOG(ERROR) << "Failed to parse extension manifest.";
return std::unique_ptr<base::Value::Dict>();
return {};
}
return std::make_unique<base::Value::Dict>(std::move(*manifest).TakeDict());
}
} // namespace
void ElectronExtensionSystem::LoadComponentExtensions() {
std::string utf8_error;
#if BUILDFLAG(ENABLE_PDF_VIEWER)

View File

@@ -165,22 +165,22 @@ base::FilePath ElectronExtensionsBrowserClient::GetBundleResourcePath(
*resource_id = 0;
base::FilePath chrome_resources_path;
if (!base::PathService::Get(chrome::DIR_RESOURCES, &chrome_resources_path))
return base::FilePath();
return {};
// Since component extension resources are included in
// component_extension_resources.pak file in |chrome_resources_path|,
// calculate the extension |request_relative_path| against
// |chrome_resources_path|.
if (!chrome_resources_path.IsParent(extension_resources_path))
return base::FilePath();
return {};
const base::FilePath request_relative_path =
base::FilePath request_relative_path =
extensions::file_util::ExtensionURLToRelativeFilePath(request.url);
if (!ExtensionsBrowserClient::Get()
->GetComponentExtensionResourceManager()
->IsComponentExtensionResource(extension_resources_path,
request_relative_path, resource_id)) {
return base::FilePath();
return {};
}
DCHECK_NE(0, *resource_id);

View File

@@ -531,7 +531,7 @@ bool FileSelectHelper::IsAcceptTypeValid(const std::string& accept_type) {
base::FilePath FileSelectHelper::GetSanitizedFileName(
const base::FilePath& suggested_filename) {
if (suggested_filename.empty())
return base::FilePath();
return {};
return net::GenerateFileName(
GURL(), std::string(), std::string(), suggested_filename.AsUTF8Unsafe(),
std::string(), l10n_util::GetStringUTF8(IDS_DEFAULT_DOWNLOAD_FILENAME));

View File

@@ -90,10 +90,10 @@ using blink::mojom::PermissionStatus;
// }
const char kDefaultLastPickedDirectoryKey[] = "default-id";
const char kCustomLastPickedDirectoryKey[] = "custom-id";
const char kPathKey[] = "path";
const char kPathTypeKey[] = "path-type";
const char kDisplayNameKey[] = "display-name";
const char kTimestampKey[] = "timestamp";
constexpr std::string_view kPathKey = "path";
constexpr std::string_view kPathTypeKey = "path-type";
constexpr std::string_view kDisplayNameKey = "display-name";
constexpr std::string_view kTimestampKey = "timestamp";
constexpr base::TimeDelta kPermissionRevocationTimeout = base::Seconds(5);

View File

@@ -40,12 +40,14 @@ gin::IsolateHolder CreateIsolateHolder(v8::Isolate* isolate) {
// This is necessary for important aspects of Node.js
// including heap and cpu profilers to function properly.
return gin::IsolateHolder(base::SingleThreadTaskRunner::GetCurrentDefault(),
gin::IsolateHolder::kSingleThread,
gin::IsolateHolder::IsolateType::kUtility,
std::move(create_params),
gin::IsolateHolder::IsolateCreationMode::kNormal,
nullptr, nullptr, isolate);
return {base::SingleThreadTaskRunner::GetCurrentDefault(),
gin::IsolateHolder::kSingleThread,
gin::IsolateHolder::IsolateType::kUtility,
std::move(create_params),
gin::IsolateHolder::IsolateCreationMode::kNormal,
nullptr,
nullptr,
isolate};
}
} // namespace

View File

@@ -10,24 +10,22 @@
#include <string>
// Unity data typedefs.
typedef struct _UnityInspector UnityInspector;
typedef UnityInspector* (*unity_inspector_get_default_func)();
typedef gboolean (*unity_inspector_get_unity_running_func)(
UnityInspector* self);
using UnityInspector = struct _UnityInspector;
using unity_inspector_get_default_func = UnityInspector* (*)();
using unity_inspector_get_unity_running_func =
gboolean (*)(UnityInspector* self);
typedef struct _UnityLauncherEntry UnityLauncherEntry;
typedef UnityLauncherEntry* (*unity_launcher_entry_get_for_desktop_id_func)(
const gchar* desktop_id);
typedef void (*unity_launcher_entry_set_count_func)(UnityLauncherEntry* self,
gint64 value);
typedef void (*unity_launcher_entry_set_count_visible_func)(
UnityLauncherEntry* self,
gboolean value);
typedef void (*unity_launcher_entry_set_progress_func)(UnityLauncherEntry* self,
gdouble value);
typedef void (*unity_launcher_entry_set_progress_visible_func)(
UnityLauncherEntry* self,
gboolean value);
using UnityLauncherEntry = struct _UnityLauncherEntry;
using unity_launcher_entry_get_for_desktop_id_func =
UnityLauncherEntry* (*)(const gchar* desktop_id);
using unity_launcher_entry_set_count_func = void (*)(UnityLauncherEntry* self,
gint64 value);
using unity_launcher_entry_set_count_visible_func =
void (*)(UnityLauncherEntry* self, gboolean value);
using unity_launcher_entry_set_progress_func =
void (*)(UnityLauncherEntry* self, gdouble value);
using unity_launcher_entry_set_progress_visible_func =
void (*)(UnityLauncherEntry* self, gboolean value);
namespace {

View File

@@ -334,7 +334,7 @@ extensions::SizeConstraints NativeWindow::GetSizeConstraints() const {
if (size_constraints_)
return *size_constraints_;
if (!content_size_constraints_)
return extensions::SizeConstraints();
return {};
// Convert content size constraints to window size constraints.
extensions::SizeConstraints constraints;
if (content_size_constraints_->HasMaximumSize()) {
@@ -368,7 +368,7 @@ extensions::SizeConstraints NativeWindow::GetContentSizeConstraints() const {
if (content_size_constraints_)
return *content_size_constraints_;
if (!size_constraints_)
return extensions::SizeConstraints();
return {};
// Convert window size constraints to content size constraints.
// Note that we are not caching the results, because Chromium reccalculates
// window frame size everytime when min/max sizes are passed, and we must

View File

@@ -169,6 +169,9 @@ class NativeWindowMac : public NativeWindow,
void NotifyWindowDidFailToEnterFullScreen();
void NotifyWindowWillLeaveFullScreen();
// views::WidgetDelegate:
views::View* GetContentsView() override;
// Cleanup observers when window is getting closed. Note that the destructor
// can be called much later after window gets closed, so we should not do
// cleanup in destructor.
@@ -220,7 +223,6 @@ class NativeWindowMac : public NativeWindow,
protected:
// views::WidgetDelegate:
views::View* GetContentsView() override;
bool CanMaximize() const override;
std::unique_ptr<views::NonClientFrameView> CreateNonClientFrameView(
views::Widget* widget) override;

View File

@@ -26,7 +26,7 @@ namespace electron {
class NativeWindowObserver : public base::CheckedObserver {
public:
~NativeWindowObserver() override {}
~NativeWindowObserver() override = default;
// Called when the web page in window wants to create a popup window.
virtual void WillCreatePopupWindow(const std::u16string& frame_name,

Some files were not shown because too many files have changed in this diff Show More