Compare commits

...

15 Commits

Author SHA1 Message Date
Electron Bot
0bdb7b164c Bump v7.0.0-beta.2 2019-08-07 09:03:21 -07:00
trop[bot]
ea9cfc127c fix: crash on print cancellation and silent print settings (#19668)
* fix: crash on print cancellation

* fix: update printing patch for new options

* refactor: use DictionaryValue for printBackground
2019-08-07 08:44:48 -07:00
trop[bot]
0afb1a8188 fix: handle edge behavior for about panel on Linux (#19625)
* fix: graceful About dialog fail/exit (Linux)

* Allow current to travel along path with no electrical impedance
2019-08-05 20:57:04 -07:00
trop[bot]
f154dbda40 docs: remove implicit 'any' and 'Object' types from the docs (#19630)
* docs: remove implicit 'any' and 'Object' types from the docs

* docs: more docs improvements, remove all remaining empty interfaces

* chore: update tests for better types
2019-08-05 20:56:42 -07:00
trop[bot]
c3013d2e9f fix: clearRecentDocuments role on Windows (#19638)
* fix: clear recent documents on windows

* chore: don't check for version < win 7
2019-08-05 17:16:20 -07:00
trop[bot]
3272564eac fix: make child windows not crash when ipc messages are received (#19632)
* fix: make child windows not crash when ipc messages are received

This also adds a path forward for apps using child windows with
nodeIntegration to migrate into a non-leaky way of doing it.

1. Ensure that if ipcNative is missing we don't crash rather log that it
is missing
2. Add a hidden option `--enable-node-leakage-in-renderers` (temporary
measure) to allow app devs to opt in to leaking node in child windows
3. Bypasses the Opener() check if renderer process reuse is enabled
(which would prevent the leak anyway)

So the path forward is: it no longer crashes --> folks use the hidden
option --> folks opt in to renderer process reuse.

* Apply suggestions from code review

Co-Authored-By: Jeremy Apthorp <jeremya@chromium.org>

* Update shell/renderer/atom_renderer_client.cc

Co-Authored-By: Jeremy Apthorp <jeremya@chromium.org>
2019-08-05 15:11:01 -07:00
trop[bot]
a0f4632461 fix: crash on window.print() (#19623) 2019-08-05 07:52:08 -07:00
trop[bot]
8ddf837d49 fix: expose setMenuBarVisibility again (#19579) 2019-08-02 19:06:47 -07:00
Samuel Attard
9822953d31 build: lock chromium major to 78 on 7-0-x (#19552)
* build: lock chromium major to 78 on 7-0-x

* chore: update patches

* fix geometry.mojom

* Adopt more inclusive language in //net

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

* [mojo] Introduce ServiceFactory API

https://chromium-review.googlesource.com/c/chromium/src/+/1717474
2019-08-02 15:41:41 -04:00
trop[bot]
c6061cce41 doc: add missing MenuItem roles (#19555) 2019-07-31 19:12:52 -07:00
trop[bot]
a9602682c5 fix: use WeakPtr to detect deletion (#19558) 2019-07-31 19:12:32 -07:00
Electron Bot
b7e5213afc Bump v7.0.0-beta.1 2019-07-31 13:36:10 -07:00
Samuel Attard
9b70d9aa68 Revert "Bump v7.0.0-beta.1"
This reverts commit d9bfac32e3.
2019-07-31 13:30:47 -07:00
Electron Bot
d9bfac32e3 Bump v7.0.0-beta.1 2019-07-31 11:07:14 -07:00
Samuel Attard
9e815afc02 build: fix first beta version choosing logic 2019-07-31 11:01:25 -07:00
67 changed files with 490 additions and 271 deletions

2
DEPS
View File

@@ -10,7 +10,7 @@ gclient_gn_args = [
vars = {
'chromium_version':
'9eecb7a9f652bbf84f6437b49c70922b65b38bf3',
'78.0.3866.0',
'node_version':
'v12.6.0',
'nan_version':

View File

@@ -1 +1 @@
7.0.0-nightly.20190731
7.0.0-beta.2

View File

@@ -32,7 +32,7 @@ In most cases, you should do everything in the `ready` event handler.
Returns:
* `launchInfo` Object _macOS_
* `launchInfo` unknown _macOS_
Emitted when Electron has finished initializing. On macOS, `launchInfo` holds
the `userInfo` of the `NSUserNotification` that was used to open the application,
@@ -146,7 +146,7 @@ Returns:
* `event` Event
* `type` String - A string identifying the activity. Maps to
[`NSUserActivity.activityType`][activity-type].
* `userInfo` Object - Contains app-specific state stored by the activity on
* `userInfo` unknown - Contains app-specific state stored by the activity on
another device.
Emitted during [Handoff][handoff] when an activity from a different device wants
@@ -189,7 +189,7 @@ Returns:
* `event` Event
* `type` String - A string identifying the activity. Maps to
[`NSUserActivity.activityType`][activity-type].
* `userInfo` Object - Contains app-specific state stored by the activity.
* `userInfo` unknown - Contains app-specific state stored by the activity.
Emitted during [Handoff][handoff] after an activity from this device was successfully
resumed on another one.
@@ -201,7 +201,7 @@ Returns:
* `event` Event
* `type` String - A string identifying the activity. Maps to
[`NSUserActivity.activityType`][activity-type].
* `userInfo` Object - Contains app-specific state stored by the activity.
* `userInfo` unknown - Contains app-specific state stored by the activity.
Emitted when [Handoff][handoff] is about to be resumed on another device. If you need to update the state to be transferred, you should call `event.preventDefault()` immediately, construct a new `userInfo` dictionary and call `app.updateCurrentActiviy()` in a timely manner. Otherwise, the operation will fail and `continue-activity-error` will be called.
@@ -949,7 +949,7 @@ allow multiple instances of the application to once again run side by side.
* `type` String - Uniquely identifies the activity. Maps to
[`NSUserActivity.activityType`][activity-type].
* `userInfo` Object - App-specific state to store for use by another device.
* `userInfo` any - App-specific state to store for use by another device.
* `webpageURL` String (optional) - The webpage to load in a browser if no suitable app is
installed on the resuming device. The scheme must be `http` or `https`.
@@ -972,7 +972,7 @@ Marks the current [Handoff][handoff] user activity as inactive without invalidat
* `type` String - Uniquely identifies the activity. Maps to
[`NSUserActivity.activityType`][activity-type].
* `userInfo` Object - App-specific state to store for use by another device.
* `userInfo` any - App-specific state to store for use by another device.
Updates the current activity if its type matches `type`, merging the entries from
`userInfo` into its current `userInfo` dictionary.

View File

@@ -103,7 +103,7 @@ The `autoUpdater` object has the following methods:
* `options` Object
* `url` String
* `headers` Object (optional) _macOS_ - HTTP request headers.
* `headers` Record<String, String> (optional) _macOS_ - HTTP request headers.
* `serverType` String (optional) _macOS_ - Either `json` or `default`, see the [Squirrel.Mac][squirrel-mac]
README for more information.

View File

@@ -691,7 +691,7 @@ is emitted.
#### `BrowserWindow.getExtensions()`
Returns `Object` - The keys are the extension names and each value is
Returns `Record<String, ExtensionInfo>` - The keys are the extension names and each value is
an Object containing `name` and `version` properties.
**Note:** This API cannot be called before the `ready` event of the `app` module
@@ -724,7 +724,7 @@ is emitted.
#### `BrowserWindow.getDevToolsExtensions()`
Returns `Object` - The keys are the extension names and each value is
Returns `Record<string, ExtensionInfo>` - The keys are the extension names and each value is
an Object containing `name` and `version` properties.
To check if a DevTools extension is installed you can run the following:
@@ -1381,7 +1381,7 @@ win.loadURL('http://localhost:8000/post', {
* `filePath` String
* `options` Object (optional)
* `query` Object (optional) - Passed to `url.format()`.
* `query` Record<String, String> (optional) - Passed to `url.format()`.
* `search` String (optional) - Passed to `url.format()`.
* `hash` String (optional) - Passed to `url.format()`.

View File

@@ -16,7 +16,7 @@ following properties:
method.
* `url` String (optional) - The request URL. Must be provided in the absolute
form with the protocol scheme specified as http or https.
* `session` Object (optional) - The [`Session`](session.md) instance with
* `session` Session (optional) - The [`Session`](session.md) instance with
which the request is associated.
* `partition` String (optional) - The name of the [`partition`](session.md)
with which the request is associated. Defaults to the empty string. The
@@ -134,7 +134,7 @@ Returns:
* `statusCode` Integer
* `method` String
* `redirectUrl` String
* `responseHeaders` Object
* `responseHeaders` Record<String, String[]>
Emitted when there is redirection and the mode is `manual`. Calling
[`request.followRedirect`](#requestfollowredirect) will continue with the redirection.
@@ -158,7 +158,7 @@ internally buffered inside Electron process memory.
#### `request.setHeader(name, value)`
* `name` String - An extra HTTP header name.
* `value` Object - An extra HTTP header value.
* `value` String - An extra HTTP header value.
Adds an extra HTTP header. The header name will be issued as-is without
lowercasing. It can be called only before first write. Calling this method after
@@ -169,7 +169,7 @@ the first write will throw an error. If the passed value is not a `String`, its
* `name` String - Specify an extra header name.
Returns `Object` - The value of a previously set extra header name.
Returns `String` - The value of a previously set extra header name.
#### `request.removeHeader(name)`

View File

@@ -74,6 +74,9 @@ will be returned in the promise.
Returns `Promise<Object>` - Resolves with an object containing the `value` and `percentage` of trace buffer maximum usage
* `value` Number
* `percentage` Number
Get the maximum usage across processes of trace buffer as a percentage of the
full state.

View File

@@ -48,7 +48,7 @@ The `crashReporter` module has the following methods:
* `productName` String (optional) - Defaults to `app.name`.
* `uploadToServer` Boolean (optional) - Whether crash reports should be sent to the server. Default is `true`.
* `ignoreSystemCrashHandler` Boolean (optional) - Default is `false`.
* `extra` Object (optional) - An object you can define that will be sent along with the
* `extra` Record<String, String> (optional) - An object you can define that will be sent along with the
report. Only string properties are sent correctly. Nested objects are not
supported. When using Windows, the property names and values must be fewer than 64 characters.
* `crashesDirectory` String (optional) - Directory to store the crash reports temporarily (only used when the crash reporter is started via `process.crashReporter.start`).

View File

@@ -50,7 +50,7 @@ Returns:
* `event` Event
* `method` String - Method name.
* `params` Object - Event parameters defined by the 'parameters'
* `params` unknown - Event parameters defined by the 'parameters'
attribute in the remote debugging protocol.
Emitted whenever the debugging target issues an instrumentation event.
@@ -78,7 +78,7 @@ Detaches the debugger from the `webContents`.
* `method` String - Method name, should be one of the methods defined by the
[remote debugging protocol][rdp].
* `commandParams` Object (optional) - JSON object with request parameters.
* `commandParams` any (optional) - JSON object with request parameters.
Returns `Promise<any>` - A promise that resolves with the response defined by
the 'returns' attribute of the command description in the remote debugging protocol

View File

@@ -51,7 +51,7 @@ A `String` representing the HTTP status message.
#### `response.headers`
An `Object` representing the response HTTP headers. The `headers` object is
An `Record<string, string[]>` representing the response HTTP headers. The `headers` object is
formatted as follows:
* All header names are lowercased.

View File

@@ -90,7 +90,7 @@ Removes listeners of the specified `channel`.
### `ipcMain.handle(channel, listener)`
* `channel` String
* `listener` Function<Promise> | Function<any>
* `listener` Function<Promise<void> | any>
* `event` IpcMainInvokeEvent
* `...args` any[]
@@ -122,7 +122,7 @@ WebContents is the source of the invoke request.
### `ipcMain.handleOnce(channel, listener)`
* `channel` String
* `listener` Function<Promise> | Function<any>
* `listener` Function<Promise<void> | any>
* `event` IpcMainInvokeEvent
* `...args` any[]

View File

@@ -14,7 +14,7 @@ See [`Menu`](menu.md) for examples.
* `menuItem` MenuItem
* `browserWindow` [BrowserWindow](browser-window.md)
* `event` [KeyboardEvent](structures/keyboard-event.md)
* `role` String (optional) - Can be `undo`, `redo`, `cut`, `copy`, `paste`, `pasteandmatchstyle`, `delete`, `selectall`, `reload`, `forcereload`, `toggledevtools`, `resetzoom`, `zoomin`, `zoomout`, `togglefullscreen`, `window`, `minimize`, `close`, `help`, `about`, `services`, `hide`, `hideothers`, `unhide`, `quit`, `startspeaking`, `stopspeaking`, `close`, `minimize`, `zoom`, `front`, `appMenu`, `fileMenu`, `editMenu`, `viewMenu` or `windowMenu` - Define the action of the menu item, when specified the
* `role` String (optional) - Can be `undo`, `redo`, `cut`, `copy`, `paste`, `pasteAndMatchStyle`, `delete`, `selectAll`, `reload`, `forceReload`, `toggleDevTools`, `resetZoom`, `zoomIn`, `zoomOut`, `togglefullscreen`, `window`, `minimize`, `close`, `help`, `about`, `services`, `hide`, `hideOthers`, `unhide`, `quit`, `startSpeaking`, `stopSpeaking`, `close`, `minimize`, `zoom`, `front`, `appMenu`, `fileMenu`, `editMenu`, `viewMenu`, `recentDocuments`, `toggleTabBar`, `selectNextTab`, `selectPreviousTab`, `mergeAllWindows`, `clearRecentDocuments`, `moveTabToNewWindow` or `windowMenu` - Define the action of the menu item, when specified the
`click` property will be ignored. See [roles](#roles).
* `type` String (optional) - Can be `normal`, `separator`, `submenu`, `checkbox` or
`radio`.
@@ -82,7 +82,7 @@ The `role` property can have following values:
* `reload` - Reload the current window.
* `forceReload` - Reload the current window ignoring the cache.
* `toggleDevTools` - Toggle developer tools in the current window.
* `toggleFullScreen` - Toggle full screen mode on the current window.
* `togglefullscreen` - Toggle full screen mode on the current window.
* `resetZoom` - Reset the focused page's zoom level to the original size.
* `zoomIn` - Zoom in the focused page by 10%.
* `zoomOut` - Zoom out the focused page by 10%.
@@ -152,7 +152,7 @@ A `String` indicating the type of the item. Can be `normal`, `separator`, `subme
#### `menuItem.role`
A `String` (optional) indicating the item's role, if set. Can be `undo`, `redo`, `cut`, `copy`, `paste`, `pasteandmatchstyle`, `delete`, `selectall`, `reload`, `forcereload`, `toggledevtools`, `resetzoom`, `zoomin`, `zoomout`, `togglefullscreen`, `window`, `minimize`, `close`, `help`, `about`, `services`, `hide`, `hideothers`, `unhide`, `quit`, `startspeaking`, `stopspeaking`, `close`, `minimize`, `zoom`, `front`, `appMenu`, `fileMenu`, `editMenu`, `viewMenu` or `windowMenu`
A `String` (optional) indicating the item's role, if set. Can be `undo`, `redo`, `cut`, `copy`, `paste`, `pasteAndMatchStyle`, `delete`, `selectAll`, `reload`, `forceReload`, `toggleDevTools`, `resetZoom`, `zoomIn`, `zoomOut`, `togglefullscreen`, `window`, `minimize`, `close`, `help`, `about`, `services`, `hide`, `hideOthers`, `unhide`, `quit`, `startSpeaking`, `stopSpeaking`, `close`, `minimize`, `zoom`, `front`, `appMenu`, `fileMenu`, `editMenu`, `viewMenu`, `recentDocuments`, `toggleTabBar`, `selectNextTab`, `selectPreviousTab`, `mergeAllWindows`, `clearRecentDocuments`, `moveTabToNewWindow` or `windowMenu`
#### `menuItem.accelerator`

View File

@@ -54,7 +54,7 @@ The `net` module has the following methods:
### `net.request(options)`
* `options` (Object | String) - The `ClientRequest` constructor options.
* `options` (ClientRequestConstructorOptions | String) - The `ClientRequest` constructor options.
Returns [`ClientRequest`](./client-request.md)

View File

@@ -228,7 +228,7 @@ should be called with either a `String` or an object that has the `data`,
* `redirectRequest` Object
* `url` String
* `method` String (optional)
* `session` Object (optional)
* `session` Session | null (optional)
* `uploadData` [ProtocolResponseUploadData](structures/protocol-response-upload-data.md) (optional)
* `completion` Function (optional)
* `error` Error
@@ -388,7 +388,7 @@ which sends a `Buffer` as a response.
* `redirectRequest` Object
* `url` String
* `method` String (optional)
* `session` Object | null (optional)
* `session` Session | null (optional)
* `uploadData` Object (optional)
* `contentType` String - MIME type of the content.
* `data` String - Content to be sent.

View File

@@ -0,0 +1,4 @@
# ExtensionInfo Object
* `name` String
* `version` String

View File

@@ -19,7 +19,7 @@
include in the trace. If not specified, trace all processes.
* `histogram_names` String[] (optional) - a list of [histogram][] names to report
with the trace.
* `memory_dump_config` Object (optional) - if the
* `memory_dump_config` Record<String, any> (optional) - if the
`disabled-by-default-memory-infra` category is enabled, this contains
optional additional configuration for data collection. See the [Chromium
memory-infra docs][memory-infra docs] for more information.

View File

@@ -56,7 +56,7 @@ Returns `Boolean` - Whether the Swipe between pages setting is on.
### `systemPreferences.postNotification(event, userInfo[, deliverImmediately])` _macOS_
* `event` String
* `userInfo` Object
* `userInfo` Record<String, any>
* `deliverImmediately` Boolean (optional) - `true` to post notifications immediately even when the subscribing app is inactive.
Posts `event` as native notifications of macOS. The `userInfo` is an Object
@@ -65,7 +65,7 @@ that contains the user information dictionary sent along with the notification.
### `systemPreferences.postLocalNotification(event, userInfo)` _macOS_
* `event` String
* `userInfo` Object
* `userInfo` Record<String, any>
Posts `event` as native notifications of macOS. The `userInfo` is an Object
that contains the user information dictionary sent along with the notification.
@@ -73,7 +73,7 @@ that contains the user information dictionary sent along with the notification.
### `systemPreferences.postWorkspaceNotification(event, userInfo)` _macOS_
* `event` String
* `userInfo` Object
* `userInfo` Record<String, any>
Posts `event` as native notifications of macOS. The `userInfo` is an Object
that contains the user information dictionary sent along with the notification.
@@ -83,7 +83,7 @@ that contains the user information dictionary sent along with the notification.
* `event` String
* `callback` Function
* `event` String
* `userInfo` Object
* `userInfo` Record<String, unknown>
* `object` String
Returns `Number` - The ID of this subscription
@@ -110,7 +110,7 @@ example values of `event` are:
* `event` String
* `callback` Function
* `event` String
* `userInfo` Object
* `userInfo` Record<String, unknown>
* `object` String
Returns `Number` - The ID of this subscription
@@ -123,7 +123,7 @@ This is necessary for events such as `NSUserDefaultsDidChangeNotification`.
* `event` String
* `callback` Function
* `event` String
* `userInfo` Object
* `userInfo` Record<String, unknown>
* `object` String
Same as `subscribeNotification`, but uses `NSWorkspace.sharedWorkspace.notificationCenter`.
@@ -149,7 +149,7 @@ Same as `unsubscribeNotification`, but removes the subscriber from `NSWorkspace.
### `systemPreferences.registerDefaults(defaults)` _macOS_
* `defaults` Object - a dictionary of (`key: value`) user defaults
* `defaults` Record<String, String | Boolean | Number> - a dictionary of (`key: value`) user defaults
Add the specified defaults to your application's `NSUserDefaults`.

View File

@@ -143,7 +143,7 @@ Returns:
* `frameName` String
* `disposition` String - Can be `default`, `foreground-tab`, `background-tab`,
`new-window`, `save-to-disk` and `other`.
* `options` Object - The options which will be used for creating the new
* `options` BrowserWindowConstructorOptions - The options which will be used for creating the new
[`BrowserWindow`](browser-window.md).
* `additionalFeatures` String[] - The non-standard features (features not handled
by Chromium or Electron) given to `window.open()`.
@@ -481,7 +481,7 @@ Returns:
* `requestId` Integer
* `activeMatchOrdinal` Integer - Position of the active match.
* `matches` Integer - Number of Matches.
* `selectionArea` Object - Coordinates of first match region.
* `selectionArea` Rectangle - Coordinates of first match region.
* `finalUpdate` Boolean
Emitted when a result is available for
@@ -669,10 +669,10 @@ Emitted when the devtools window instructs the webContents to reload
Returns:
* `event` Event
* `webPreferences` Object - The web preferences that will be used by the guest
* `webPreferences` WebPreferences - The web preferences that will be used by the guest
page. This object can be modified to adjust the preferences for the guest
page.
* `params` Object - The other `<webview>` parameters such as the `src` URL.
* `params` Record<string, string> - The other `<webview>` parameters such as the `src` URL.
This object can be modified to adjust the parameters of the guest page.
Emitted when a `<webview>`'s web contents is being attached to this web
@@ -842,7 +842,7 @@ webContents.loadURL('https://github.com', options)
* `filePath` String
* `options` Object (optional)
* `query` Object (optional) - Passed to `url.format()`.
* `query` Record<String, String> (optional) - Passed to `url.format()`.
* `search` String (optional) - Passed to `url.format()`.
* `hash` String (optional) - Passed to `url.format()`.
@@ -1563,13 +1563,6 @@ Disable device emulation enabled by `webContents.enableDeviceEmulation`.
#### `contents.sendInputEvent(inputEvent)`
* `inputEvent` [MouseInputEvent](structures/mouse-input-event.md) | [MouseWheelInputEvent](structures/mouse-wheel-input-event.md) | [KeyboardInputEvent](structures/keyboard-input-event.md)
* `type` String (**required**) - The type of the event, can be `mouseDown`,
`mouseUp`, `mouseEnter`, `mouseLeave`, `contextMenu`, `mouseWheel`,
`mouseMove`, `keyDown`, `keyUp` or `char`.
* `modifiers` String[] - An array of modifiers of the event, can
include `shift`, `control`, `alt`, `meta`, `isKeypad`, `isAutoRepeat`,
`leftButtonDown`, `middleButtonDown`, `rightButtonDown`, `capsLock`,
`numLock`, `left`, `right`.
Sends an input `event` to the page.
**Note:** The [`BrowserWindow`](browser-window.md) containing the contents needs to be focused for

View File

@@ -593,7 +593,7 @@ examples.
### `<webview>.sendInputEvent(event)`
* `event` Object
* `event` [MouseInputEvent](structures/mouse-input-event.md) | [MouseWheelInputEvent](structures/mouse-wheel-input-event.md) | [KeyboardInputEvent](structures/keyboard-input-event.md)
Returns `Promise<void>`
@@ -767,7 +767,7 @@ Returns:
* `requestId` Integer
* `activeMatchOrdinal` Integer - Position of the active match.
* `matches` Integer - Number of Matches.
* `selectionArea` Object - Coordinates of first match region.
* `selectionArea` Rectangle - Coordinates of first match region.
* `finalUpdate` Boolean
Fired when a result is available for
@@ -791,7 +791,7 @@ Returns:
* `frameName` String
* `disposition` String - Can be `default`, `foreground-tab`, `background-tab`,
`new-window`, `save-to-disk` and `other`.
* `options` Object - The options which should be used for creating the new
* `options` BrowserWindowConstructorOptions - The options which should be used for creating the new
[`BrowserWindow`](browser-window.md).
Fired when the guest page attempts to open a new browser window.
@@ -872,7 +872,7 @@ webview.addEventListener('close', () => {
Returns:
* `channel` String
* `args` Array
* `args` any[]
Fired when the guest page has sent an asynchronous message to embedder page.

View File

@@ -76,6 +76,7 @@ auto_filenames = {
"docs/api/structures/desktop-capturer-source.md",
"docs/api/structures/display.md",
"docs/api/structures/event.md",
"docs/api/structures/extension-info.md",
"docs/api/structures/file-filter.md",
"docs/api/structures/file-path-with-headers.md",
"docs/api/structures/gpu-feature-status.md",

View File

@@ -178,7 +178,7 @@ const roles = {
{ role: 'services' },
{ type: 'separator' },
{ role: 'hide' },
{ role: 'hideothers' },
{ role: 'hideOthers' },
{ role: 'unhide' },
{ type: 'separator' },
{ role: 'quit' }
@@ -209,8 +209,8 @@ const roles = {
{
label: 'Speech',
submenu: [
{ role: 'startspeaking' },
{ role: 'stopspeaking' }
{ role: 'startSpeaking' },
{ role: 'stopSpeaking' }
]
}
] : [
@@ -225,12 +225,12 @@ const roles = {
label: 'View',
submenu: [
{ role: 'reload' },
{ role: 'forcereload' },
{ role: 'toggledevtools' },
{ role: 'forceReload' },
{ role: 'toggleDevTools' },
{ type: 'separator' },
{ role: 'resetzoom' },
{ role: 'zoomin' },
{ role: 'zoomout' },
{ role: 'resetZoom' },
{ role: 'zoomIn' },
{ role: 'zoomOut' },
{ type: 'separator' },
{ role: 'togglefullscreen' }
]

View File

@@ -40,9 +40,9 @@ const getEditMenuItems = function (): Electron.MenuItemConstructorOptions[] {
{ role: 'cut' },
{ role: 'copy' },
{ role: 'paste' },
{ role: 'pasteandmatchstyle' },
{ role: 'pasteAndMatchStyle' },
{ role: 'delete' },
{ role: 'selectall' }
{ role: 'selectAll' }
]
}

View File

@@ -34,7 +34,7 @@ const mergeOptions = function (child, parent, visited) {
if (key in child && key !== 'webPreferences') continue
const value = parent[key]
if (typeof value === 'object') {
if (typeof value === 'object' && !Array.isArray(value)) {
child[key] = mergeOptions(child[key] || {}, value, visited)
} else {
child[key] = value

View File

@@ -1,11 +1,11 @@
{
"name": "electron",
"version": "7.0.0-nightly.20190731",
"version": "7.0.0-beta.2",
"repository": "https://github.com/electron/electron",
"description": "Build cross platform desktop apps with JavaScript, HTML, and CSS",
"devDependencies": {
"@electron/docs-parser": "^0.4.1",
"@electron/typescript-definitions": "^8.5.0",
"@electron/docs-parser": "^0.4.2",
"@electron/typescript-definitions": "^8.6.1",
"@octokit/rest": "^16.3.2",
"@primer/octicons": "^9.1.1",
"@types/chai": "^4.1.7",

View File

@@ -77,3 +77,4 @@ put_back_deleted_colors_for_autofill.patch
build_win_disable_zc_twophase.patch
disable_color_correct_rendering.patch
add_contentgpuclient_precreatemessageloop_callback.patch
fix_use_weakptr_to_detect_deletion.patch

View File

@@ -10,10 +10,10 @@ to fix electron/electron#13787. The backport landed in Chromium 67 but the
DidCreateScriptContext re-ordering needs to be upstreamed or kept indefinitely
diff --git a/third_party/blink/renderer/bindings/core/v8/local_window_proxy.cc b/third_party/blink/renderer/bindings/core/v8/local_window_proxy.cc
index 50c06fddeff3647dc99f8ab9f1538723f91ec2a9..fa4b6c3c8081af03055ddeadc53606fcc9030d5c 100644
index b6622fd132cc1b46127a2157b28c2fd2ab63e40d..1a3196aa5737e35237fd467260973fdf260587c4 100644
--- a/third_party/blink/renderer/bindings/core/v8/local_window_proxy.cc
+++ b/third_party/blink/renderer/bindings/core/v8/local_window_proxy.cc
@@ -203,11 +203,10 @@ void LocalWindowProxy::Initialize() {
@@ -205,11 +205,10 @@ void LocalWindowProxy::Initialize() {
GetFrame()->IsMainFrame());
MainThreadDebugger::Instance()->ContextCreated(script_state_, GetFrame(),
origin);

View File

@@ -14,7 +14,7 @@ when there is code doing that.
This patch reverts the change to fix the crash in Electron.
diff --git a/third_party/blink/renderer/core/frame/local_frame.cc b/third_party/blink/renderer/core/frame/local_frame.cc
index 60b3fe655dc8c309e3099d15283f8223e9ae2a50..c66465dd1c059e8de6055e44260dd51810c4f202 100644
index 76286491111dc1a73ad6e268aa356c8ef668d47b..64824ceabd004c80a610c1ab414e8acbccd20157 100644
--- a/third_party/blink/renderer/core/frame/local_frame.cc
+++ b/third_party/blink/renderer/core/frame/local_frame.cc
@@ -332,10 +332,6 @@ void LocalFrame::DetachImpl(FrameDetachType type) {

View File

@@ -19,10 +19,10 @@ index ea92c2747104615ac876b8322bd5e7acf039924d..1a5b6c4945de6e26a163fe653fef6583
// that the script evaluated to with callback. Script execution can be
// suspend.
diff --git a/third_party/blink/renderer/core/frame/web_local_frame_impl.cc b/third_party/blink/renderer/core/frame/web_local_frame_impl.cc
index 3215cba24c414f235c3149ffd45e30dfc7979060..752e04d1510d54ae525e4c7d1b5a149cba2b087a 100644
index d0a05520d52a6912ed2454752d8bb7fa78d79ff5..0b8f0f03b965c156858b07d93faff5a960e493b4 100644
--- a/third_party/blink/renderer/core/frame/web_local_frame_impl.cc
+++ b/third_party/blink/renderer/core/frame/web_local_frame_impl.cc
@@ -868,6 +868,13 @@ v8::Local<v8::Object> WebLocalFrameImpl::GlobalProxy() const {
@@ -866,6 +866,13 @@ v8::Local<v8::Object> WebLocalFrameImpl::GlobalProxy() const {
return MainWorldScriptContext()->Global();
}
@@ -37,10 +37,10 @@ index 3215cba24c414f235c3149ffd45e30dfc7979060..752e04d1510d54ae525e4c7d1b5a149c
return BindingSecurity::ShouldAllowAccessToFrame(
CurrentDOMWindow(V8PerIsolateData::MainThreadIsolate()),
diff --git a/third_party/blink/renderer/core/frame/web_local_frame_impl.h b/third_party/blink/renderer/core/frame/web_local_frame_impl.h
index c9a5d1d253d7ff16dc88667b07b883842a388c11..ee7079631e3a713f8b001c5d104fc2b1bbe99e8c 100644
index df0c843043e29029ccbfa51752866bbaa945e5e3..0ee2e45b7d91028720757672d1adf1636986a991 100644
--- a/third_party/blink/renderer/core/frame/web_local_frame_impl.h
+++ b/third_party/blink/renderer/core/frame/web_local_frame_impl.h
@@ -149,6 +149,8 @@ class CORE_EXPORT WebLocalFrameImpl final
@@ -148,6 +148,8 @@ class CORE_EXPORT WebLocalFrameImpl final
int argc,
v8::Local<v8::Value> argv[]) override;
v8::Local<v8::Context> MainWorldScriptContext() const override;

View File

@@ -8,7 +8,7 @@ This is to workaround the bug in crbug.com/969698#c10
until fixes have landed in upstream.
diff --git a/build/config/win/BUILD.gn b/build/config/win/BUILD.gn
index a6c0aeaf98f7a860c131dc52161f52f308432a91..7b490d07d0f8383db5cea2703d7451db0108d252 100644
index 781aeaaf46b6de0f98f26df4ddcbd13cac527d62..254ede050920993d6b283ffb67f13d2eea633113 100644
--- a/build/config/win/BUILD.gn
+++ b/build/config/win/BUILD.gn
@@ -2,6 +2,7 @@

View File

@@ -5,10 +5,10 @@ Subject: can_create_window.patch
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc
index a9d30fa2e6b9b2f5fd96be4ecf90dafa9e7ea57a..b352615567a2719828626d9ad4b79ea8c494975f 100644
index d731d6d9e2626157520ddcaf231781e723d8d2ce..583065369a21acd86b017d716f6670ff67d2e108 100644
--- a/content/browser/frame_host/render_frame_host_impl.cc
+++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -3831,6 +3831,7 @@ void RenderFrameHostImpl::CreateNewWindow(
@@ -3848,6 +3848,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,
@@ -17,10 +17,10 @@ index a9d30fa2e6b9b2f5fd96be4ecf90dafa9e7ea57a..b352615567a2719828626d9ad4b79ea8
&no_javascript_access);
diff --git a/content/common/frame.mojom b/content/common/frame.mojom
index a2fe2dbd0d1c91a0bf5047b5c93f30758a0db277..d9f44fecaae883d861eea94c6cc16727967f0baa 100644
index b3eb08bcfd338f0085d7576a78e158a874033f3a..819dd480af5937aaa63b63e38f4d32e4ff7ba8c6 100644
--- a/content/common/frame.mojom
+++ b/content/common/frame.mojom
@@ -305,6 +305,10 @@ struct CreateNewWindowParams {
@@ -311,6 +311,10 @@ struct CreateNewWindowParams {
// The window features to use for the new window.
blink.mojom.WindowFeatures features;
@@ -32,7 +32,7 @@ index a2fe2dbd0d1c91a0bf5047b5c93f30758a0db277..d9f44fecaae883d861eea94c6cc16727
// Operation result when the renderer asks the browser to create a new window.
diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc
index 21da9c9c43a94411787d7cab8513b88302383e97..44a574d3c621695d7d1304c7b8db08db8cf753d1 100644
index e2b0dcdb14075754a4a1e8a90b3cd9a14a08796b..1f469e9c1001ba63e371456d3cbbbfbddffeabb8 100644
--- a/content/public/browser/content_browser_client.cc
+++ b/content/public/browser/content_browser_client.cc
@@ -494,6 +494,8 @@ bool ContentBrowserClient::CanCreateWindow(
@@ -45,7 +45,7 @@ index 21da9c9c43a94411787d7cab8513b88302383e97..44a574d3c621695d7d1304c7b8db08db
bool opener_suppressed,
bool* no_javascript_access) {
diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h
index b0709c05aec437c36498587e7a3bd79bf311c525..7d83d9e0d0c57511955921d85f15a27a88c3ac37 100644
index a14b357dca0133d25e06b53c19926a7598258382..46399a321845e04f67d8424acddec2636b2d9cc6 100644
--- a/content/public/browser/content_browser_client.h
+++ b/content/public/browser/content_browser_client.h
@@ -175,6 +175,7 @@ class RenderFrameHost;
@@ -66,7 +66,7 @@ index b0709c05aec437c36498587e7a3bd79bf311c525..7d83d9e0d0c57511955921d85f15a27a
bool opener_suppressed,
bool* no_javascript_access);
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index d0ca81590d2b5688022ca6045869dcae0ecd778e..7752c1e49dbee49c64a552ec249cabdb4d073109 100644
index 561f409be27c004629455fc3392463fa43313a73..222db08480b15a18d50f0ef8d02ea6afb1681961 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -75,6 +75,7 @@
@@ -77,7 +77,7 @@ index d0ca81590d2b5688022ca6045869dcae0ecd778e..7752c1e49dbee49c64a552ec249cabdb
#include "content/renderer/media/audio/audio_device_factory.h"
#include "content/renderer/media/stream/media_stream_device_observer.h"
#include "content/renderer/media/video_capture/video_capture_impl_manager.h"
@@ -1366,6 +1367,8 @@ WebView* RenderViewImpl::CreateView(
@@ -1368,6 +1369,8 @@ WebView* RenderViewImpl::CreateView(
}
params->features = ConvertWebWindowFeaturesToMojoWindowFeatures(features);

View File

@@ -22,7 +22,7 @@ index b74bbef56038e29ca35403affd284a7a8868c201..d6887e576ac197f80a7e5261bd251cd7
}
diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc
index 39d3c28ca33fa1eeab14b67ec31a6ae09f25c354..1fc64dd493536f1aefafd6a683c19289920000b7 100644
index 5142cfedf46dafa383f615fe8ca72c1d4c20b36e..691fbc819713beb881402cb8a84886bd0780b106 100644
--- a/content/public/browser/content_browser_client.cc
+++ b/content/public/browser/content_browser_client.cc
@@ -71,6 +71,10 @@ std::unique_ptr<BrowserMainParts> ContentBrowserClient::CreateBrowserMainParts(
@@ -37,7 +37,7 @@ index 39d3c28ca33fa1eeab14b67ec31a6ae09f25c354..1fc64dd493536f1aefafd6a683c19289
const base::Location& from_here,
const scoped_refptr<base::TaskRunner>& task_runner,
diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h
index 3d518759a3bc190970a2d45ec178c97096fa250d..b2c12759d2cd94d7971f20bc289c7fa70f1fe863 100644
index 671b2ccfb8f8f21018931c454584d7f0bd2b1418..b5361817676abfdf74cc6cf9a628e18a5aeb3dd8 100644
--- a/content/public/browser/content_browser_client.h
+++ b/content/public/browser/content_browser_client.h
@@ -249,6 +249,9 @@ class CONTENT_EXPORT ContentBrowserClient {

View File

@@ -234,7 +234,7 @@ index 6f0671a753879d7b327681979090508e610cc129..f1beaf3433d67014cff527a686fd3239
network::switches::kExplicitlyAllowedPorts,
service_manager::switches::kDisableInProcessStackTraces,
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index 734c561001cc625c60851590d69bc7485928538a..1f56e138ae967e8f7c39a4629f6cb7dc590cf42c 100644
index 2c96d679729d6ceac7d2b5077b8bbf2b6d951fa5..61ef919b51a1712fb2c0d8eecee8f5b953532b32 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -2854,6 +2854,9 @@ cc::LayerTreeSettings RenderWidget::GenerateLayerTreeSettings(

View File

@@ -6,10 +6,10 @@ Subject: disable_user_gesture_requirement_for_beforeunload_dialogs.patch
See https://github.com/electron/electron/issues/10754
diff --git a/third_party/blink/renderer/core/dom/document.cc b/third_party/blink/renderer/core/dom/document.cc
index ac89475a90cdf889c073c6d7749732285455db8c..ed658f7a115087cdec0778ace5ad80b8643d5e92 100644
index 14e41abcabba4d881ee8016833662d4cd8ba420b..2499bbcfd67c362166c1ea7e0f4a692784a4bc4c 100644
--- a/third_party/blink/renderer/core/dom/document.cc
+++ b/third_party/blink/renderer/core/dom/document.cc
@@ -4067,7 +4067,9 @@ bool Document::DispatchBeforeUnloadEvent(ChromeClient* chrome_client,
@@ -4065,7 +4065,9 @@ bool Document::DispatchBeforeUnloadEvent(ChromeClient* chrome_client,
"frame that never had a user gesture since its load. "
"https://www.chromestatus.com/feature/5082396709879808";
Intervention::GenerateReport(frame_, "BeforeUnloadNoGesture", message);

View File

@@ -7,10 +7,10 @@ Compilation of those files fails with the Chromium 68.
Remove the patch during the Chromium 69 upgrade.
diff --git a/third_party/blink/renderer/platform/BUILD.gn b/third_party/blink/renderer/platform/BUILD.gn
index 0764cc88a8c4753a1c682e4164ec1988f7b824dd..cb1314d44fe2150a049e1e6072f036ffd26a5bfb 100644
index 72177b83dec57c6b9497d59304076f60cf96552a..8856846e1a366f224dd8eefdaf3eb75b1e83b76f 100644
--- a/third_party/blink/renderer/platform/BUILD.gn
+++ b/third_party/blink/renderer/platform/BUILD.gn
@@ -1706,7 +1706,7 @@ jumbo_source_set("blink_platform_unittests_sources") {
@@ -1717,7 +1717,7 @@ jumbo_source_set("blink_platform_unittests_sources") {
"graphics/paint/drawing_display_item_test.cc",
"graphics/paint/drawing_recorder_test.cc",
"graphics/paint/float_clip_rect_test.cc",

View File

@@ -98,7 +98,7 @@ index d9a9730a78b9aec833c64282ca868dbba5594d82..d98426e9f78931bd43061ec994559d59
private:
const HWND hwnd_;
diff --git a/components/viz/service/BUILD.gn b/components/viz/service/BUILD.gn
index a43cee43701fc3c139c726d14b128de3ae71c2c2..32ce9f5634ddefd5cd0feaa551f04697b53da68d 100644
index fdd358f741e6bfc1eb0cd67c3bb113e64250400c..fe0e53fd43fc762e2d6c096fbccc5676bc14bfde 100644
--- a/components/viz/service/BUILD.gn
+++ b/components/viz/service/BUILD.gn
@@ -113,6 +113,8 @@ viz_component("service") {
@@ -477,7 +477,7 @@ index 73ea1986b2140a3ffb87c5e23c7ab2174bac0a10..3ba3657ba12ec47cc3db3fec218496ff
return std::make_unique<SoftwareOutputDeviceWinDirect>(hwnd, backing);
}
diff --git a/services/viz/privileged/interfaces/compositing/display_private.mojom b/services/viz/privileged/interfaces/compositing/display_private.mojom
index 8898b9162a65e043e8b95237b8874e48ea71744e..a455df870ece25fc6e5e46688a1c6b5b396b841a 100644
index d5d0f0eaab04ccfedf6c01ae565c1ddc3f518cd0..b186708c6a3443806236a565496c5e55019ae9fb 100644
--- a/services/viz/privileged/interfaces/compositing/display_private.mojom
+++ b/services/viz/privileged/interfaces/compositing/display_private.mojom
@@ -79,12 +79,14 @@ interface DisplayPrivate {
@@ -497,7 +497,7 @@ index 8898b9162a65e043e8b95237b8874e48ea71744e..a455df870ece25fc6e5e46688a1c6b5b
// Notifies that a swap has occurred and provides information about the pixel
diff --git a/services/viz/privileged/interfaces/compositing/layered_window_updater.mojom b/services/viz/privileged/interfaces/compositing/layered_window_updater.mojom
index 58a7e221eaabd9e21196496d220c77babe07c56d..dd141b16eace2999380ed137b4adf1f3538a8a70 100644
index 6b7fbb6cf13dc8ee6ade0878a9a2c1efc5d4d3f1..e2af75168cb914a7b3b4a6c9b6a285498c3f8e72 100644
--- a/services/viz/privileged/interfaces/compositing/layered_window_updater.mojom
+++ b/services/viz/privileged/interfaces/compositing/layered_window_updater.mojom
@@ -26,5 +26,5 @@ interface LayeredWindowUpdater {
@@ -595,7 +595,7 @@ index 4014e64a75da88cf66c02e8adb71171c2666cab7..25e57784e1a1ffc546b003daa4cd0059
gfx::Size pixel_size;
float scale_factor = 1.f;
diff --git a/ui/gfx/mojo/ca_layer_params.mojom b/ui/gfx/mojo/ca_layer_params.mojom
index 7bf735643541b18bafffe645d3ff37e96caa4dea..f7eaf10ffd665789f10a587142fac0c0c79b9798 100644
index a73b2e678ffe0a682d0aa5409724fb441768bec5..6c36626d204c77ef51278b9e8f6fc6ee24a7a9ab 100644
--- a/ui/gfx/mojo/ca_layer_params.mojom
+++ b/ui/gfx/mojo/ca_layer_params.mojom
@@ -18,5 +18,6 @@ struct CALayerParams {
@@ -606,7 +606,7 @@ index 7bf735643541b18bafffe645d3ff37e96caa4dea..f7eaf10ffd665789f10a587142fac0c0
float scale_factor;
};
diff --git a/ui/gfx/mojo/ca_layer_params_struct_traits.cc b/ui/gfx/mojo/ca_layer_params_struct_traits.cc
index dd553996b5c6ff5ec0c210a020a18a6a843b8aae..26d1e0bda2640052d42ea4e691c3df73074dea08 100644
index 5be5a3547f8eb826faaa4a18455b18ee22ec0bf9..beb94400a0d7a30c2aae0b3821f011853c8b6c58 100644
--- a/ui/gfx/mojo/ca_layer_params_struct_traits.cc
+++ b/ui/gfx/mojo/ca_layer_params_struct_traits.cc
@@ -52,6 +52,9 @@ bool StructTraits<gfx::mojom::CALayerParamsDataView, gfx::CALayerParams>::Read(

View File

@@ -0,0 +1,76 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: John Kleinschmidt <kleinschmidtorama@gmail.com>
Date: Wed, 31 Jul 2019 14:36:27 -0400
Subject: fix: use WeakPtr to detect deletion
diff --git a/ui/compositor/callback_layer_animation_observer.cc b/ui/compositor/callback_layer_animation_observer.cc
index 639caf4d1411b867a31ce29e6c6ec4ae846359a8..6296afa55e38494cf0232f8bcd05811bfd4ebe38 100644
--- a/ui/compositor/callback_layer_animation_observer.cc
+++ b/ui/compositor/callback_layer_animation_observer.cc
@@ -38,22 +38,18 @@ CallbackLayerAnimationObserver::CallbackLayerAnimationObserver(
&CallbackLayerAnimationObserver::DummyAnimationStartedCallback)),
animation_ended_callback_(animation_ended_callback) {}
-CallbackLayerAnimationObserver::~CallbackLayerAnimationObserver() {
- if (destroyed_)
- *destroyed_ = true;
-}
+CallbackLayerAnimationObserver::~CallbackLayerAnimationObserver() {}
void CallbackLayerAnimationObserver::SetActive() {
active_ = true;
- bool destroyed = false;
- destroyed_ = &destroyed;
+ base::WeakPtr<CallbackLayerAnimationObserver> weak_this =
+ weak_factory_.GetWeakPtr();
CheckAllSequencesStarted();
- if (destroyed)
+ if (!weak_this)
return;
- destroyed_ = nullptr;
CheckAllSequencesCompleted();
}
@@ -110,19 +106,17 @@ void CallbackLayerAnimationObserver::CheckAllSequencesStarted() {
void CallbackLayerAnimationObserver::CheckAllSequencesCompleted() {
if (active_ && GetNumSequencesCompleted() == attached_sequence_count_) {
active_ = false;
- bool destroyed = false;
- destroyed_ = &destroyed;
-
+ base::WeakPtr<CallbackLayerAnimationObserver> weak_this =
+ weak_factory_.GetWeakPtr();
bool should_delete = animation_ended_callback_.Run(*this);
- if (destroyed) {
+ if (!weak_this) {
if (should_delete)
LOG(WARNING) << "CallbackLayerAnimationObserver was explicitly "
"destroyed AND was requested to be destroyed via the "
"AnimationEndedCallback's return value.";
return;
}
- destroyed_ = nullptr;
if (should_delete)
delete this;
diff --git a/ui/compositor/callback_layer_animation_observer.h b/ui/compositor/callback_layer_animation_observer.h
index fc631cc21ccc83a74955cd1af8bf43b879b6bc80..9b3448eecbc6a9bc75719c8df08586fe8870fa96 100644
--- a/ui/compositor/callback_layer_animation_observer.h
+++ b/ui/compositor/callback_layer_animation_observer.h
@@ -167,9 +167,8 @@ class COMPOSITOR_EXPORT CallbackLayerAnimationObserver
// The callback to invoke once all the animation sequences have finished.
AnimationEndedCallback animation_ended_callback_;
- // Set to true in the destructor (if non-NULL). Used to detect deletion while
- // calling out.
- bool* destroyed_ = nullptr;
+ // Used to detect deletion while calling out.
+ base::WeakPtrFactory<CallbackLayerAnimationObserver> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(CallbackLayerAnimationObserver);
};

View File

@@ -180,7 +180,7 @@ index 1edb9fd6b0c383f291735dd1a952fcb7b17cc87f..23967f040eb346be265faa2a92562e1f
size_t GetRelatedActiveContentsCount() override;
bool RequiresDedicatedProcess() override;
diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc
index 44a574d3c621695d7d1304c7b8db08db8cf753d1..39d3c28ca33fa1eeab14b67ec31a6ae09f25c354 100644
index 1f469e9c1001ba63e371456d3cbbbfbddffeabb8..5142cfedf46dafa383f615fe8ca72c1d4c20b36e 100644
--- a/content/public/browser/content_browser_client.cc
+++ b/content/public/browser/content_browser_client.cc
@@ -52,6 +52,20 @@ void OverrideOnBindInterface(const service_manager::BindSourceInfo& remote_info,
@@ -205,7 +205,7 @@ index 44a574d3c621695d7d1304c7b8db08db8cf753d1..39d3c28ca33fa1eeab14b67ec31a6ae0
const MainFunctionParams& parameters) {
return nullptr;
diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h
index 7d83d9e0d0c57511955921d85f15a27a88c3ac37..3d518759a3bc190970a2d45ec178c97096fa250d 100644
index 46399a321845e04f67d8424acddec2636b2d9cc6..671b2ccfb8f8f21018931c454584d7f0bd2b1418 100644
--- a/content/public/browser/content_browser_client.h
+++ b/content/public/browser/content_browser_client.h
@@ -208,8 +208,41 @@ CONTENT_EXPORT void OverrideOnBindInterface(

View File

@@ -6,10 +6,10 @@ Subject: gritsettings_resource_ids.patch
Add electron resources file to the list of resource ids generation.
diff --git a/tools/gritsettings/resource_ids b/tools/gritsettings/resource_ids
index 7ac3cf37b48153541278b3524d5c1610f6ae62e7..d284647347afca7beb1fea7415ae8f951026a03b 100644
index e43847961df964f2de96075a4aed90c233c9babe..bb7f9bf1fc01fa61421baffd344dcae2ac28b0d5 100644
--- a/tools/gritsettings/resource_ids
+++ b/tools/gritsettings/resource_ids
@@ -459,6 +459,11 @@
@@ -462,6 +462,11 @@
"includes": [28880],
},

View File

@@ -73,7 +73,7 @@ index 94afefcee81b87c05bf9b1199d90d3d4b5ea84a6..2ec7f04c71824b47de1ddbf1f0e8625d
} // namespace blink
diff --git a/third_party/blink/renderer/core/paint/theme_painter_mac.mm b/third_party/blink/renderer/core/paint/theme_painter_mac.mm
index e965faf9fd8d5ec3572d769421f149907d66c67f..b2d0bbd80994fdf9607009d9e27bf4c3629fe402 100644
index e94235acb17335fbc78c606ff26036871117bd09..7c4bd19215c67f649636ae69b9a21b5c1ba21ecc 100644
--- a/third_party/blink/renderer/core/paint/theme_painter_mac.mm
+++ b/third_party/blink/renderer/core/paint/theme_painter_mac.mm
@@ -41,6 +41,7 @@

View File

@@ -11,7 +11,7 @@ majority of changes originally come from these PRs:
This patch also fixes callback for manual user cancellation and success.
diff --git a/chrome/browser/printing/print_job_worker.cc b/chrome/browser/printing/print_job_worker.cc
index 63f432b58371cfa0f8079fa78a51c8865a00c183..7b39523e0b8b840191ea517d5f5e8eda701995bc 100644
index 63f432b58371cfa0f8079fa78a51c8865a00c183..d20d803f55ca67fb6993facc69c3431767786053 100644
--- a/chrome/browser/printing/print_job_worker.cc
+++ b/chrome/browser/printing/print_job_worker.cc
@@ -21,12 +21,12 @@
@@ -28,25 +28,40 @@ index 63f432b58371cfa0f8079fa78a51c8865a00c183..7b39523e0b8b840191ea517d5f5e8eda
#include "printing/print_job_constants.h"
#include "printing/printed_document.h"
#include "printing/printing_utils.h"
@@ -224,7 +224,15 @@ void PrintJobWorker::UpdatePrintSettingsFromPOD(
@@ -206,9 +206,14 @@ void PrintJobWorker::SetSettingsFromPOD(
void PrintJobWorker::UpdatePrintSettings(base::Value new_settings,
SettingsCallback callback) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
- PrintingContext::Result result =
- printing_context_->UpdatePrintSettings(std::move(new_settings));
- GetSettingsDone(std::move(callback), result);
+ // Reset settings from previous print job
+ printing_context_->ResetSettings();
+ PrintingContext::Result get_default_result = printing_context_->UseDefaultSettings();
+ if (get_default_result == PrintingContext::Result::OK) {
+ PrintingContext::Result update_result =
+ printing_context_->UpdatePrintSettings(std::move(new_settings));
+ GetSettingsDone(std::move(callback), update_result);
+ }
}
#if defined(OS_CHROMEOS)
@@ -224,6 +229,13 @@ void PrintJobWorker::UpdatePrintSettingsFromPOD(
void PrintJobWorker::GetSettingsDone(SettingsCallback callback,
PrintingContext::Result result) {
- std::move(callback).Run(printing_context_->settings(), result);
+ if (result == PrintingContext::CANCEL) {
+ print_job_->PostTask(
+ FROM_HERE,
+ base::BindOnce(&NotificationCallback, base::RetainedRef(print_job_),
+ JobEventDetails::USER_INIT_CANCELED, 0,
+ base::RetainedRef(document_)));
+ } else {
+ std::move(callback).Run(printing_context_->settings(), result);
+ }
std::move(callback).Run(printing_context_->settings(), result);
}
void PrintJobWorker::GetSettingsWithUI(int document_page_count,
diff --git a/chrome/browser/printing/print_view_manager_base.cc b/chrome/browser/printing/print_view_manager_base.cc
index c4e0992f6265b34659514ef5f15eb8d78645161c..e95f62c0761d1a5829cc4403434fd643e45a0a69 100644
index c4e0992f6265b34659514ef5f15eb8d78645161c..1aca2f88da5d8e96a0f16a667a8a86a7873dfdf9 100644
--- a/chrome/browser/printing/print_view_manager_base.cc
+++ b/chrome/browser/printing/print_view_manager_base.cc
@@ -27,10 +27,7 @@
@@ -188,16 +203,19 @@ index c4e0992f6265b34659514ef5f15eb8d78645161c..e95f62c0761d1a5829cc4403434fd643
if (!print_job_)
return;
@@ -607,7 +619,7 @@ void PrintViewManagerBase::ReleasePrintJob() {
@@ -606,8 +618,9 @@ void PrintViewManagerBase::ReleasePrintJob() {
rfh->Send(msg.release());
}
registrar_.Remove(this, chrome::NOTIFICATION_PRINT_JOB_EVENT,
- registrar_.Remove(this, chrome::NOTIFICATION_PRINT_JOB_EVENT,
- content::Source<PrintJob>(print_job_.get()));
+ content::NotificationService::AllSources());
+ if (!callback_.is_null())
+ registrar_.Remove(this, chrome::NOTIFICATION_PRINT_JOB_EVENT,
+ content::NotificationService::AllSources());
// Don't close the worker thread.
print_job_ = nullptr;
}
@@ -677,6 +689,9 @@ bool PrintViewManagerBase::PrintNowInternal(
@@ -677,6 +690,9 @@ bool PrintViewManagerBase::PrintNowInternal(
// Don't print / print preview interstitials or crashed tabs.
if (web_contents()->ShowingInterstitialPage() || web_contents()->IsCrashed())
return false;
@@ -248,7 +266,7 @@ index 925736d379c34ac7ddc07032305d24e1ae65e4b3..a8b2b31ec8bcb04d83df368b12d124dc
// This means we are _blocking_ until all the necessary pages have been
// rendered or the print settings are being loaded.
diff --git a/chrome/browser/printing/printing_message_filter.cc b/chrome/browser/printing/printing_message_filter.cc
index 706617b7924cfbf25e4f3a04a40d9ee977e6fd69..6e3c3743e5da782e227e1ec3dba83ed7b401f3de 100644
index 706617b7924cfbf25e4f3a04a40d9ee977e6fd69..92b46562ef36bbfe874d39d706ab589d98f37cda 100644
--- a/chrome/browser/printing/printing_message_filter.cc
+++ b/chrome/browser/printing/printing_message_filter.cc
@@ -21,6 +21,7 @@
@@ -314,7 +332,18 @@ index 706617b7924cfbf25e4f3a04a40d9ee977e6fd69..6e3c3743e5da782e227e1ec3dba83ed7
std::unique_ptr<PrinterQuery> printer_query =
queue_->PopPrinterQuery(document_cookie);
if (!printer_query) {
@@ -295,7 +303,7 @@ void PrintingMessageFilter::OnUpdatePrintSettingsReply(
@@ -257,7 +265,9 @@ void PrintingMessageFilter::OnUpdatePrintSettingsReply(
std::unique_ptr<PrinterQuery> printer_query,
IPC::Message* reply_msg) {
PrintMsg_PrintPages_Params params;
- if (!printer_query || printer_query->last_status() != PrintingContext::OK) {
+ // We call update without first printing from defaults,
+ // so the last printer status will still be defaulted to PrintingContext::FAILED
+ if (!printer_query) {
params.Reset();
} else {
RenderParamsFromPrintSettings(printer_query->settings(), &params.params);
@@ -295,7 +305,7 @@ void PrintingMessageFilter::OnUpdatePrintSettingsReply(
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
void PrintingMessageFilter::OnCheckForCancel(const PrintHostMsg_PreviewIds& ids,
bool* cancel) {
@@ -349,23 +378,22 @@ index 9fbea6d0a2dbe55b1d600fbc217dee5aa8ae8cd5..de9bd267e408c02fd4da7d903523c0e6
// content::BrowserMessageFilter:
bool OnMessageReceived(const IPC::Message& message) override;
diff --git a/components/printing/common/print_messages.h b/components/printing/common/print_messages.h
index 1802034a6e15a6ad8b0d9591cfb79ba5873dc982..a827091facdb4f6b1d74ce826c3492ced27c008e 100644
index 1802034a6e15a6ad8b0d9591cfb79ba5873dc982..331ac71d925c056d3b7577123251514c35f30fde 100644
--- a/components/printing/common/print_messages.h
+++ b/components/printing/common/print_messages.h
@@ -368,7 +368,10 @@ IPC_MESSAGE_ROUTED0(PrintMsg_PrintNodeUnderContextMenu)
@@ -368,7 +368,9 @@ IPC_MESSAGE_ROUTED0(PrintMsg_PrintNodeUnderContextMenu)
#if BUILDFLAG(ENABLE_PRINTING)
// Tells the RenderFrame to switch the CSS to print media type, renders every
// requested pages and switch back the CSS to display media type.
-IPC_MESSAGE_ROUTED0(PrintMsg_PrintPages)
+IPC_MESSAGE_ROUTED3(PrintMsg_PrintPages,
+IPC_MESSAGE_ROUTED2(PrintMsg_PrintPages,
+ bool /* silent print */,
+ bool /* print page's background */,
+ base::DictionaryValue /* settings */)
// Like PrintMsg_PrintPages, but using the print preview document's frame/node.
IPC_MESSAGE_ROUTED0(PrintMsg_PrintForSystemDialog)
diff --git a/components/printing/renderer/print_render_frame_helper.cc b/components/printing/renderer/print_render_frame_helper.cc
index ef580254bd8feba84ac02924b77b9b4feaf14d96..57a8264a7174b440ed1d6bfe9c2c3e21552d950b 100644
index ef580254bd8feba84ac02924b77b9b4feaf14d96..8b10469dd2e91edec2ddf9411b5281b76a8398a1 100644
--- a/components/printing/renderer/print_render_frame_helper.cc
+++ b/components/printing/renderer/print_render_frame_helper.cc
@@ -37,6 +37,7 @@
@@ -376,49 +404,47 @@ index ef580254bd8feba84ac02924b77b9b4feaf14d96..57a8264a7174b440ed1d6bfe9c2c3e21
#include "printing/units.h"
#include "third_party/blink/public/common/frame/frame_owner_element_type.h"
#include "third_party/blink/public/common/frame/sandbox_flags.h"
@@ -1116,7 +1117,9 @@ void PrintRenderFrameHelper::ScriptedPrint(bool user_initiated) {
@@ -1116,7 +1117,8 @@ void PrintRenderFrameHelper::ScriptedPrint(bool user_initiated) {
web_frame->DispatchBeforePrintEvent();
if (!weak_this)
return;
- Print(web_frame, blink::WebNode(), PrintRequestType::kScripted);
+ Print(web_frame, blink::WebNode(), PrintRequestType::kScripted,
+ false /* silent */, false /* print_background */,
+ base::DictionaryValue() /* new_settings */);
+ false /* silent */, base::DictionaryValue() /* new_settings */);
if (weak_this)
web_frame->DispatchAfterPrintEvent();
}
@@ -1164,7 +1167,10 @@ void PrintRenderFrameHelper::OnDestruct() {
@@ -1164,7 +1166,9 @@ void PrintRenderFrameHelper::OnDestruct() {
delete this;
}
-void PrintRenderFrameHelper::OnPrintPages() {
+void PrintRenderFrameHelper::OnPrintPages(
+ bool silent,
+ bool print_background,
+ const base::DictionaryValue& settings) {
if (ipc_nesting_level_ > 1)
return;
@@ -1177,7 +1183,8 @@ void PrintRenderFrameHelper::OnPrintPages() {
@@ -1177,7 +1181,8 @@ void PrintRenderFrameHelper::OnPrintPages() {
// If we are printing a PDF extension frame, find the plugin node and print
// that instead.
auto plugin = delegate_->GetPdfElement(frame);
- Print(frame, plugin, PrintRequestType::kRegular);
+ Print(frame, plugin, PrintRequestType::kRegular,
+ silent, print_background, settings);
+ silent, settings);
if (weak_this)
frame->DispatchAfterPrintEvent();
// WARNING: |this| may be gone at this point. Do not do any more work here and
@@ -1194,7 +1201,7 @@ void PrintRenderFrameHelper::OnPrintForSystemDialog() {
@@ -1194,7 +1199,7 @@ void PrintRenderFrameHelper::OnPrintForSystemDialog() {
}
auto weak_this = weak_ptr_factory_.GetWeakPtr();
Print(frame, print_preview_context_.source_node(),
- PrintRequestType::kRegular);
+ PrintRequestType::kRegular, false, false, base::DictionaryValue());
+ PrintRequestType::kRegular, false, base::DictionaryValue());
if (weak_this)
frame->DispatchAfterPrintEvent();
// WARNING: |this| may be gone at this point. Do not do any more work here and
@@ -1230,6 +1237,8 @@ void PrintRenderFrameHelper::OnPrintPreview(
@@ -1230,6 +1235,8 @@ void PrintRenderFrameHelper::OnPrintPreview(
if (ipc_nesting_level_ > 1)
return;
@@ -427,31 +453,29 @@ index ef580254bd8feba84ac02924b77b9b4feaf14d96..57a8264a7174b440ed1d6bfe9c2c3e21
print_preview_context_.OnPrintPreview();
UMA_HISTOGRAM_ENUMERATION("PrintPreview.PreviewEvent",
@@ -1622,7 +1631,10 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) {
@@ -1622,7 +1629,9 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) {
auto self = weak_ptr_factory_.GetWeakPtr();
Print(duplicate_node.GetDocument().GetFrame(), duplicate_node,
- PrintRequestType::kRegular);
+ PrintRequestType::kRegular,
+ false /* silent */,
+ false /* print_background */,
+ base::DictionaryValue() /* new_settings */);
// Check if |this| is still valid.
if (!self)
return;
@@ -1633,7 +1645,10 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) {
@@ -1633,7 +1642,9 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) {
void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
const blink::WebNode& node,
- PrintRequestType print_request_type) {
+ PrintRequestType print_request_type,
+ bool silent,
+ bool print_background,
+ const base::DictionaryValue& settings) {
// If still not finished with earlier print request simply ignore.
if (prep_frame_view_)
return;
@@ -1641,7 +1656,7 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
@@ -1641,7 +1652,7 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
FrameReference frame_ref(frame);
int expected_page_count = 0;
@@ -460,7 +484,7 @@ index ef580254bd8feba84ac02924b77b9b4feaf14d96..57a8264a7174b440ed1d6bfe9c2c3e21
DidFinishPrinting(FAIL_PRINT_INIT);
return; // Failed to init print page settings.
}
@@ -1661,8 +1676,11 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
@@ -1661,8 +1672,11 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
PrintMsg_PrintPages_Params print_settings;
auto self = weak_ptr_factory_.GetWeakPtr();
@@ -474,15 +498,7 @@ index ef580254bd8feba84ac02924b77b9b4feaf14d96..57a8264a7174b440ed1d6bfe9c2c3e21
// Check if |this| is still valid.
if (!self)
return;
@@ -1672,6 +1690,7 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
? blink::kWebPrintScalingOptionSourceSize
: scaling_option;
SetPrintPagesParams(print_settings);
+ print_settings.params.should_print_backgrounds = print_background;
if (print_settings.params.dpi.IsEmpty() ||
!print_settings.params.document_cookie) {
DidFinishPrinting(OK); // Release resources and fail silently on failure.
@@ -1867,10 +1886,24 @@ std::vector<int> PrintRenderFrameHelper::GetPrintedPages(
@@ -1867,10 +1881,17 @@ std::vector<int> PrintRenderFrameHelper::GetPrintedPages(
return printed_pages;
}
@@ -493,24 +509,17 @@ index ef580254bd8feba84ac02924b77b9b4feaf14d96..57a8264a7174b440ed1d6bfe9c2c3e21
PrintMsg_PrintPages_Params settings;
- Send(new PrintHostMsg_GetDefaultPrintSettings(routing_id(),
- &settings.params));
+ if (new_settings.empty()) {
+ Send(new PrintHostMsg_GetDefaultPrintSettings(routing_id(),
+ &settings.params));
+ } else {
+ // Send the cookie so that UpdatePrintSettings can reuse PrinterQuery when
+ // possible.
+ int cookie =
+ print_pages_params_ ? print_pages_params_->params.document_cookie : 0;
+ bool canceled = false;
+ Send(new PrintHostMsg_UpdatePrintSettings(
+ routing_id(), cookie, new_settings, &settings, &canceled));
+ if (canceled)
+ return false;
+ }
+ // new_settings will never be empty, always send the update IPC message
+ bool canceled = false;
+ Send(new PrintHostMsg_UpdatePrintSettings(
+ routing_id(), 0, new_settings, &settings, &canceled));
+ if (canceled)
+ return false;
+
// Check if the printer returned any settings, if the settings is empty, we
// can safely assume there are no printer drivers configured. So we safely
// terminate.
@@ -1890,12 +1923,14 @@ bool PrintRenderFrameHelper::InitPrintSettings(bool fit_to_paper_size) {
@@ -1890,12 +1911,14 @@ bool PrintRenderFrameHelper::InitPrintSettings(bool fit_to_paper_size) {
return result;
}
@@ -530,33 +539,31 @@ index ef580254bd8feba84ac02924b77b9b4feaf14d96..57a8264a7174b440ed1d6bfe9c2c3e21
Send(new PrintHostMsg_ShowInvalidPrinterSettingsError(routing_id()));
return false;
diff --git a/components/printing/renderer/print_render_frame_helper.h b/components/printing/renderer/print_render_frame_helper.h
index 71c0c15217b62cd7a6087c6d9ae50481f9041d5f..e2250a66517dbd909cd3b5407173ad91c11ec32f 100644
index 71c0c15217b62cd7a6087c6d9ae50481f9041d5f..18d853d7f808aaf816de86e8c5b8231738d16f55 100644
--- a/components/printing/renderer/print_render_frame_helper.h
+++ b/components/printing/renderer/print_render_frame_helper.h
@@ -193,7 +193,9 @@ class PrintRenderFrameHelper
@@ -193,7 +193,8 @@ class PrintRenderFrameHelper
bool OnMessageReceived(const IPC::Message& message) override;
// Message handlers ---------------------------------------------------------
- void OnPrintPages();
+ void OnPrintPages(bool silent,
+ bool print_background,
+ const base::DictionaryValue& settings);
void OnPrintForSystemDialog();
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
void OnInitiatePrintPreview(bool has_selection);
@@ -243,7 +245,10 @@ class PrintRenderFrameHelper
@@ -243,7 +244,9 @@ class PrintRenderFrameHelper
// WARNING: |this| may be gone after this method returns.
void Print(blink::WebLocalFrame* frame,
const blink::WebNode& node,
- PrintRequestType print_request_type);
+ PrintRequestType print_request_type,
+ bool silent,
+ bool print_background,
+ const base::DictionaryValue& settings);
// Notification when printing is done - signal tear-down/free resources.
void DidFinishPrinting(PrintingResult result);
@@ -252,12 +257,14 @@ class PrintRenderFrameHelper
@@ -252,12 +255,14 @@ class PrintRenderFrameHelper
// Initialize print page settings with default settings.
// Used only for native printing workflow.
@@ -573,3 +580,54 @@ index 71c0c15217b62cd7a6087c6d9ae50481f9041d5f..e2250a66517dbd909cd3b5407173ad91
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
// Set options for print preset from source PDF document.
diff --git a/printing/print_settings_conversion.cc b/printing/print_settings_conversion.cc
index 2563ae6a87b2354ff2f2b45c17f61d2f44910efa..1f34f905791f38a44ae8c892cc9cfb38d15b659d 100644
--- a/printing/print_settings_conversion.cc
+++ b/printing/print_settings_conversion.cc
@@ -190,11 +190,12 @@ bool PrintSettingsFromJobSettings(const base::Value& job_settings,
settings->set_dpi_xy(dpi_horizontal.value(), dpi_vertical.value());
#endif
+ if (!device_name->empty())
+ settings->set_device_name(base::UTF8ToUTF16(*device_name));
settings->set_collate(collate.value());
settings->set_copies(copies.value());
settings->SetOrientation(landscape.value());
- settings->set_device_name(base::UTF8ToUTF16(*device_name));
settings->set_duplex_mode(static_cast<DuplexMode>(duplex_mode.value()));
settings->set_color(static_cast<ColorModel>(color.value()));
settings->set_scale_factor(static_cast<double>(scale_factor.value()) / 100.0);
diff --git a/printing/printing_context.cc b/printing/printing_context.cc
index 78e3c3b2e1bea0f3626838eab14267847a556470..b1c16e6eb1d0d9c0a8b700d9faf408d602f962ea 100644
--- a/printing/printing_context.cc
+++ b/printing/printing_context.cc
@@ -77,8 +77,6 @@ PrintingContext::Result PrintingContext::UsePdfSettings() {
PrintingContext::Result PrintingContext::UpdatePrintSettings(
base::Value job_settings) {
- ResetSettings();
-
if (!PrintSettingsFromJobSettings(job_settings, &settings_)) {
NOTREACHED();
return OnError();
diff --git a/printing/printing_context.h b/printing/printing_context.h
index 9ccc1a6680bcedd452cade7f7531924ace7876cf..4e1c330c01a1d6d1ba702337f16d8f8a70cd76f5 100644
--- a/printing/printing_context.h
+++ b/printing/printing_context.h
@@ -129,12 +129,12 @@ class PRINTING_EXPORT PrintingContext {
int job_id() const { return job_id_; }
- protected:
- explicit PrintingContext(Delegate* delegate);
-
// Reinitializes the settings for object reuse.
void ResetSettings();
+ protected:
+ explicit PrintingContext(Delegate* delegate);
+
// Does bookkeeping when an error occurs.
PrintingContext::Result OnError();

View File

@@ -52,10 +52,10 @@ Some alternatives to this patch:
None of these options seems like a substantial maintainability win over this patch to me (@nornagon).
diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn
index e107dd9f5d264b17601a67edafe9bd61c4d767c3..85e6af67276684202fadd7a4ca4e58252f222c70 100644
index 1b355b2404bca740edc422693c482ceae5d13b9d..93b5810ec10466625b11e7e1d19abfd78589786a 100644
--- a/chrome/BUILD.gn
+++ b/chrome/BUILD.gn
@@ -1716,7 +1716,7 @@ if (is_chrome_branded && !is_android) {
@@ -1717,7 +1717,7 @@ if (is_chrome_branded && !is_android) {
}
}
@@ -64,7 +64,7 @@ index e107dd9f5d264b17601a67edafe9bd61c4d767c3..85e6af67276684202fadd7a4ca4e5825
chrome_paks("packed_resources") {
if (is_mac) {
output_dir = "$root_gen_dir/repack"
@@ -1740,6 +1740,12 @@ if (!is_android) {
@@ -1741,6 +1741,12 @@ if (!is_android) {
}
}

View File

@@ -6,7 +6,7 @@ Subject: scroll_bounce_flag.patch
Patch to make scrollBounce option work.
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
index 76de46a31174c27f11a097575c6dec7b5f675fa8..3f119362e22c14e63d2afafa79df46836c59ae81 100644
index 02fb86dce91aab3385c9ee2acacf6a9a40cc1642..0a2cf06d6aa03dafc922912a2c4788bc43e00fae 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -1506,7 +1506,7 @@ bool RenderThreadImpl::IsGpuMemoryBufferCompositorResourcesEnabled() {

View File

@@ -6,7 +6,7 @@ Subject: ssl_security_state_tab_helper.patch
Allows populating security tab info for devtools in Electron.
diff --git a/chrome/browser/ssl/security_state_tab_helper.cc b/chrome/browser/ssl/security_state_tab_helper.cc
index 45e0f485363a282e2e0caf227c2a7fbc8309acee..a05e16eba687d34e0cbad8cdc6159156cea59abd 100644
index f271b01fad91c169afb06795d9b8aa7207744139..6c3fcf193d5f47670c6642a5643b639dd7ed99a7 100644
--- a/chrome/browser/ssl/security_state_tab_helper.cc
+++ b/chrome/browser/ssl/security_state_tab_helper.cc
@@ -13,14 +13,18 @@
@@ -25,13 +25,13 @@ index 45e0f485363a282e2e0caf227c2a7fbc8309acee..a05e16eba687d34e0cbad8cdc6159156
#include "components/omnibox/common/omnibox_features.h"
#include "components/password_manager/core/browser/password_manager_metrics_util.h"
+#endif
#include "components/safe_browsing/buildflags.h"
#include "components/security_state/content/content_utils.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/navigation_entry.h"
@@ -43,8 +47,10 @@
@@ -44,8 +48,10 @@
#endif // defined(OS_CHROMEOS)
#if defined(FULL_SAFE_BROWSING)
#if BUILDFLAG(FULL_SAFE_BROWSING)
+#if 0
#include "chrome/browser/safe_browsing/chrome_password_protection_service.h"
#endif
@@ -39,7 +39,7 @@ index 45e0f485363a282e2e0caf227c2a7fbc8309acee..a05e16eba687d34e0cbad8cdc6159156
namespace {
@@ -64,8 +70,9 @@ void RecordSecurityLevel(
@@ -65,8 +71,9 @@ void RecordSecurityLevel(
} // namespace
@@ -50,7 +50,7 @@ index 45e0f485363a282e2e0caf227c2a7fbc8309acee..a05e16eba687d34e0cbad8cdc6159156
SecurityStateTabHelper::SecurityStateTabHelper(
content::WebContents* web_contents)
@@ -153,6 +160,7 @@ SecurityStateTabHelper::GetMaliciousContentStatus() const {
@@ -154,6 +161,7 @@ SecurityStateTabHelper::GetMaliciousContentStatus() const {
web_contents()->GetController().GetVisibleEntry();
if (!entry)
return security_state::MALICIOUS_CONTENT_STATUS_NONE;
@@ -58,7 +58,7 @@ index 45e0f485363a282e2e0caf227c2a7fbc8309acee..a05e16eba687d34e0cbad8cdc6159156
safe_browsing::SafeBrowsingService* sb_service =
g_browser_process->safe_browsing_service();
if (!sb_service)
@@ -219,6 +227,7 @@ SecurityStateTabHelper::GetMaliciousContentStatus() const {
@@ -220,6 +228,7 @@ SecurityStateTabHelper::GetMaliciousContentStatus() const {
break;
}
}

View File

@@ -21,10 +21,10 @@ index bfc62d1766686981ded5e62ad7da466d3afb9bab..5fa60ba975561626ae3ccecd9968278c
// An empty URL is returned if the URL is not overriden.
virtual GURL OverrideFlashEmbedWithHTML(const GURL& url);
diff --git a/content/renderer/renderer_blink_platform_impl.cc b/content/renderer/renderer_blink_platform_impl.cc
index a89a61d35a4b9cdde896f8a1d8acfa5c17baec02..4547b0146ae3d03844a5c73a3b4eed97fdbc89c1 100644
index 379ca75ac50388ddb8338f2dabc78faaa68a8088..fe6d379868953918892712da387da1a134cdbd50 100644
--- a/content/renderer/renderer_blink_platform_impl.cc
+++ b/content/renderer/renderer_blink_platform_impl.cc
@@ -914,6 +914,12 @@ void RendererBlinkPlatformImpl::WillStopWorkerThread() {
@@ -947,6 +947,12 @@ void RendererBlinkPlatformImpl::WillStopWorkerThread() {
WorkerThreadRegistry::Instance()->WillStopCurrentWorkerThread();
}
@@ -38,10 +38,10 @@ index a89a61d35a4b9cdde896f8a1d8acfa5c17baec02..4547b0146ae3d03844a5c73a3b4eed97
const v8::Local<v8::Context>& worker) {
GetContentClient()->renderer()->DidInitializeWorkerContextOnWorkerThread(
diff --git a/content/renderer/renderer_blink_platform_impl.h b/content/renderer/renderer_blink_platform_impl.h
index f1bc21b53606d4133440c72c9dea6de1a3a9544f..2c58ea10e04bb1ee337f12a2fcc4db77a071510d 100644
index a58c51ee026ead91af050541a8663dc070388e45..01f170553ac95dfeb34f91290c39845ce349b1c8 100644
--- a/content/renderer/renderer_blink_platform_impl.h
+++ b/content/renderer/renderer_blink_platform_impl.h
@@ -186,6 +186,7 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl {
@@ -191,6 +191,7 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl {
void DidStartWorkerThread() override;
void WillStopWorkerThread() override;
void WorkerContextCreated(const v8::Local<v8::Context>& worker) override;
@@ -50,10 +50,10 @@ index f1bc21b53606d4133440c72c9dea6de1a3a9544f..2c58ea10e04bb1ee337f12a2fcc4db77
const blink::WebString& header_name) override;
diff --git a/third_party/blink/public/platform/platform.h b/third_party/blink/public/platform/platform.h
index 9ae02783be95b1748b931c2f75eb79b038947b7f..eb99295295613fe044b27c401a4b4a77b084255d 100644
index 049aac2befd99a746fbe667a69fd1873333fcdba..f089b63da4b1150151877edb257d959401b1319c 100644
--- a/third_party/blink/public/platform/platform.h
+++ b/third_party/blink/public/platform/platform.h
@@ -636,6 +636,7 @@ class BLINK_PLATFORM_EXPORT Platform {
@@ -656,6 +656,7 @@ class BLINK_PLATFORM_EXPORT Platform {
virtual void DidStartWorkerThread() {}
virtual void WillStopWorkerThread() {}
virtual void WorkerContextCreated(const v8::Local<v8::Context>& worker) {}

View File

@@ -47,7 +47,7 @@ async function nextBeta (v) {
tags.sort((t1, t2) => semver.gt(t1, t2))
// increment the latest existing beta tag or start at beta.1 if it's a new beta line
return tags.length === 0 ? semver.inc(next, 'beta', 'prerelease') : semver.inc(tags.pop(), 'prerelease')
return tags.length === 0 ? `${next}-beta.1` : semver.inc(tags.pop(), 'prerelease')
}
async function getElectronVersion () {

View File

@@ -563,7 +563,7 @@ v8::Local<v8::Promise> Session::ClearAuthCache() {
void Session::AllowNTLMCredentialsForDomains(const std::string& domains) {
auto auth_params = CreateHttpAuthDynamicParams();
auth_params->server_whitelist = domains;
auth_params->server_allowlist = domains;
content::GetNetworkService()->ConfigureHttpAuthPrefs(std::move(auth_params));
}

View File

@@ -1168,6 +1168,7 @@ void TopLevelWindow::BuildPrototype(v8::Isolate* isolate,
.SetMethod("_isMenuBarAutoHide", &TopLevelWindow::IsMenuBarAutoHide)
.SetProperty("autoHideMenuBar", &TopLevelWindow::IsMenuBarAutoHide,
&TopLevelWindow::SetAutoHideMenuBar)
.SetMethod("setMenuBarVisibility", &TopLevelWindow::SetMenuBarVisibility)
.SetMethod("isMenuBarVisible", &TopLevelWindow::IsMenuBarVisible)
.SetMethod("setAspectRatio", &TopLevelWindow::SetAspectRatio)
.SetMethod("previewFile", &TopLevelWindow::PreviewFile)

View File

@@ -1591,13 +1591,16 @@ bool WebContents::IsCurrentlyAudible() {
void WebContents::Print(mate::Arguments* args) {
mate::Dictionary options = mate::Dictionary::CreateEmpty(args->isolate());
base::DictionaryValue settings;
if (args->Length() >= 1 && !args->GetNext(&options)) {
args->ThrowError("Invalid print settings specified");
args->ThrowError("webContents.print(): Invalid print settings specified.");
return;
}
printing::CompletionCallback callback;
if (args->Length() == 2 && !args->GetNext(&callback)) {
args->ThrowError("Invalid optional callback provided");
args->ThrowError(
"webContents.print(): Invalid optional callback provided.");
return;
}
@@ -1605,8 +1608,13 @@ void WebContents::Print(mate::Arguments* args) {
bool silent = false;
options.Get("silent", &silent);
bool print_background = false;
options.Get("printBackground", &print_background);
settings.SetBoolean(printing::kSettingShouldPrintBackgrounds,
print_background);
// Set custom margin settings
mate::Dictionary margins;
mate::Dictionary margins = mate::Dictionary::CreateEmpty(args->isolate());
if (options.Get("margins", &margins)) {
printing::MarginType margin_type = printing::DEFAULT_MARGINS;
margins.Get("marginType", &margin_type);
@@ -1643,6 +1651,8 @@ void WebContents::Print(mate::Arguments* args) {
options.Get("landscape", &landscape);
settings.SetBoolean(printing::kSettingLandscape, landscape);
// We set the default to empty string here and only update
// if at the Chromium level if it's non-empty
base::string16 device_name;
options.Get("deviceName", &device_name);
settings.SetString(printing::kSettingDeviceName, device_name);
@@ -1663,11 +1673,6 @@ void WebContents::Print(mate::Arguments* args) {
options.Get("copies", &copies);
settings.SetInteger(printing::kSettingCopies, copies);
bool print_background = false;
options.Get("printBackground", &print_background);
settings.SetBoolean(printing::kSettingShouldPrintBackgrounds,
print_background);
// For now we don't want to allow the user to enable these settings
// but we need to set them or a CHECK is hit.
settings.SetBoolean(printing::kSettingPrintToPDF, false);
@@ -1723,11 +1728,10 @@ void WebContents::Print(mate::Arguments* args) {
auto* rfh = focused_frame && focused_frame->HasSelection()
? focused_frame
: web_contents()->GetMainFrame();
print_view_manager->PrintNow(
rfh,
std::make_unique<PrintMsg_PrintPages>(rfh->GetRoutingID(), silent,
print_background, settings),
std::move(callback));
print_view_manager->PrintNow(rfh,
std::make_unique<PrintMsg_PrintPages>(
rfh->GetRoutingID(), silent, settings),
std::move(callback));
}
std::vector<printing::PrinterBasicInfo> WebContents::GetPrinterList() {

View File

@@ -147,9 +147,17 @@ bool Browser::IsEmojiPanelSupported() {
}
void Browser::ShowAboutPanel() {
GtkAboutDialog* dialog = GTK_ABOUT_DIALOG(gtk_about_dialog_new());
const auto& opts = about_panel_options_;
if (!opts.is_dict()) {
LOG(WARNING) << "Called showAboutPanel(), but didn't use "
"setAboutPanelSettings() first";
return;
}
GtkWidget* dialogWidget = gtk_about_dialog_new();
GtkAboutDialog* dialog = GTK_ABOUT_DIALOG(dialogWidget);
const std::string* str;
const base::Value* val;
@@ -198,7 +206,7 @@ void Browser::ShowAboutPanel() {
}
gtk_dialog_run(GTK_DIALOG(dialog));
g_clear_object(&dialog);
gtk_widget_destroy(dialogWidget);
}
void Browser::SetAboutPanelOptions(const base::DictionaryValue& options) {

View File

@@ -96,9 +96,6 @@ void Browser::Focus() {
}
void Browser::AddRecentDocument(const base::FilePath& path) {
if (base::win::GetVersion() < base::win::Version::WIN7)
return;
CComPtr<IShellItem> item;
HRESULT hr = SHCreateItemFromParsingName(path.value().c_str(), NULL,
IID_PPV_ARGS(&item));
@@ -111,13 +108,7 @@ void Browser::AddRecentDocument(const base::FilePath& path) {
}
void Browser::ClearRecentDocuments() {
CComPtr<IApplicationDestinations> destinations;
if (FAILED(destinations.CoCreateInstance(CLSID_ApplicationDestinations, NULL,
CLSCTX_INPROC_SERVER)))
return;
if (FAILED(destinations->SetAppID(GetAppUserModelID())))
return;
destinations->RemoveAllDestinations();
SHAddToRecentDocs(SHARD_APPIDINFO, nullptr);
}
void Browser::SetAppUserModelID(const base::string16& name) {

View File

@@ -50,9 +50,9 @@ network::mojom::HttpAuthDynamicParamsPtr CreateHttpAuthDynamicParams() {
network::mojom::HttpAuthDynamicParamsPtr auth_dynamic_params =
network::mojom::HttpAuthDynamicParams::New();
auth_dynamic_params->server_whitelist = command_line->GetSwitchValueASCII(
auth_dynamic_params->server_allowlist = command_line->GetSwitchValueASCII(
electron::switches::kAuthServerWhitelist);
auth_dynamic_params->delegate_whitelist = command_line->GetSwitchValueASCII(
auth_dynamic_params->delegate_allowlist = command_line->GetSwitchValueASCII(
electron::switches::kAuthNegotiateDelegateWhitelist);
auth_dynamic_params->enable_negotiate_port =
command_line->HasSwitch(electron::switches::kEnableAuthNegotiatePort);

View File

@@ -50,8 +50,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 7,0,0,20190731
PRODUCTVERSION 7,0,0,20190731
FILEVERSION 7,0,0,2
PRODUCTVERSION 7,0,0,2
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L

View File

@@ -7,6 +7,6 @@ mojom("mojo") {
public_deps = [
"//mojo/public/mojom/base",
"//ui/gfx/geometry/mojo",
"//ui/gfx/geometry/mojom",
]
}

View File

@@ -2,7 +2,7 @@ module electron.mojom;
import "mojo/public/mojom/base/values.mojom";
import "mojo/public/mojom/base/string16.mojom";
import "ui/gfx/geometry/mojo/geometry.mojom";
import "ui/gfx/geometry/mojom/geometry.mojom";
interface ElectronRenderer {
Message(

View File

@@ -234,6 +234,7 @@ const char kNativeWindowOpen[] = "native-window-open";
const char kWebviewTag[] = "webview-tag";
const char kDisableElectronSiteInstanceOverrides[] =
"disable-electron-site-instance-overrides";
const char kEnableNodeLeakageInRenderers[] = "enable-node-leakage-in-renderers";
// Command switch passed to renderer process to control nodeIntegration.
const char kNodeIntegrationInWorker[] = "node-integration-in-worker";

View File

@@ -118,6 +118,7 @@ extern const char kNodeIntegrationInWorker[];
extern const char kWebviewTag[];
extern const char kNodeIntegrationInSubFrames[];
extern const char kDisableElectronSiteInstanceOverrides[];
extern const char kEnableNodeLeakageInRenderers[];
extern const char kWidevineCdmPath[];
extern const char kWidevineCdmVersion[];

View File

@@ -68,16 +68,25 @@ void AtomRenderFrameObserver::DidCreateScriptContext(
if (ShouldNotifyClient(world_id))
renderer_client_->DidCreateScriptContext(context, render_frame_);
auto* command_line = base::CommandLine::ForCurrentProcess();
bool use_context_isolation = renderer_client_->isolated_world();
// This logic matches the EXPLAINED logic in atom_renderer_client.cc
// to avoid explaining it twice go check that implementation in
// DidCreateScriptContext();
bool is_main_world = IsMainWorld(world_id);
bool is_main_frame = render_frame_->IsMainFrame();
bool is_not_opened = !render_frame_->GetWebFrame()->Opener();
bool reuse_renderer_processes_enabled =
command_line->HasSwitch(switches::kDisableElectronSiteInstanceOverrides);
bool is_not_opened =
!render_frame_->GetWebFrame()->Opener() ||
command_line->HasSwitch(switches::kEnableNodeLeakageInRenderers);
bool allow_node_in_sub_frames =
base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kNodeIntegrationInSubFrames);
command_line->HasSwitch(switches::kNodeIntegrationInSubFrames);
bool should_create_isolated_context =
use_context_isolation && is_main_world &&
(is_main_frame || allow_node_in_sub_frames) && is_not_opened;
(is_main_frame || allow_node_in_sub_frames) &&
(is_not_opened || reuse_renderer_processes_enabled);
if (should_create_isolated_context) {
CreateIsolatedWorldContext();

View File

@@ -76,14 +76,26 @@ void AtomRendererClient::DidCreateScriptContext(
// TODO(zcbenz): Do not create Node environment if node integration is not
// enabled.
// Do not load node if we're aren't a main frame or a devtools extension
auto* command_line = base::CommandLine::ForCurrentProcess();
// Only load node if we are a main frame or a devtools extension
// unless node support has been explicitly enabled for sub frames
bool is_main_frame =
render_frame->IsMainFrame() && !render_frame->GetWebFrame()->Opener();
bool reuse_renderer_processes_enabled =
command_line->HasSwitch(switches::kDisableElectronSiteInstanceOverrides);
// Consider the window not "opened" if it does not have an Opener, or if a
// user has manually opted in to leaking node in the renderer
bool is_not_opened =
!render_frame->GetWebFrame()->Opener() ||
command_line->HasSwitch(switches::kEnableNodeLeakageInRenderers);
// Consider this the main frame if it is both a Main Frame and it wasn't
// opened. We allow an opened main frame to have node if renderer process
// reuse is enabled as that will correctly free node environments prevent a
// leak in child windows.
bool is_main_frame = render_frame->IsMainFrame() &&
(is_not_opened || reuse_renderer_processes_enabled);
bool is_devtools = IsDevToolsExtension(render_frame);
bool allow_node_in_subframes =
base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kNodeIntegrationInSubFrames);
command_line->HasSwitch(switches::kNodeIntegrationInSubFrames);
bool should_load_node =
(is_main_frame || is_devtools || allow_node_in_subframes) &&
!IsWebViewFrame(renderer_context, render_frame);
@@ -111,7 +123,6 @@ void AtomRendererClient::DidCreateScriptContext(
DCHECK(!context.IsEmpty());
node::Environment* env =
node_bindings_->CreateEnvironment(context, nullptr, true);
auto* command_line = base::CommandLine::ForCurrentProcess();
// If we have disabled the site instance overrides we should prevent loading
// any non-context aware native module
if (command_line->HasSwitch(switches::kDisableElectronSiteInstanceOverrides))

View File

@@ -39,7 +39,10 @@ v8::Local<v8::Object> GetIpcObject(v8::Local<v8::Context> context) {
auto global_object = context->Global();
auto value =
global_object->GetPrivate(context, private_binding_key).ToLocalChecked();
DCHECK(!value.IsEmpty() && value->IsObject());
if (value.IsEmpty() || !value->IsObject()) {
LOG(ERROR) << "Attempted to get the 'ipcNative' object but it was missing";
return v8::Local<v8::Object>();
}
return value->ToObject(context).ToLocalChecked();
}
@@ -50,6 +53,8 @@ void InvokeIpcCallback(v8::Local<v8::Context> context,
auto* isolate = context->GetIsolate();
auto ipcNative = GetIpcObject(context);
if (ipcNative.IsEmpty())
return;
// Only set up the node::CallbackScope if there's a node environment.
// Sandboxed renderers don't have a node environment.

View File

@@ -13,6 +13,7 @@
#include "content/public/common/service_manager_connection.h"
#include "content/public/common/simple_connection_filter.h"
#include "content/public/utility/utility_thread.h"
#include "mojo/public/cpp/bindings/service_factory.h"
#include "services/proxy_resolver/proxy_resolver_factory_impl.h"
#include "services/proxy_resolver/public/mojom/proxy_resolver.mojom.h"
#include "services/service_manager/public/cpp/service.h"
@@ -42,6 +43,13 @@ void RunServiceAsyncThenTerminateProcess(
base::BindOnce([] { content::UtilityThread::Get()->ReleaseProcess(); }));
}
auto RunProxyResolver(
mojo::PendingReceiver<proxy_resolver::mojom::ProxyResolverFactory>
receiver) {
return std::make_unique<proxy_resolver::ProxyResolverFactoryImpl>(
std::move(receiver));
}
} // namespace
AtomContentUtilityClient::AtomContentUtilityClient() : elevated_(false) {
@@ -111,14 +119,9 @@ bool AtomContentUtilityClient::HandleServiceRequest(
return false;
}
void AtomContentUtilityClient::RunIOThreadService(
mojo::GenericPendingReceiver* receiver) {
if (auto factory_receiver =
receiver->As<proxy_resolver::mojom::ProxyResolverFactory>()) {
static base::NoDestructor<proxy_resolver::ProxyResolverFactoryImpl> factory(
std::move(factory_receiver));
return;
}
mojo::ServiceFactory* AtomContentUtilityClient::GetIOThreadServiceFactory() {
static base::NoDestructor<mojo::ServiceFactory> factory{RunProxyResolver};
return factory.get();
}
std::unique_ptr<service_manager::Service>

View File

@@ -29,7 +29,7 @@ class AtomContentUtilityClient : public content::ContentUtilityClient {
bool HandleServiceRequest(
const std::string& service_name,
service_manager::mojom::ServiceRequest request) override;
void RunIOThreadService(mojo::GenericPendingReceiver* receiver) override;
mojo::ServiceFactory* GetIOThreadServiceFactory() override;
private:
std::unique_ptr<service_manager::Service> MaybeCreateMainThreadService(

View File

@@ -1714,7 +1714,7 @@ describe('BrowserWindow module', () => {
}
})
w.webContents.once('new-window', (event, url, frameName, disposition, options) => {
options.webPreferences.preload = preload
options.webPreferences!.preload = preload
})
const htmlPath = path.join(fixtures, 'api', 'sandbox.html?window-open')
const pageUrl = 'file://' + htmlPath
@@ -1742,7 +1742,7 @@ describe('BrowserWindow module', () => {
})
w.webContents.once('new-window', (event, url, frameName, disposition, options) => {
options.webPreferences.preload = preload
options.webPreferences!.preload = preload
})
w.loadFile(
path.join(fixtures, 'api', 'sandbox.html'),
@@ -1800,7 +1800,7 @@ describe('BrowserWindow module', () => {
const preloadPath = path.join(fixtures, 'api', 'new-window-preload.js')
w.webContents.once('new-window', (event, url, frameName, disposition, options) => {
options.webPreferences.preload = preloadPath
options.webPreferences!.preload = preloadPath
})
w.loadFile(path.join(fixtures, 'api', 'new-window.html'))
const [, args] = await emittedOnce(ipcMain, 'answer')
@@ -1817,8 +1817,9 @@ describe('BrowserWindow module', () => {
const preloadPath = path.join(fixtures, 'api', 'new-window-preload.js')
w.webContents.once('new-window', (event, url, frameName, disposition, options) => {
options.webPreferences.preload = preloadPath
options.webPreferences.foo = 'bar'
options.webPreferences!.preload = preloadPath
const prefs = options.webPreferences as any
prefs.foo = 'bar'
})
w.loadFile(path.join(fixtures, 'api', 'new-window.html'))
const [, , webPreferences] = await emittedOnce(ipcMain, 'answer')
@@ -1835,8 +1836,8 @@ describe('BrowserWindow module', () => {
})
let childWc: WebContents | null = null
w.webContents.on('new-window', (event, url, frameName, disposition, options) => {
options.webPreferences.preload = preload
childWc = options.webContents
options.webPreferences!.preload = preload
childWc = (options as any).webContents
expect(w.webContents).to.not.equal(childWc)
})
ipcMain.once('parent-ready', function (event) {
@@ -1954,7 +1955,7 @@ describe('BrowserWindow module', () => {
}
})
w.webContents.once('new-window', (event, url, frameName, disposition, options) => {
options.webPreferences.preload = preload
options.webPreferences!.preload = preload
})
w.loadFile(path.join(fixtures, 'api', 'sandbox.html'), { search: 'reload-remote-child' })
@@ -2119,7 +2120,7 @@ describe('BrowserWindow module', () => {
it('should inherit the nativeWindowOpen setting in opened windows', async () => {
const preloadPath = path.join(fixtures, 'api', 'new-window-preload.js')
w.webContents.once('new-window', (event, url, frameName, disposition, options) => {
options.webPreferences.preload = preloadPath
options.webPreferences!.preload = preloadPath
})
w.loadFile(path.join(fixtures, 'api', 'new-window.html'))
const [, args] = await emittedOnce(ipcMain, 'answer')
@@ -2128,8 +2129,9 @@ describe('BrowserWindow module', () => {
it('should open windows with the options configured via new-window event listeners', async () => {
const preloadPath = path.join(fixtures, 'api', 'new-window-preload.js')
w.webContents.once('new-window', (event, url, frameName, disposition, options) => {
options.webPreferences.preload = preloadPath
options.webPreferences.foo = 'bar'
options.webPreferences!.preload = preloadPath
const prefs = options.webPreferences! as any
prefs.foo = 'bar'
})
w.loadFile(path.join(fixtures, 'api', 'new-window.html'))
const [, , webPreferences] = await emittedOnce(ipcMain, 'answer')
@@ -2185,7 +2187,7 @@ describe('BrowserWindow module', () => {
})
w.webContents.once('new-window', (event, url, frameName, disposition, options) => {
options.webPreferences.preload = path.join(fixtures, 'api', 'window-open-preload.js')
options.webPreferences!.preload = path.join(fixtures, 'api', 'window-open-preload.js')
})
w.loadFile(path.join(fixtures, 'api', 'window-open-location-open.html'))
const [, args, typeofProcess] = await emittedOnce(ipcMain, 'answer')
@@ -2205,7 +2207,7 @@ describe('BrowserWindow module', () => {
})
w.webContents.once('new-window', (event, url, frameName, disposition, options) => {
options.webPreferences.preload = path.join(fixtures, 'api', 'window-open-preload.js')
options.webPreferences!.preload = path.join(fixtures, 'api', 'window-open-preload.js')
})
w.loadFile(path.join(fixtures, 'api', 'window-open-location-open.html'))
const [, , , windowOpenerIsNull] = await emittedOnce(ipcMain, 'answer')

View File

@@ -190,7 +190,7 @@ describe('MenuItems', () => {
it('execute roles with non-native role functions', () => {
const win = new BrowserWindow({ show: false, width: 200, height: 200 })
const item = new MenuItem({ role: 'resetzoom' })
const item = new MenuItem({ role: 'resetZoom' })
const canExecute = execute(item.role, win, win.webContents)
expect(canExecute).to.be.true('can execute')

View File

@@ -307,7 +307,7 @@ describe('net module', () => {
done()
})
})
urlRequest.setHeader(customHeaderName, customHeaderValue)
urlRequest.setHeader(customHeaderName, customHeaderValue as any)
expect(urlRequest.getHeader(customHeaderName)).to.equal(customHeaderValue)
expect(urlRequest.getHeader(customHeaderName.toLowerCase())).to.equal(customHeaderValue)
urlRequest.write('')
@@ -975,7 +975,7 @@ describe('net module', () => {
expect(() => {
net.request({
url: 'https://foo',
session: 1
session: 1 as any
})
}).to.throw("`session` should be an instance of the Session class")
})
@@ -984,7 +984,7 @@ describe('net module', () => {
expect(() => {
net.request({
url: 'https://foo',
partition: 1
partition: 1 as any
})
}).to.throw("`partition` should be a string")
})
@@ -1001,7 +1001,7 @@ describe('net module', () => {
}).then(serverUrlUnparsed => {
const serverUrl = url.parse(serverUrlUnparsed)
const options = {
port: serverUrl.port,
port: serverUrl.port ? parseInt(serverUrl.port, 10) : undefined,
hostname: '127.0.0.1',
headers: { [customHeaderName]: customHeaderValue }
}

View File

@@ -52,7 +52,7 @@ describe('systemPreferences module', () => {
for (const badDefault of badDefaults) {
expect(() => {
systemPreferences.registerDefaults(badDefault)
systemPreferences.registerDefaults(badDefault as any)
}).to.throw('Invalid userDefault data provided')
}
})

View File

@@ -129,7 +129,7 @@ app.on('ready', () => {
console.log('Debugger detached due to : ', reason)
})
mainWindow.webContents.debugger.on('message', function (event, method, params) {
mainWindow.webContents.debugger.on('message', function (event, method, params: any) {
if (method === 'Network.requestWillBeSent') {
if (params.request.url === 'https://www.github.com') {
mainWindow.webContents.debugger.detach()
@@ -756,6 +756,54 @@ Menu.buildFromTemplate([
{ label: '3' }
])
// All possible MenuItem roles
Menu.buildFromTemplate([
{ role: 'undo' },
{ role: 'redo' },
{ role: 'cut' },
{ role: 'copy' },
{ role: 'paste' },
{ role: 'pasteAndMatchStyle' },
{ role: 'delete' },
{ role: 'selectAll' },
{ role: 'reload' },
{ role: 'forceReload' },
{ role: 'toggleDevTools' },
{ role: 'resetZoom' },
{ role: 'zoomIn' },
{ role: 'zoomOut' },
{ role: 'togglefullscreen' },
{ role: 'window' },
{ role: 'minimize' },
{ role: 'close' },
{ role: 'help' },
{ role: 'about' },
{ role: 'services' },
{ role: 'hide' },
{ role: 'hideOthers' },
{ role: 'unhide' },
{ role: 'quit' },
{ role: 'startSpeaking' },
{ role: 'stopSpeaking' },
{ role: 'close' },
{ role: 'minimize' },
{ role: 'zoom' },
{ role: 'front' },
{ role: 'appMenu' },
{ role: 'fileMenu' },
{ role: 'editMenu' },
{ role: 'viewMenu' },
{ role: 'windowMenu' },
{ role: 'recentDocuments' },
{ role: 'clearRecentDocuments' },
{ role: 'toggleTabBar' },
{ role: 'selectNextTab' },
{ role: 'selectPreviousTab' },
{ role: 'mergeAllWindows' },
{ role: 'clearRecentDocuments' },
{ role : 'moveTabToNewWindow'}
])
// net
// https://github.com/electron/electron/blob/master/docs/api/net.md

View File

@@ -25,10 +25,10 @@
dependencies:
regenerator-runtime "^0.13.2"
"@electron/docs-parser@^0.4.1":
version "0.4.1"
resolved "https://registry.yarnpkg.com/@electron/docs-parser/-/docs-parser-0.4.1.tgz#e6557a6a3899ca1168b9f2d70ad24d9ba924e4a9"
integrity sha512-mn4ofEvH8HNdzRMb++cUbiTkO88BAKwM0yjED3KrQ07yEl7CU1lK13qSMVSRhDzNkbg4kFTqBDjaJ57fdHlkxQ==
"@electron/docs-parser@^0.4.1", "@electron/docs-parser@^0.4.2":
version "0.4.2"
resolved "https://registry.yarnpkg.com/@electron/docs-parser/-/docs-parser-0.4.2.tgz#1d5feb0376363435b2f6833b60271ee90c26f952"
integrity sha512-BdEW2So0Qg7lxIET9q84DceavC1v/EyYF9PXU8vRRiwFebGPyEaJS4uqxhStAxmZslQAT4JjQc9jTd12IbG6BQ==
dependencies:
"@types/markdown-it" "^0.0.7"
chai "^4.2.0"
@@ -40,10 +40,10 @@
ora "^3.4.0"
pretty-ms "^5.0.0"
"@electron/typescript-definitions@^8.5.0":
version "8.5.0"
resolved "https://registry.yarnpkg.com/@electron/typescript-definitions/-/typescript-definitions-8.5.0.tgz#8be8d90e2245478368180795b3632db02e90ccdc"
integrity sha512-sq7tTIyQyGMxrSbmCsbpyfV5Yc68Pb74rp5cbpaS3Kopi5sAL2nIi4TdTakVE7Pp4cye75i8HqDUBhsMpt+TvA==
"@electron/typescript-definitions@^8.6.1":
version "8.6.1"
resolved "https://registry.yarnpkg.com/@electron/typescript-definitions/-/typescript-definitions-8.6.1.tgz#7d7b506c21d6667f9e53e5930e3b70a9c1d4ccf3"
integrity sha512-lv6tj76wnhWzTHuxryhTV329AWHPoOn+VUpCzsz3XVCKm+FO+ldttdgFv+1lA7YGOsi+ttiaX678g+iBGZDlTQ==
dependencies:
"@electron/docs-parser" "^0.4.1"
"@types/node" "^11.13.7"
@@ -57,7 +57,6 @@
mkdirp "^0.5.1"
ora "^3.4.0"
pretty-ms "^5.0.0"
rimraf "^2.5.4"
typescript "^3.4.5"
"@mrmlnc/readdir-enhanced@^2.2.1":
@@ -226,9 +225,9 @@
integrity sha512-rp7La3m845mSESCgsJePNL/JQyhkOJA6G4vcwvVgkDAwHhGdq5GCumxmPjEk1MZf+8p5ZQAUE7tqgQRQTXN7uQ==
"@types/node@^11.13.7":
version "11.13.17"
resolved "https://registry.yarnpkg.com/@types/node/-/node-11.13.17.tgz#2e7efbfe5253561087812571e5e6a1e4b1d6295b"
integrity sha512-7W3kSMa8diVH6s24a8Qrmvwu+vG3ahOC/flMHFdWSdnPYoQI0yPO84h5zOWYXAha2Npn3Pw3SSuQSwBUfaniyQ==
version "11.13.18"
resolved "https://registry.yarnpkg.com/@types/node/-/node-11.13.18.tgz#758ec2bf26339d3cc83da22676b64777d0c2befe"
integrity sha512-sMHdXLccscaxI+Hlzz58yLQue3lQyXP+6aQniDRi5oju3n0123kcjhicVGF20WF7cHiwJ2vxMbXc4skOclosoA==
"@types/normalize-package-data@^2.4.0":
version "2.4.0"
@@ -3871,9 +3870,9 @@ levn@^0.3.0, levn@~0.3.0:
type-check "~0.3.2"
linkify-it@^2.0.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/linkify-it/-/linkify-it-2.1.0.tgz#c4caf38a6cd7ac2212ef3c7d2bde30a91561f9db"
integrity sha512-4REs8/062kV2DSHxNfq5183zrqXMl7WP0WzABH9IeJI+NLm429FgE1PDecltYfnOoFDFlZGh2T8PfZn0r+GTRg==
version "2.2.0"
resolved "https://registry.yarnpkg.com/linkify-it/-/linkify-it-2.2.0.tgz#e3b54697e78bf915c70a38acd78fd09e0058b1cf"
integrity sha512-GnAl/knGn+i1U/wjBz3akz2stz+HrHLsxMwHQGofCDfPvlf+gDKN58UtfmUquTY4/MXeE2x7k19KQmeoZi94Iw==
dependencies:
uc.micro "^1.0.1"
@@ -4067,12 +4066,12 @@ lodash.uniq@^4.5.0:
resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773"
integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=
lodash@^4.0.0:
lodash@^4.0.0, lodash@^4.17.11:
version "4.17.15"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548"
integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==
lodash@^4.17.11, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.3.0:
lodash@^4.17.4, lodash@^4.17.5, lodash@^4.3.0:
version "4.17.14"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.14.tgz#9ce487ae66c96254fe20b599f21b6816028078ba"
integrity sha512-mmKYbW3GLuJeX+iGP+Y7Gp1AiGHGbXHCOh/jZmrawMmsE7MS4znI3RL2FsjbqOyMayHInjOeykW7PEajUk1/xw==