From 8e2e2620d36cd78ba887a79b8a209570a35df1c3 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 21 May 2019 17:26:00 +0200 Subject: [PATCH 1/4] Revert "Revert "Merge pull request #18916 from atom/electron-3.1"" This reverts commit 3da827b8b06128b2fbe94d5ee16d762871a7aa31. --- package.json | 2 +- script/lib/check-chromedriver-version.js | 12 ++++----- script/lib/generate-startup-snapshot.js | 34 +++++++++++++++++------- script/package-lock.json | 15 ++++++----- script/package.json | 4 +-- spec/theme-manager-spec.js | 4 +-- src/text-editor-component.js | 2 +- 7 files changed, 44 insertions(+), 29 deletions(-) diff --git a/package.json b/package.json index 5eb80f5c637..1ceefbc28dc 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "url": "https://github.com/atom/atom/issues" }, "license": "MIT", - "electronVersion": "2.0.18", + "electronVersion": "3.1.9", "dependencies": { "@atom/nsfw": "1.0.22", "@atom/source-map-support": "^0.3.4", diff --git a/script/lib/check-chromedriver-version.js b/script/lib/check-chromedriver-version.js index 1659f093c0a..f5cada045b5 100644 --- a/script/lib/check-chromedriver-version.js +++ b/script/lib/check-chromedriver-version.js @@ -5,17 +5,17 @@ const CONFIG = require('../config') const semver = require('semver') module.exports = function () { - // Chromedriver should be specified as ~x.y where x and y match Electron major/minor + // Chromedriver should be specified as ^n.x where n matches the Electron major version const chromedriverVer = buildMetadata.dependencies['electron-chromedriver'] const mksnapshotVer = buildMetadata.dependencies['electron-mksnapshot'] - // Always use tilde on electron-chromedriver so that it can pick up the best patch version - if (!chromedriverVer.startsWith('~')) { - throw new Error(`electron-chromedriver version in script/package.json should start with a tilde to match latest patch version.`) + // Always use caret on electron-chromedriver so that it can pick up the best minor/patch versions + if (!chromedriverVer.startsWith('^')) { + throw new Error(`electron-chromedriver version in script/package.json should start with a caret to match latest patch version.`) } - if (!mksnapshotVer.startsWith('~')) { - throw new Error(`electron-mksnapshot version in script/package.json should start with a tilde to match latest patch version.`) + if (!mksnapshotVer.startsWith('^')) { + throw new Error(`electron-mksnapshot version in script/package.json should start with a caret to match latest patch version.`) } const electronVer = CONFIG.appMetadata.electronVersion diff --git a/script/lib/generate-startup-snapshot.js b/script/lib/generate-startup-snapshot.js index c8cf0202264..da87b32539b 100644 --- a/script/lib/generate-startup-snapshot.js +++ b/script/lib/generate-startup-snapshot.js @@ -104,22 +104,36 @@ module.exports = function (packagedAppPath) { {env: Object.assign({}, process.env, {ELECTRON_RUN_AS_NODE: 1})} ) - const generatedStartupBlobPath = path.join(CONFIG.buildOutputPath, 'snapshot_blob.bin') - console.log(`Generating startup blob at "${generatedStartupBlobPath}"`) - childProcess.execFileSync( - path.join(CONFIG.repositoryRootPath, 'script', 'node_modules', 'electron-mksnapshot', 'bin', 'mksnapshot'), - ['--no-use_ic', snapshotScriptPath, '--startup_blob', generatedStartupBlobPath] + console.log('Generating startup blob with mksnapshot') + childProcess.spawnSync( + process.execPath, [ + path.join(CONFIG.repositoryRootPath, 'script', 'node_modules', 'electron-mksnapshot', 'mksnapshot.js'), + snapshotScriptPath, + '--output_dir', + CONFIG.buildOutputPath + ] ) let startupBlobDestinationPath if (process.platform === 'darwin') { - startupBlobDestinationPath = `${packagedAppPath}/Contents/Frameworks/Electron Framework.framework/Resources/snapshot_blob.bin` + startupBlobDestinationPath = `${packagedAppPath}/Contents/Frameworks/Electron Framework.framework/Resources` } else { - startupBlobDestinationPath = path.join(packagedAppPath, 'snapshot_blob.bin') + startupBlobDestinationPath = packagedAppPath } - console.log(`Moving generated startup blob into "${startupBlobDestinationPath}"`) - fs.unlinkSync(startupBlobDestinationPath) - fs.renameSync(generatedStartupBlobPath, startupBlobDestinationPath) + const snapshotBinaries = ['v8_context_snapshot.bin', 'snapshot_blob.bin'] + for (let snapshotBinary of snapshotBinaries) { + const destinationPath = path.join(startupBlobDestinationPath, snapshotBinary) + console.log(`Moving generated startup blob into "${destinationPath}"`) + try { + fs.unlinkSync(destinationPath) + } catch (err) { + // Doesn't matter if the file doesn't exist already + if (!err.code || err.code !== 'ENOENT') { + throw err + } + } + fs.renameSync(path.join(CONFIG.buildOutputPath, snapshotBinary), destinationPath) + } }) } diff --git a/script/package-lock.json b/script/package-lock.json index 4c8ad5fe286..8eddc0bdf3d 100644 --- a/script/package-lock.json +++ b/script/package-lock.json @@ -1912,9 +1912,9 @@ } }, "electron-chromedriver": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/electron-chromedriver/-/electron-chromedriver-2.0.0.tgz", - "integrity": "sha512-kERk/Wzhc9RzW9jUKXA5kJc4m8BlL6c9p5QH+CrIlst0saeqZL1Up7vzD4ZOnuBDpAVBBYJ4jhkAKIssf8ZlXg==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/electron-chromedriver/-/electron-chromedriver-3.0.0.tgz", + "integrity": "sha512-xWivZRiPTtDFJt+qXv7Ax/Dmhxj0iqESOxoLZ2szu3fv6k1vYDUDJUMHfdfVAke9D2gBRIgChuGb5j3YEt6hxQ==", "requires": { "electron-download": "^4.1.0", "extract-zip": "^1.6.5" @@ -2009,12 +2009,13 @@ } }, "electron-mksnapshot": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/electron-mksnapshot/-/electron-mksnapshot-2.0.0.tgz", - "integrity": "sha512-OoZwZJNKgHP+DwhCGVTJEuDSeb478hOzAbHeg7dKGCHDbKKmUWmjGc+pEjxGutpqQ3Mn8hCdLzdx2c/lAJcTLA==", + "version": "3.0.10", + "resolved": "https://registry.npmjs.org/electron-mksnapshot/-/electron-mksnapshot-3.0.10.tgz", + "integrity": "sha512-Toy6sAC3t9tgvq1kUYsx+4TRNPDj7Bzoo+1gx5FD8Q0YCS+tq+ter62Ot6dBXCKG9SwoaGBz84b++MgO0VobYw==", "requires": { "electron-download": "^4.1.0", - "extract-zip": "^1.6.5" + "extract-zip": "^1.6.5", + "temp": "^0.8.3" } }, "electron-osx-sign": { diff --git a/script/package.json b/script/package.json index 1076c63a97a..9335733686d 100644 --- a/script/package.json +++ b/script/package.json @@ -10,9 +10,9 @@ "coffeelint": "1.15.7", "colors": "1.1.2", "donna": "1.0.16", - "electron-chromedriver": "~2.0", + "electron-chromedriver": "^3.0.0", "electron-link": "0.4.0", - "electron-mksnapshot": "~2.0", + "electron-mksnapshot": "^3.0.10", "electron-packager": "12.2.0", "electron-winstaller": "2.6.4", "eslint": "^5.16.0", diff --git a/spec/theme-manager-spec.js b/spec/theme-manager-spec.js index 2e4f74b509b..a146d1486bf 100644 --- a/spec/theme-manager-spec.js +++ b/spec/theme-manager-spec.js @@ -319,9 +319,9 @@ h2 { it('returns a disposable allowing styles applied by the given path to be removed', function () { const cssPath = require.resolve('./fixtures/css.css') - expect(getComputedStyle(document.body).fontWeight).not.toBe('bold') + expect(getComputedStyle(document.body).fontWeight).not.toBe('700') const disposable = atom.themes.requireStylesheet(cssPath) - expect(getComputedStyle(document.body).fontWeight).toBe('bold') + expect(getComputedStyle(document.body).fontWeight).toBe('700') let styleElementRemovedHandler atom.styles.onDidRemoveStyleElement( diff --git a/src/text-editor-component.js b/src/text-editor-component.js index 7db3997136f..30af9fd38f9 100644 --- a/src/text-editor-component.js +++ b/src/text-editor-component.js @@ -4449,7 +4449,7 @@ class NodePool { if (element) { element.className = className || '' - element.styleMap.forEach((value, key) => { + element.attributeStyleMap.forEach((value, key) => { if (!style || style[key] == null) element.style[key] = '' }) if (style) Object.assign(element.style, style) From 4a1ff9982607b3c673dc1f01aee42b0810981ced Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 21 May 2019 20:12:25 +0200 Subject: [PATCH 2/4] :arrow_up: nsfw@1.0.23 --- package-lock.json | 19 ++++++++++++++++--- package.json | 2 +- script/package-lock.json | 4 +--- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9d60f314990..644d6f9e9e7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -456,11 +456,24 @@ } }, "@atom/nsfw": { - "version": "1.0.22", - "resolved": "https://registry.npmjs.org/@atom/nsfw/-/nsfw-1.0.22.tgz", - "integrity": "sha512-D1yp+X31Jed/2xkGXTurC9CGZO4d2WzEr5Rxi1elzv7bipqtIcM7HmxV0gK+WceeEj2+V1lrIINhU6mbXsJ69w==", + "version": "1.0.23", + "resolved": "https://registry.npmjs.org/@atom/nsfw/-/nsfw-1.0.23.tgz", + "integrity": "sha512-mo6G3eYzQzmdUWjCHO/2a4dWPPYYOZjAXjA4QtLGVXlnTMn08gC7JUEuztjAld1Qk+MYyV613O3ACj8xZ4KEog==", "requires": { + "fs-extra": "^7.0.0", "nan": "^2.10.0" + }, + "dependencies": { + "fs-extra": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", + "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + } } }, "@atom/source-map-support": { diff --git a/package.json b/package.json index 1ceefbc28dc..59255e9084a 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "license": "MIT", "electronVersion": "3.1.9", "dependencies": { - "@atom/nsfw": "1.0.22", + "@atom/nsfw": "1.0.23", "@atom/source-map-support": "^0.3.4", "@atom/watcher": "1.3.1", "about": "file:packages/about", diff --git a/script/package-lock.json b/script/package-lock.json index 8eddc0bdf3d..042db4275d5 100644 --- a/script/package-lock.json +++ b/script/package-lock.json @@ -901,7 +901,6 @@ "version": "0.4.2", "resolved": "https://registry.npmjs.org/boom/-/boom-0.4.2.tgz", "integrity": "sha1-emNune1O/O+xnO9JR6PGffrukRs=", - "optional": true, "requires": { "hoek": "0.9.x" } @@ -3992,8 +3991,7 @@ "hoek": { "version": "0.9.1", "resolved": "https://registry.npmjs.org/hoek/-/hoek-0.9.1.tgz", - "integrity": "sha1-PTIkYrrfB3Fup+uFuviAec3c5QU=", - "optional": true + "integrity": "sha1-PTIkYrrfB3Fup+uFuviAec3c5QU=" }, "home-or-tmp": { "version": "1.0.0", From 95fe9527d9580445ae74b3a40f71ca9dfe944962 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 27 May 2019 12:32:54 +0200 Subject: [PATCH 3/4] Don't create a promise when preloading package settings in snapshot Promise creation is forbidden within `mksnapshot` (see https://github.com/electron/libchromiumcontent/pull/363, https://github.com/nodejs/node/pull/13242 and https://github.com/electron/electron/issues/18420). Since preloading a package's settings is a synchronous action anyway, we just avoid instantiating a new Promise when calling `loadSettings`. --- src/package.js | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/package.js b/src/package.js index 56764a86a67..37afb30b57c 100644 --- a/src/package.js +++ b/src/package.js @@ -648,16 +648,15 @@ class Package { }) } - return new Promise(resolve => { - if (this.preloadedPackage && this.packageManager.packagesCache[this.name]) { - for (let settingsPath in this.packageManager.packagesCache[this.name].settings) { - const properties = this.packageManager.packagesCache[this.name].settings[settingsPath] - const settingsFile = new SettingsFile(`core:${settingsPath}`, properties || {}) - this.settings.push(settingsFile) - if (this.settingsActivated) settingsFile.activate(this.config) - } - return resolve() - } else { + if (this.preloadedPackage && this.packageManager.packagesCache[this.name]) { + for (let settingsPath in this.packageManager.packagesCache[this.name].settings) { + const properties = this.packageManager.packagesCache[this.name].settings[settingsPath] + const settingsFile = new SettingsFile(`core:${settingsPath}`, properties || {}) + this.settings.push(settingsFile) + if (this.settingsActivated) settingsFile.activate(this.config) + } + } else { + return new Promise(resolve => { const settingsDirPath = path.join(this.path, 'settings') fs.exists(settingsDirPath, (settingsDirExists) => { if (!settingsDirExists) return resolve() @@ -666,8 +665,8 @@ class Package { async.each(settingsPaths, loadSettingsFile, () => resolve()) }) }) - } - }) + }) + } } serialize () { From 20a49bb165ea6e57b2ce1be65e3cdf30dd1fb9a0 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 29 May 2019 18:59:40 +0200 Subject: [PATCH 4/4] Upgrade to Electron 3.1.10 --- package.json | 2 +- script/package-lock.json | 27 ++++++++++++++++++++++++--- script/package.json | 2 +- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 848f02f1736..781ecba5314 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "url": "https://github.com/atom/atom/issues" }, "license": "MIT", - "electronVersion": "3.1.9", + "electronVersion": "3.1.10", "dependencies": { "@atom/nsfw": "1.0.23", "@atom/source-map-support": "^0.3.4", diff --git a/script/package-lock.json b/script/package-lock.json index 042db4275d5..568d7d6224c 100644 --- a/script/package-lock.json +++ b/script/package-lock.json @@ -2008,13 +2008,34 @@ } }, "electron-mksnapshot": { - "version": "3.0.10", - "resolved": "https://registry.npmjs.org/electron-mksnapshot/-/electron-mksnapshot-3.0.10.tgz", - "integrity": "sha512-Toy6sAC3t9tgvq1kUYsx+4TRNPDj7Bzoo+1gx5FD8Q0YCS+tq+ter62Ot6dBXCKG9SwoaGBz84b++MgO0VobYw==", + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/electron-mksnapshot/-/electron-mksnapshot-3.1.10.tgz", + "integrity": "sha512-hPbFENfbUNrgOsLMja3nUFbneBxgXowmfztmRdr+a7yW6X6/d9YAGw23b9kugBNDFTKcuuTo825zVpBRwjSYRQ==", "requires": { "electron-download": "^4.1.0", "extract-zip": "^1.6.5", + "fs-extra": "^7.0.1", "temp": "^0.8.3" + }, + "dependencies": { + "fs-extra": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", + "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", + "requires": { + "graceful-fs": "^4.1.6" + } + } } }, "electron-osx-sign": { diff --git a/script/package.json b/script/package.json index 9335733686d..c6ed49977d0 100644 --- a/script/package.json +++ b/script/package.json @@ -12,7 +12,7 @@ "donna": "1.0.16", "electron-chromedriver": "^3.0.0", "electron-link": "0.4.0", - "electron-mksnapshot": "^3.0.10", + "electron-mksnapshot": "^3.1.10", "electron-packager": "12.2.0", "electron-winstaller": "2.6.4", "eslint": "^5.16.0",