Skip to content

Commit

Permalink
Merge branch '13-x-y' into trop/13-x-y-bp-fix-adjust-initial-webconte…
Browse files Browse the repository at this point in the history
…nts-focus-calculation-1621416492669
  • Loading branch information
jkleinsc committed May 24, 2021
2 parents 23680e8 + 215c2d3 commit 5112506
Show file tree
Hide file tree
Showing 65 changed files with 1,110 additions and 546 deletions.
2 changes: 1 addition & 1 deletion DEPS
Expand Up @@ -14,7 +14,7 @@ gclient_gn_args = [

vars = {
'chromium_version':
'91.0.4472.38',
'91.0.4472.69',
'node_version':
'v14.16.0',
'nan_version':
Expand Down
2 changes: 1 addition & 1 deletion ELECTRON_VERSION
@@ -1 +1 @@
13.0.0-beta.27
13.0.0-beta.28
2 changes: 1 addition & 1 deletion azure-pipelines-woa.yml
Expand Up @@ -64,7 +64,7 @@ steps:
set npm_config_arch=arm64
cd electron
# CalculateNativeWinOcclusion is disabled due to https://bugs.chromium.org/p/chromium/issues/detail?id=1139022
node script/yarn test -- --enable-logging --verbose --disable-features=CalculateNativeWinOcclusion
node script/yarn test -- --enable-logging --verbose --disable-features=CalculateNativeWinOcclusion --disable-gpu
displayName: 'Run Electron tests'
env:
ELECTRON_OUT_DIR: Default
Expand Down
14 changes: 4 additions & 10 deletions docs/README.md
Expand Up @@ -18,20 +18,14 @@ an issue:

## Guides and Tutorials

### Quickstart
### Getting started

* [Quick Start Guide](tutorial/quick-start.md)
* [Prerequisites](tutorial/quick-start.md#prerequisites)
* [Create a basic application](tutorial/quick-start.md#create-a-basic-application)
* [Run your application](tutorial/quick-start.md#run-your-application)
* [Package and distribute the application](tutorial/quick-start.md#package-and-distribute-the-application)
* [Introduction](tutorial/introduction.md)
* [Quick Start](tutorial/quick-start.md)
* [Process Model](tutorial/process-model.md)

### Learning the basics

* [Electron's Process Model](tutorial/quick-start.md#application-architecture)
* [Main and Renderer Processes](tutorial/quick-start.md#main-and-renderer-processes)
* [Electron API](tutorial/quick-start.md#electron-api)
* [Node.js API](tutorial/quick-start.md#nodejs-api)
* Adding Features to Your App
* [Notifications](tutorial/notifications.md)
* [Recent Documents](tutorial/recent-documents.md)
Expand Down
2 changes: 1 addition & 1 deletion docs/api/browser-window.md
Expand Up @@ -1382,7 +1382,7 @@ Captures a snapshot of the page within `rect`. Omitting `rect` will capture the
* `httpReferrer` (String | [Referrer](structures/referrer.md)) (optional) - An HTTP Referrer URL.
* `userAgent` String (optional) - A user agent originating the request.
* `extraHeaders` String (optional) - Extra headers separated by "\n"
* `postData` ([UploadRawData[]](structures/upload-raw-data.md) | [UploadFile[]](structures/upload-file.md)) (optional)
* `postData` ([UploadRawData](structures/upload-raw-data.md) | [UploadFile](structures/upload-file.md))[] (optional)
* `baseURLForDataURL` String (optional) - Base URL (with trailing path separator) for files to be loaded by the data URL. This is needed only if the specified `url` is a data URL and needs to load other files.

Returns `Promise<void>` - the promise will resolve when the page has finished loading
Expand Down
4 changes: 2 additions & 2 deletions docs/api/dialog.md
Expand Up @@ -154,7 +154,7 @@ dialog.showOpenDialog(mainWindow, {

* `browserWindow` [BrowserWindow](browser-window.md) (optional)
* `options` Object
* `title` String (optional)
* `title` String (optional) - The dialog title. Cannot be displayed on some _Linux_ desktop environments.
* `defaultPath` String (optional) - Absolute directory path, absolute file
path, or file name to use by default.
* `buttonLabel` String (optional) - Custom label for the confirmation button, when
Expand Down Expand Up @@ -185,7 +185,7 @@ The `filters` specifies an array of file types that can be displayed, see

* `browserWindow` [BrowserWindow](browser-window.md) (optional)
* `options` Object
* `title` String (optional)
* `title` String (optional) - The dialog title. Cannot be displayed on some _Linux_ desktop environments.
* `defaultPath` String (optional) - Absolute directory path, absolute file
path, or file name to use by default.
* `buttonLabel` String (optional) - Custom label for the confirmation button, when
Expand Down
2 changes: 1 addition & 1 deletion docs/api/structures/post-body.md
@@ -1,6 +1,6 @@
# PostBody Object

* `data` Array<[PostData](./post-data.md)> - The post data to be sent to the
* `data` ([UploadRawData](upload-raw-data.md) | [UploadFile](upload-file.md))[] - The post data to be sent to the
new window.
* `contentType` String - The `content-type` header used for the data. One of
`application/x-www-form-urlencoded` or `multipart/form-data`. Corresponds to
Expand Down
21 changes: 0 additions & 21 deletions docs/api/structures/post-data.md

This file was deleted.

4 changes: 1 addition & 3 deletions docs/api/synopsis.md
Expand Up @@ -13,7 +13,7 @@ either process type.

The basic rule is: if a module is [GUI][gui] or low-level system related, then
it should be only available in the main process. You need to be familiar with
the concept of [main process vs. renderer process](../tutorial/quick-start.md#main-and-renderer-processes)
the concept of main process vs. renderer process
scripts to be able to use those modules.

The main process script is like a normal Node.js script:
Expand Down Expand Up @@ -43,8 +43,6 @@ extra ability to use node modules if `nodeIntegration` is enabled:
</html>
```

To run your app, read [Run your app](../tutorial/quick-start.md#run-your-application).

## Destructuring assignment

As of 0.37, you can use
Expand Down
11 changes: 10 additions & 1 deletion docs/api/web-contents.md
Expand Up @@ -914,7 +914,7 @@ in `webPreferences`.
* `httpReferrer` (String | [Referrer](structures/referrer.md)) (optional) - An HTTP Referrer url.
* `userAgent` String (optional) - A user agent originating the request.
* `extraHeaders` String (optional) - Extra headers separated by "\n".
* `postData` ([UploadRawData[]](structures/upload-raw-data.md) | [UploadFile[]](structures/upload-file.md)) (optional)
* `postData` ([UploadRawData](structures/upload-raw-data.md) | [UploadFile](structures/upload-file.md))[] (optional)
* `baseURLForDataURL` String (optional) - Base url (with trailing path separator) for files to be loaded by the data url. This is needed only if the specified `url` is a data url and needs to load other files.

Returns `Promise<void>` - the promise will resolve when the page has finished loading
Expand Down Expand Up @@ -1184,6 +1184,15 @@ Ignore application menu shortcuts while this web contents is focused.
* `url` String - The _resolved_ version of the URL passed to `window.open()`. e.g. opening a window with `window.open('foo')` will yield something like `https://the-origin/the/current/path/foo`.
* `frameName` String - Name of the window provided in `window.open()`
* `features` String - Comma separated list of window features provided to `window.open()`.
* `disposition` String - Can be `default`, `foreground-tab`, `background-tab`,
`new-window`, `save-to-disk` or `other`.
* `referrer` [Referrer](structures/referrer.md) - The referrer that will be
passed to the new window. May or may not result in the `Referer` header being
sent, depending on the referrer policy.
* `postBody` [PostBody](structures/post-body.md) (optional) - The post data that
will be sent to the new window, along with the appropriate headers that will
be set. If no post data is to be sent, the value will be `null`. Only defined
when the window is being created by a form that set `target=_blank`.

Returns `{action: 'deny'} | {action: 'allow', overrideBrowserWindowOptions?: BrowserWindowConstructorOptions}` - `deny` cancels the creation of the new
window. `allow` will allow the new window to be created. Specifying `overrideBrowserWindowOptions` allows customization of the created window.
Expand Down
2 changes: 1 addition & 1 deletion docs/api/webview-tag.md
Expand Up @@ -274,7 +274,7 @@ webview.addEventListener('dom-ready', () => {
* `httpReferrer` (String | [Referrer](structures/referrer.md)) (optional) - An HTTP Referrer url.
* `userAgent` String (optional) - A user agent originating the request.
* `extraHeaders` String (optional) - Extra headers separated by "\n"
* `postData` ([UploadRawData[]](structures/upload-raw-data.md) | [UploadFile[]](structures/upload-file.md)) (optional)
* `postData` ([UploadRawData](structures/upload-raw-data.md) | [UploadFile](structures/upload-file.md))[] (optional)
* `baseURLForDataURL` String (optional) - Base url (with trailing path separator) for files to be loaded by the data url. This is needed only if the specified `url` is a data url and needs to load other files.

Returns `Promise<void>` - The promise will resolve when the page has finished loading
Expand Down
6 changes: 1 addition & 5 deletions docs/fiddles/features/keyboard-shortcuts/global/index.html
Expand Up @@ -7,10 +7,6 @@
</head>
<body>
<h1>Hello World!</h1>
<p>
We are using node <script>document.write(process.versions.node)</script>,
Chrome <script>document.write(process.versions.chrome)</script>,
and Electron <script>document.write(process.versions.electron)</script>.
</p>
<p>Hit Alt+Ctrl+I on Windows or Opt+Cmd+I on Mac to see a message printed to the console.</p>
</body>
</html>
3 changes: 0 additions & 3 deletions docs/fiddles/features/keyboard-shortcuts/global/main.js
Expand Up @@ -4,9 +4,6 @@ function createWindow () {
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
}
})

win.loadFile('index.html')
Expand Down
Expand Up @@ -7,8 +7,6 @@
</head>
<body>
<h1>Hello World!</h1>
We are using node <script>document.write(process.versions.node)</script>,
Chrome <script>document.write(process.versions.chrome)</script>,
and Electron <script>document.write(process.versions.electron)</script>.
<p>Hit Ctrl+I to see a message printed to the console.</p>
</body>
</html>
@@ -1,7 +1,7 @@
const { app, BrowserWindow } = require('electron')

app.whenReady().then(() => {
const win = new BrowserWindow({ width: 800, height: 600, webPreferences: { nodeIntegration: true } })
const win = new BrowserWindow({ width: 800, height: 600 })

win.loadFile('index.html')
win.webContents.on('before-input-event', (event, input) => {
Expand Down
6 changes: 1 addition & 5 deletions docs/fiddles/features/keyboard-shortcuts/local/index.html
Expand Up @@ -7,10 +7,6 @@
</head>
<body>
<h1>Hello World!</h1>
<p>
We are using node <script>document.write(process.versions.node)</script>,
Chrome <script>document.write(process.versions.chrome)</script>,
and Electron <script>document.write(process.versions.electron)</script>.
</p>
<p>Hit Alt+Shift+I on Windows, or Opt+Cmd+I on mac to see a message printed to the console.</p>
</body>
</html>
3 changes: 0 additions & 3 deletions docs/fiddles/features/keyboard-shortcuts/local/main.js
Expand Up @@ -4,9 +4,6 @@ function createWindow () {
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
}
})

win.loadFile('index.html')
Expand Down
17 changes: 17 additions & 0 deletions docs/fiddles/features/keyboard-shortcuts/web-apis/index.html
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'">
<meta http-equiv="X-Content-Security-Policy" content="default-src 'self'; script-src 'self'">
<title>Hello World!</title>
</head>
<body>
<h1>Hello World!</h1>

<p>Hit any key with this window focused to see it captured here.</p>
<div><span>Last Key Pressed: </span><span id="last-keypress"></span></div>
<script src="./renderer.js"></script>
</body>
</html>
35 changes: 35 additions & 0 deletions docs/fiddles/features/keyboard-shortcuts/web-apis/main.js
@@ -0,0 +1,35 @@
// Modules to control application life and create native browser window
const {app, BrowserWindow} = require('electron')
const path = require('path')

function createWindow () {
// Create the browser window.
const mainWindow = new BrowserWindow({
width: 800,
height: 600,
})

// and load the index.html of the app.
mainWindow.loadFile('index.html')

}

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.whenReady().then(() => {
createWindow()

app.on('activate', function () {
// On macOS it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (BrowserWindow.getAllWindows().length === 0) createWindow()
})
})

// Quit when all windows are closed, except on macOS. There, it's common
// for applications and their menu bar to stay active until the user quits
// explicitly with Cmd + Q.
app.on('window-all-closed', function () {
if (process.platform !== 'darwin') app.quit()
})
7 changes: 7 additions & 0 deletions docs/fiddles/features/keyboard-shortcuts/web-apis/renderer.js
@@ -0,0 +1,7 @@
function handleKeyPress (event) {
// You can put code here to handle the keypress.
document.getElementById("last-keypress").innerText = event.key
console.log(`You pressed ${event.key}`)
}

window.addEventListener('keyup', handleKeyPress, true)
15 changes: 0 additions & 15 deletions docs/fiddles/features/offscreen-rendering/index.html

This file was deleted.

3 changes: 2 additions & 1 deletion docs/fiddles/features/offscreen-rendering/main.js
@@ -1,5 +1,6 @@
const { app, BrowserWindow } = require('electron')
const fs = require('fs')
const path = require('path')

app.disableHardwareAcceleration()

Expand All @@ -12,7 +13,7 @@ app.whenReady().then(() => {
fs.writeFileSync('ex.png', image.toPNG())
})
win.webContents.setFrameRate(60)
console.log(`The screenshot has been successfully saved to ${process.cwd()}/ex.png`)
console.log(`The screenshot has been successfully saved to ${path.join(process.cwd(), 'ex.png')}`)
})

app.on('window-all-closed', () => {
Expand Down
13 changes: 13 additions & 0 deletions docs/fiddles/features/online-detection/index.html
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
</head>
<body>
<h1>Connection status: <strong id='status'></strong></h1>

<script src="renderer.js"></script>
</body>
</html>
26 changes: 26 additions & 0 deletions docs/fiddles/features/online-detection/main.js
@@ -0,0 +1,26 @@
const { app, BrowserWindow } = require('electron')

function createWindow () {
const onlineStatusWindow = new BrowserWindow({
width: 300,
height: 200
})

onlineStatusWindow.loadFile('index.html')
}

app.whenReady().then(() => {
createWindow()

app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()
}
})
})

app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
17 changes: 0 additions & 17 deletions docs/fiddles/features/online-detection/main/index.html

This file was deleted.

24 changes: 0 additions & 24 deletions docs/fiddles/features/online-detection/main/main.js

This file was deleted.

0 comments on commit 5112506

Please sign in to comment.