This commit is contained in:
Samuel Attard 2020-07-09 10:18:49 -07:00 коммит произвёл GitHub
Родитель 9bd0fc5348
Коммит eb6616e4e9
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
37 изменённых файлов: 495 добавлений и 665 удалений

Просмотреть файл

@ -990,6 +990,7 @@ if (!gotTheLock) {
// Create myWindow, load the rest of the app, etc...
app.whenReady().then(() => {
myWindow = createWindow()
})
}
```
@ -1105,8 +1106,10 @@ For `infoType` equal to `complete`:
For `infoType` equal to `basic`:
Promise is fulfilled with `Object` containing fewer attributes than when requested with `complete`. Here's an example of basic response:
```js
{ auxAttributes:
{ amdSwitchable: true,
{
auxAttributes:
{
amdSwitchable: true,
canSupportThreadedTextureMailbox: false,
directComposition: false,
directRendering: true,
@ -1119,12 +1122,14 @@ For `infoType` equal to `basic`:
sandboxed: false,
softwareRendering: false,
supportsOverlays: false,
videoDecodeAcceleratorFlags: 0 },
gpuDevice:
[ { active: true, deviceId: 26657, vendorId: 4098 },
{ active: false, deviceId: 3366, vendorId: 32902 } ],
machineModelName: 'MacBookPro',
machineModelVersion: '11.5' }
videoDecodeAcceleratorFlags: 0
},
gpuDevice:
[{ active: true, deviceId: 26657, vendorId: 4098 },
{ active: false, deviceId: 3366, vendorId: 32902 }],
machineModelName: 'MacBookPro',
machineModelVersion: '11.5'
}
```
Using `basic` should be preferred if only basic information like `vendorId` or `driverId` is needed.

Просмотреть файл

@ -38,7 +38,7 @@ the window after this event will have no visual flash:
```javascript
const { BrowserWindow } = require('electron')
let win = new BrowserWindow({ show: false })
const win = new BrowserWindow({ show: false })
win.once('ready-to-show', () => {
win.show()
})
@ -60,7 +60,7 @@ immediately, and use a `backgroundColor` close to your app's background:
```javascript
const { BrowserWindow } = require('electron')
let win = new BrowserWindow({ backgroundColor: '#2e2c29' })
const win = new BrowserWindow({ backgroundColor: '#2e2c29' })
win.loadURL('https://github.com')
```
@ -74,8 +74,8 @@ By using `parent` option, you can create child windows:
```javascript
const { BrowserWindow } = require('electron')
let top = new BrowserWindow()
let child = new BrowserWindow({ parent: top })
const top = new BrowserWindow()
const child = new BrowserWindow({ parent: top })
child.show()
top.show()
```
@ -90,7 +90,7 @@ window, you have to set both `parent` and `modal` options:
```javascript
const { BrowserWindow } = require('electron')
let child = new BrowserWindow({ parent: top, modal: true, show: false })
const child = new BrowserWindow({ parent: top, modal: true, show: false })
child.loadURL('https://github.com')
child.once('ready-to-show', () => {
child.show()
@ -597,7 +597,7 @@ e.g. `APPCOMMAND_BROWSER_BACKWARD` is emitted as `browser-backward`.
```javascript
const { BrowserWindow } = require('electron')
let win = new BrowserWindow()
const win = new BrowserWindow()
win.on('app-command', (e, cmd) => {
// Navigate the window back when the user hits their mouse back button
if (cmd === 'browser-backward' && win.webContents.canGoBack()) {
@ -772,7 +772,7 @@ To check if a DevTools extension is installed you can run the following:
```javascript
const { BrowserWindow } = require('electron')
let installed = BrowserWindow.getDevToolsExtensions().hasOwnProperty('devtron')
const installed = 'devtron' in BrowserWindow.getDevToolsExtensions()
console.log(installed)
```
@ -789,7 +789,7 @@ Objects created with `new BrowserWindow` have the following properties:
```javascript
const { BrowserWindow } = require('electron')
// In this example `win` is our instance
let win = new BrowserWindow({ width: 800, height: 600 })
const win = new BrowserWindow({ width: 800, height: 600 })
win.loadURL('https://github.com')
```
@ -1314,9 +1314,9 @@ a HTML-rendered toolbar. For example:
```javascript
const { BrowserWindow } = require('electron')
let win = new BrowserWindow()
const win = new BrowserWindow()
let toolbarRect = document.getElementById('toolbar').getBoundingClientRect()
const toolbarRect = document.getElementById('toolbar').getBoundingClientRect()
win.setSheetOffset(toolbarRect.height)
```
@ -1440,7 +1440,7 @@ Node's [`url.format`](https://nodejs.org/api/url.html#url_url_format_urlobject)
method:
```javascript
let url = require('url').format({
const url = require('url').format({
protocol: 'file',
slashes: true,
pathname: require('path').join(__dirname, 'index.html')

Просмотреть файл

@ -9,7 +9,7 @@ runtime that allows interacting with pages and instrumenting them.
```javascript
const { BrowserWindow } = require('electron')
let win = new BrowserWindow()
const win = new BrowserWindow()
try {
win.webContents.debugger.attach('1.1')

Просмотреть файл

@ -11,7 +11,7 @@ control the download item.
```javascript
// In the main process.
const { BrowserWindow } = require('electron')
let win = new BrowserWindow()
const win = new BrowserWindow()
win.webContents.session.on('will-download', (event, item, webContents) => {
// Set the save path, making Electron not to prompt a save dialog.
item.setSavePath('/tmp/save.pdf')

Просмотреть файл

@ -15,7 +15,7 @@ To create a frameless window, you need to set `frame` to `false` in
```javascript
const { BrowserWindow } = require('electron')
let win = new BrowserWindow({ width: 800, height: 600, frame: false })
const win = new BrowserWindow({ width: 800, height: 600, frame: false })
win.show()
```
@ -33,7 +33,7 @@ Results in a hidden title bar and a full size content window, yet the title bar
```javascript
const { BrowserWindow } = require('electron')
let win = new BrowserWindow({ titleBarStyle: 'hidden' })
const win = new BrowserWindow({ titleBarStyle: 'hidden' })
win.show()
```
@ -43,7 +43,7 @@ Results in a hidden title bar with an alternative look where the traffic light b
```javascript
const { BrowserWindow } = require('electron')
let win = new BrowserWindow({ titleBarStyle: 'hiddenInset' })
const win = new BrowserWindow({ titleBarStyle: 'hiddenInset' })
win.show()
```
@ -58,7 +58,7 @@ This option is only applicable for frameless windows.
```javascript
const { BrowserWindow } = require('electron')
let win = new BrowserWindow({ titleBarStyle: 'customButtonsOnHover', frame: false })
const win = new BrowserWindow({ titleBarStyle: 'customButtonsOnHover', frame: false })
win.show()
```
@ -69,7 +69,7 @@ window transparent:
```javascript
const { BrowserWindow } = require('electron')
let win = new BrowserWindow({ transparent: true, frame: false })
const win = new BrowserWindow({ transparent: true, frame: false })
win.show()
```
@ -100,7 +100,7 @@ API:
```javascript
const { BrowserWindow } = require('electron')
let win = new BrowserWindow()
const win = new BrowserWindow()
win.setIgnoreMouseEvents(true)
```
@ -112,8 +112,8 @@ optional parameter can be used to forward mouse move messages to the web page,
allowing events such as `mouseleave` to be emitted:
```javascript
let win = require('electron').remote.getCurrentWindow()
let el = document.getElementById('clickThroughElement')
const win = require('electron').remote.getCurrentWindow()
const el = document.getElementById('clickThroughElement')
el.addEventListener('mouseenter', () => {
win.setIgnoreMouseEvents(true, { forward: true })
})

Просмотреть файл

@ -17,7 +17,7 @@ renderer process:
```javascript
const { BrowserWindow } = require('electron').remote
let win = new BrowserWindow({ width: 800, height: 600 })
const win = new BrowserWindow({ width: 800, height: 600 })
win.loadURL('https://github.com')
```

Просмотреть файл

@ -33,8 +33,8 @@ const { app, BrowserWindow, screen } = require('electron')
let win
app.whenReady().then(() => {
let displays = screen.getAllDisplays()
let externalDisplay = displays.find((display) => {
const displays = screen.getAllDisplays()
const externalDisplay = displays.find((display) => {
return display.bounds.x !== 0 || display.bounds.y !== 0
})

Просмотреть файл

@ -12,7 +12,7 @@ property of [`WebContents`](web-contents.md), or from the `session` module.
```javascript
const { BrowserWindow } = require('electron')
let win = new BrowserWindow({ width: 800, height: 600 })
const win = new BrowserWindow({ width: 800, height: 600 })
win.loadURL('http://github.com')
const ses = win.webContents.session
@ -332,7 +332,7 @@ verify proc.
```javascript
const { BrowserWindow } = require('electron')
let win = new BrowserWindow()
const win = new BrowserWindow()
win.webContents.session.setCertificateVerifyProc((request, callback) => {
const { hostname } = request
@ -655,7 +655,7 @@ const path = require('path')
app.whenReady().then(() => {
const protocol = session.fromPartition('some-partition').protocol
protocol.registerFileProtocol('atom', (request, callback) => {
let url = request.url.substr(7)
const url = request.url.substr(7)
callback({ path: path.normalize(`${__dirname}/${url}`) })
}, (error) => {
if (error) console.error('Failed to register protocol')

Просмотреть файл

@ -41,7 +41,7 @@ An example TraceConfig that roughly matches what Chrome DevTools records:
'disabled-by-default-v8.cpu_profiler',
'disabled-by-default-v8.cpu_profiler.hires'
],
excluded_categories: [ '*' ]
excluded_categories: ['*']
}
```

Просмотреть файл

@ -209,7 +209,7 @@ not (transparent windows won't work correctly when DWM composition is disabled):
```javascript
const { BrowserWindow, systemPreferences } = require('electron')
let browserOptions = { width: 1000, height: 800 }
const browserOptions = { width: 1000, height: 800 }
// Make the window transparent only if the platform supports it.
if (process.platform !== 'win32' || systemPreferences.isAeroGlassEnabled()) {
@ -218,7 +218,7 @@ if (process.platform !== 'win32' || systemPreferences.isAeroGlassEnabled()) {
}
// Create the window.
let win = new BrowserWindow(browserOptions)
const win = new BrowserWindow(browserOptions)
// Navigate.
if (browserOptions.transparent) {

Просмотреть файл

@ -12,10 +12,10 @@ the [`BrowserWindow`](browser-window.md) object. An example of accessing the
```javascript
const { BrowserWindow } = require('electron')
let win = new BrowserWindow({ width: 800, height: 1500 })
const win = new BrowserWindow({ width: 800, height: 1500 })
win.loadURL('http://github.com')
let contents = win.webContents
const contents = win.webContents
console.log(contents)
```
@ -418,7 +418,7 @@ To only prevent the menu shortcuts, use
```javascript
const { BrowserWindow } = require('electron')
let win = new BrowserWindow({ width: 800, height: 600 })
const win = new BrowserWindow({ width: 800, height: 600 })
win.webContents.on('before-input-event', (event, input) => {
// For example, only enable application menu keyboard shortcuts when
@ -665,7 +665,7 @@ app.whenReady().then(() => {
win = new BrowserWindow({ width: 800, height: 600 })
win.webContents.on('select-bluetooth-device', (event, deviceList, callback) => {
event.preventDefault()
let result = deviceList.find((device) => {
const result = deviceList.find((device) => {
return device.deviceName === 'test'
})
if (!result) {
@ -691,7 +691,7 @@ buffer.
```javascript
const { BrowserWindow } = require('electron')
let win = new BrowserWindow({ webPreferences: { offscreen: true } })
const win = new BrowserWindow({ webPreferences: { offscreen: true } })
win.webContents.on('paint', (event, dirty, image) => {
// updateBitmap(dirty, image.getBitmap())
})
@ -907,7 +907,7 @@ Returns `String` - The URL of the current web page.
```javascript
const { BrowserWindow } = require('electron')
let win = new BrowserWindow({ width: 800, height: 600 })
const win = new BrowserWindow({ width: 800, height: 600 })
win.loadURL('http://github.com').then(() => {
const currentURL = win.webContents.getURL()
console.log(currentURL)
@ -1372,7 +1372,7 @@ An example of `webContents.printToPDF`:
const { BrowserWindow } = require('electron')
const fs = require('fs')
let win = new BrowserWindow({ width: 800, height: 600 })
const win = new BrowserWindow({ width: 800, height: 600 })
win.loadURL('http://github.com')
win.webContents.on('did-finish-load', () => {
@ -1397,7 +1397,7 @@ creation:
```javascript
const { BrowserWindow } = require('electron')
let win = new BrowserWindow()
const win = new BrowserWindow()
win.webContents.on('devtools-opened', () => {
win.webContents.addWorkSpace(__dirname)
})
@ -1718,7 +1718,7 @@ Returns `Promise<void>` - resolves if the page is saved.
```javascript
const { BrowserWindow } = require('electron')
let win = new BrowserWindow()
const win = new BrowserWindow()
win.loadURL('https://github.com')

Просмотреть файл

@ -816,7 +816,7 @@ const { shell } = require('electron')
const webview = document.querySelector('webview')
webview.addEventListener('new-window', async (e) => {
const protocol = require('url').parse(e.url).protocol
const protocol = (new URL(e.url)).protocol
if (protocol === 'http:' || protocol === 'https:') {
await shell.openExternal(e.url)
}

Просмотреть файл

@ -94,6 +94,6 @@ mainWindow.webContents.on('new-window', (event, url, frameName, disposition, opt
```javascript
// renderer process (mainWindow)
let modal = window.open('', 'modal')
const modal = window.open('', 'modal')
modal.document.write('<h1>Hello</h1>')
```

Просмотреть файл

@ -266,7 +266,7 @@ const getGuestForWebContents = (webContentsId, contents) => {
throw new Error(`Invalid webContentsId: ${webContentsId}`)
}
if (guest.hostWebContents !== contents) {
throw new Error(`Access denied to webContents`)
throw new Error('Access denied to webContents')
}
return guest
}
@ -610,11 +610,11 @@ const { memory } = metrics[0] // Deprecated property
```js
// Deprecated
let optionsA = { webPreferences: { blinkFeatures: '' } }
let windowA = new BrowserWindow(optionsA)
const optionsA = { webPreferences: { blinkFeatures: '' } }
const windowA = new BrowserWindow(optionsA)
// Replace with
let optionsB = { webPreferences: { enableBlinkFeatures: '' } }
let windowB = new BrowserWindow(optionsB)
const optionsB = { webPreferences: { enableBlinkFeatures: '' } }
const windowB = new BrowserWindow(optionsB)
// Deprecated
window.on('app-command', (e, cmd) => {
@ -785,11 +785,11 @@ The following list includes the breaking API changes made in Electron 2.0.
```js
// Deprecated
let optionsA = { titleBarStyle: 'hidden-inset' }
let windowA = new BrowserWindow(optionsA)
const optionsA = { titleBarStyle: 'hidden-inset' }
const windowA = new BrowserWindow(optionsA)
// Replace with
let optionsB = { titleBarStyle: 'hiddenInset' }
let windowB = new BrowserWindow(optionsB)
const optionsB = { titleBarStyle: 'hiddenInset' }
const windowB = new BrowserWindow(optionsB)
```
### `menu`

Просмотреть файл

@ -107,7 +107,7 @@ To solve this, you can turn off node integration in Electron:
```javascript
// In the main process.
const { BrowserWindow } = require('electron')
let win = new BrowserWindow({
const win = new BrowserWindow({
webPreferences: {
nodeIntegration: false
}
@ -155,7 +155,7 @@ To achieve this goal, set the background in the constructor for [BrowserWindow][
```javascript
const { BrowserWindow } = require('electron')
let win = new BrowserWindow({
const win = new BrowserWindow({
backgroundColor: '#fff'
})
```

Просмотреть файл

@ -15,7 +15,7 @@ can open them programmatically by calling the `openDevTools()` API on the
```javascript
const { BrowserWindow } = require('electron')
let win = new BrowserWindow()
const win = new BrowserWindow()
win.webContents.openDevTools()
```

Просмотреть файл

@ -70,7 +70,7 @@ fs.readdirSync('/path/to/example.asar')
Use a module from the archive:
```javascript
require('/path/to/example.asar/dir/module.js')
require('./path/to/example.asar/dir/module.js')
```
You can also display a web page in an `asar` archive with `BrowserWindow`:

Просмотреть файл

@ -9,9 +9,9 @@ const childProcess = require('child_process')
const electronPath = require('electron')
// spawn the process
let env = { /* ... */ }
let stdio = ['inherit', 'inherit', 'inherit', 'ipc']
let appProcess = childProcess.spawn(electronPath, ['./app'], { stdio, env })
const env = { /* ... */ }
const stdio = ['inherit', 'inherit', 'inherit', 'ipc']
const appProcess = childProcess.spawn(electronPath, ['./app'], { stdio, env })
// listen for IPC messages from the app
appProcess.on('message', (msg) => {
@ -50,7 +50,7 @@ class TestDriver {
// handle rpc responses
this.process.on('message', (message) => {
// pop the handler
let rpcCall = this.rpcCalls[message.msgId]
const rpcCall = this.rpcCalls[message.msgId]
if (!rpcCall) return
this.rpcCalls[message.msgId] = null
// reject/resolve
@ -70,7 +70,7 @@ class TestDriver {
// to use: driver.rpc('method', 1, 2, 3).then(...)
async rpc (cmd, ...args) {
// send rpc request
let msgId = this.rpcCalls.length
const msgId = this.rpcCalls.length
this.process.send({ msgId, cmd, args })
return new Promise((resolve, reject) => this.rpcCalls.push({ resolve, reject }))
}
@ -92,10 +92,10 @@ async function onMessage ({ msgId, cmd, args }) {
let method = METHODS[cmd]
if (!method) method = () => new Error('Invalid method: ' + cmd)
try {
let resolve = await method(...args)
const resolve = await method(...args)
process.send({ msgId, resolve })
} catch (err) {
let reject = {
const reject = {
message: err.message,
stack: err.stack,
name: err.name
@ -119,7 +119,7 @@ Then, in your test suite, you can use your test-driver as follows:
const test = require('ava')
const electronPath = require('electron')
let app = new TestDriver({
const app = new TestDriver({
path: electronPath,
args: ['./app'],
env: {

Просмотреть файл

@ -96,7 +96,7 @@ const { app, BrowserWindow } = require('electron')
function createWindow () {
// Create the browser window.
let win = new BrowserWindow({
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {

Просмотреть файл

@ -37,18 +37,18 @@ inAppPurchase.on('transactions-updated', (event, transactions) => {
// Check each transaction.
transactions.forEach(function (transaction) {
let payment = transaction.payment
const payment = transaction.payment
switch (transaction.transactionState) {
case 'purchasing':
console.log(`Purchasing ${payment.productIdentifier}...`)
break
case 'purchased':
case 'purchased': {
console.log(`${payment.productIdentifier} purchased.`)
// Get the receipt url.
let receiptURL = inAppPurchase.getReceiptURL()
const receiptURL = inAppPurchase.getReceiptURL()
console.log(`Receipt URL: ${receiptURL}`)
@ -62,6 +62,8 @@ inAppPurchase.on('transactions-updated', (event, transactions) => {
inAppPurchase.finishTransactionByDate(transaction.transactionDate)
break
}
case 'failed':
console.log(`Failed to purchase ${payment.productIdentifier}.`)
@ -105,8 +107,8 @@ inAppPurchase.getProducts(PRODUCT_IDS).then(products => {
})
// Ask the user which product he/she wants to purchase.
let selectedProduct = products[0]
let selectedQuantity = 1
const selectedProduct = products[0]
const selectedQuantity = 1
// Purchase the selected product.
inAppPurchase.purchaseProduct(selectedProduct.productIdentifier, selectedQuantity).then(isProductValid => {

Просмотреть файл

@ -10,7 +10,7 @@ so the `nodeIntegrationInWorker` option should be set to `true` in
`webPreferences`.
```javascript
let win = new BrowserWindow({
const win = new BrowserWindow({
webPreferences: {
nodeIntegrationInWorker: true
}
@ -44,7 +44,7 @@ loads no native modules after the Web Workers get started.
process.dlopen = () => {
throw new Error('Load native module is not safe')
}
let worker = new Worker('script.js')
const worker = new Worker('script.js')
```
[web-workers]: https://developer.mozilla.org/en/docs/Web/API/Web_Workers_API/Using_web_workers

Просмотреть файл

@ -10,7 +10,7 @@ you want to show Notifications in the main process please check out the
[Notification](../api/notification.md) module.
```javascript
let myNotification = new Notification('Title', {
const myNotification = new Notification('Title', {
body: 'Lorem Ipsum Dolor Sit Amet'
})

Просмотреть файл

@ -42,7 +42,7 @@ app.commandLine.appendSwitch('ppapi-flash-path', path.join(__dirname, pluginName
app.commandLine.appendSwitch('ppapi-flash-version', '17.0.0.169')
app.whenReady().then(() => {
let win = new BrowserWindow({
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {

Просмотреть файл

@ -146,7 +146,7 @@ const options = {
}
}
let client = webdriverio.remote(options)
const client = webdriverio.remote(options)
client
.init()

Просмотреть файл

@ -149,7 +149,7 @@ To set the overlay icon for a window, you can use the
```javascript
const { BrowserWindow } = require('electron')
let win = new BrowserWindow()
const win = new BrowserWindow()
win.setOverlayIcon('path/to/overlay.png', 'Description for overlay')
```
@ -168,7 +168,7 @@ To flash the BrowserWindow taskbar button, you can use the
```javascript
const { BrowserWindow } = require('electron')
let win = new BrowserWindow()
const win = new BrowserWindow()
win.once('focus', () => win.flashFrame(false))
win.flashFrame(true)
```

Просмотреть файл

@ -134,6 +134,7 @@ class SlurpStream extends Writable {
this._data = Buffer.concat([this._data, chunk]);
callback();
}
data () { return this._data; }
}

Просмотреть файл

@ -31,7 +31,7 @@
"dotenv-safe": "^4.0.4",
"dugite": "^1.45.0",
"eslint": "^7.4.0",
"eslint-config-standard": "^12.0.0",
"eslint-config-standard": "^14.1.1",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-mocha": "^7.0.1",
"eslint-plugin-node": "^11.1.0",
@ -53,7 +53,7 @@
"request": "^2.88.0",
"semver": "^5.6.0",
"shx": "^0.3.2",
"standard-markdown": "^5.0.0",
"standard-markdown": "^6.0.0",
"sumchecker": "^2.0.2",
"tap-xunit": "^2.4.1",
"temp": "^0.8.3",

Просмотреть файл

@ -40,6 +40,7 @@ class GHKey {
this.repo = repo;
this.number = number;
}
static NewFromPull (pull) {
const owner = pull.base.repo.owner.login;
const repo = pull.base.repo.name;
@ -405,7 +406,7 @@ function getOldestMajorBranchOfPull (pull) {
}
function getOldestMajorBranchOfCommit (commit, pool) {
return [ ...commit.prKeys.values() ]
return [...commit.prKeys.values()]
.map(prKey => pool.pulls[prKey.number])
.filter(pull => !!pull)
.map(pull => getOldestMajorBranchOfPull(pull))
@ -531,13 +532,13 @@ const removeSupercededStackUpdates = (commits) => {
notupdates.push(commit);
continue;
}
const [ , dep, version ] = match;
const [, dep, version] = match;
if (!newest[dep] || newest[dep].version < version) {
newest[dep] = { commit, version };
}
}
return [ ...notupdates, ...Object.values(newest).map(o => o.commit) ];
return [...notupdates, ...Object.values(newest).map(o => o.commit)];
};
/***

Просмотреть файл

@ -1007,7 +1007,7 @@ describe('BrowserWindow module', () => {
});
});
ifdescribe(process.platform === 'win32')(`Fullscreen state`, () => {
ifdescribe(process.platform === 'win32')('Fullscreen state', () => {
it('with properties', () => {
it('can be set with the fullscreen constructor option', () => {
w = new BrowserWindow({ fullscreen: true });
@ -1021,7 +1021,7 @@ describe('BrowserWindow module', () => {
expect(w.fullScreen).to.be.true();
});
it(`checks normal bounds when fullscreen'ed`, async () => {
it('checks normal bounds when fullscreen\'ed', async () => {
const bounds = w.getBounds();
const enterFullScreen = emittedOnce(w, 'enter-full-screen');
w.show();
@ -1030,7 +1030,7 @@ describe('BrowserWindow module', () => {
expectBoundsEqual(w.getNormalBounds(), bounds);
});
it(`checks normal bounds when unfullscreen'ed`, async () => {
it('checks normal bounds when unfullscreen\'ed', async () => {
const bounds = w.getBounds();
w.once('enter-full-screen', () => {
w.fullScreen = false;
@ -1056,7 +1056,7 @@ describe('BrowserWindow module', () => {
expect(w.isFullScreen()).to.be.true();
});
it(`checks normal bounds when fullscreen'ed`, async () => {
it('checks normal bounds when fullscreen\'ed', async () => {
const bounds = w.getBounds();
w.show();
@ -1067,7 +1067,7 @@ describe('BrowserWindow module', () => {
expectBoundsEqual(w.getNormalBounds(), bounds);
});
it(`checks normal bounds when unfullscreen'ed`, async () => {
it('checks normal bounds when unfullscreen\'ed', async () => {
const bounds = w.getBounds();
w.show();

Просмотреть файл

@ -203,7 +203,7 @@ ifdescribe(!isLinuxOnArm && !process.mas && !process.env.DISABLE_CRASH_REPORTER_
require('electron').crashReporter.start({
submitURL: `http://127.0.0.1:${port}`,
ignoreSystemCrashHandler: true,
extra: { 'longParam': 'a'.repeat(130) }
extra: { longParam: 'a'.repeat(130) }
});
setTimeout(() => process.crash());
}, port);
@ -381,7 +381,7 @@ ifdescribe(!isLinuxOnArm && !process.mas && !process.env.DISABLE_CRASH_REPORTER_
await remotely(() => {
require('electron').crashReporter.start({
submitURL: 'http://127.0.0.1',
extra: { 'extra1': 'hi' }
extra: { extra1: 'hi' }
});
});
const parameters = await remotely(() => require('electron').crashReporter.getParameters());
@ -414,8 +414,8 @@ ifdescribe(!isLinuxOnArm && !process.mas && !process.env.DISABLE_CRASH_REPORTER_
crashReporter.start({ submitURL: 'http://' });
const bw = new BrowserWindow({ show: false, webPreferences: { nodeIntegration: true } });
bw.loadURL('about:blank');
await bw.webContents.executeJavaScript(`require('electron').crashReporter.addExtraParameter('hello', 'world')`);
return bw.webContents.executeJavaScript(`require('electron').crashReporter.getParameters()`);
await bw.webContents.executeJavaScript('require(\'electron\').crashReporter.addExtraParameter(\'hello\', \'world\')');
return bw.webContents.executeJavaScript('require(\'electron\').crashReporter.getParameters()');
});
if (process.platform === 'linux') {
// On Linux, 'getParameters' will also include the global parameters,

Просмотреть файл

@ -523,7 +523,7 @@ describe('net module', () => {
session: sess
});
const response = await getResponse(urlRequest);
expect(response.headers['x-cookie']).to.equal(`undefined`);
expect(response.headers['x-cookie']).to.equal('undefined');
});
it('should be able to use the sessions cookie store', async () => {

Просмотреть файл

@ -105,7 +105,7 @@ describe('session module', () => {
});
}
it(`fails to set cookies with samesite=garbage`, async () => {
it('fails to set cookies with samesite=garbage', async () => {
const { cookies } = session.defaultSession;
const value = 'hithere';
await expect(cookies.set({ url, value, sameSite: 'garbage' as any })).to.eventually.be.rejectedWith('Failed to convert \'garbage\' to an appropriate cookie same site value');

Просмотреть файл

@ -1905,7 +1905,7 @@ describe('webContents module', () => {
wasCalled = true;
});
await w.loadURL('about:blank');
await w.webContents.executeJavaScript(`window.open('about:blank')`);
await w.webContents.executeJavaScript('window.open(\'about:blank\')');
await new Promise((resolve) => { process.nextTick(resolve); });
expect(wasCalled).to.equal(false);
await closeAllWindows();

Просмотреть файл

@ -274,7 +274,7 @@ describe('chrome extensions', () => {
await customSession.loadExtension(path.join(fixtures, 'extensions', 'persistent-background-page'));
const w = new BrowserWindow({ show: false, webPreferences: { session: customSession } });
const promise = emittedOnce(app, 'web-contents-created');
await w.loadURL(`about:blank`);
await w.loadURL('about:blank');
const [, bgPageContents] = await promise;
expect(bgPageContents.session).to.not.equal(undefined);
});

Просмотреть файл

@ -31,7 +31,7 @@ class GitFake {
// find the newest shared commit between branches a and b
mergeBase (a: string, b:string): string {
for (const commit of [ ...this.branches[a].reverse() ]) {
for (const commit of [...this.branches[a].reverse()]) {
if (this.branches[b].map((commit: Commit) => commit.sha1).includes(commit.sha1)) {
return commit.sha1;
}
@ -57,7 +57,7 @@ class GitFake {
stdout = this.branches[branch].map((commit: Commit) => commit.sha1).join('\n');
} else if (args.length > 1 && args[0] === 'log' && args.includes('--format=%H,%s')) {
// expected form: `git log --format=%H,%s sha1..branchName
const [ start, branch ] = args[args.length - 1].split('..');
const [start, branch] = args[args.length - 1].split('..');
const lines : string[] = [];
let started = false;
for (const commit of this.branches[branch]) {
@ -108,7 +108,7 @@ describe('release notes', () => {
const wrapper = (args: string[], path: string, options?: IGitExecutionOptions | undefined) => gitFake.exec(args, path, options);
sandbox.replace(GitProcess, 'exec', wrapper);
gitFake.setBranch(oldBranch, [ ...sharedHistory, oldFix ]);
gitFake.setBranch(oldBranch, [...sharedHistory, oldFix]);
});
afterEach(() => {
@ -120,8 +120,8 @@ describe('release notes', () => {
// while oldBranch was the latest stable release
it('are skipped if the target version is a new major line (x.0.0)', async function () {
const version = 'v9.0.0';
gitFake.setBranch(oldBranch, [ ...sharedHistory, oldTropFix ]);
gitFake.setBranch(newBranch, [ ...sharedHistory, newTropFix ]);
gitFake.setBranch(oldBranch, [...sharedHistory, oldTropFix]);
gitFake.setBranch(newBranch, [...sharedHistory, newTropFix]);
const results: any = await notes.get(oldBranch, newBranch, version);
expect(results.fix).to.have.lengthOf(0);
});
@ -130,8 +130,8 @@ describe('release notes', () => {
// multiple stable branches at once, including newBranch.
it('are included if the target version is a minor or patch bump', async function () {
const version = 'v9.0.1';
gitFake.setBranch(oldBranch, [ ...sharedHistory, oldTropFix ]);
gitFake.setBranch(newBranch, [ ...sharedHistory, newTropFix ]);
gitFake.setBranch(oldBranch, [...sharedHistory, oldTropFix]);
gitFake.setBranch(newBranch, [...sharedHistory, newTropFix]);
const results: any = await notes.get(oldBranch, newBranch, version);
expect(results.fix).to.have.lengthOf(1);
});
@ -146,7 +146,7 @@ describe('release notes', () => {
const testCommit = new Commit('89eb309d0b22bd4aec058ffaf983e81e56a5c378', 'feat: lole u got troled hard (#21891)');
const version = 'v9.0.0';
gitFake.setBranch(newBranch, [ ...sharedHistory, testCommit ]);
gitFake.setBranch(newBranch, [...sharedHistory, testCommit]);
const results: any = await notes.get(oldBranch, newBranch, version);
expect(results.feat).to.have.lengthOf(1);
expect(results.feat[0].hash).to.equal(testCommit.sha1);
@ -160,7 +160,7 @@ describe('release notes', () => {
it("honors 'feat' type", async function () {
const testCommit = newFeat;
gitFake.setBranch(newBranch, [ ...sharedHistory, testCommit ]);
gitFake.setBranch(newBranch, [...sharedHistory, testCommit]);
const results: any = await notes.get(oldBranch, newBranch, version);
expect(results.feat).to.have.lengthOf(1);
expect(results.feat[0].hash).to.equal(testCommit.sha1);
@ -168,7 +168,7 @@ describe('release notes', () => {
it("honors 'fix' type", async function () {
const testCommit = newFix;
gitFake.setBranch(newBranch, [ ...sharedHistory, testCommit ]);
gitFake.setBranch(newBranch, [...sharedHistory, testCommit]);
const results: any = await notes.get(oldBranch, newBranch, version);
expect(results.fix).to.have.lengthOf(1);
expect(results.fix[0].hash).to.equal(testCommit.sha1);
@ -176,7 +176,7 @@ describe('release notes', () => {
it("honors 'BREAKING CHANGE' message", async function () {
const testCommit = newBreaking;
gitFake.setBranch(newBranch, [ ...sharedHistory, testCommit ]);
gitFake.setBranch(newBranch, [...sharedHistory, testCommit]);
const results: any = await notes.get(oldBranch, newBranch, version);
expect(results.breaking).to.have.lengthOf(1);
expect(results.breaking[0].hash).to.equal(testCommit.sha1);

Просмотреть файл

@ -38,106 +38,106 @@ function ToWebM (frames, outputAsArray) {
const EBML = [
{
'id': 0x1a45dfa3, // EBML
'data': [
id: 0x1a45dfa3, // EBML
data: [
{
'data': 1,
'id': 0x4286 // EBMLVersion
data: 1,
id: 0x4286 // EBMLVersion
},
{
'data': 1,
'id': 0x42f7 // EBMLReadVersion
data: 1,
id: 0x42f7 // EBMLReadVersion
},
{
'data': 4,
'id': 0x42f2 // EBMLMaxIDLength
data: 4,
id: 0x42f2 // EBMLMaxIDLength
},
{
'data': 8,
'id': 0x42f3 // EBMLMaxSizeLength
data: 8,
id: 0x42f3 // EBMLMaxSizeLength
},
{
'data': 'webm',
'id': 0x4282 // DocType
data: 'webm',
id: 0x4282 // DocType
},
{
'data': 2,
'id': 0x4287 // DocTypeVersion
data: 2,
id: 0x4287 // DocTypeVersion
},
{
'data': 2,
'id': 0x4285 // DocTypeReadVersion
data: 2,
id: 0x4285 // DocTypeReadVersion
}
]
},
{
'id': 0x18538067, // Segment
'data': [
id: 0x18538067, // Segment
data: [
{
'id': 0x1549a966, // Info
'data': [
id: 0x1549a966, // Info
data: [
{
'data': 1e6, // do things in millisecs (num of nanosecs for duration scale)
'id': 0x2ad7b1 // TimecodeScale
data: 1e6, // do things in millisecs (num of nanosecs for duration scale)
id: 0x2ad7b1 // TimecodeScale
},
{
'data': 'whammy',
'id': 0x4d80 // MuxingApp
data: 'whammy',
id: 0x4d80 // MuxingApp
},
{
'data': 'whammy',
'id': 0x5741 // WritingApp
data: 'whammy',
id: 0x5741 // WritingApp
},
{
'data': doubleToString(info.duration),
'id': 0x4489 // Duration
data: doubleToString(info.duration),
id: 0x4489 // Duration
}
]
},
{
'id': 0x1654ae6b, // Tracks
'data': [
id: 0x1654ae6b, // Tracks
data: [
{
'id': 0xae, // TrackEntry
'data': [
id: 0xae, // TrackEntry
data: [
{
'data': 1,
'id': 0xd7 // TrackNumber
data: 1,
id: 0xd7 // TrackNumber
},
{
'data': 1,
'id': 0x73c5 // TrackUID
data: 1,
id: 0x73c5 // TrackUID
},
{
'data': 0,
'id': 0x9c // FlagLacing
data: 0,
id: 0x9c // FlagLacing
},
{
'data': 'und',
'id': 0x22b59c // Language
data: 'und',
id: 0x22b59c // Language
},
{
'data': 'V_VP8',
'id': 0x86 // CodecID
data: 'V_VP8',
id: 0x86 // CodecID
},
{
'data': 'VP8',
'id': 0x258688 // CodecName
data: 'VP8',
id: 0x258688 // CodecName
},
{
'data': 1,
'id': 0x83 // TrackType
data: 1,
id: 0x83 // TrackType
},
{
'id': 0xe0, // Video
'data': [
id: 0xe0, // Video
data: [
{
'data': info.width,
'id': 0xb0 // PixelWidth
data: info.width,
id: 0xb0 // PixelWidth
},
{
'data': info.height,
'id': 0xba // PixelHeight
data: info.height,
id: 0xba // PixelHeight
}
]
}
@ -146,8 +146,8 @@ function ToWebM (frames, outputAsArray) {
]
},
{
'id': 0x1c53bb6b, // Cues
'data': [
id: 0x1c53bb6b, // Cues
data: [
// cue insertion point
]
}
@ -165,23 +165,23 @@ function ToWebM (frames, outputAsArray) {
let clusterTimecode = 0;
while (frameNumber < frames.length) {
const cuePoint = {
'id': 0xbb, // CuePoint
'data': [
id: 0xbb, // CuePoint
data: [
{
'data': Math.round(clusterTimecode),
'id': 0xb3 // CueTime
data: Math.round(clusterTimecode),
id: 0xb3 // CueTime
},
{
'id': 0xb7, // CueTrackPositions
'data': [
id: 0xb7, // CueTrackPositions
data: [
{
'data': 1,
'id': 0xf7 // CueTrack
data: 1,
id: 0xf7 // CueTrack
},
{
'data': 0, // to be filled in when we know it
'size': 8,
'id': 0xf1 // CueClusterPosition
data: 0, // to be filled in when we know it
size: 8,
id: 0xf1 // CueClusterPosition
}
]
}
@ -200,11 +200,11 @@ function ToWebM (frames, outputAsArray) {
let clusterCounter = 0;
const cluster = {
'id': 0x1f43b675, // Cluster
'data': [
id: 0x1f43b675, // Cluster
data: [
{
'data': Math.round(clusterTimecode),
'id': 0xe7 // Timecode
data: Math.round(clusterTimecode),
id: 0xe7 // Timecode
}
].concat(clusterFrames.map(function (webp) {
const block = makeSimpleBlock({

789
yarn.lock

Разница между файлами не показана из-за своего большого размера Загрузить разницу