Bug 1359140 - Fix various ESLint issues in services/ (mostly automatic). r=markh

This fixes various errors raised in services for the rules: key-spacing, quotes, no-else-return, no-extra-semi, comma-spacing, object-shorthand.

MozReview-Commit-ID: IClwG5rfXfW

--HG--
extra : rebase_source : 81c059dacfc39b5cf8bc85b9b746dcdd494a3629
This commit is contained in:
Mark Banner 2017-04-24 18:52:57 +01:00
parent 6c2259f717
commit 29c680ad80
19 changed files with 255 additions and 161 deletions

View File

@ -14,10 +14,19 @@ add_task(function* test_merge_bookmarks_flat() {
let rootFolder = yield CloudSync().bookmarks.getRootFolder("TEST");
ok(rootFolder.id, "root folder id is ok");
let items = [
{"id":"G_UL4ZhOyX8m", "type":rootFolder.BOOKMARK, "title":"reddit: the front page of the internet 1", "uri":"http://www.reddit.com", index:2},
{"id":"G_UL4ZhOyX8n", "type":rootFolder.BOOKMARK, "title":"reddit: the front page of the internet 2", "uri":"http://www.reddit.com?1", index:1},
];
let items = [{
"id": "G_UL4ZhOyX8m",
"type": rootFolder.BOOKMARK,
"title": "reddit: the front page of the internet 1",
"uri": "http://www.reddit.com",
index: 2
}, {
"id": "G_UL4ZhOyX8n",
"type": rootFolder.BOOKMARK,
"title": "reddit: the front page of the internet 2",
"uri": "http://www.reddit.com?1",
index: 1
}];
yield rootFolder.mergeRemoteItems(items);
let localItems = yield rootFolder.getLocalItems();
@ -32,11 +41,23 @@ add_task(function* test_merge_bookmarks_in_folders() {
let rootFolder = yield CloudSync().bookmarks.getRootFolder("TEST");
ok(rootFolder.id, "root folder id is ok");
let items = [
{"id":"G_UL4ZhOyX8m", "type":rootFolder.BOOKMARK, "title":"reddit: the front page of the internet 1", "uri":"http://www.reddit.com", index:2},
{"id":"G_UL4ZhOyX8n", "type":rootFolder.BOOKMARK, parent:"G_UL4ZhOyX8x", "title":"reddit: the front page of the internet 2", "uri":"http://www.reddit.com/?a=å%20ä%20ö", index:1},
{"id":"G_UL4ZhOyX8x", "type":rootFolder.FOLDER},
];
let items = [{
"id": "G_UL4ZhOyX8m",
"type": rootFolder.BOOKMARK,
"title": "reddit: the front page of the internet 1",
"uri": "http://www.reddit.com",
index: 2
}, {
"id": "G_UL4ZhOyX8n",
"type": rootFolder.BOOKMARK,
parent: "G_UL4ZhOyX8x",
"title": "reddit: the front page of the internet 2",
"uri": "http://www.reddit.com/?a=å%20ä%20ö",
index: 1
}, {
"id": "G_UL4ZhOyX8x",
"type": rootFolder.FOLDER
}];
yield rootFolder.mergeRemoteItems(items);
let localItems = yield rootFolder.getLocalItems();

View File

@ -17,10 +17,17 @@ add_task(function* test_get_remote_tabs() {
yield cloudSync.tabs.mergeRemoteTabs({
id: "001",
name: "FakeClient",
}, [
{url:"https://www.google.ca?a=å%20ä%20ö", title:"Google Canada", icon:"https://www.google.ca/favicon.ico", lastUsed:0},
{url:"http://www.reddit.com", title:"Reddit", icon:"http://www.reddit.com/favicon.ico", lastUsed:1},
]);
}, [{
url: "https://www.google.ca?a=å%20ä%20ö",
title: "Google Canada",
icon: "https://www.google.ca/favicon.ico",
lastUsed: 0
}, {
url: "http://www.reddit.com",
title: "Reddit",
icon: "http://www.reddit.com/favicon.ico",
lastUsed: 1
}]);
ok(cloudSync.tabs.hasRemoteTabs());
clients = yield cloudSync.tabs.getRemoteTabs();

View File

@ -169,7 +169,16 @@ function getSampleResponse(req, port) {
"Server: waitress"
],
"status": {status: 200, statusText: "OK"},
"responseBody": JSON.stringify({"settings":{"batch_max_requests":25}, "url":`http://localhost:${port}/v1/`, "documentation":"https://kinto.readthedocs.org/", "version":"1.5.1", "commit":"cbc6f58", "hello":"kinto"})
"responseBody": JSON.stringify({
"settings": {
"batch_max_requests": 25
},
"url": `http://localhost:${port}/v1/`,
"documentation": "https://kinto.readthedocs.org/",
"version": "1.5.1",
"commit": "cbc6f58",
"hello": "kinto"
})
},
"GET:/v1/buckets/blocklists/collections/certificates/records?_sort=-last_modified": {
"sampleHeaders": [
@ -180,7 +189,7 @@ function getSampleResponse(req, port) {
"Etag: \"1000\""
],
"status": {status: 200, statusText: "OK"},
"responseBody": JSON.stringify({"data":[{}]})
"responseBody": JSON.stringify({"data": [{}]})
},
"GET:/v1/buckets/blocklists/collections/certificates/records?_sort=-last_modified&_since=1000": {
"sampleHeaders": [
@ -191,11 +200,11 @@ function getSampleResponse(req, port) {
"Etag: \"3000\""
],
"status": {status: 200, statusText: "OK"},
"responseBody": JSON.stringify({"data":[{
"responseBody": JSON.stringify({"data": [{
"issuerName": "MEQxCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwx0aGF3dGUsIEluYy4xHjAcBgNVBAMTFXRoYXd0ZSBFViBTU0wgQ0EgLSBHMw==",
"serialNumber":"CrTHPEE6AZSfI3jysin2bA==",
"id":"78cf8900-fdea-4ce5-f8fb-b78710617718",
"last_modified":3000
"serialNumber": "CrTHPEE6AZSfI3jysin2bA==",
"id": "78cf8900-fdea-4ce5-f8fb-b78710617718",
"last_modified": 3000
}]})
},
"GET:/v1/buckets/blocklists/collections/certificates/records?_sort=-last_modified&_since=3000": {
@ -207,16 +216,16 @@ function getSampleResponse(req, port) {
"Etag: \"4000\""
],
"status": {status: 200, statusText: "OK"},
"responseBody": JSON.stringify({"data":[{
"issuerName":"MFkxCzAJBgNVBAYTAk5MMR4wHAYDVQQKExVTdGFhdCBkZXIgTmVkZXJsYW5kZW4xKjAoBgNVBAMTIVN0YWF0IGRlciBOZWRlcmxhbmRlbiBPdmVyaGVpZCBDQQ",
"serialNumber":"ATFpsA==",
"id":"dabafde9-df4a-ddba-2548-748da04cc02c",
"last_modified":4000
"responseBody": JSON.stringify({"data": [{
"issuerName": "MFkxCzAJBgNVBAYTAk5MMR4wHAYDVQQKExVTdGFhdCBkZXIgTmVkZXJsYW5kZW4xKjAoBgNVBAMTIVN0YWF0IGRlciBOZWRlcmxhbmRlbiBPdmVyaGVpZCBDQQ",
"serialNumber": "ATFpsA==",
"id": "dabafde9-df4a-ddba-2548-748da04cc02c",
"last_modified": 4000
}, {
"subject":"MCIxIDAeBgNVBAMMF0Fub3RoZXIgVGVzdCBFbmQtZW50aXR5",
"pubKeyHash":"VCIlmPM9NkgFQtrs4Oa5TeFcDu6MWRTKSNdePEhOgD8=",
"id":"dabafde9-df4a-ddba-2548-748da04cc02d",
"last_modified":4000
"subject": "MCIxIDAeBgNVBAMMF0Fub3RoZXIgVGVzdCBFbmQtZW50aXR5",
"pubKeyHash": "VCIlmPM9NkgFQtrs4Oa5TeFcDu6MWRTKSNdePEhOgD8=",
"id": "dabafde9-df4a-ddba-2548-748da04cc02d",
"last_modified": 4000
}]})
},
"GET:/v1/buckets/blocklists/collections/certificates/records?_sort=-last_modified&_since=4000": {
@ -228,21 +237,21 @@ function getSampleResponse(req, port) {
"Etag: \"5000\""
],
"status": {status: 200, statusText: "OK"},
"responseBody": JSON.stringify({"data":[{
"issuerName":"not a base64 encoded issuer",
"serialNumber":"not a base64 encoded serial",
"id":"dabafde9-df4a-ddba-2548-748da04cc02e",
"last_modified":5000
"responseBody": JSON.stringify({"data": [{
"issuerName": "not a base64 encoded issuer",
"serialNumber": "not a base64 encoded serial",
"id": "dabafde9-df4a-ddba-2548-748da04cc02e",
"last_modified": 5000
}, {
"subject":"not a base64 encoded subject",
"pubKeyHash":"not a base64 encoded pubKeyHash",
"id":"dabafde9-df4a-ddba-2548-748da04cc02f",
"last_modified":5000
"subject": "not a base64 encoded subject",
"pubKeyHash": "not a base64 encoded pubKeyHash",
"id": "dabafde9-df4a-ddba-2548-748da04cc02f",
"last_modified": 5000
}, {
"subject":"MCIxIDAeBgNVBAMMF0Fub3RoZXIgVGVzdCBFbmQtZW50aXR5",
"pubKeyHash":"VCIlmPM9NkgFQtrs4Oa5TeFcDu6MWRTKSNdePEhOgD8=",
"id":"dabafde9-df4a-ddba-2548-748da04cc02g",
"last_modified":5000
"subject": "MCIxIDAeBgNVBAMMF0Fub3RoZXIgVGVzdCBFbmQtZW50aXR5",
"pubKeyHash": "VCIlmPM9NkgFQtrs4Oa5TeFcDu6MWRTKSNdePEhOgD8=",
"id": "dabafde9-df4a-ddba-2548-748da04cc02g",
"last_modified": 5000
}]})
}
};

View File

@ -231,7 +231,16 @@ function getSampleResponse(req, port) {
"Server: waitress"
],
"status": {status: 200, statusText: "OK"},
"responseBody": JSON.stringify({"settings":{"batch_max_requests":25}, "url":`http://localhost:${port}/v1/`, "documentation":"https://kinto.readthedocs.org/", "version":"1.5.1", "commit":"cbc6f58", "hello":"kinto"})
"responseBody": JSON.stringify({
"settings": {
"batch_max_requests": 25
},
"url": `http://localhost:${port}/v1/`,
"documentation": "https://kinto.readthedocs.org/",
"version": "1.5.1",
"commit": "cbc6f58",
"hello": "kinto"
})
},
"GET:/v1/buckets/blocklists/collections/addons/records?_sort=-last_modified": {
"sampleHeaders": [
@ -242,7 +251,7 @@ function getSampleResponse(req, port) {
"Etag: \"3000\""
],
"status": {status: 200, statusText: "OK"},
"responseBody": JSON.stringify({"data":[{
"responseBody": JSON.stringify({"data": [{
"prefs": [],
"blockID": "i539",
"last_modified": 3000,
@ -265,7 +274,7 @@ function getSampleResponse(req, port) {
"Etag: \"3000\""
],
"status": {status: 200, statusText: "OK"},
"responseBody": JSON.stringify({"data":[{
"responseBody": JSON.stringify({"data": [{
"matchFilename": "NPFFAddOn.dll",
"blockID": "p28",
"id": "7b1e0b3c-e390-a817-11b6-a6887f65f56e",
@ -282,7 +291,7 @@ function getSampleResponse(req, port) {
"Etag: \"3000\""
],
"status": {status: 200, statusText: "OK"},
"responseBody": JSON.stringify({"data":[{
"responseBody": JSON.stringify({"data": [{
"driverVersionComparator": "LESS_THAN_OR_EQUAL",
"driverVersion": "8.17.12.5896",
"vendor": "0x10de",
@ -304,7 +313,7 @@ function getSampleResponse(req, port) {
"Etag: \"4000\""
],
"status": {status: 200, statusText: "OK"},
"responseBody": JSON.stringify({"data":[{
"responseBody": JSON.stringify({"data": [{
"prefs": [],
"blockID": "i808",
"last_modified": 4000,
@ -339,7 +348,7 @@ function getSampleResponse(req, port) {
"Etag: \"4000\""
],
"status": {status: 200, statusText: "OK"},
"responseBody": JSON.stringify({"data":[{
"responseBody": JSON.stringify({"data": [{
"infoURL": "https://get.adobe.com/flashplayer/",
"blockID": "p1044",
"matchFilename": "libflashplayer\\.so",
@ -376,7 +385,7 @@ function getSampleResponse(req, port) {
"Etag: \"4000\""
],
"status": {status: 200, statusText: "OK"},
"responseBody": JSON.stringify({"data":[{
"responseBody": JSON.stringify({"data": [{
"vendor": "0x8086",
"blockID": "g204",
"feature": "WEBGL_MSAA",

View File

@ -218,7 +218,16 @@ function getSampleResponse(req, port) {
"Server: waitress"
],
"status": {status: 200, statusText: "OK"},
"responseBody": JSON.stringify({"settings":{"batch_max_requests":25}, "url":`http://localhost:${port}/v1/`, "documentation":"https://kinto.readthedocs.org/", "version":"1.5.1", "commit":"cbc6f58", "hello":"kinto"})
"responseBody": JSON.stringify({
"settings": {
"batch_max_requests": 25
},
"url": `http://localhost:${port}/v1/`,
"documentation": "https://kinto.readthedocs.org/",
"version": "1.5.1",
"commit": "cbc6f58",
"hello": "kinto"
})
},
"GET:/v1/buckets/pinning/collections/pins/records?_sort=-last_modified": {
"sampleHeaders": [
@ -229,16 +238,16 @@ function getSampleResponse(req, port) {
"Etag: \"3000\""
],
"status": {status: 200, statusText: "OK"},
"responseBody": JSON.stringify({"data":[{
"responseBody": JSON.stringify({"data": [{
"pinType": "KeyPin",
"hostName": "one.example.com",
"includeSubdomains": false,
"expires": new Date().getTime() + 1000000,
"pins" : ["cUPcTAZWKaASuYWhhneDttWpY3oBAkE3h2+soZS7sWs=",
"pins": ["cUPcTAZWKaASuYWhhneDttWpY3oBAkE3h2+soZS7sWs=",
"M8HztCzM3elUxkcjR2S5P4hhyBNf6lHkmjAHKhpGPWE="],
"versions" : [appInfo.version],
"id":"78cf8900-fdea-4ce5-f8fb-b78710617718",
"last_modified":3000
"versions": [appInfo.version],
"id": "78cf8900-fdea-4ce5-f8fb-b78710617718",
"last_modified": 3000
}]})
},
"GET:/v1/buckets/pinning/collections/pins/records?_sort=-last_modified&_since=3000": {
@ -250,44 +259,44 @@ function getSampleResponse(req, port) {
"Etag: \"4000\""
],
"status": {status: 200, statusText: "OK"},
"responseBody": JSON.stringify({"data":[{
"responseBody": JSON.stringify({"data": [{
"pinType": "KeyPin",
"hostName": "two.example.com",
"includeSubdomains": false,
"expires": new Date().getTime() + 1000000,
"pins" : ["cUPcTAZWKaASuYWhhneDttWpY3oBAkE3h2+soZS7sWs=",
"pins": ["cUPcTAZWKaASuYWhhneDttWpY3oBAkE3h2+soZS7sWs=",
"M8HztCzM3elUxkcjR2S5P4hhyBNf6lHkmjAHKhpGPWE="],
"versions" : [appInfo.version],
"id":"dabafde9-df4a-ddba-2548-748da04cc02c",
"last_modified":4000
"versions": [appInfo.version],
"id": "dabafde9-df4a-ddba-2548-748da04cc02c",
"last_modified": 4000
}, {
"pinType": "KeyPin",
"hostName": "three.example.com",
"includeSubdomains": false,
"expires": new Date().getTime() + 1000000,
"pins" : ["cUPcTAZWKaASuYWhhneDttWpY3oBAkE3h2+soZS7sWs=",
"pins": ["cUPcTAZWKaASuYWhhneDttWpY3oBAkE3h2+soZS7sWs=",
"M8HztCzM3elUxkcjR2S5P4hhyBNf6lHkmjAHKhpGPWE="],
"versions" : [appInfo.version, "some other version that won't match"],
"id":"dabafde9-df4a-ddba-2548-748da04cc02d",
"last_modified":4000
"versions": [appInfo.version, "some other version that won't match"],
"id": "dabafde9-df4a-ddba-2548-748da04cc02d",
"last_modified": 4000
}, {
"pinType": "KeyPin",
"hostName": "four.example.com",
"includeSubdomains": false,
"expires": new Date().getTime() + 1000000,
"pins" : ["cUPcTAZWKaASuYWhhneDttWpY3oBAkE3h2+soZS7sWs=",
"pins": ["cUPcTAZWKaASuYWhhneDttWpY3oBAkE3h2+soZS7sWs=",
"M8HztCzM3elUxkcjR2S5P4hhyBNf6lHkmjAHKhpGPWE="],
"versions" : ["some version that won't match"],
"id":"dabafde9-df4a-ddba-2548-748da04cc02e",
"last_modified":4000
"versions": ["some version that won't match"],
"id": "dabafde9-df4a-ddba-2548-748da04cc02e",
"last_modified": 4000
}, {
"pinType": "STSPin",
"hostName": "five.example.com",
"includeSubdomains": false,
"expires": new Date().getTime() + 1000000,
"versions" : [appInfo.version, "some version that won't match"],
"id":"dabafde9-df4a-ddba-2548-748da04cc032",
"last_modified":4000
"versions": [appInfo.version, "some version that won't match"],
"id": "dabafde9-df4a-ddba-2548-748da04cc032",
"last_modified": 4000
}]})
},
"GET:/v1/buckets/pinning/collections/pins/records?_sort=-last_modified&_since=4000": {
@ -299,37 +308,37 @@ function getSampleResponse(req, port) {
"Etag: \"5000\""
],
"status": {status: 200, statusText: "OK"},
"responseBody": JSON.stringify({"data":[{
"irrelevant":"this entry looks nothing whatsoever like a pin preload",
"responseBody": JSON.stringify({"data": [{
"irrelevant": "this entry looks nothing whatsoever like a pin preload",
"pinType": "KeyPin",
"id":"dabafde9-df4a-ddba-2548-748da04cc02f",
"last_modified":5000
"id": "dabafde9-df4a-ddba-2548-748da04cc02f",
"last_modified": 5000
}, {
"irrelevant":"this entry has data of the wrong type",
"irrelevant": "this entry has data of the wrong type",
"pinType": "KeyPin",
"hostName": 3,
"includeSubdomains": "nonsense",
"expires": "more nonsense",
"pins" : [1, 2, 3, 4],
"id":"dabafde9-df4a-ddba-2548-748da04cc030",
"last_modified":5000
"pins": [1, 2, 3, 4],
"id": "dabafde9-df4a-ddba-2548-748da04cc030",
"last_modified": 5000
}, {
"irrelevant":"this entry is missing the actual pins",
"irrelevant": "this entry is missing the actual pins",
"pinType": "KeyPin",
"hostName": "missingpins.example.com",
"includeSubdomains": false,
"expires": new Date().getTime() + 1000000,
"versions" : [appInfo.version],
"id":"dabafde9-df4a-ddba-2548-748da04cc031",
"last_modified":5000
"versions": [appInfo.version],
"id": "dabafde9-df4a-ddba-2548-748da04cc031",
"last_modified": 5000
}, {
"pinType": "STSPin",
"hostName": "five.example.com",
"includeSubdomains": true,
"expires": new Date().getTime() + 1000000,
"versions" : [appInfo.version, "some version that won't match"],
"id":"dabafde9-df4a-ddba-2548-748da04cc032",
"last_modified":5000
"versions": [appInfo.version, "some version that won't match"],
"id": "dabafde9-df4a-ddba-2548-748da04cc032",
"last_modified": 5000
}]})
}
};

View File

@ -255,7 +255,16 @@ add_task(function* test_check_signatures() {
"Server: waitress"
],
status: {status: 200, statusText: "OK"},
responseBody: JSON.stringify({"settings":{"batch_max_requests":25}, "url":`http://localhost:${port}/v1/`, "documentation":"https://kinto.readthedocs.org/", "version":"1.5.1", "commit":"cbc6f58", "hello":"kinto"})
responseBody: JSON.stringify({
"settings": {
"batch_max_requests": 25
},
"url": `http://localhost:${port}/v1/`,
"documentation": "https://kinto.readthedocs.org/",
"version": "1.5.1",
"commit": "cbc6f58",
"hello": "kinto"
})
};
// This is the initial, empty state of the collection. This is only used
@ -281,7 +290,7 @@ add_task(function* test_check_signatures() {
// Here, we map request method and path to the available responses
const emptyCollectionResponses = {
"GET:/test_blocklist_signatures/test_cert_chain.pem?":[RESPONSE_CERT_CHAIN],
"GET:/test_blocklist_signatures/test_cert_chain.pem?": [RESPONSE_CERT_CHAIN],
"GET:/v1/?": [RESPONSE_SERVER_SETTINGS],
"GET:/v1/buckets/blocklists/collections/certificates/records?_sort=-last_modified":
[RESPONSE_EMPTY_INITIAL],

View File

@ -19,7 +19,7 @@ function do_get_kinto_sqliteHandle() {
function do_get_kinto_collection(sqliteHandle, collection = "test_collection") {
let config = {
remote:`http://localhost:${server.identity.primaryPort}/v1/`,
remote: `http://localhost:${server.identity.primaryPort}/v1/`,
headers: {Authorization: "Basic " + btoa("user:pass")},
adapter: FirefoxAdapter,
adapterOptions: {sqliteHandle},
@ -378,7 +378,16 @@ function getSampleResponse(req, port) {
"Server: waitress"
],
"status": {status: 200, statusText: "OK"},
"responseBody": JSON.stringify({"settings":{"batch_max_requests":25}, "url":`http://localhost:${port}/v1/`, "documentation":"https://kinto.readthedocs.org/", "version":"1.5.1", "commit":"cbc6f58", "hello":"kinto"})
"responseBody": JSON.stringify({
"settings": {
"batch_max_requests": 25
},
"url": `http://localhost:${port}/v1/`,
"documentation": "https://kinto.readthedocs.org/",
"version": "1.5.1",
"commit": "cbc6f58",
"hello": "kinto"
})
},
"GET:/v1/buckets/default/collections/test_collection/records?_sort=-last_modified": {
"sampleHeaders": [
@ -389,7 +398,14 @@ function getSampleResponse(req, port) {
"Etag: \"1445606341071\""
],
"status": {status: 200, statusText: "OK"},
"responseBody": JSON.stringify({"data":[{"last_modified":1445606341071, "done":false, "id":"68db8313-686e-4fff-835e-07d78ad6f2af", "title":"New test"}]})
"responseBody": JSON.stringify({
"data": [{
"last_modified": 1445606341071,
"done": false,
"id": "68db8313-686e-4fff-835e-07d78ad6f2af",
"title": "New test"
}]
})
},
"GET:/v1/buckets/default/collections/test_collection/records?_sort=-last_modified&_since=1445606341071": {
"sampleHeaders": [
@ -400,7 +416,14 @@ function getSampleResponse(req, port) {
"Etag: \"1445607941223\""
],
"status": {status: 200, statusText: "OK"},
"responseBody": JSON.stringify({"data":[{"last_modified":1445607941223, "done":false, "id":"901967b0-f729-4b30-8d8d-499cba7f4b1d", "title":"Another new test"}]})
"responseBody": JSON.stringify({
"data": [{
"last_modified": 1445607941223,
"done": false,
"id": "901967b0-f729-4b30-8d8d-499cba7f4b1d",
"title": "Another new test"
}]
})
},
"GET:/v1/buckets/default/collections/test_collection/records?_sort=-last_modified&_since=1445607941223": {
"sampleHeaders": [
@ -411,7 +434,14 @@ function getSampleResponse(req, port) {
"Etag: \"1445607541265\""
],
"status": {status: 200, statusText: "OK"},
"responseBody": JSON.stringify({"data":[{"last_modified":1445607541265, "done":false, "id":"901967b0-f729-4b30-8d8d-499cba7f4b1d", "title":"Modified title"}]})
"responseBody": JSON.stringify({
"data": [{
"last_modified": 1445607541265,
"done": false,
"id": "901967b0-f729-4b30-8d8d-499cba7f4b1d",
"title": "Modified title"
}]
})
}
};
return responses[`${req.method}:${req.path}?${req.queryString}`] ||

View File

@ -43,7 +43,7 @@ function test_collection_operations() {
add_task(function* test_kinto_create_new_get_existing() {
let sqliteHandle = yield do_get_kinto_connection();
let adapter = do_get_kinto_adapter(sqliteHandle);
let record = {id:"test-id", foo:"bar"};
let record = {id: "test-id", foo: "bar"};
yield adapter.execute((transaction) => transaction.create(record));
let newRecord = yield adapter.get("test-id");
// ensure the record is the same as when it was added
@ -56,7 +56,7 @@ function test_collection_operations() {
let sqliteHandle = yield do_get_kinto_connection();
let adapter = do_get_kinto_adapter(sqliteHandle);
// create a second record
let record = {id:"test-id-2", foo:"baz"};
let record = {id: "test-id-2", foo: "baz"};
yield adapter.execute((transaction) => transaction.create(record));
let newRecord = yield adapter.get("test-id-2");
deepEqual(record, newRecord);
@ -86,8 +86,8 @@ function test_collection_operations() {
add_task(function* test_kinto_update_get_existing() {
let sqliteHandle = yield do_get_kinto_connection();
let adapter = do_get_kinto_adapter(sqliteHandle);
let originalRecord = {id:"test-id", foo:"bar"};
let updatedRecord = {id:"test-id", foo:"baz"};
let originalRecord = {id: "test-id", foo: "bar"};
let updatedRecord = {id: "test-id", foo: "baz"};
yield adapter.clear();
yield adapter.execute((transaction) => transaction.create(originalRecord));
yield adapter.execute((transaction) => transaction.update(updatedRecord));
@ -102,7 +102,7 @@ function test_collection_operations() {
add_task(function* test_kinto_list() {
let sqliteHandle = yield do_get_kinto_connection();
let adapter = do_get_kinto_adapter(sqliteHandle);
let originalRecord = {id:"test-id-1", foo:"bar"};
let originalRecord = {id: "test-id-1", foo: "bar"};
let records = yield adapter.list();
do_check_eq(records.length, 1);
yield adapter.execute((transaction) => transaction.create(originalRecord));

View File

@ -28,14 +28,14 @@ this.WeaveCrypto = function WeaveCrypto() {
};
WeaveCrypto.prototype = {
prefBranch : null,
debug : true, // services.sync.log.cryptoDebug
prefBranch: null,
debug: true, // services.sync.log.cryptoDebug
observer : {
_self : null,
observer: {
_self: null,
QueryInterface : XPCOMUtils.generateQI([Ci.nsIObserver,
Ci.nsISupportsWeakReference]),
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver,
Ci.nsISupportsWeakReference]),
observe(subject, topic, data) {
let self = this._self;

View File

@ -182,7 +182,7 @@ this.CryptoUtils = {
* The output is an octet string of length dkLen, which you
* can encode as you wish.
*/
pbkdf2Generate : function pbkdf2Generate(P, S, c, dkLen,
pbkdf2Generate: function pbkdf2Generate(P, S, c, dkLen,
hmacAlg = Ci.nsICryptoHMAC.SHA1, hmacLen = 20) {
// We don't have a default in the algo itself, as NSS does.

View File

@ -296,7 +296,7 @@ ClientEngine.prototype = {
// We assume that clients not present in the FxA Device Manager list have been
// disconnected and so are stale
_refreshKnownStaleClients() {
this._log.debug('Refreshing the known stale clients list');
this._log.debug("Refreshing the known stale clients list");
let localClients = Object.values(this._store._remoteClients)
.filter(client => client.fxaDeviceId) // iOS client records don't have fxaDeviceId
.map(client => client.fxaDeviceId);
@ -304,7 +304,7 @@ ClientEngine.prototype = {
try {
fxaClients = Async.promiseSpinningly(this.fxAccounts.getDeviceList()).map(device => device.id);
} catch (ex) {
this._log.error('Could not retrieve the FxA device list', ex);
this._log.error("Could not retrieve the FxA device list", ex);
this._knownStaleFxADeviceIds = [];
return;
}

View File

@ -302,7 +302,7 @@ this.Utils = {
* N.B., salt should be base64 encoded, even though we have to decode
* it later!
*/
derivePresentableKeyFromPassphrase : function derivePresentableKeyFromPassphrase(passphrase, salt, keyLength, forceJS) {
derivePresentableKeyFromPassphrase: function derivePresentableKeyFromPassphrase(passphrase, salt, keyLength, forceJS) {
let k = CryptoUtils.deriveKeyFromPassphrase(passphrase, salt, keyLength,
forceJS);
return Utils.encodeKeyBase32(k);
@ -312,7 +312,7 @@ this.Utils = {
* N.B., salt should be base64 encoded, even though we have to decode
* it later!
*/
deriveEncodedKeyFromPassphrase : function deriveEncodedKeyFromPassphrase(passphrase, salt, keyLength, forceJS) {
deriveEncodedKeyFromPassphrase: function deriveEncodedKeyFromPassphrase(passphrase, salt, keyLength, forceJS) {
let k = CryptoUtils.deriveKeyFromPassphrase(passphrase, salt, keyLength,
forceJS);
return Utils.base64Key(k);
@ -323,7 +323,7 @@ this.Utils = {
* uppercase alphanumeric characters, separated by hyphens.
* A.K.A. base64-to-base32 encoding.
*/
presentEncodedKeyAsSyncKey : function presentEncodedKeyAsSyncKey(encodedKey) {
presentEncodedKeyAsSyncKey: function presentEncodedKeyAsSyncKey(encodedKey) {
return Utils.encodeKeyBase32(atob(encodedKey));
},
@ -461,13 +461,13 @@ this.Utils = {
try {
if (args) {
return Str.errors.formatStringFromName(error, args, args.length);
} else {
return Str.errors.GetStringFromName(error);
}
return Str.errors.GetStringFromName(error);
} catch (e) {}
// basically returns "Unknown Error"
return Str.errors.GetStringFromName('error.reason.unknown');
return Str.errors.GetStringFromName("error.reason.unknown");
},
/**

View File

@ -58,26 +58,26 @@ var bookmarks_after = {
* Test phases
*/
Phase('phase1', [
Phase("phase1", [
[Bookmarks.add, bookmarks_initial],
[Bookmarks.verify, bookmarks_initial],
[Sync]
]);
Phase('phase2', [
Phase("phase2", [
[Bookmarks.add, bookmarks_initial],
[Bookmarks.verify, bookmarks_initial],
[Sync]
]);
Phase('phase3', [
Phase("phase3", [
[Bookmarks.verify, bookmarks_initial],
[Bookmarks.modify, bookmarks_initial],
[Bookmarks.verify, bookmarks_after],
[Sync]
]);
Phase('phase4', [
Phase("phase4", [
[Sync],
[Bookmarks.verify, bookmarks_after]
]);

View File

@ -513,22 +513,22 @@ add_task(async function test_mismatched_types() {
let oldRecord = {
"id": "l1nZZXfB8nC7",
"type":"folder",
"parentName":"Bookmarks Toolbar",
"title":"Innerst i Sneglehode",
"description":null,
"type": "folder",
"parentName": "Bookmarks Toolbar",
"title": "Innerst i Sneglehode",
"description": null,
"parentid": "toolbar"
};
oldRecord.cleartext = oldRecord;
let newRecord = {
"id": "l1nZZXfB8nC7",
"type":"livemark",
"siteUri":"http://sneglehode.wordpress.com/",
"feedUri":"http://sneglehode.wordpress.com/feed/",
"parentName":"Bookmarks Toolbar",
"title":"Innerst i Sneglehode",
"description":null,
"type": "livemark",
"siteUri": "http://sneglehode.wordpress.com/",
"feedUri": "http://sneglehode.wordpress.com/feed/",
"parentName": "Bookmarks Toolbar",
"title": "Innerst i Sneglehode",
"description": null,
"children":
["HCRq40Rnxhrd", "YeyWCV1RVsYw", "GCceVZMhvMbP", "sYi2hevdArlF",
"vjbZlPlSyGY8", "UtjUhVyrpeG6", "rVq8WMG2wfZI", "Lx0tcy43ZKhZ",

View File

@ -21,14 +21,14 @@ var record631361 = {
index: 150,
modified: 1296768176.49,
payload:
{"id":"M5bwUKK8hPyF",
"type":"livemark",
"siteUri":"http://www.bbc.co.uk/go/rss/int/news/-/news/",
"feedUri":"http://fxfeeds.mozilla.com/en-US/firefox/headlines.xml",
"parentName":"Bookmarks Toolbar",
"parentid":"toolbar",
"title":"Latest Headlines",
"description":"",
{"id": "M5bwUKK8hPyF",
"type": "livemark",
"siteUri": "http://www.bbc.co.uk/go/rss/int/news/-/news/",
"feedUri": "http://fxfeeds.mozilla.com/en-US/firefox/headlines.xml",
"parentName": "Bookmarks Toolbar",
"parentid": "toolbar",
"title": "Latest Headlines",
"description": "",
"children":
["7oBdEZB-8BMO", "SUd1wktMNCTB", "eZe4QWzo1BcY", "YNBhGwhVnQsN",
"92Aw2SMEkFg0", "uw0uKqrVFwd-", "x7mx2P3--8FJ", "d-jVF8UuC9Ye",

View File

@ -74,7 +74,7 @@ async function promiseValidationDone(expected) {
actual.sort((a, b) => String(a.name).localeCompare(b.name));
expected.sort((a, b) => String(a.name).localeCompare(b.name));
deepEqual(actual, expected);
};
}
async function cleanup(server) {
bookmarksEngine._store.wipe();
@ -166,8 +166,8 @@ add_task(async function test_bookmark_repair_integration() {
// sync again - we should have a few problems...
_("Sync again to trigger repair");
validationPromise = promiseValidationDone([
{"name":"missingChildren","count":1},
{"name":"structuralDifferences","count":1},
{"name": "missingChildren", "count": 1},
{"name": "structuralDifferences", "count": 1},
]);
Service.sync();
await validationPromise;
@ -396,8 +396,8 @@ add_task(async function test_repair_client_missing() {
// sync again - we should have a few problems...
_("Syncing again.");
validationPromise = promiseValidationDone([
{"name":"clientMissing","count":1},
{"name":"structuralDifferences","count":1},
{"name": "clientMissing", "count": 1},
{"name": "structuralDifferences", "count": 1},
]);
Service.sync();
await validationPromise;
@ -480,8 +480,8 @@ add_task(async function test_repair_server_missing() {
// sync again - we should have a few problems...
_("Syncing again.");
validationPromise = promiseValidationDone([
{"name":"serverMissing","count":1},
{"name":"missingChildren","count":1},
{"name": "serverMissing", "count": 1},
{"name": "missingChildren", "count": 1},
]);
Service.sync();
await validationPromise;
@ -567,9 +567,9 @@ add_task(async function test_repair_server_deleted() {
// sync again - we should have a few problems...
_("Syncing again.");
validationPromise = promiseValidationDone([
{"name":"serverDeleted","count":1},
{"name":"deletedChildren","count":1},
{"name":"orphans","count":1}
{"name": "serverDeleted", "count": 1},
{"name": "deletedChildren", "count": 1},
{"name": "orphans", "count": 1}
]);
Service.sync();
await validationPromise;

View File

@ -496,17 +496,17 @@ add_task(async function test_requestor_already_repairing_continue() {
{ method: "started",
object: "repair",
value: undefined,
extra: { flowID: flowID, numIDs: "3" },
extra: { flowID, numIDs: "3" },
},
{ method: "request",
object: "repair",
value: "upload",
extra: { flowID: flowID, numIDs: "3", deviceID: "client-a" },
extra: { flowID, numIDs: "3", deviceID: "client-a" },
},
{ method: "aborted",
object: "repair",
value: undefined,
extra: { flowID: flowID, numIDs: "3", reason: "other clients repairing" },
extra: { flowID, numIDs: "3", reason: "other clients repairing" },
}
];

View File

@ -947,7 +947,7 @@ add_task(async function test_engine_applyFailed() {
engine.enabled = true;
delete engine.exception;
engine.sync = function sync() {
Svc.Obs.notify("weave:engine:sync:applied", {newFailed:1}, "catapult");
Svc.Obs.notify("weave:engine:sync:applied", {newFailed: 1}, "catapult");
};
Svc.Prefs.set("log.appender.file.logOnError", true);

View File

@ -25,23 +25,23 @@ function TPSCmdLineHandler() {}
TPSCmdLineHandler.prototype = {
classDescription: "TPSCmdLineHandler",
classID : TPS_CMDLINE_CLSID,
contractID : TPS_CMDLINE_CONTRACTID,
classID: TPS_CMDLINE_CLSID,
contractID: TPS_CMDLINE_CONTRACTID,
QueryInterface: XPCOMUtils.generateQI([nsISupports,
nsICommandLineHandler,
nsICmdLineHandler]), /* nsISupports */
/* nsICmdLineHandler */
commandLineArgument : "-tps",
prefNameForStartup : "general.startup.tps",
helpText : "Run TPS tests with the given test file.",
handlesArgs : true,
defaultArgs : "",
openWindowWithArgs : true,
commandLineArgument: "-tps",
prefNameForStartup: "general.startup.tps",
helpText: "Run TPS tests with the given test file.",
handlesArgs: true,
defaultArgs: "",
openWindowWithArgs: true,
/* nsICommandLineHandler */
handle : function handler_handle(cmdLine) {
handle: function handler_handle(cmdLine) {
let options = {};
let uristr = cmdLine.handleFlagWithParam("tps", false);
@ -72,10 +72,10 @@ TPSCmdLineHandler.prototype = {
// cmdLine.preventDefault = true;
},
helpInfo : " --tps <file> Run TPS tests with the given test file.\n" +
" --tpsphase <phase> Run the specified phase in the TPS test.\n" +
" --tpslogfile <file> Logfile for TPS output.\n" +
" --ignore-unused-engines Don't load engines not used in tests.\n",
helpInfo: " --tps <file> Run TPS tests with the given test file.\n" +
" --tpsphase <phase> Run the specified phase in the TPS test.\n" +
" --tpslogfile <file> Logfile for TPS output.\n" +
" --ignore-unused-engines Don't load engines not used in tests.\n",
};