Merge branch 'master' into electron-3.1

This commit is contained in:
Rafael Oleza
2019-05-16 11:22:02 +02:00
7 changed files with 40 additions and 37 deletions

1
dot-atom/.gitignore vendored
View File

@@ -5,3 +5,4 @@ storage
.apm
.node-gyp
.npm
.atom-socket-secret-*

6
package-lock.json generated
View File

@@ -7192,9 +7192,9 @@
}
},
"tree-sitter-ruby": {
"version": "0.13.13",
"resolved": "https://registry.npmjs.org/tree-sitter-ruby/-/tree-sitter-ruby-0.13.13.tgz",
"integrity": "sha512-paG2Qib6kPo2++RyuobOsxFuNcLNbb2vOCVB6/gqI7tPIZUJNcwuTnRynvhNq935Oy+fpCTlXZy5d6J/MMwbHA==",
"version": "0.13.14",
"resolved": "https://registry.npmjs.org/tree-sitter-ruby/-/tree-sitter-ruby-0.13.14.tgz",
"integrity": "sha512-ye0Bpzp12HifMoocwhDVR0Adqo7DdR44anPHkx1qhhmdpzMdzsW7WzQYBTJjQo/iFXsgahl/Q9L7AwNI+2cKLw==",
"requires": {
"nan": "^2.12.1",
"prebuild-install": "^5.0.0"

View File

@@ -18,88 +18,88 @@ describe "FileSystemBlobStore", ->
expect(blobStore.get("bar")).toBeUndefined()
it "allows to read and write buffers from/to memory without persisting them", ->
blobStore.set("foo", new Buffer("foo"))
blobStore.set("bar", new Buffer("bar"))
blobStore.set("foo", Buffer.from("foo"))
blobStore.set("bar", Buffer.from("bar"))
expect(blobStore.get("foo")).toEqual(new Buffer("foo"))
expect(blobStore.get("bar")).toEqual(new Buffer("bar"))
expect(blobStore.get("foo")).toEqual(Buffer.from("foo"))
expect(blobStore.get("bar")).toEqual(Buffer.from("bar"))
expect(blobStore.get("baz")).toBeUndefined()
expect(blobStore.get("qux")).toBeUndefined()
it "persists buffers when saved and retrieves them on load, giving priority to in-memory ones", ->
blobStore.set("foo", new Buffer("foo"))
blobStore.set("bar", new Buffer("bar"))
blobStore.set("foo", Buffer.from("foo"))
blobStore.set("bar", Buffer.from("bar"))
blobStore.save()
blobStore = FileSystemBlobStore.load(storageDirectory)
expect(blobStore.get("foo")).toEqual(new Buffer("foo"))
expect(blobStore.get("bar")).toEqual(new Buffer("bar"))
expect(blobStore.get("foo")).toEqual(Buffer.from("foo"))
expect(blobStore.get("bar")).toEqual(Buffer.from("bar"))
expect(blobStore.get("baz")).toBeUndefined()
expect(blobStore.get("qux")).toBeUndefined()
blobStore.set("foo", new Buffer("changed"))
blobStore.set("foo", Buffer.from("changed"))
expect(blobStore.get("foo")).toEqual(new Buffer("changed"))
expect(blobStore.get("foo")).toEqual(Buffer.from("changed"))
it "persists in-memory and previously stored buffers, and deletes unused keys when saved", ->
blobStore.set("foo", new Buffer("foo"))
blobStore.set("bar", new Buffer("bar"))
blobStore.set("foo", Buffer.from("foo"))
blobStore.set("bar", Buffer.from("bar"))
blobStore.save()
blobStore = FileSystemBlobStore.load(storageDirectory)
blobStore.set("bar", new Buffer("changed"))
blobStore.set("qux", new Buffer("qux"))
blobStore.set("bar", Buffer.from("changed"))
blobStore.set("qux", Buffer.from("qux"))
blobStore.save()
blobStore = FileSystemBlobStore.load(storageDirectory)
expect(blobStore.get("foo")).toBeUndefined()
expect(blobStore.get("bar")).toEqual(new Buffer("changed"))
expect(blobStore.get("qux")).toEqual(new Buffer("qux"))
expect(blobStore.get("bar")).toEqual(Buffer.from("changed"))
expect(blobStore.get("qux")).toEqual(Buffer.from("qux"))
it "allows to delete keys from both memory and stored buffers", ->
blobStore.set("a", new Buffer("a"))
blobStore.set("b", new Buffer("b"))
blobStore.set("a", Buffer.from("a"))
blobStore.set("b", Buffer.from("b"))
blobStore.save()
blobStore = FileSystemBlobStore.load(storageDirectory)
blobStore.get("a") # prevent the key from being deleted on save
blobStore.set("b", new Buffer("b"))
blobStore.set("c", new Buffer("c"))
blobStore.set("b", Buffer.from("b"))
blobStore.set("c", Buffer.from("c"))
blobStore.delete("b")
blobStore.delete("c")
blobStore.save()
blobStore = FileSystemBlobStore.load(storageDirectory)
expect(blobStore.get("a")).toEqual(new Buffer("a"))
expect(blobStore.get("a")).toEqual(Buffer.from("a"))
expect(blobStore.get("b")).toBeUndefined()
expect(blobStore.get("b")).toBeUndefined()
expect(blobStore.get("c")).toBeUndefined()
it "ignores errors when loading an invalid blob store", ->
blobStore.set("a", new Buffer("a"))
blobStore.set("b", new Buffer("b"))
blobStore.set("a", Buffer.from("a"))
blobStore.set("b", Buffer.from("b"))
blobStore.save()
# Simulate corruption
fs.writeFileSync(path.join(storageDirectory, "MAP"), new Buffer([0]))
fs.writeFileSync(path.join(storageDirectory, "INVKEYS"), new Buffer([0]))
fs.writeFileSync(path.join(storageDirectory, "BLOB"), new Buffer([0]))
fs.writeFileSync(path.join(storageDirectory, "MAP"), Buffer.from([0]))
fs.writeFileSync(path.join(storageDirectory, "INVKEYS"), Buffer.from([0]))
fs.writeFileSync(path.join(storageDirectory, "BLOB"), Buffer.from([0]))
blobStore = FileSystemBlobStore.load(storageDirectory)
expect(blobStore.get("a")).toBeUndefined()
expect(blobStore.get("b")).toBeUndefined()
blobStore.set("a", new Buffer("x"))
blobStore.set("b", new Buffer("y"))
blobStore.set("a", Buffer.from("x"))
blobStore.set("b", Buffer.from("y"))
blobStore.save()
blobStore = FileSystemBlobStore.load(storageDirectory)
expect(blobStore.get("a")).toEqual(new Buffer("x"))
expect(blobStore.get("b")).toEqual(new Buffer("y"))
expect(blobStore.get("a")).toEqual(Buffer.from("x"))
expect(blobStore.get("b")).toEqual(Buffer.from("y"))

View File

@@ -89,7 +89,7 @@ describe "NativeCompileCache", ->
it "deletes previously cached code when the cache is an invalid file", ->
fakeCacheStore.has.andReturn(true)
fakeCacheStore.get.andCallFake -> new Buffer("an invalid cache")
fakeCacheStore.get.andCallFake -> Buffer.from("an invalid cache")
fn3 = require('./fixtures/native-cache/file-3')

View File

@@ -49,13 +49,15 @@ describe('SyntaxScopeMap', () => {
const map = new SyntaxScopeMap({
'"b"': 'w',
'a > "b"': 'x',
'a > "b":nth-child(1)': 'y'
'a > "b":nth-child(1)': 'y',
'"\\""': 'z'
})
expect(map.get(['b'], [0], true)).toBe(undefined)
expect(map.get(['b'], [0], false)).toBe('w')
expect(map.get(['a', 'b'], [0, 0], false)).toBe('x')
expect(map.get(['a', 'b'], [0, 1], false)).toBe('y')
expect(map.get(['a', '"'], [0, 1], false)).toBe('z')
})
it('supports the wildcard selector', () => {

View File

@@ -331,7 +331,7 @@ const configSchema = {
fileSystemWatcher: {
description: 'Choose the underlying implementation used to watch for filesystem changes. Emulating changes will miss any events caused by applications other than Atom, but may help prevent crashes or freezes. Polling may be useful for network drives, but will be more costly in terms of CPU overhead.<br>This setting will require a relaunch of Atom to take effect.',
type: 'string',
default: 'experimental',
default: 'native',
enum: [
{
value: 'native',

View File

@@ -36,7 +36,7 @@ class SyntaxScopeMap {
case 'string':
if (!currentTable) currentTable = this.anonymousScopeTable
const value = termNode.value.slice(1, -1)
const value = termNode.value.slice(1, -1).replace(/\\"/g, '"')
if (!currentTable[value]) currentTable[value] = {}
currentTable = currentTable[value]
if (currentIndexValue != null) {