Bug 1372427 - add error to not pad blocks. r=mattn
auto --fix
MozReview-Commit-ID: 6tXXL7Ncmso
--- a/toolkit/components/satchel/.eslintrc.js
+++ b/toolkit/components/satchel/.eslintrc.js
@@ -42,10 +42,11 @@ module.exports = {
}],
"dot-location": ["error", "property"],
"max-len": ["error", 100],
"no-fallthrough": "error",
"no-multiple-empty-lines": ["error", {
max: 2,
}],
"no-throw-literal": "error",
+ "padded-blocks": ["error", "never"],
},
};
--- a/toolkit/components/satchel/FormHistoryStartup.js
+++ b/toolkit/components/satchel/FormHistoryStartup.js
@@ -129,14 +129,13 @@ FormHistoryStartup.prototype = {
let { inputName, value } = message.data;
FormHistory.update({
op: "remove",
fieldname: inputName,
value,
});
break;
}
-
}
}
};
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([FormHistoryStartup]);
--- a/toolkit/components/satchel/formSubmitListener.js
+++ b/toolkit/components/satchel/formSubmitListener.js
@@ -1,16 +1,15 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* eslint-env mozilla/frame-script */
(function() {
-
const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
var satchelFormListener = {
QueryInterface: XPCOMUtils.generateQI([
@@ -166,10 +165,9 @@ var satchelFormListener = {
}
} catch (e) {
this.log("notify failed: " + e);
}
}
};
satchelFormListener.init();
-
})();
--- a/toolkit/components/satchel/nsInputListAutoComplete.js
+++ b/toolkit/components/satchel/nsInputListAutoComplete.js
@@ -56,14 +56,13 @@ InputListAutoComplete.prototype = {
continue;
}
labels.push(label);
values.push(item.value);
}
return [values, labels];
-
}
};
var component = [InputListAutoComplete];
this.NSGetFactory = XPCOMUtils.generateNSGetFactory(component);
--- a/toolkit/components/satchel/test/test_form_submission.html
+++ b/toolkit/components/satchel/test/test_form_submission.html
@@ -352,17 +352,16 @@ function startTest() {
// submit the first form.
var button = getFormSubmitButton(1);
button.click();
}
// Called by each form's onsubmit handler.
function checkSubmit(formNum) {
-
ok(true, "form " + formNum + " submitted");
numSubmittedForms++;
// Check for expected storage state.
switch (formNum) {
// Test 1-24 should not save anything.
case 1:
case 2:
--- a/toolkit/components/satchel/test/unit/test_db_update_v4.js
+++ b/toolkit/components/satchel/test/unit/test_db_update_v4.js
@@ -9,17 +9,16 @@ var iter;
function run_test() {
do_test_pending();
iter = next_test();
iter.next();
}
function* next_test() {
try {
-
// ===== test init =====
var testfile = do_get_file("formhistory_v3.sqlite");
var profileDir = dirSvc.get("ProfD", Ci.nsIFile);
// Cleanup from any previous tests or failures.
var destFile = profileDir.clone();
destFile.append("formhistory.sqlite");
if (destFile.exists()) {
@@ -47,13 +46,12 @@ function* next_test() {
do_check_eq(CURRENT_SCHEMA, FormHistory.schemaVersion);
// check that an entry still exists
yield countEntries("name-A", "value-A",
function(num) {
do_check_true(num > 0);
do_test_finished();
}
);
-
} catch (e) {
throw new Error(`FAILED in test #${testnum} -- ${e}`);
}
}
--- a/toolkit/components/satchel/test/unit/test_db_update_v4b.js
+++ b/toolkit/components/satchel/test/unit/test_db_update_v4b.js
@@ -9,17 +9,16 @@ var iter;
function run_test() {
do_test_pending();
iter = next_test();
iter.next();
}
function* next_test() {
try {
-
// ===== test init =====
var testfile = do_get_file("formhistory_v3v4.sqlite");
var profileDir = dirSvc.get("ProfD", Ci.nsIFile);
// Cleanup from any previous tests or failures.
var destFile = profileDir.clone();
destFile.append("formhistory.sqlite");
if (destFile.exists()) {
@@ -45,13 +44,12 @@ function* next_test() {
// check that an entry still exists
yield countEntries("name-A", "value-A",
function(num) {
do_check_true(num > 0);
do_test_finished();
}
);
-
} catch (e) {
throw new Error(`FAILED in test #${testnum} -- ${e}`);
}
}
--- a/toolkit/components/satchel/test/unit/test_db_update_v999a.js
+++ b/toolkit/components/satchel/test/unit/test_db_update_v999a.js
@@ -59,15 +59,14 @@ function* tests() {
// ===== 2 =====
testnum++;
// Exercise adding and removing a name/value pair
yield countEntries("name-D", "value-D", checkZero);
yield updateEntry("add", "name-D", "value-D", next_test);
yield countEntries("name-D", "value-D", checkOne);
yield updateEntry("remove", "name-D", "value-D", next_test);
yield countEntries("name-D", "value-D", checkZero);
-
} catch (e) {
throw new Error(`FAILED in test #${testnum} -- ${e}`);
}
do_test_finished();
}
--- a/toolkit/components/satchel/test/unit/test_db_update_v999b.js
+++ b/toolkit/components/satchel/test/unit/test_db_update_v999b.js
@@ -77,15 +77,14 @@ function* tests() {
yield countEntries("name-A", "value-A", checkOne);
// ===== 4 =====
testnum++;
// Try removing an entry
yield updateEntry("remove", "name-A", "value-A", next_test);
yield countEntries(null, null, checkZero);
yield countEntries("name-A", "value-A", checkZero);
-
} catch (e) {
throw new Error(`FAILED in test #${testnum} -- ${e}`);
}
do_test_finished();
}
--- a/toolkit/components/satchel/test/unit/test_history_api.js
+++ b/toolkit/components/satchel/test/unit/test_history_api.js
@@ -101,17 +101,16 @@ function promiseCountEntries(name, value
});
}
add_task(async function() {
let oldSupportsDeletedTable = FormHistory._supportsDeletedTable;
FormHistory._supportsDeletedTable = true;
try {
-
// ===== test init =====
var testfile = do_get_file("formhistory_apitest.sqlite");
var profileDir = dirSvc.get("ProfD", Ci.nsIFile);
// Cleanup from any previous tests or failures.
var destFile = profileDir.clone();
destFile.append("formhistory.sqlite");
if (destFile.exists()) {
@@ -445,17 +444,16 @@ add_task(async function() {
]),
function(err) { return err.result == Ci.mozIStorageError.MISUSE; },
"Invalid entries when form history is disabled should fail");
// Remove should work though.
await promiseUpdate([{ op: "remove", fieldname: "field5", value: null },
{ op: "remove", fieldname: null, value: null }]);
Services.prefs.clearUserPref("browser.formfill.enable");
-
} catch (e) {
throw new Error(`FAILED in test #${testnum} -- ${e}`);
} finally {
FormHistory._supportsDeletedTable = oldSupportsDeletedTable;
dbConnection.asyncClose(do_test_finished);
}
});
--- a/toolkit/components/satchel/test/unit/test_notify.js
+++ b/toolkit/components/satchel/test/unit/test_notify.js
@@ -162,13 +162,12 @@ function* run_test_steps() {
},
});
do_check_eq(expectedNotification, null);
os.removeObserver(TestObserver, "satchel-storage-changed");
do_test_finished();
-
} catch (e) {
throw new Error(`FAILED in test #${testnum} -- ${testdesc}: ${e}`);
}
}