Compare commits

...

5 Commits

Author SHA1 Message Date
Electron Bot
236d552d6a Bump v7.0.0-nightly.20190621 2019-06-21 08:31:04 -07:00
Shelley Vohr
57c099d8b8 chore: fix branch trimming for blast-off releases (#18907) 2019-06-20 13:12:05 -07:00
Shelley Vohr
7e5ea179a1 chore: remove unneeded require (#18863)
* chore: remove unneeded require

* chore: update lockfile
2019-06-20 12:28:13 -07:00
Shelley Vohr
536327151d refactor: make savePath a property on DownloadItem (#18677) 2019-06-20 10:04:57 -07:00
Jeremy Apthorp
e95d2129be spec: de-flake ses.protocol test (#18884) 2019-06-20 09:54:33 -07:00
10 changed files with 42 additions and 45 deletions

View File

@@ -1 +1 @@
7.0.0-nightly.20190620
7.0.0-nightly.20190621

View File

@@ -80,7 +80,9 @@ The `downloadItem` object has the following methods:
The API is only available in session's `will-download` callback function.
If user doesn't set the save path via the API, Electron will use the original
routine to determine the save path(Usually prompts a save dialog).
routine to determine the save path; this usually prompts a save dialog.
**[Deprecated](modernization/property-updates.md): use the `savePath` property instead.**
#### `downloadItem.getSavePath()`
@@ -88,6 +90,8 @@ Returns `String` - The save path of the download item. This will be either the p
set via `downloadItem.setSavePath(path)` or the path selected from the shown
save dialog.
**[Deprecated](modernization/property-updates.md): use the `savePath` property instead.**
#### `downloadItem.setSaveDialogOptions(options)`
* `options` SaveDialogOptions - Set the save file dialog options. This object has the same
@@ -181,3 +185,13 @@ Returns `String` - ETag header value.
Returns `Double` - Number of seconds since the UNIX epoch when the download was
started.
### Instance Properties
#### `downloadItem.savePath`
A `String` property that determines the save file path of the download item.
The property is only available in session's `will-download` callback function.
If user doesn't set the save path via the property, Electron will use the original
routine to determine the save path; this usually prompts a save dialog.

View File

@@ -20,9 +20,6 @@ The Electron team is currently undergoing an initiative to convert separate gett
* `visibleOnAllWorkspaces`
* `crashReporter` module
* `uploadToServer`
* `DownloadItem` class
* `savePath`
* `paused`
* `Session` module
* `preloads`
* `webContents` module
@@ -47,6 +44,8 @@ The Electron team is currently undergoing an initiative to convert separate gett
* `applicationMenu`
* `badgeCount`
* `name`
* `DownloadItem` class
* `savePath`
* `BrowserWindow` module
* `autohideMenuBar`
* `resizable`

View File

@@ -1,6 +1,6 @@
{
"name": "electron",
"version": "7.0.0-nightly.20190620",
"version": "7.0.0-nightly.20190621",
"repository": "https://github.com/electron/electron",
"description": "Build cross platform desktop apps with JavaScript, HTML, and CSS",
"devDependencies": {
@@ -41,7 +41,6 @@
"minimist": "^1.2.0",
"nugget": "^2.0.1",
"octicons": "^7.3.0",
"plist": "^3.0.1",
"pre-flight": "^1.1.0",
"remark-cli": "^4.0.0",
"remark-preset-lint-markdown-style-guide": "^2.1.1",

View File

@@ -2,7 +2,6 @@
const { GitProcess } = require('dugite')
const utils = require('./lib/version-utils')
const plist = require('plist')
const fs = require('fs')
const semver = require('semver')
const path = require('path')

View File

@@ -28,8 +28,7 @@ function getAbsoluteElectronExec () {
async function handleGitCall (args, gitDir) {
const details = await GitProcess.exec(args, gitDir)
if (details.exitCode === 0) {
const output = details.stdout.replace(/^\*|\s+|\s+$/, '')
return output.trim()
return details.stdout.replace(/^\*|\s+|\s+$/, '')
} else {
const error = GitProcess.parseError(details.stderr)
console.log(`${fail} couldn't parse git process call: `, error)
@@ -48,7 +47,7 @@ async function getCurrentBranch (gitDir) {
process.exit(1)
}
}
return branch
return branch.trim()
}
module.exports = {

View File

@@ -209,6 +209,8 @@ void DownloadItem::BuildPrototype(v8::Isolate* isolate,
.SetMethod("isDone", &DownloadItem::IsDone)
.SetMethod("setSavePath", &DownloadItem::SetSavePath)
.SetMethod("getSavePath", &DownloadItem::GetSavePath)
.SetProperty("savePath", &DownloadItem::GetSavePath,
&DownloadItem::SetSavePath)
.SetMethod("setSaveDialogOptions", &DownloadItem::SetSaveDialogOptions)
.SetMethod("getSaveDialogOptions", &DownloadItem::GetSaveDialogOptions)
.SetMethod("getLastModifiedTime", &DownloadItem::GetLastModifiedTime)

View File

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

View File

@@ -265,7 +265,7 @@ describe('session module', () => {
let customSession = null
const protocol = session.defaultSession.protocol
const handler = (ignoredError, callback) => {
callback({ data: 'test', mimeType: 'text/html' })
callback({ data: `<script>require('electron').ipcRenderer.send('hello')</script>`, mimeType: 'text/html' })
}
beforeEach(async () => {
@@ -273,7 +273,8 @@ describe('session module', () => {
w = new BrowserWindow({
show: false,
webPreferences: {
partition: partitionName
partition: partitionName,
nodeIntegration: true,
}
})
customSession = session.fromPartition(partitionName)
@@ -294,8 +295,8 @@ describe('session module', () => {
})
it('handles requests from partition', async () => {
await w.loadURL(`${protocolName}://fake-host`)
expect(await w.webContents.executeJavaScript('document.body.textContent')).to.equal('test')
w.loadURL(`${protocolName}://fake-host`)
await emittedOnce(ipcMain, 'hello')
})
})
@@ -552,8 +553,8 @@ describe('session module', () => {
const assertDownload = (state, item, isCustom = false) => {
expect(state).to.equal('completed')
expect(item.getFilename()).to.equal('mock.pdf')
expect(path.isAbsolute(item.getSavePath())).to.equal(true)
expect(isPathEqual(item.getSavePath(), downloadFilePath)).to.equal(true)
expect(path.isAbsolute(item.savePath)).to.equal(true)
expect(isPathEqual(item.savePath, downloadFilePath)).to.equal(true)
if (isCustom) {
expect(item.getURL()).to.equal(`${protocolName}://item`)
} else {
@@ -570,7 +571,7 @@ describe('session module', () => {
it('can download using WebContents.downloadURL', (done) => {
const port = downloadServer.address().port
w.webContents.session.once('will-download', function (e, item) {
item.setSavePath(downloadFilePath)
item.savePath = downloadFilePath
item.on('done', function (e, state) {
assertDownload(state, item)
done()
@@ -588,7 +589,7 @@ describe('session module', () => {
protocol.registerHttpProtocol(protocolName, handler, (error) => {
if (error) return done(error)
w.webContents.session.once('will-download', function (e, item) {
item.setSavePath(downloadFilePath)
item.savePath = downloadFilePath
item.on('done', function (e, state) {
assertDownload(state, item, true)
done()
@@ -611,7 +612,7 @@ describe('session module', () => {
}
const done = new Promise(resolve => {
w.webContents.session.once('will-download', function (e, item) {
item.setSavePath(downloadFilePath)
item.savePath = downloadFilePath
item.on('done', function (e, state) {
resolve([state, item])
})
@@ -625,7 +626,7 @@ describe('session module', () => {
it('can cancel download', (done) => {
const port = downloadServer.address().port
w.webContents.session.once('will-download', function (e, item) {
item.setSavePath(downloadFilePath)
item.savePath = downloadFilePath
item.on('done', function (e, state) {
expect(state).to.equal('cancelled')
expect(item.getFilename()).to.equal('mock.pdf')
@@ -649,7 +650,7 @@ describe('session module', () => {
const port = downloadServer.address().port
w.webContents.session.once('will-download', function (e, item) {
item.setSavePath(downloadFilePath)
item.savePath = downloadFilePath
item.on('done', function (e, state) {
expect(item.getFilename()).to.equal('download.pdf')
done()
@@ -693,7 +694,7 @@ describe('session module', () => {
describe('when a save path is specified and the URL is unavailable', () => {
it('does not display a save dialog and reports the done state as interrupted', (done) => {
w.webContents.session.once('will-download', function (e, item) {
item.setSavePath(downloadFilePath)
item.savePath = downloadFilePath
if (item.getState() === 'interrupted') {
item.resume()
}
@@ -724,7 +725,7 @@ describe('session module', () => {
expect(item.getMimeType()).to.equal(options.mimeType)
expect(item.getReceivedBytes()).to.equal(options.offset)
expect(item.getTotalBytes()).to.equal(options.length)
expect(item.getSavePath()).to.equal(downloadFilePath)
expect(item.savePath).to.equal(downloadFilePath)
done()
})
w.webContents.session.createInterruptedDownload(options)
@@ -755,7 +756,7 @@ describe('session module', () => {
expect(item.getState()).to.equal('cancelled')
const options = {
path: item.getSavePath(),
path: item.savePath,
urlChain: item.getURLChain(),
mimeType: item.getMimeType(),
offset: item.getReceivedBytes(),
@@ -777,7 +778,7 @@ describe('session module', () => {
const completedItem = await downloadResumed
expect(completedItem.getState()).to.equal('completed')
expect(completedItem.getFilename()).to.equal('logo.png')
expect(completedItem.getSavePath()).to.equal(downloadFilePath)
expect(completedItem.savePath).to.equal(downloadFilePath)
expect(completedItem.getURL()).to.equal(downloadUrl)
expect(completedItem.getMimeType()).to.equal('image/png')
expect(completedItem.getReceivedBytes()).to.equal(14022)

View File

@@ -692,7 +692,7 @@ balanced-match@^1.0.0:
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c=
base64-js@^1.0.2, base64-js@^1.2.3:
base64-js@^1.0.2:
version "1.3.0"
resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.3.0.tgz#cab1e6118f051095e58b5281aea8c1cd22bfc0e3"
@@ -4616,14 +4616,6 @@ please-upgrade-node@^3.0.2, please-upgrade-node@^3.1.1:
dependencies:
semver-compare "^1.0.0"
plist@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/plist/-/plist-3.0.1.tgz#a9b931d17c304e8912ef0ba3bdd6182baf2e1f8c"
dependencies:
base64-js "^1.2.3"
xmlbuilder "^9.0.7"
xmldom "0.1.x"
plur@^3.0.0:
version "3.1.1"
resolved "https://registry.yarnpkg.com/plur/-/plur-3.1.1.tgz#60267967866a8d811504fe58f2faaba237546a5b"
@@ -6934,14 +6926,6 @@ x-is-string@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/x-is-string/-/x-is-string-0.1.0.tgz#474b50865af3a49a9c4657f05acd145458f77d82"
xmlbuilder@^9.0.7:
version "9.0.7"
resolved "https://registry.yarnpkg.com/xmlbuilder/-/xmlbuilder-9.0.7.tgz#132ee63d2ec5565c557e20f4c22df9aca686b10d"
xmldom@0.1.x:
version "0.1.27"
resolved "https://registry.yarnpkg.com/xmldom/-/xmldom-0.1.27.tgz#d501f97b3bdb403af8ef9ecc20573187aadac0e9"
xtend@^4.0.0, xtend@^4.0.1, xtend@~4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af"