--- a/dom/indexedDB/test/unit/.eslintrc.js
+++ b/dom/indexedDB/test/unit/.eslintrc.js
@@ -5,27 +5,13 @@ module.exports = {
"plugin:mozilla/recommended",
"plugin:mozilla/xpcshell-test",
],
"plugins": [
"mozilla"
],
"rules": {
"brace-style": "off",
- "comma-spacing": "off",
- "func-call-spacing": "off",
- "key-spacing": "off",
- "keyword-spacing": "off",
- "no-extra-semi": "off",
- "no-lonely-if": "off",
"no-mixed-spaces-and-tabs": "off",
- "no-multi-spaces": "off",
"no-shadow": "off",
- "no-trailing-spaces": "off",
"no-unused-vars": "off",
- "object-shorthand": "off",
- "quotes": "off",
- "spaced-comment": "off",
- "space-before-blocks": "off",
- "space-before-function-paren": "off",
- "space-infix-ops": "off"
}
};
--- a/dom/indexedDB/test/unit/GlobalObjectsComponent.js
+++ b/dom/indexedDB/test/unit/GlobalObjectsComponent.js
@@ -13,17 +13,17 @@ function GlobalObjectsComponent() {
}
GlobalObjectsComponent.prototype =
{
classID: Components.ID("{949ebf50-e0da-44b9-8335-cbfd4febfdcc}"),
QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsISupports]),
- runTest: function() {
+ runTest() {
const name = "Splendid Test";
let ok = this.ok;
let finishTest = this.finishTest;
let keyRange = IDBKeyRange.only(42);
ok(keyRange, "Got keyRange");
--- a/dom/indexedDB/test/unit/GlobalObjectsModule.jsm
+++ b/dom/indexedDB/test/unit/GlobalObjectsModule.jsm
@@ -8,17 +8,17 @@ Components.utils.importGlobalProperties(
this.EXPORTED_SYMBOLS = [
"GlobalObjectsModule"
];
this.GlobalObjectsModule = function GlobalObjectsModule() {
}
GlobalObjectsModule.prototype = {
- runTest: function() {
+ runTest() {
const name = "Splendid Test";
let ok = this.ok;
let finishTest = this.finishTest;
let keyRange = IDBKeyRange.only(42);
ok(keyRange, "Got keyRange");
--- a/dom/indexedDB/test/unit/test_abort_deleted_index.js
+++ b/dom/indexedDB/test/unit/test_abort_deleted_index.js
@@ -51,27 +51,27 @@ function* testSteps()
let index = objectStore.index(indexName_ToBeDeleted);
ok(index, "index is valid.");
objectStore.deleteIndex(indexName_ToBeDeleted);
// Aborting the transaction.
request.onerror = expectedErrorHandler("AbortError");
txn.abort();
try {
- index.get('foo');
+ index.get("foo");
ok(false, "TransactionInactiveError shall be thrown right after a deletion of an index is aborted.");
} catch (e) {
ok(e instanceof DOMException, "got a database exception");
is(e.name, "TransactionInactiveError", "TransactionInactiveError shall be thrown right after a deletion of an index is aborted.");
}
yield undefined;
try {
- index.get('foo');
+ index.get("foo");
ok(false, "TransactionInactiveError shall be thrown after the transaction is inactive.");
} catch (e) {
ok(e instanceof DOMException, "got a database exception");
is(e.name, "TransactionInactiveError", "TransactionInactiveError shall be thrown after the transaction is inactive.");
}
finishTest();
}
--- a/dom/indexedDB/test/unit/test_abort_deleted_objectStore.js
+++ b/dom/indexedDB/test/unit/test_abort_deleted_objectStore.js
@@ -47,27 +47,27 @@ function* testSteps()
ok(objectStore, "objectStore is available");
db.deleteObjectStore(storeName_ToBeDeleted);
// Aborting the transaction.
request.onerror = expectedErrorHandler("AbortError");
txn.abort();
try {
- objectStore.get('foo');
+ objectStore.get("foo");
ok(false, "TransactionInactiveError shall be thrown if the transaction is inactive.");
} catch (e) {
ok(e instanceof DOMException, "got a database exception");
is(e.name, "TransactionInactiveError", "correct error");
}
yield undefined;
try {
- objectStore.get('foo');
+ objectStore.get("foo");
ok(false, "TransactionInactiveError shall be thrown if the transaction is inactive.");
} catch (e) {
ok(e instanceof DOMException, "got a database exception");
is(e.name, "TransactionInactiveError", "correct error");
}
finishTest();
}
--- a/dom/indexedDB/test/unit/test_add_put.js
+++ b/dom/indexedDB/test/unit/test_add_put.js
@@ -31,21 +31,21 @@ function* testSteps()
// Create store
if (db.objectStoreNames.contains("mystore"))
db.deleteObjectStore("mystore");
let store = db.createObjectStore("mystore",
{ autoIncrement: autoincrement,
keyPath: (keypath ? "id" : null) });
- let test = " for test " + JSON.stringify({ autoincrement: autoincrement,
- keypath: keypath,
- method: method,
+ let test = " for test " + JSON.stringify({ autoincrement,
+ keypath,
+ method,
explicit: explicit === undefined ? "undefined" : explicit,
- existing: existing });
+ existing });
// Insert "existing" data if needed
if (existing) {
if (keypath)
store.add({ existing: "data", id: 5 }).onsuccess = grabEventAndContinueHandler;
else
store.add({ existing: "data" }, 5).onsuccess = grabEventAndContinueHandler;
--- a/dom/indexedDB/test/unit/test_autoIncrement.js
+++ b/dom/indexedDB/test/unit/test_autoIncrement.js
@@ -203,28 +203,28 @@ function* testSteps()
test = " for test non-overlapping counts";
trans = db.transaction("store1", RW);
let trans2 = db.transaction("store1", RW);
trans2.objectStore("store1").put({ over: 2 }).onsuccess =
genCheck(c1 + 1, { over: 2 }, "first" + test,
{ trans: trans2 });
trans.objectStore("store1").put({ over: 1 }).onsuccess =
genCheck(c1, { over: 1 }, "second" + test,
- { trans: trans });
+ { trans });
c1 += 2;
yield undefined; yield undefined;
trans = db.transaction("store2", RW);
trans2 = db.transaction("store2", RW);
trans2.objectStore("store2").put({ over: 2 }).onsuccess =
genCheck(c2 + 1, { over: 2, id: c2 + 1 }, "third" + test,
{ trans: trans2 });
trans.objectStore("store2").put({ over: 1 }).onsuccess =
genCheck(c2, { over: 1, id: c2 }, "fourth" + test,
- { trans: trans });
+ { trans });
c2 += 2;
yield undefined; yield undefined;
// Test that error inserts doesn't increase generator
test = " for test error inserts";
trans = db.transaction(["store1", "store2"], RW);
trans.objectStore("store1").add({ unique: 1 }, -1);
trans.objectStore("store2").add({ unique: 1, id: "unique" });
--- a/dom/indexedDB/test/unit/test_autoIncrement_indexes.js
+++ b/dom/indexedDB/test/unit/test_autoIncrement_indexes.js
@@ -12,19 +12,19 @@ function* testSteps()
request.onupgradeneeded = grabEventAndContinueHandler;
let event = yield undefined;
let db = request.result;
db.onerror = errorHandler;
let objectStore = db.createObjectStore("foo", { keyPath: "id",
autoIncrement: true });
- objectStore.createIndex("first","first");
- objectStore.createIndex("second","second");
- objectStore.createIndex("third","third");
+ objectStore.createIndex("first", "first");
+ objectStore.createIndex("second", "second");
+ objectStore.createIndex("third", "third");
let data = { first: "foo", second: "foo", third: "foo" };
objectStore.add(data).onsuccess = grabEventAndContinueHandler;
event = yield undefined;
is(event.target.result, 1, "Added entry");
request.onsuccess = grabEventAndContinueHandler;
@@ -34,22 +34,22 @@ function* testSteps()
objectStore = db.transaction("foo").objectStore("foo");
let first = objectStore.index("first");
let second = objectStore.index("second");
let third = objectStore.index("third");
first.get("foo").onsuccess = grabEventAndContinueHandler;
event = yield undefined;
- is (event.target.result.id, 1, "Entry in first");
+ is(event.target.result.id, 1, "Entry in first");
second.get("foo").onsuccess = grabEventAndContinueHandler;
event = yield undefined;
- is (event.target.result.id, 1, "Entry in second");
+ is(event.target.result.id, 1, "Entry in second");
third.get("foo").onsuccess = grabEventAndContinueHandler;
event = yield undefined;
- is (event.target.result.id, 1, "Entry in third");
+ is(event.target.result.id, 1, "Entry in third");
finishTest();
}
--- a/dom/indexedDB/test/unit/test_blob_file_backed.js
+++ b/dom/indexedDB/test/unit/test_blob_file_backed.js
@@ -14,17 +14,17 @@ function* testSteps()
const databaseName =
("window" in this) ? window.location.pathname : "Test";
const objectStoreName = "foo";
const objectStoreKey = "10";
info("Creating temp file");
- SpecialPowers.createFiles([{data:fileData, options:{type:fileType}}], function (files) {
+ SpecialPowers.createFiles([{data: fileData, options: {type: fileType}}], function(files) {
testGenerator.next(files[0]);
});
let file = yield undefined;
ok(file instanceof File, "Got a File object");
is(file.size, fileData.length, "Correct size");
is(file.type, fileType, "Correct type");
--- a/dom/indexedDB/test/unit/test_cleanup_transaction.js
+++ b/dom/indexedDB/test/unit/test_cleanup_transaction.js
@@ -26,17 +26,17 @@ function* testSteps()
clearAllDatabases(continueToNextStepSync);
yield undefined;
info("Opening database");
let request = indexedDB.openForPrincipal(getPrincipal(spec), name);
request.onerror = errorHandler;
- request.onupgradeneeded = grabEventAndContinueHandler;;
+ request.onupgradeneeded = grabEventAndContinueHandler;
request.onsuccess = unexpectedSuccessHandler;
yield undefined;
// upgradeneeded
request.onupgradeneeded = unexpectedSuccessHandler;
request.onsuccess = grabEventAndContinueHandler;
@@ -94,17 +94,17 @@ function* testSteps()
// Plain cleanup transaction (just vacuuming and checkpointing)
// couldn't shrink database any further.
break;
}
j = 1;
trans = db.transaction(objectStoreName, "cleanup");
- trans.onabort = unexpectedSuccessHandler;;
+ trans.onabort = unexpectedSuccessHandler;
trans.oncomplete = grabEventAndContinueHandler;
yield undefined;
}
}
info("Reopening database");
@@ -119,17 +119,17 @@ function* testSteps()
db = request.result;
db.onerror = errorHandler;
info("Deleting some data")
let trans = db.transaction(objectStoreName, "cleanup");
trans.objectStore(objectStoreName).delete(1);
- trans.onabort = unexpectedSuccessHandler;;
+ trans.onabort = unexpectedSuccessHandler;
trans.oncomplete = grabEventAndContinueHandler;
yield undefined;
info("Adding data again")
trans = db.transaction(objectStoreName, "readwrite");
trans.objectStore(objectStoreName).add(obj, 1);
--- a/dom/indexedDB/test/unit/test_complex_keyPaths.js
+++ b/dom/indexedDB/test/unit/test_complex_keyPaths.js
@@ -30,17 +30,17 @@ function* testSteps()
{ keyPath: "", value: { id: 12 } },
{ keyPath: "", value: /x/ },
{ keyPath: "foo.bar", value: { baz: 1, foo: { baz2: 2, bar: "xo" } }, key: "xo" },
{ keyPath: "foo.bar.baz", value: { foo: { bar: { bazz: 16, baz: 17 } } }, key: 17 },
{ keyPath: "foo..id", exception: true },
{ keyPath: "foo.", exception: true },
{ keyPath: "fo o", exception: true },
{ keyPath: "foo ", exception: true },
- { keyPath: "foo[bar]",exception: true },
+ { keyPath: "foo[bar]", exception: true },
{ keyPath: "foo[1]", exception: true },
{ keyPath: "$('id').stuff", exception: true },
{ keyPath: "foo.2.bar", exception: true },
{ keyPath: "foo. .bar", exception: true },
{ keyPath: ".bar", exception: true },
{ keyPath: [], exception: true },
{ keyPath: ["foo", "bar"], value: { foo: 1, bar: 2 }, key: [1, 2] },
@@ -138,17 +138,17 @@ function* testSteps()
// Check that cursor.update throws as expected when key is changed
let newValue = cursor.value;
let destProp = Array.isArray(info.keyPath) ? info.keyPath[0] : info.keyPath;
if (destProp) {
// eslint-disable-next-line no-eval
eval("newValue." + destProp + " = 'newKeyValue'");
}
else {
- newValue = 'newKeyValue';
+ newValue = "newKeyValue";
}
let didThrow;
try {
cursor.update(newValue);
}
catch (ex) {
didThrow = ex;
}
@@ -233,17 +233,17 @@ function* testSteps()
store.add(info.v).onsuccess = grabEventAndContinueHandler;
is(JSON.stringify(info.v), preValue, "put didn't modify value" + test);
}
else {
try {
store.add(info.v);
ok(false, "should throw" + test);
}
- catch(e) {
+ catch (e) {
ok(true, "did throw" + test);
ok(e instanceof DOMException, "Got a DOMException" + test);
is(e.name, "DataError", "expect a DataError" + test);
is(e.code, 0, "expect zero" + test);
is(JSON.stringify(info.v), preValue, "failing put didn't modify value" + test);
continue;
--- a/dom/indexedDB/test/unit/test_create_index.js
+++ b/dom/indexedDB/test/unit/test_create_index.js
@@ -33,37 +33,37 @@ function* testSteps()
let objectStore = info.hasOwnProperty("options") ?
db.createObjectStore(info.name, info.options) :
db.createObjectStore(info.name);
try {
request = objectStore.createIndex("Hola");
ok(false, "createIndex with no keyPath should throw");
}
- catch(e) {
+ catch (e) {
ok(true, "createIndex with no keyPath should throw");
}
let ex;
try {
objectStore.createIndex("Hola", ["foo"], { multiEntry: true });
}
- catch(e) {
+ catch (e) {
ex = e;
}
ok(ex, "createIndex with array keyPath and multiEntry should throw");
is(ex.name, "InvalidAccessError", "should throw right exception");
ok(ex instanceof DOMException, "should throw right exception");
is(ex.code, DOMException.INVALID_ACCESS_ERR, "should throw right exception");
try {
objectStore.createIndex("foo", "bar", 10);
ok(false, "createIndex with bad options should throw");
}
- catch(e) {
+ catch (e) {
ok(true, "createIndex with bad options threw");
}
ok(objectStore.createIndex("foo", "bar", { foo: "" }),
"createIndex with unknown options should not throw");
objectStore.deleteIndex("foo");
// Test index creation, and that it ends up in indexNames.
--- a/dom/indexedDB/test/unit/test_create_locale_aware_index.js
+++ b/dom/indexedDB/test/unit/test_create_locale_aware_index.js
@@ -34,37 +34,37 @@ function* testSteps()
let objectStore = info.hasOwnProperty("options") ?
db.createObjectStore(info.name, info.options) :
db.createObjectStore(info.name);
try {
request = objectStore.createIndex("Hola");
ok(false, "createIndex with no keyPath should throw");
}
- catch(e) {
+ catch (e) {
ok(true, "createIndex with no keyPath should throw");
}
let ex;
try {
objectStore.createIndex("Hola", ["foo"], { multiEntry: true });
}
- catch(e) {
+ catch (e) {
ex = e;
}
ok(ex, "createIndex with array keyPath and multiEntry should throw");
is(ex.name, "InvalidAccessError", "should throw right exception");
ok(ex instanceof DOMException, "should throw right exception");
is(ex.code, DOMException.INVALID_ACCESS_ERR, "should throw right exception");
try {
objectStore.createIndex("foo", "bar", 10);
ok(false, "createIndex with bad options should throw");
}
- catch(e) {
+ catch (e) {
ok(true, "createIndex with bad options threw");
}
ok(objectStore.createIndex("foo", "bar", { foo: "" }),
"createIndex with unknown options should not throw");
objectStore.deleteIndex("foo");
// Test index creation, and that it ends up in indexNames.
--- a/dom/indexedDB/test/unit/test_create_objectStore.js
+++ b/dom/indexedDB/test/unit/test_create_objectStore.js
@@ -35,17 +35,17 @@ function* testSteps()
let count = db.objectStoreNames.length;
is(count, 0, "correct objectStoreNames length");
try {
db.createObjectStore("foo", "bar");
ok(false, "createObjectStore with bad options should throw");
}
- catch(e) {
+ catch (e) {
ok(true, "createObjectStore with bad options");
}
ok(db.createObjectStore("foo", { foo: "" }),
"createObjectStore with unknown options should not throw");
db.deleteObjectStore("foo");
for (let index in objectStoreInfo) {
@@ -75,17 +75,17 @@ function* testSteps()
}
}
is(found, true, "objectStoreNames contains name");
is(objectStore.name, name, "Bad name");
is(objectStore.keyPath, info.options && info.options.keyPath ?
info.options.keyPath : null,
"Bad keyPath");
- if(objectStore.indexNames.length, 0, "Bad indexNames");
+ if (objectStore.indexNames.length, 0, "Bad indexNames");
ok(event.target.transaction, "event has a transaction");
ok(event.target.transaction.db === db, "transaction has the right db");
is(event.target.transaction.mode, "versionchange",
"transaction has the correct mode");
is(event.target.transaction.objectStoreNames.length, index + 1,
"transaction has correct objectStoreNames list");
found = false;
@@ -99,29 +99,29 @@ function* testSteps()
is(found, true, "transaction has correct objectStoreNames list");
}
// Can't handle autoincrement and empty keypath
let ex;
try {
db.createObjectStore("storefail", { keyPath: "", autoIncrement: true });
}
- catch(e) {
+ catch (e) {
ex = e;
}
ok(ex, "createObjectStore with empty keyPath and autoIncrement should throw");
is(ex.name, "InvalidAccessError", "should throw right exception");
ok(ex instanceof DOMException, "should throw right exception");
is(ex.code, DOMException.INVALID_ACCESS_ERR, "should throw right exception");
// Can't handle autoincrement and array keypath
try {
db.createObjectStore("storefail", { keyPath: ["a"], autoIncrement: true });
}
- catch(e) {
+ catch (e) {
ex = e;
}
ok(ex, "createObjectStore with array keyPath and autoIncrement should throw");
is(ex.name, "InvalidAccessError", "should throw right exception");
ok(ex instanceof DOMException, "should throw right exception");
is(ex.code, DOMException.INVALID_ACCESS_ERR, "should throw right exception");
request.onsuccess = grabEventAndContinueHandler;
--- a/dom/indexedDB/test/unit/test_cursors.js
+++ b/dom/indexedDB/test/unit/test_cursors.js
@@ -21,49 +21,49 @@ function* testSteps()
let db = event.target.result;
let objectStore = db.createObjectStore("autoIncrement",
{ autoIncrement: true });
request = objectStore.openCursor();
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
ok(!event.target.result, "No results");
testGenerator.next();
}
yield undefined;
objectStore = db.createObjectStore("autoIncrementKeyPath",
{ keyPath: "foo",
autoIncrement: true });
request = objectStore.openCursor();
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
ok(!event.target.result, "No results");
testGenerator.next();
}
yield undefined;
objectStore = db.createObjectStore("keyPath", { keyPath: "foo" });
request = objectStore.openCursor();
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
ok(!event.target.result, "No results");
testGenerator.next();
}
yield undefined;
objectStore = db.createObjectStore("foo");
request = objectStore.openCursor();
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
ok(!event.target.result, "No results");
testGenerator.next();
}
yield undefined;
let keyIndex = 0;
for (let i in keys) {
@@ -76,17 +76,17 @@ function* testSteps()
};
}
yield undefined;
keyIndex = 0;
request = objectStore.openCursor();
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, sortedKeys[keyIndex], "Correct key");
is(cursor.primaryKey, sortedKeys[keyIndex], "Correct primary key");
is(cursor.value, "foo", "Correct value");
cursor.continue();
@@ -114,17 +114,17 @@ function* testSteps()
is(keyIndex, keys.length, "Saw all added items");
keyIndex = 4;
let range = IDBKeyRange.bound(2000, "q");
request = objectStore.openCursor(range);
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, sortedKeys[keyIndex], "Correct key");
is(cursor.primaryKey, sortedKeys[keyIndex], "Correct primary key");
is(cursor.value, "foo", "Correct value");
cursor.continue();
@@ -141,17 +141,17 @@ function* testSteps()
yield undefined;
is(keyIndex, 8, "Saw all the expected keys");
keyIndex = 0;
request = objectStore.openCursor();
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, sortedKeys[keyIndex], "Correct key");
is(cursor.primaryKey, sortedKeys[keyIndex], "Correct primary key");
is(cursor.value, "foo", "Correct value");
if (keyIndex) {
cursor.continue();
@@ -159,31 +159,31 @@ function* testSteps()
else {
cursor.continue("b");
}
is(cursor.key, sortedKeys[keyIndex], "Correct key");
is(cursor.primaryKey, sortedKeys[keyIndex], "Correct primary key");
is(cursor.value, "foo", "Correct value");
- keyIndex += keyIndex ? 1: 6;
+ keyIndex += keyIndex ? 1 : 6;
}
else {
testGenerator.next();
}
}
yield undefined;
is(keyIndex, keys.length, "Saw all the expected keys");
keyIndex = 0;
request = objectStore.openCursor();
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, sortedKeys[keyIndex], "Correct key");
is(cursor.primaryKey, sortedKeys[keyIndex], "Correct primary key");
is(cursor.value, "foo", "Correct value");
if (keyIndex) {
cursor.continue();
@@ -191,31 +191,31 @@ function* testSteps()
else {
cursor.continue(10);
}
is(cursor.key, sortedKeys[keyIndex], "Correct key");
is(cursor.primaryKey, sortedKeys[keyIndex], "Correct primary key");
is(cursor.value, "foo", "Correct value");
- keyIndex += keyIndex ? 1: 3;
+ keyIndex += keyIndex ? 1 : 3;
}
else {
testGenerator.next();
}
}
yield undefined;
is(keyIndex, keys.length, "Saw all the expected keys");
keyIndex = 0;
request = objectStore.openCursor();
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, sortedKeys[keyIndex], "Correct key");
is(cursor.primaryKey, sortedKeys[keyIndex], "Correct primary key");
is(cursor.value, "foo", "Correct value");
if (keyIndex) {
cursor.continue();
@@ -239,17 +239,17 @@ function* testSteps()
is(keyIndex, keys.length, "Saw all the expected keys");
keyIndex = 0;
request = objectStore.openCursor();
request.onerror = errorHandler;
let storedCursor = null;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
storedCursor = cursor;
is(cursor.key, sortedKeys[keyIndex], "Correct key");
is(cursor.primaryKey, sortedKeys[keyIndex], "Correct primary key");
is(cursor.value, "foo", "Correct value");
@@ -291,17 +291,17 @@ function* testSteps()
keyIndex = 0;
let gotRemoveEvent = false;
let retval = false;
request = objectStore.openCursor(null, "next");
request.onerror = errorHandler;
storedCursor = null;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
storedCursor = cursor;
is(cursor.key, sortedKeys[keyIndex], "Correct key");
is(cursor.primaryKey, sortedKeys[keyIndex], "Correct primary key");
is(cursor.value, "foo", "Correct value");
@@ -341,17 +341,17 @@ function* testSteps()
request.onsuccess = grabEventAndContinueHandler;
event = yield undefined;
keyIndex = sortedKeys.length - 1;
request = objectStore.openCursor(null, "prev");
request.onerror = errorHandler;
storedCursor = null;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
storedCursor = cursor;
is(cursor.key, sortedKeys[keyIndex], "Correct key");
is(cursor.primaryKey, sortedKeys[keyIndex], "Correct primary key");
is(cursor.value, "foo", "Correct value");
--- a/dom/indexedDB/test/unit/test_database_onclose.js
+++ b/dom/indexedDB/test/unit/test_database_onclose.js
@@ -95,17 +95,17 @@ function* testSteps()
is(event.target, openRequest, "Event has right target");
ok(event.target.result instanceof IDBDatabase, "Result should be a database");
is(db.objectStoreNames.length, 1, "Expect an objectStore here");
txn = db.transaction("store", "readwrite");
objectStore = txn.objectStore("store");
let objectId = 0;
- while(true) {
+ while (true) {
let addRequest = objectStore.add({foo: "foo"}, objectId);
addRequest.onerror = function(event) {
info("addRequest.onerror, objectId: " + objectId);
txn.onerror = grabEventAndContinueHandler;
testGenerator.next(true);
}
addRequest.onsuccess = function() {
testGenerator.next(false);
@@ -161,17 +161,17 @@ function* testSteps()
db = event.target.result;
objectStore =
db.createObjectStore("store", { keyPath: "id", autoIncrement: true });
// The number of read records varies between 1~2000 before the db is cleared
// during testing.
let numberOfObjects = 3000;
objectId = 0;
- while(true) {
+ while (true) {
let addRequest = objectStore.add({foo: "foo"});
addRequest.onsuccess = function() {
objectId++;
testGenerator.next(objectId == numberOfObjects);
}
addRequest.onerror = errorHandler;
let done = yield undefined;
--- a/dom/indexedDB/test/unit/test_defaultStorageUpgrade.js
+++ b/dom/indexedDB/test/unit/test_defaultStorageUpgrade.js
@@ -94,22 +94,20 @@ function* testSteps()
let principal = getPrincipal(params.url);
if ("dbVersion" in params) {
request = indexedDB.openForPrincipal(principal, params.dbName,
params.dbVersion);
} else {
request = indexedDB.openForPrincipal(principal, params.dbName,
params.dbOptions);
}
+ } else if ("dbVersion" in params) {
+ request = indexedDB.open(params.dbName, params.dbVersion);
} else {
- if ("dbVersion" in params) {
- request = indexedDB.open(params.dbName, params.dbVersion);
- } else {
- request = indexedDB.open(params.dbName, params.dbOptions);
- }
+ request = indexedDB.open(params.dbName, params.dbOptions);
}
return request;
}
clearAllDatabases(continueToNextStepSync);
yield undefined;
installPackagedProfile("defaultStorageUpgrade_profile");
--- a/dom/indexedDB/test/unit/test_deleteDatabase.js
+++ b/dom/indexedDB/test/unit/test_deleteDatabase.js
@@ -54,17 +54,17 @@ function* testSteps()
is(event.oldVersion, 10, "oldVersion should be 10");
ok(event.newVersion === null, "newVersion should be null");
ok(!(event.newVersion === undefined), "newVersion should be null");
ok(!(event.newVersion === 0), "newVersion should be null");
db.close();
db2.close();
db.onversionchange = unexpectedSuccessHandler;
db2.onversionchange = unexpectedSuccessHandler;
- };
+ }
// The IDB spec doesn't guarantee the order that onversionchange will fire
// on the dbs.
db.onversionchange = closeDBs;
db2.onversionchange = closeDBs;
request = indexedDB.deleteDatabase(name);
request.onerror = errorHandler;
--- a/dom/indexedDB/test/unit/test_index_update_delete.js
+++ b/dom/indexedDB/test/unit/test_index_update_delete.js
@@ -16,24 +16,24 @@ function* testSteps()
let event = yield undefined;
let db = event.target.result;
db.onerror = errorHandler;
for (let autoIncrement of [false, true]) {
let objectStore =
db.createObjectStore(autoIncrement, { keyPath: "id",
- autoIncrement: autoIncrement });
+ autoIncrement });
for (let i = 0; i < 10; i++) {
objectStore.add({ id: i, index: i });
}
for (let unique of [false, true]) {
- objectStore.createIndex(unique, "index", { unique: unique });
+ objectStore.createIndex(unique, "index", { unique });
}
for (let i = 10; i < 20; i++) {
objectStore.add({ id: i, index: i });
}
}
event = yield undefined;
--- a/dom/indexedDB/test/unit/test_indexes.js
+++ b/dom/indexedDB/test/unit/test_indexes.js
@@ -120,17 +120,17 @@ function* testSteps()
is(event.target.result.weight, 120, "Correct weight returned!");
ok(true, "Test group 1");
let keyIndex = 0;
request = objectStore.index("name").openKeyCursor();
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
"Correct key");
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
"Correct primary key");
ok(!("value" in cursor), "No value");
@@ -153,17 +153,17 @@ function* testSteps()
is(keyIndex, objectStoreData.length, "Saw all the expected keys");
ok(true, "Test group 2");
keyIndex = 0;
request = objectStore.index("weight").openKeyCursor(null, "next");
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataWeightSort[keyIndex].value.weight,
"Correct key");
is(cursor.primaryKey, objectStoreDataWeightSort[keyIndex].key,
"Correct value");
cursor.continue();
@@ -193,17 +193,17 @@ function* testSteps()
event = yield undefined;
ok(true, "Test group 3");
keyIndex = objectStoreDataNameSort.length - 1;
request = objectStore.index("name").openKeyCursor(null, "prev");
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
"Correct key");
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
"Correct value");
cursor.continue();
@@ -225,17 +225,17 @@ function* testSteps()
ok(true, "Test group 4");
keyIndex = 1;
let keyRange = IDBKeyRange.bound("Bob", "Ron");
request = objectStore.index("name").openKeyCursor(keyRange);
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
"Correct key");
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
"Correct value");
cursor.continue();
@@ -251,17 +251,17 @@ function* testSteps()
ok(true, "Test group 5");
keyIndex = 2;
keyRange = IDBKeyRange.bound("Bob", "Ron", true);
request = objectStore.index("name").openKeyCursor(keyRange);
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
"Correct key");
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
"Correct value");
cursor.continue();
@@ -277,17 +277,17 @@ function* testSteps()
ok(true, "Test group 6");
keyIndex = 1;
keyRange = IDBKeyRange.bound("Bob", "Ron", false, true);
request = objectStore.index("name").openKeyCursor(keyRange);
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
"Correct key");
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
"Correct value");
cursor.continue();
@@ -303,17 +303,17 @@ function* testSteps()
ok(true, "Test group 7");
keyIndex = 2;
keyRange = IDBKeyRange.bound("Bob", "Ron", true, true);
request = objectStore.index("name").openKeyCursor(keyRange);
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
"Correct key");
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
"Correct value");
cursor.continue();
@@ -329,17 +329,17 @@ function* testSteps()
ok(true, "Test group 8");
keyIndex = 1;
keyRange = IDBKeyRange.lowerBound("Bob");
request = objectStore.index("name").openKeyCursor(keyRange);
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
"Correct key");
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
"Correct value");
cursor.continue();
@@ -355,17 +355,17 @@ function* testSteps()
ok(true, "Test group 9");
keyIndex = 2;
keyRange = IDBKeyRange.lowerBound("Bob", true);
request = objectStore.index("name").openKeyCursor(keyRange);
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
"Correct key");
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
"Correct value");
cursor.continue();
@@ -381,17 +381,17 @@ function* testSteps()
ok(true, "Test group 10");
keyIndex = 0;
keyRange = IDBKeyRange.upperBound("Joe");
request = objectStore.index("name").openKeyCursor(keyRange);
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
"Correct key");
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
"Correct value");
cursor.continue();
@@ -407,17 +407,17 @@ function* testSteps()
ok(true, "Test group 11");
keyIndex = 0;
keyRange = IDBKeyRange.upperBound("Joe", true);
request = objectStore.index("name").openKeyCursor(keyRange);
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
"Correct key");
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
"Correct value");
cursor.continue();
@@ -433,17 +433,17 @@ function* testSteps()
ok(true, "Test group 12");
keyIndex = 3;
keyRange = IDBKeyRange.only("Pat");
request = objectStore.index("name").openKeyCursor(keyRange);
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
"Correct key");
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
"Correct value");
cursor.continue();
@@ -458,17 +458,17 @@ function* testSteps()
is(keyIndex, 4, "Saw all the expected keys");
ok(true, "Test group 13");
keyIndex = 0;
request = objectStore.index("name").openCursor();
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
"Correct key");
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
"Correct primary key");
is(cursor.value.name, objectStoreDataNameSort[keyIndex].value.name,
"Correct name");
@@ -509,17 +509,17 @@ function* testSteps()
is(keyIndex, objectStoreDataNameSort.length, "Saw all the expected keys");
ok(true, "Test group 14");
keyIndex = objectStoreDataNameSort.length - 1;
request = objectStore.index("name").openCursor(null, "prev");
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
"Correct key");
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
"Correct primary key");
is(cursor.value.name, objectStoreDataNameSort[keyIndex].value.name,
"Correct name");
@@ -561,17 +561,17 @@ function* testSteps()
ok(true, "Test group 15");
keyIndex = 1;
keyRange = IDBKeyRange.bound("Bob", "Ron");
request = objectStore.index("name").openCursor(keyRange);
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
"Correct key");
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
"Correct primary key");
is(cursor.value.name, objectStoreDataNameSort[keyIndex].value.name,
"Correct name");
@@ -613,17 +613,17 @@ function* testSteps()
ok(true, "Test group 16");
keyIndex = 2;
keyRange = IDBKeyRange.bound("Bob", "Ron", true);
request = objectStore.index("name").openCursor(keyRange);
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
"Correct key");
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
"Correct primary key");
is(cursor.value.name, objectStoreDataNameSort[keyIndex].value.name,
"Correct name");
@@ -665,17 +665,17 @@ function* testSteps()
ok(true, "Test group 17");
keyIndex = 1;
keyRange = IDBKeyRange.bound("Bob", "Ron", false, true);
request = objectStore.index("name").openCursor(keyRange);
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
"Correct key");
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
"Correct primary key");
is(cursor.value.name, objectStoreDataNameSort[keyIndex].value.name,
"Correct name");
@@ -717,17 +717,17 @@ function* testSteps()
ok(true, "Test group 18");
keyIndex = 2;
keyRange = IDBKeyRange.bound("Bob", "Ron", true, true);
request = objectStore.index("name").openCursor(keyRange);
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
"Correct key");
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
"Correct primary key");
is(cursor.value.name, objectStoreDataNameSort[keyIndex].value.name,
"Correct name");
@@ -769,17 +769,17 @@ function* testSteps()
ok(true, "Test group 19");
keyIndex = 4;
keyRange = IDBKeyRange.bound("Bob", "Ron");
request = objectStore.index("name").openCursor(keyRange, "prev");
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
"Correct key");
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
"Correct primary key");
is(cursor.value.name, objectStoreDataNameSort[keyIndex].value.name,
"Correct name");
@@ -822,17 +822,17 @@ function* testSteps()
ok(true, "Test group 20");
// Test "nextunique"
keyIndex = 3;
keyRange = IDBKeyRange.only(65);
request = objectStore.index("height").openKeyCursor(keyRange, "next");
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataHeightSort[keyIndex].value.height,
"Correct key");
is(cursor.primaryKey, objectStoreDataHeightSort[keyIndex].key,
"Correct value");
cursor.continue();
@@ -849,17 +849,17 @@ function* testSteps()
ok(true, "Test group 21");
keyIndex = 3;
keyRange = IDBKeyRange.only(65);
request = objectStore.index("height").openKeyCursor(keyRange,
"nextunique");
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataHeightSort[keyIndex].value.height,
"Correct key");
is(cursor.primaryKey, objectStoreDataHeightSort[keyIndex].key,
"Correct value");
cursor.continue();
@@ -874,17 +874,17 @@ function* testSteps()
is(keyIndex, 4, "Saw all the expected keys");
ok(true, "Test group 21.5");
keyIndex = 5;
request = objectStore.index("height").openKeyCursor(null, "prev");
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataHeightSort[keyIndex].value.height,
"Correct key");
is(cursor.primaryKey, objectStoreDataHeightSort[keyIndex].key,
"Correct value");
cursor.continue();
@@ -900,17 +900,17 @@ function* testSteps()
ok(true, "Test group 22");
keyIndex = 5;
request = objectStore.index("height").openKeyCursor(null,
"prevunique");
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataHeightSort[keyIndex].value.height,
"Correct key");
is(cursor.primaryKey, objectStoreDataHeightSort[keyIndex].key,
"Correct value");
cursor.continue();
@@ -929,17 +929,17 @@ function* testSteps()
ok(true, "Test group 23");
keyIndex = 3;
keyRange = IDBKeyRange.only(65);
request = objectStore.index("height").openCursor(keyRange, "next");
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataHeightSort[keyIndex].value.height,
"Correct key");
is(cursor.primaryKey, objectStoreDataHeightSort[keyIndex].key,
"Correct primary key");
is(cursor.value.name, objectStoreDataHeightSort[keyIndex].value.name,
"Correct name");
@@ -966,17 +966,17 @@ function* testSteps()
ok(true, "Test group 24");
keyIndex = 3;
keyRange = IDBKeyRange.only(65);
request = objectStore.index("height").openCursor(keyRange,
"nextunique");
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataHeightSort[keyIndex].value.height,
"Correct key");
is(cursor.primaryKey, objectStoreDataHeightSort[keyIndex].key,
"Correct primary key");
is(cursor.value.name, objectStoreDataHeightSort[keyIndex].value.name,
"Correct name");
@@ -1001,17 +1001,17 @@ function* testSteps()
is(keyIndex, 4, "Saw all the expected keys");
ok(true, "Test group 24.5");
keyIndex = 5;
request = objectStore.index("height").openCursor(null, "prev");
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataHeightSort[keyIndex].value.height,
"Correct key");
is(cursor.primaryKey, objectStoreDataHeightSort[keyIndex].key,
"Correct primary key");
is(cursor.value.name, objectStoreDataHeightSort[keyIndex].value.name,
"Correct name");
@@ -1037,17 +1037,17 @@ function* testSteps()
ok(true, "Test group 25");
keyIndex = 5;
request = objectStore.index("height").openCursor(null,
"prevunique");
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataHeightSort[keyIndex].value.height,
"Correct key");
is(cursor.primaryKey, objectStoreDataHeightSort[keyIndex].key,
"Correct primary key");
is(cursor.value.name, objectStoreDataHeightSort[keyIndex].value.name,
"Correct name");
@@ -1075,17 +1075,17 @@ function* testSteps()
is(keyIndex, -1, "Saw all the expected keys");
ok(true, "Test group 26");
keyIndex = 0;
request = objectStore.index("name").openKeyCursor();
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
"Correct key");
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
"Correct value");
let nextKey = !keyIndex ? "Pat" : undefined;
@@ -1113,17 +1113,17 @@ function* testSteps()
is(keyIndex, objectStoreData.length, "Saw all the expected keys");
ok(true, "Test group 27");
keyIndex = 0;
request = objectStore.index("name").openKeyCursor();
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
"Correct key");
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
"Correct value");
let nextKey = !keyIndex ? "Flo" : undefined;
@@ -1146,17 +1146,17 @@ function* testSteps()
is(keyIndex, objectStoreData.length, "Saw all the expected keys");
ok(true, "Test group 28");
keyIndex = 0;
request = objectStore.index("name").openCursor();
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
"Correct key");
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
"Correct primary key");
is(cursor.value.name, objectStoreDataNameSort[keyIndex].value.name,
"Correct name");
@@ -1204,17 +1204,17 @@ function* testSteps()
is(keyIndex, objectStoreDataNameSort.length, "Saw all the expected keys");
ok(true, "Test group 29");
keyIndex = 0;
request = objectStore.index("name").openCursor();
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
"Correct key");
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
"Correct primary key");
is(cursor.value.name, objectStoreDataNameSort[keyIndex].value.name,
"Correct name");
--- a/dom/indexedDB/test/unit/test_indexes_bad_values.js
+++ b/dom/indexedDB/test/unit/test_indexes_bad_values.js
@@ -82,17 +82,17 @@ function* testSteps()
objectStore = db.transaction(objectStoreName)
.objectStore(objectStoreName);
let keyIndex = 0;
request = objectStore.index("weight").openKeyCursor();
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataWeightSort[keyIndex].value.weight,
"Correct key");
is(cursor.primaryKey, objectStoreDataWeightSort[keyIndex].key,
"Correct value");
keyIndex++;
@@ -105,17 +105,17 @@ function* testSteps()
yield undefined;
is(keyIndex, objectStoreDataWeightSort.length, "Saw all weights");
keyIndex = 0;
request = objectStore.openCursor();
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
keyIndex++;
cursor.continue();
}
else {
testGenerator.next();
}
--- a/dom/indexedDB/test/unit/test_indexes_funny_things.js
+++ b/dom/indexedDB/test/unit/test_indexes_funny_things.js
@@ -100,17 +100,17 @@ function* testSteps()
}
ok(true, "Test group 1");
let keyIndex = 0;
request = objectStore.index("type").openKeyCursor();
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataTypeSort[keyIndex].value.type,
"Correct key");
is(cursor.primaryKey, objectStoreDataTypeSort[keyIndex].key,
"Correct primary key");
ok(!("value" in cursor), "No value");
@@ -133,17 +133,17 @@ function* testSteps()
is(keyIndex, objectStoreDataTypeSort.length, "Saw all the expected keys");
ok(true, "Test group 2");
keyIndex = 0;
request = objectStore.index("length").openKeyCursor(null, "next");
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataLengthSort[keyIndex].value.length,
"Correct key");
is(cursor.primaryKey, objectStoreDataLengthSort[keyIndex].key,
"Correct value");
cursor.continue();
--- a/dom/indexedDB/test/unit/test_key_requirements.js
+++ b/dom/indexedDB/test/unit/test_key_requirements.js
@@ -1,14 +1,14 @@
/**
* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
-var testGenerator = testSteps();
+var testGenerator = testSteps();
function* testSteps()
{
const name = this.window ? window.location.pathname : "Splendid Test";
let request = indexedDB.open(name, 1);
request.onerror = errorHandler;
request.onupgradeneeded = grabEventAndContinueHandler;
@@ -118,17 +118,17 @@ function* testSteps()
objectStore.add({});
ok(false, "add with no key should throw!");
}
catch (e) {
ok(true, "add with no key threw");
}
try {
- objectStore.add({id:5}, 5);
+ objectStore.add({id: 5}, 5);
ok(false, "add with inline key and passed key should throw!");
}
catch (e) {
ok(true, "add with inline key and passed key threw");
}
try {
objectStore.put({});
@@ -151,38 +151,38 @@ function* testSteps()
ok(false, "remove with no key should throw!");
}
catch (e) {
ok(true, "remove with no key threw");
}
key1 = 10;
- request = objectStore.add({id:key1});
+ request = objectStore.add({id: key1});
request.onerror = errorHandler;
request.onsuccess = grabEventAndContinueHandler;
event = yield undefined;
is(event.target.result, key1, "add gave back the same key");
- request = objectStore.put({id:10});
+ request = objectStore.put({id: 10});
request.onerror = errorHandler;
request.onsuccess = grabEventAndContinueHandler;
event = yield undefined;
is(event.target.result, key1, "put gave back the same key");
- request = objectStore.put({id:10});
+ request = objectStore.put({id: 10});
request.onerror = errorHandler;
request.onsuccess = grabEventAndContinueHandler;
event = yield undefined;
is(event.target.result, key1, "put gave back the same key");
- request = objectStore.add({id:10});
+ request = objectStore.add({id: 10});
request.addEventListener("error", new ExpectError("ConstraintError", true));
request.onsuccess = unexpectedSuccessHandler;
event = yield undefined;
try {
objectStore.add({}, null);
ok(false, "add with null key should throw!");
}
@@ -219,26 +219,26 @@ function* testSteps()
request = objectStore.add({});
request.onerror = errorHandler;
request.onsuccess = grabEventAndContinueHandler;
event = yield undefined;
key1 = event.target.result;
- request = objectStore.put({id:key1});
+ request = objectStore.put({id: key1});
request.onerror = errorHandler;
request.onsuccess = grabEventAndContinueHandler;
event = yield undefined;
is(event.target.result, key1, "put gave the same key back");
key2 = 10;
- request = objectStore.put({id:key2});
+ request = objectStore.put({id: key2});
request.onerror = errorHandler;
request.onsuccess = grabEventAndContinueHandler;
event = yield undefined;
is(event.target.result, key2, "put gave the same key back");
try {
objectStore.put({});
@@ -260,17 +260,17 @@ function* testSteps()
objectStore.delete();
ok(false, "remove with no key should throw!");
}
catch (e) {
ok(true, "remove with no key threw");
}
try {
- objectStore.add({id:5}, 5);
+ objectStore.add({id: 5}, 5);
ok(false, "add with inline key and passed key should throw!");
}
catch (e) {
ok(true, "add with inline key and passed key threw");
}
request = objectStore.delete(key2);
request.onerror = errorHandler;
--- a/dom/indexedDB/test/unit/test_keys.js
+++ b/dom/indexedDB/test/unit/test_keys.js
@@ -20,32 +20,32 @@ function* testSteps()
let db = event.target.result;
let trans = event.target.transaction;
// Create test stores
let store = db.createObjectStore("store");
// Test simple inserts
var keys = [
- -1/0,
+ -1 / 0,
-1.7e308,
-10000,
-2,
-1.5,
-1,
-1.00001e-200,
-1e-200,
0,
1e-200,
1.00001e-200,
1,
2,
10000,
1.7e308,
- 1/0,
+ 1 / 0,
new Date("1750-01-02"),
new Date("1800-12-31T12:34:56.001"),
new Date(-1000),
new Date(-10),
new Date(-1),
new Date(0),
new Date(1),
new Date(2),
@@ -108,17 +108,17 @@ function* testSteps()
"\uDBFF",
"\uDC00",
"\uDFFF\uD800",
"\uFFFE",
"\uFFFF",
"\uFFFF\x00",
"\uFFFFZZZ",
[],
- [-1/0],
+ [-1 / 0],
[-1],
[0],
[1],
[1, "a"],
[1, []],
[1, [""]],
[2, 3],
[2, 3.0000000000001],
@@ -137,46 +137,46 @@ function* testSteps()
["abc", "def"],
["abc\x00"],
["abc\x00", "\x00\x01"],
["abc\x00", "\x00def"],
["abc\x00\x00def"],
["x", [[]]],
["x", [[[]]]],
[[]],
- [[],"foo"],
- [[],[]],
+ [[], "foo"],
+ [[], []],
[[[]]],
[[[]], []],
[[[]], [[]]],
[[[]], [[1]]],
[[[]], [[[]]]],
[[[1]]],
[[[[]], []]],
];
for (var i = 0; i < keys.length; ++i) {
let keyI = keys[i];
is(indexedDB.cmp(keyI, keyI), 0, i + " compared to self");
function doCompare(keyI) {
- for (var j = i-1; j >= i-10 && j >= 0; --j) {
+ for (var j = i - 1; j >= i - 10 && j >= 0; --j) {
is(indexedDB.cmp(keyI, keys[j]), 1, i + " compared to " + j);
is(indexedDB.cmp(keys[j], keyI), -1, j + " compared to " + i);
}
}
-
+
doCompare(keyI);
store.add(i, keyI).onsuccess = function(e) {
is(indexedDB.cmp(e.target.result, keyI), 0,
"Returned key should cmp as equal");
ok(compareKeys(e.target.result, keyI),
"Returned key should actually be equal");
};
-
+
// Test that -0 compares the same as 0
if (keyI === 0) {
doCompare(-0);
let req = store.add(i, -0);
req.addEventListener("error", new ExpectError("ConstraintError", true));
req.onsuccess = unexpectedSuccessHandler;
yield undefined;
}
@@ -199,17 +199,17 @@ function* testSteps()
"Read back key should actually be equal");
is(cursor.value, i, "Stored with right value");
cursor.continue();
}
event = yield undefined;
is(event.target.result, null, "no more results expected");
- var nan = 0/0;
+ var nan = 0 / 0;
var invalidKeys = [
nan,
undefined,
null,
/x/,
{},
new Date(NaN),
new Date("foopy"),
@@ -225,41 +225,41 @@ function* testSteps()
[1, /x/],
[1, {}],
[1, [nan]],
[1, [undefined]],
[1, [null]],
[1, [/x/]],
[1, [{}]],
];
-
+
for (i = 0; i < invalidKeys.length; ++i) {
try {
indexedDB.cmp(invalidKeys[i], 1);
ok(false, "didn't throw");
}
- catch(ex) {
+ catch (ex) {
ok(ex instanceof DOMException, "Threw DOMException");
is(ex.name, "DataError", "Threw right DOMException");
is(ex.code, 0, "Threw with right code");
}
try {
indexedDB.cmp(1, invalidKeys[i]);
ok(false, "didn't throw2");
}
- catch(ex) {
+ catch (ex) {
ok(ex instanceof DOMException, "Threw DOMException2");
is(ex.name, "DataError", "Threw right DOMException2");
is(ex.code, 0, "Threw with right code2");
}
try {
store.put(1, invalidKeys[i]);
ok(false, "didn't throw3");
}
- catch(ex) {
+ catch (ex) {
ok(ex instanceof DOMException, "Threw DOMException3");
is(ex.name, "DataError", "Threw right DOMException3");
is(ex.code, 0, "Threw with right code3");
}
}
openRequest.onsuccess = grabEventAndContinueHandler;
yield undefined;
--- a/dom/indexedDB/test/unit/test_locale_aware_indexes.js
+++ b/dom/indexedDB/test/unit/test_locale_aware_indexes.js
@@ -127,17 +127,17 @@ function* testSteps()
is(event.target.result.weight, 120, "Correct weight returned!");
ok(true, "Test group 1");
let keyIndex = 0;
request = objectStore.index("name").openKeyCursor();
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
"Correct key");
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
"Correct primary key");
ok(!("value" in cursor), "No value");
@@ -160,17 +160,17 @@ function* testSteps()
is(keyIndex, objectStoreData.length, "Saw all the expected keys");
ok(true, "Test group 2");
keyIndex = 0;
request = objectStore.index("weight").openKeyCursor(null, "next");
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataWeightSort[keyIndex].value.weight,
"Correct key");
is(cursor.primaryKey, objectStoreDataWeightSort[keyIndex].key,
"Correct value");
cursor.continue();
@@ -200,17 +200,17 @@ function* testSteps()
event = yield undefined;
ok(true, "Test group 3");
keyIndex = objectStoreDataNameSort.length - 1;
request = objectStore.index("name").openKeyCursor(null, "prev");
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
"Correct key");
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
"Correct value");
cursor.continue();
@@ -232,17 +232,17 @@ function* testSteps()
ok(true, "Test group 4");
keyIndex = 1;
let keyRange = IDBLocaleAwareKeyRange.bound("\u00E1na", "fabio");
request = objectStore.index("name").openKeyCursor(keyRange);
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
"Correct key");
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
"Correct value");
cursor.continue();
@@ -258,17 +258,17 @@ function* testSteps()
ok(true, "Test group 5");
keyIndex = 2;
keyRange = IDBLocaleAwareKeyRange.bound("\u00E1na", "fabio", true);
request = objectStore.index("name").openKeyCursor(keyRange);
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
"Correct key");
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
"Correct value");
cursor.continue();
@@ -284,17 +284,17 @@ function* testSteps()
ok(true, "Test group 6");
keyIndex = 1;
keyRange = IDBLocaleAwareKeyRange.bound("\u00E1na", "fabio", false, true);
request = objectStore.index("name").openKeyCursor(keyRange);
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
"Correct key");
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
"Correct value");
cursor.continue();
@@ -310,17 +310,17 @@ function* testSteps()
ok(true, "Test group 7");
keyIndex = 2;
keyRange = IDBLocaleAwareKeyRange.bound("\u00E1na", "fabio", true, true);
request = objectStore.index("name").openKeyCursor(keyRange);
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
"Correct key");
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
"Correct value");
cursor.continue();
@@ -336,17 +336,17 @@ function* testSteps()
ok(true, "Test group 8");
keyIndex = 1;
keyRange = IDBKeyRange.lowerBound("\u00E1na");
request = objectStore.index("name").openKeyCursor(keyRange);
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
"Correct key");
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
"Correct value");
cursor.continue();
@@ -362,17 +362,17 @@ function* testSteps()
ok(true, "Test group 9");
keyIndex = 2;
keyRange = IDBKeyRange.lowerBound("\u00E1na", true);
request = objectStore.index("name").openKeyCursor(keyRange);
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
"Correct key");
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
"Correct value");
cursor.continue();
@@ -388,17 +388,17 @@ function* testSteps()
ok(true, "Test group 10");
keyIndex = 0;
keyRange = IDBKeyRange.upperBound("bob");
request = objectStore.index("name").openKeyCursor(keyRange);
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
"Correct key");
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
"Correct value");
cursor.continue();
@@ -414,17 +414,17 @@ function* testSteps()
ok(true, "Test group 11");
keyIndex = 0;
keyRange = IDBKeyRange.upperBound("bob", true);
request = objectStore.index("name").openKeyCursor(keyRange);
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
"Correct key");
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
"Correct value");
cursor.continue();
@@ -440,17 +440,17 @@ function* testSteps()
ok(true, "Test group 12");
keyIndex = 3;
keyRange = IDBKeyRange.only("\u00E9ason");
request = objectStore.index("name").openKeyCursor(keyRange);
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
"Correct key");
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
"Correct value");
cursor.continue();
@@ -465,17 +465,17 @@ function* testSteps()
is(keyIndex, 4, "Saw all the expected keys");
ok(true, "Test group 13");
keyIndex = 0;
request = objectStore.index("name").openCursor();
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
"Correct key");
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
"Correct primary key");
is(cursor.value.name, objectStoreDataNameSort[keyIndex].value.name,
"Correct name");
@@ -516,17 +516,17 @@ function* testSteps()
is(keyIndex, objectStoreDataNameSort.length, "Saw all the expected keys");
ok(true, "Test group 14");
keyIndex = objectStoreDataNameSort.length - 1;
request = objectStore.index("name").openCursor(null, "prev");
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
"Correct key");
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
"Correct primary key");
is(cursor.value.name, objectStoreDataNameSort[keyIndex].value.name,
"Correct name");
@@ -568,17 +568,17 @@ function* testSteps()
ok(true, "Test group 15");
keyIndex = 1;
keyRange = IDBLocaleAwareKeyRange.bound("\u00E1na", "fabio");
request = objectStore.index("name").openCursor(keyRange);
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
"Correct key");
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
"Correct primary key");
is(cursor.value.name, objectStoreDataNameSort[keyIndex].value.name,
"Correct name");
@@ -620,17 +620,17 @@ function* testSteps()
ok(true, "Test group 16");
keyIndex = 2;
keyRange = IDBLocaleAwareKeyRange.bound("\u00E1na", "fabio", true);
request = objectStore.index("name").openCursor(keyRange);
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
"Correct key");
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
"Correct primary key");
is(cursor.value.name, objectStoreDataNameSort[keyIndex].value.name,
"Correct name");
@@ -672,17 +672,17 @@ function* testSteps()
ok(true, "Test group 17");
keyIndex = 1;
keyRange = IDBLocaleAwareKeyRange.bound("\u00E1na", "fabio", false, true);
request = objectStore.index("name").openCursor(keyRange);
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
"Correct key");
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
"Correct primary key");
is(cursor.value.name, objectStoreDataNameSort[keyIndex].value.name,
"Correct name");
@@ -724,17 +724,17 @@ function* testSteps()
ok(true, "Test group 18");
keyIndex = 2;
keyRange = IDBLocaleAwareKeyRange.bound("\u00E1na", "fabio", true, true);
request = objectStore.index("name").openCursor(keyRange);
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
"Correct key");
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
"Correct primary key");
is(cursor.value.name, objectStoreDataNameSort[keyIndex].value.name,
"Correct name");
@@ -776,17 +776,17 @@ function* testSteps()
ok(true, "Test group 19");
keyIndex = 4;
keyRange = IDBLocaleAwareKeyRange.bound("\u00E1na", "fabio");
request = objectStore.index("name").openCursor(keyRange, "prev");
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
"Correct key");
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
"Correct primary key");
is(cursor.value.name, objectStoreDataNameSort[keyIndex].value.name,
"Correct name");
@@ -829,17 +829,17 @@ function* testSteps()
ok(true, "Test group 20");
// Test "nextunique"
keyIndex = 3;
keyRange = IDBKeyRange.only(65);
request = objectStore.index("height").openKeyCursor(keyRange, "next");
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataHeightSort[keyIndex].value.height,
"Correct key");
is(cursor.primaryKey, objectStoreDataHeightSort[keyIndex].key,
"Correct value");
cursor.continue();
@@ -856,17 +856,17 @@ function* testSteps()
ok(true, "Test group 21");
keyIndex = 3;
keyRange = IDBKeyRange.only(65);
request = objectStore.index("height").openKeyCursor(keyRange,
"nextunique");
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataHeightSort[keyIndex].value.height,
"Correct key");
is(cursor.primaryKey, objectStoreDataHeightSort[keyIndex].key,
"Correct value");
cursor.continue();
@@ -881,17 +881,17 @@ function* testSteps()
is(keyIndex, 4, "Saw all the expected keys");
ok(true, "Test group 21.5");
keyIndex = 5;
request = objectStore.index("height").openKeyCursor(null, "prev");
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataHeightSort[keyIndex].value.height,
"Correct key");
is(cursor.primaryKey, objectStoreDataHeightSort[keyIndex].key,
"Correct value");
cursor.continue();
@@ -907,17 +907,17 @@ function* testSteps()
ok(true, "Test group 22");
keyIndex = 5;
request = objectStore.index("height").openKeyCursor(null,
"prevunique");
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataHeightSort[keyIndex].value.height,
"Correct key");
is(cursor.primaryKey, objectStoreDataHeightSort[keyIndex].key,
"Correct value");
cursor.continue();
@@ -936,17 +936,17 @@ function* testSteps()
ok(true, "Test group 23");
keyIndex = 3;
keyRange = IDBKeyRange.only(65);
request = objectStore.index("height").openCursor(keyRange, "next");
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataHeightSort[keyIndex].value.height,
"Correct key");
is(cursor.primaryKey, objectStoreDataHeightSort[keyIndex].key,
"Correct primary key");
is(cursor.value.name, objectStoreDataHeightSort[keyIndex].value.name,
"Correct name");
@@ -973,17 +973,17 @@ function* testSteps()
ok(true, "Test group 24");
keyIndex = 3;
keyRange = IDBKeyRange.only(65);
request = objectStore.index("height").openCursor(keyRange,
"nextunique");
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataHeightSort[keyIndex].value.height,
"Correct key");
is(cursor.primaryKey, objectStoreDataHeightSort[keyIndex].key,
"Correct primary key");
is(cursor.value.name, objectStoreDataHeightSort[keyIndex].value.name,
"Correct name");
@@ -1008,17 +1008,17 @@ function* testSteps()
is(keyIndex, 4, "Saw all the expected keys");
ok(true, "Test group 24.5");
keyIndex = 5;
request = objectStore.index("height").openCursor(null, "prev");
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataHeightSort[keyIndex].value.height,
"Correct key");
is(cursor.primaryKey, objectStoreDataHeightSort[keyIndex].key,
"Correct primary key");
is(cursor.value.name, objectStoreDataHeightSort[keyIndex].value.name,
"Correct name");
@@ -1044,17 +1044,17 @@ function* testSteps()
ok(true, "Test group 25");
keyIndex = 5;
request = objectStore.index("height").openCursor(null,
"prevunique");
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataHeightSort[keyIndex].value.height,
"Correct key");
is(cursor.primaryKey, objectStoreDataHeightSort[keyIndex].key,
"Correct primary key");
is(cursor.value.name, objectStoreDataHeightSort[keyIndex].value.name,
"Correct name");
@@ -1082,17 +1082,17 @@ function* testSteps()
is(keyIndex, -1, "Saw all the expected keys");
ok(true, "Test group 26");
keyIndex = 0;
request = objectStore.index("name").openKeyCursor();
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
"Correct key");
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
"Correct value");
let nextKey = !keyIndex ? "\u00E9ason" : undefined;
@@ -1120,17 +1120,17 @@ function* testSteps()
is(keyIndex, objectStoreData.length, "Saw all the expected keys");
ok(true, "Test group 27");
keyIndex = 0;
request = objectStore.index("name").openKeyCursor();
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
"Correct key");
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
"Correct value");
let nextKey = !keyIndex ? "bar" : undefined;
@@ -1153,17 +1153,17 @@ function* testSteps()
is(keyIndex, objectStoreData.length, "Saw all the expected keys");
ok(true, "Test group 28");
keyIndex = 0;
request = objectStore.index("name").openCursor();
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
"Correct key");
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
"Correct primary key");
is(cursor.value.name, objectStoreDataNameSort[keyIndex].value.name,
"Correct name");
@@ -1211,17 +1211,17 @@ function* testSteps()
is(keyIndex, objectStoreDataNameSort.length, "Saw all the expected keys");
ok(true, "Test group 29");
keyIndex = 0;
request = objectStore.index("name").openCursor();
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
"Correct key");
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
"Correct primary key");
is(cursor.value.name, objectStoreDataNameSort[keyIndex].value.name,
"Correct name");
--- a/dom/indexedDB/test/unit/test_lowDiskSpace.js
+++ b/dom/indexedDB/test/unit/test_lowDiskSpace.js
@@ -716,35 +716,35 @@ function* testSteps()
finishTest();
}
function RequestCounter(expectedType) {
this._counter = 0;
}
RequestCounter.prototype = {
- incr: function() {
+ incr() {
this._counter++;
},
- decr: function() {
+ decr() {
if (!--this._counter) {
continueToNextStepSync();
}
},
- handler: function(type, preventDefault) {
+ handler(type, preventDefault) {
this.incr();
return event => {
is(event.type, type || "success", "Correct type");
this.decr();
};
},
- errorHandler: function(eventType, errorName) {
+ errorHandler(eventType, errorName) {
this.incr();
return event => {
is(event.type, eventType || "error", "Correct type");
is(event.target.error.name, errorName || "QuotaExceededError",
"Correct error name");
event.preventDefault();
event.stopPropagation();
this.decr();
--- a/dom/indexedDB/test/unit/test_multientry.js
+++ b/dom/indexedDB/test/unit/test_multientry.js
@@ -3,63 +3,63 @@
* http://creativecommons.org/publicdomain/zero/1.0/
*/
var testGenerator = testSteps();
function* testSteps()
{
// Test object stores
-
+
let name = this.window ? window.location.pathname : "Splendid Test";
let openRequest = indexedDB.open(name, 1);
openRequest.onerror = errorHandler;
openRequest.onupgradeneeded = grabEventAndContinueHandler;
openRequest.onsuccess = unexpectedSuccessHandler;
let event = yield undefined;
let db = event.target.result;
db.onerror = errorHandler;
let tests =
[{ add: { x: 1, id: 1 },
- indexes:[{ v: 1, k: 1 }] },
+ indexes: [{ v: 1, k: 1 }] },
{ add: { x: [2, 3], id: 2 },
- indexes:[{ v: 1, k: 1 },
+ indexes: [{ v: 1, k: 1 },
{ v: 2, k: 2 },
{ v: 3, k: 2 }] },
{ put: { x: [2, 4], id: 1 },
- indexes:[{ v: 2, k: 1 },
+ indexes: [{ v: 2, k: 1 },
{ v: 2, k: 2 },
{ v: 3, k: 2 },
{ v: 4, k: 1 }] },
{ add: { x: [5, 6, 5, -2, 3], id: 3 },
- indexes:[{ v:-2, k: 3 },
+ indexes: [{ v: -2, k: 3 },
{ v: 2, k: 1 },
{ v: 2, k: 2 },
{ v: 3, k: 2 },
{ v: 3, k: 3 },
{ v: 4, k: 1 },
{ v: 5, k: 3 },
{ v: 6, k: 3 }] },
{ delete: IDBKeyRange.bound(1, 3),
- indexes:[] },
+ indexes: [] },
{ put: { x: ["food", {}, false, undefined, /x/, [73, false]], id: 2 },
- indexes:[{ v: "food", k: 2 }] },
+ indexes: [{ v: "food", k: 2 }] },
{ add: { x: [{}, /x/, -12, "food", null, [false], undefined], id: 3 },
- indexes:[{ v: -12, k: 3 },
+ indexes: [{ v: -12, k: 3 },
{ v: "food", k: 2 },
{ v: "food", k: 3 }] },
{ put: { x: [], id: 2 },
- indexes:[{ v: -12, k: 3 },
+ indexes: [{ v: -12, k: 3 },
{ v: "food", k: 3 }] },
{ put: { x: { y: 3 }, id: 3 },
- indexes:[] },
+ indexes: [] },
{ add: { x: false, id: 7 },
- indexes:[] },
+ indexes: [] },
{ delete: IDBKeyRange.lowerBound(0),
- indexes:[] },
+ indexes: [] },
];
let store = db.createObjectStore("mystore", { keyPath: "id" });
let index = store.createIndex("myindex", "x", { multiEntry: true });
is(index.multiEntry, true, "index created with multiEntry");
let i;
for (i = 0; i < tests.length; ++i) {
@@ -75,17 +75,17 @@ function* testSteps()
else if (test.delete) {
req = store.delete(test.delete);
}
else {
ok(false, "borked test");
}
req.onsuccess = grabEventAndContinueHandler;
let e = yield undefined;
-
+
req = index.openKeyCursor();
req.onsuccess = grabEventAndContinueHandler;
for (let j = 0; j < test.indexes.length; ++j) {
e = yield undefined;
is(req.result.key, test.indexes[j].v, "found expected index key at index " + j + testName);
is(req.result.primaryKey, test.indexes[j].k, "found expected index primary key at index " + j + testName);
req.result.continue();
}
@@ -104,37 +104,37 @@ function* testSteps()
e = yield undefined;
ok(req.result == null, "exhausted temp index");
store.deleteIndex("temp index");
}
// Unique indexes
tests =
[{ add: { x: 1, id: 1 },
- indexes:[{ v: 1, k: 1 }] },
+ indexes: [{ v: 1, k: 1 }] },
{ add: { x: [2, 3], id: 2 },
- indexes:[{ v: 1, k: 1 },
+ indexes: [{ v: 1, k: 1 },
{ v: 2, k: 2 },
{ v: 3, k: 2 }] },
{ put: { x: [2, 4], id: 3 },
fail: true },
{ put: { x: [1, 4], id: 1 },
- indexes:[{ v: 1, k: 1 },
+ indexes: [{ v: 1, k: 1 },
{ v: 2, k: 2 },
{ v: 3, k: 2 },
{ v: 4, k: 1 }] },
{ add: { x: [5, 0, 5, 5, 5], id: 3 },
- indexes:[{ v: 0, k: 3 },
+ indexes: [{ v: 0, k: 3 },
{ v: 1, k: 1 },
{ v: 2, k: 2 },
{ v: 3, k: 2 },
{ v: 4, k: 1 },
{ v: 5, k: 3 }] },
{ delete: IDBKeyRange.bound(1, 2),
- indexes:[{ v: 0, k: 3 },
+ indexes: [{ v: 0, k: 3 },
{ v: 5, k: 3 }] },
{ add: { x: [0, 6], id: 8 },
fail: true },
{ add: { x: 5, id: 8 },
fail: true },
{ put: { x: 0, id: 8 },
fail: true },
];
@@ -155,17 +155,17 @@ function* testSteps()
req = store.put(test.put);
}
else if (test.delete) {
req = store.delete(test.delete);
}
else {
ok(false, "borked test");
}
-
+
if (!test.fail) {
req.onsuccess = grabEventAndContinueHandler;
let e = yield undefined;
indexes = test.indexes;
}
else {
req.onsuccess = unexpectedSuccessHandler;
req.onerror = grabEventAndContinueHandler;
--- a/dom/indexedDB/test/unit/test_names_sorted.js
+++ b/dom/indexedDB/test/unit/test_names_sorted.js
@@ -62,17 +62,17 @@ function* testSteps()
is(objectStore.indexNames[info.location], info.name,
"Got index name in the right location");
}
}
let trans = db.transaction(objectStoreNames);
for (let i = 0; i < objectStoreInfo.length; i++) {
let info = objectStoreInfo[i];
-
+
is(trans.objectStoreNames[info.location], info.name,
"Got objectStore name in the right location");
}
db.close();
request = indexedDB.open(name, 1);
request.onerror = errorHandler;
@@ -97,17 +97,17 @@ function* testSteps()
is(objectStore.indexNames[info.location], info.name,
"Got index name in the right location");
}
}
trans = db.transaction(objectStoreNames);
for (let i = 0; i < objectStoreInfo.length; i++) {
let info = objectStoreInfo[i];
-
+
is(trans.objectStoreNames[info.location], info.name,
"Got objectStore name in the right location");
}
db.close();
finishTest();
}
--- a/dom/indexedDB/test/unit/test_objectCursors.js
+++ b/dom/indexedDB/test/unit/test_objectCursors.js
@@ -66,17 +66,17 @@ function* testSteps()
for (let i in objectStores) {
for (let j in indexes) {
let objectStore = db.transaction(objectStores[i].name)
.objectStore(objectStores[i].name);
let index = objectStore.index(indexes[j].name);
request = index.openCursor();
request.onerror = errorHandler;
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
is(event.target.result.value.name, "Ben", "Good object");
executeSoon(function() { testGenerator.next(); });
}
yield undefined;
}
}
finishTest();
--- a/dom/indexedDB/test/unit/test_objectStore_openKeyCursor.js
+++ b/dom/indexedDB/test/unit/test_objectStore_openKeyCursor.js
@@ -57,25 +57,25 @@ function* testSteps() {
}
is(cursor.source, objectStore, "Correct source");
is(cursor.direction, "next", "Correct direction");
let exception = null;
try {
cursor.update(10);
- } catch(e) {
+ } catch (e) {
exception = e;
}
ok(!!exception, "update() throws for key cursor");
exception = null;
try {
cursor.delete();
- } catch(e) {
+ } catch (e) {
exception = e;
}
ok(!!exception, "delete() throws for key cursor");
is(cursor.key, cursor.primaryKey, "key and primaryKey match");
ok(!("value" in cursor), "No 'value' property on key cursor");
seenKeys.push(cursor.key);
@@ -107,25 +107,25 @@ function* testSteps() {
}
is(cursor.source, objectStore, "Correct source");
is(cursor.direction, "next", "Correct direction");
let exception = null;
try {
cursor.update(10);
- } catch(e) {
+ } catch (e) {
exception = e;
}
ok(!!exception, "update() throws for key cursor");
exception = null;
try {
cursor.delete();
- } catch(e) {
+ } catch (e) {
exception = e;
}
ok(!!exception, "delete() throws for key cursor");
is(cursor.key, cursor.primaryKey, "key and primaryKey match");
ok(!("value" in cursor), "No 'value' property on key cursor");
seenKeys.push(cursor.key);
@@ -174,25 +174,25 @@ function* testSteps() {
}
is(cursor.source, objectStore, "Correct source");
is(cursor.direction, "prev", "Correct direction");
let exception = null;
try {
cursor.update(10);
- } catch(e) {
+ } catch (e) {
exception = e;
}
ok(!!exception, "update() throws for key cursor");
exception = null;
try {
cursor.delete();
- } catch(e) {
+ } catch (e) {
exception = e;
}
ok(!!exception, "delete() throws for key cursor");
is(cursor.key, cursor.primaryKey, "key and primaryKey match");
ok(!("value" in cursor), "No 'value' property on key cursor");
seenKeys.push(cursor.key);
@@ -226,25 +226,25 @@ function* testSteps() {
}
is(cursor.source, objectStore, "Correct source");
is(cursor.direction, "prev", "Correct direction");
let exception = null;
try {
cursor.update(10);
- } catch(e) {
+ } catch (e) {
exception = e;
}
ok(!!exception, "update() throws for key cursor");
exception = null;
try {
cursor.delete();
- } catch(e) {
+ } catch (e) {
exception = e;
}
ok(!!exception, "delete() throws for key cursor");
is(cursor.key, cursor.primaryKey, "key and primaryKey match");
ok(!("value" in cursor), "No 'value' property on key cursor");
seenKeys.push(cursor.key);
@@ -295,25 +295,25 @@ function* testSteps() {
}
is(cursor.source, objectStore, "Correct source");
is(cursor.direction, "next", "Correct direction");
let exception = null;
try {
cursor.update(10);
- } catch(e) {
+ } catch (e) {
exception = e;
}
ok(!!exception, "update() throws for key cursor");
exception = null;
try {
cursor.delete();
- } catch(e) {
+ } catch (e) {
exception = e;
}
ok(!!exception, "delete() throws for key cursor");
is(cursor.key, cursor.primaryKey, "key and primaryKey match");
ok(!("value" in cursor), "No 'value' property on key cursor");
seenKeys.push(cursor.key);
@@ -350,25 +350,25 @@ function* testSteps() {
}
is(cursor.source, objectStore, "Correct source");
is(cursor.direction, "next", "Correct direction");
let exception = null;
try {
cursor.update(10);
- } catch(e) {
+ } catch (e) {
exception = e;
}
ok(!!exception, "update() throws for key cursor");
exception = null;
try {
cursor.delete();
- } catch(e) {
+ } catch (e) {
exception = e;
}
ok(!!exception, "delete() throws for key cursor");
is(cursor.key, cursor.primaryKey, "key and primaryKey match");
ok(!("value" in cursor), "No 'value' property on key cursor");
seenKeys.push(cursor.key);
--- a/dom/indexedDB/test/unit/test_objectStore_remove_values.js
+++ b/dom/indexedDB/test/unit/test_objectStore_remove_values.js
@@ -34,17 +34,17 @@ function* testSteps()
keyName: null,
keyValue: 1,
}
];
for (let i = 0; i < data.length; i++) {
let test = data[i];
- let request = indexedDB.open(name, i+1);
+ let request = indexedDB.open(name, i + 1);
request.onerror = errorHandler;
request.onupgradeneeded = grabEventAndContinueHandler;
request.onsuccess = grabEventAndContinueHandler;
let event = yield undefined;
let db = event.target.result;
db.onversionchange = function(event) {
event.target.close();
--- a/dom/indexedDB/test/unit/test_open_empty_db.js
+++ b/dom/indexedDB/test/unit/test_open_empty_db.js
@@ -3,17 +3,17 @@
* http://creativecommons.org/publicdomain/zero/1.0/
*/
var testGenerator = testSteps();
function* testSteps()
{
const names = [
- //"",
+ // "",
null,
undefined,
this.window ? window.location.pathname : "Splendid Test"
];
const version = 1;
for (let name of names) {
--- a/dom/indexedDB/test/unit/test_open_objectStore.js
+++ b/dom/indexedDB/test/unit/test_open_objectStore.js
@@ -26,13 +26,13 @@ function* testSteps()
is(db.objectStoreNames.item(0), objectStoreName, "Bad name");
yield undefined;
objectStore = db.transaction(objectStoreName).objectStore(objectStoreName);
is(objectStore.name, objectStoreName, "Bad name");
is(objectStore.keyPath, "foo", "Bad keyPath");
- if(objectStore.indexNames.length, 0, "Bad indexNames");
+ if (objectStore.indexNames.length, 0, "Bad indexNames");
finishTest();
}
--- a/dom/indexedDB/test/unit/test_optionalArguments.js
+++ b/dom/indexedDB/test/unit/test_optionalArguments.js
@@ -81,33 +81,33 @@ function* testSteps()
}
objectStore = db.transaction(osName).objectStore(osName);
try {
objectStore.get();
ok(false, "Get with unspecified arg should have thrown");
}
- catch(e) {
+ catch (e) {
ok(true, "Get with unspecified arg should have thrown");
}
try {
objectStore.get(undefined);
ok(false, "Get with undefined should have thrown");
}
- catch(e) {
+ catch (e) {
ok(true, "Get with undefined arg should have thrown");
}
try {
objectStore.get(null);
ok(false, "Get with null should have thrown");
}
- catch(e) {
+ catch (e) {
is(e instanceof DOMException, true,
"Got right kind of exception");
is(e.name, "DataError", "Correct error.");
is(e.code, 0, "Correct code.");
}
objectStore.get(data[2].ssn).onsuccess = grabEventAndContinueHandler;
event = yield undefined;
@@ -158,33 +158,33 @@ function* testSteps()
objectStore = db.transaction(osName, "readwrite")
.objectStore(osName);
try {
objectStore.delete();
ok(false, "Delete with unspecified arg should have thrown");
}
- catch(e) {
+ catch (e) {
ok(true, "Delete with unspecified arg should have thrown");
}
try {
objectStore.delete(undefined);
ok(false, "Delete with undefined should have thrown");
}
- catch(e) {
+ catch (e) {
ok(true, "Delete with undefined arg should have thrown");
}
try {
objectStore.delete(null);
ok(false, "Delete with null should have thrown");
}
- catch(e) {
+ catch (e) {
is(e instanceof DOMException, true,
"Got right kind of exception");
is(e.name, "DataError", "Correct error.");
is(e.code, 0, "Correct code.");
}
objectStore.count().onsuccess = grabEventAndContinueHandler;
event = yield undefined;
@@ -1242,33 +1242,33 @@ function* testSteps()
is(count, 3,
"Correct count for bound keyRange arg to index.openCursor");
try {
index.get();
ok(false, "Get with unspecified arg should have thrown");
}
- catch(e) {
+ catch (e) {
ok(true, "Get with unspecified arg should have thrown");
}
try {
index.get(undefined);
ok(false, "Get with undefined should have thrown");
}
- catch(e) {
+ catch (e) {
ok(true, "Get with undefined arg should have thrown");
}
try {
index.get(null);
ok(false, "Get with null should have thrown");
}
- catch(e) {
+ catch (e) {
is(e instanceof DOMException, true,
"Got right kind of exception");
is(e.name, "DataError", "Correct error.");
is(e.code, 0, "Correct code.");
}
index.get(data[0].weight).onsuccess = grabEventAndContinueHandler;
event = yield undefined;
@@ -1354,33 +1354,33 @@ function* testSteps()
event = yield undefined;
is(event.target.result, undefined, "Got correct result");
try {
index.getKey();
ok(false, "Get with unspecified arg should have thrown");
}
- catch(e) {
+ catch (e) {
ok(true, "Get with unspecified arg should have thrown");
}
try {
index.getKey(undefined);
ok(false, "Get with undefined should have thrown");
}
- catch(e) {
+ catch (e) {
ok(true, "Get with undefined arg should have thrown");
}
try {
index.getKey(null);
ok(false, "Get with null should have thrown");
}
- catch(e) {
+ catch (e) {
is(e instanceof DOMException, true,
"Got right kind of exception");
is(e.name, "DataError", "Correct error.");
is(e.code, 0, "Correct code.");
}
index.getKey(data[0].weight).onsuccess = grabEventAndContinueHandler;
event = yield undefined;
--- a/dom/indexedDB/test/unit/test_overlapping_transactions.js
+++ b/dom/indexedDB/test/unit/test_overlapping_transactions.js
@@ -42,27 +42,27 @@ function* testSteps()
request = db.transaction(["foo"], "readwrite")
.objectStore("foo")
.add({});
request.onerror = errorHandler;
request.onsuccess = function(event) {
is(stepNumber, 2, "This callback came second");
stepNumber++;
- event.target.transaction.oncomplete = grabEventAndContinueHandler;
+ event.target.transaction.oncomplete = grabEventAndContinueHandler;
}
request = db.transaction(["foo", "bar"], "readwrite")
.objectStore("bar")
.add({});
request.onerror = errorHandler;
request.onsuccess = function(event) {
is(stepNumber, 3, "This callback came third");
stepNumber++;
- event.target.transaction.oncomplete = grabEventAndContinueHandler;
+ event.target.transaction.oncomplete = grabEventAndContinueHandler;
}
request = db.transaction(["foo", "bar"], "readwrite")
.objectStore("bar")
.add({});
request.onerror = errorHandler;
request.onsuccess = function(event) {
is(stepNumber, 4, "This callback came fourth");
--- a/dom/indexedDB/test/unit/test_persistenceType.js
+++ b/dom/indexedDB/test/unit/test_persistenceType.js
@@ -9,25 +9,25 @@ function* testSteps()
{
const name = "Splendid Test";
const version = 1;
const objectStoreName = "Foo";
const data = { key: 1, value: "bar" };
try {
- indexedDB.open(name, { version: version, storage: "unknown" });
+ indexedDB.open(name, { version, storage: "unknown" });
ok(false, "Should have thrown!");
}
catch (e) {
ok(e instanceof TypeError, "Got TypeError.");
is(e.name, "TypeError", "Good error name.");
}
- let request = indexedDB.open(name, { version: version,
+ let request = indexedDB.open(name, { version,
storage: "persistent" });
request.onerror = errorHandler;
request.onupgradeneeded = grabEventAndContinueHandler;
request.onsuccess = grabEventAndContinueHandler;
let event = yield undefined;
is(event.type, "upgradeneeded", "Got correct event type");
@@ -54,17 +54,17 @@ function* testSteps()
is(event.target.result, undefined, "Got no data");
request = objectStore.add(data.value, data.key);
request.onsuccess = grabEventAndContinueHandler;
event = yield undefined;
is(event.target.result, data.key, "Got correct key");
- request = indexedDB.open(name, { version: version,
+ request = indexedDB.open(name, { version,
storage: "temporary" });
request.onerror = errorHandler;
request.onupgradeneeded = grabEventAndContinueHandler;
request.onsuccess = grabEventAndContinueHandler;
event = yield undefined;
is(event.type, "success", "Got correct event type");
--- a/dom/indexedDB/test/unit/test_quotaExceeded_recovery.js
+++ b/dom/indexedDB/test/unit/test_quotaExceeded_recovery.js
@@ -33,17 +33,17 @@ function* testSteps()
clearAllDatabases(continueToNextStepSync);
yield undefined;
info("Opening database");
let request = indexedDB.openForPrincipal(getPrincipal(spec), name);
request.onerror = errorHandler;
- request.onupgradeneeded = grabEventAndContinueHandler;;
+ request.onupgradeneeded = grabEventAndContinueHandler;
request.onsuccess = unexpectedSuccessHandler;
yield undefined;
// upgradeneeded
request.onupgradeneeded = unexpectedSuccessHandler;
request.onsuccess = grabEventAndContinueHandler;
@@ -124,17 +124,17 @@ function* testSteps()
let cursor = event.target.result;
if (cursor) {
cursor.delete();
cursor.continue();
}
}
}
- trans.onabort = unexpectedSuccessHandler;;
+ trans.onabort = unexpectedSuccessHandler;
trans.oncomplete = grabEventAndContinueHandler;
yield undefined;
}
}
finishTest();
yield undefined;
--- a/dom/indexedDB/test/unit/test_remove_index.js
+++ b/dom/indexedDB/test/unit/test_remove_index.js
@@ -32,17 +32,17 @@ function* testSteps()
objectStore.deleteIndex(indexName);
is(objectStore.indexNames.length, 0, "Correct indexNames list");
try {
objectStore.index(indexName);
ok(false, "should have thrown");
}
- catch(ex) {
+ catch (ex) {
ok(ex instanceof DOMException, "Got a DOMException");
is(ex.name, "NotFoundError", "expect a NotFoundError");
is(ex.code, DOMException.NOT_FOUND_ERR, "expect a NOT_FOUND_ERR");
}
let index2 = objectStore.createIndex(indexName, "foo");
isnot(index, index2, "New instance should be created");
--- a/dom/indexedDB/test/unit/test_remove_objectStore.js
+++ b/dom/indexedDB/test/unit/test_remove_objectStore.js
@@ -64,17 +64,17 @@ function* testSteps()
let oldObjectStore = trans.objectStore(objectStoreName);
isnot(oldObjectStore, null, "Correct object store prior to deleting");
db.deleteObjectStore(objectStoreName);
is(db.objectStoreNames.length, 0, "Correct objectStores list");
try {
trans.objectStore(objectStoreName);
ok(false, "should have thrown");
}
- catch(ex) {
+ catch (ex) {
ok(ex instanceof DOMException, "Got a DOMException");
is(ex.name, "NotFoundError", "expect a NotFoundError");
is(ex.code, DOMException.NOT_FOUND_ERR, "expect a NOT_FOUND_ERR");
}
objectStore = db.createObjectStore(objectStoreName, { keyPath: "foo" });
is(db.objectStoreNames.length, 1, "Correct objectStoreNames list");
is(db.objectStoreNames.item(0), objectStoreName, "Correct name");
@@ -108,17 +108,17 @@ function* testSteps()
request.onupgradeneeded = grabEventAndContinueHandler;
event = yield undefined;
db = event.target.result;
trans = event.target.transaction;
objectStore = db.createObjectStore(objectStoreName, { keyPath: "foo" });
- request = objectStore.add({foo:"bar"});
+ request = objectStore.add({foo: "bar"});
request.onerror = errorHandler;
request.onsuccess = grabEventAndContinueHandler;
db.deleteObjectStore(objectStoreName);
event = yield undefined;
trans.oncomplete = grabEventAndContinueHandler;
--- a/dom/indexedDB/test/unit/test_sandbox.js
+++ b/dom/indexedDB/test/unit/test_sandbox.js
@@ -4,75 +4,75 @@
function exerciseInterface() {
function DB(name, store) {
this.name = name;
this.store = store;
this._db = this._create();
}
DB.prototype = {
- _create: function() {
+ _create() {
var op = indexedDB.open(this.name);
op.onupgradeneeded = e => {
var db = e.target.result;
db.createObjectStore(this.store);
};
return new Promise(resolve => {
op.onsuccess = e => resolve(e.target.result);
});
},
- _result: function(tx, op) {
+ _result(tx, op) {
return new Promise((resolve, reject) => {
op.onsuccess = e => resolve(e.target.result);
op.onerror = () => reject(op.error);
tx.onabort = () => reject(tx.error);
});
},
- get: function(k) {
+ get(k) {
return this._db.then(db => {
- var tx = db.transaction(this.store, 'readonly');
+ var tx = db.transaction(this.store, "readonly");
var store = tx.objectStore(this.store);
return this._result(tx, store.get(k));
});
},
- add: function(k, v) {
+ add(k, v) {
return this._db.then(db => {
- var tx = db.transaction(this.store, 'readwrite');
+ var tx = db.transaction(this.store, "readwrite");
var store = tx.objectStore(this.store);
return this._result(tx, store.add(v, k));
});
}
};
- var db = new DB('data', 'base');
- return db.add('x', [ 10, {} ])
- .then(_ => db.get('x'))
+ var db = new DB("data", "base");
+ return db.add("x", [ 10, {} ])
+ .then(_ => db.get("x"))
.then(x => {
equal(x.length, 2);
equal(x[0], 10);
- equal(typeof x[1], 'object');
+ equal(typeof x[1], "object");
equal(Object.keys(x[1]).length, 0);
});
}
function run_test() {
do_get_profile();
let Cu = Components.utils;
- let sb = new Cu.Sandbox('https://www.example.com',
- { wantGlobalProperties: ['indexedDB'] });
+ let sb = new Cu.Sandbox("https://www.example.com",
+ { wantGlobalProperties: ["indexedDB"] });
sb.equal = equal;
var innerPromise = new Promise((resolve, reject) => {
sb.test_done = resolve;
sb.test_error = reject;
});
- Cu.evalInSandbox('(' + exerciseInterface.toSource() + ')()' +
- '.then(test_done, test_error);', sb);
+ Cu.evalInSandbox("(" + exerciseInterface.toSource() + ")()" +
+ ".then(test_done, test_error);", sb);
- Cu.importGlobalProperties(['indexedDB']);
+ Cu.importGlobalProperties(["indexedDB"]);
do_test_pending();
Promise.all([innerPromise, exerciseInterface()])
.then(do_test_finished);
}
--- a/dom/indexedDB/test/unit/test_schema18upgrade.js
+++ b/dom/indexedDB/test/unit/test_schema18upgrade.js
@@ -4,32 +4,32 @@
*/
var testGenerator = testSteps();
function* testSteps()
{
const testName = "schema18upgrade";
const testKeys = [
- -1/0,
+ -1 / 0,
-1.7e308,
-10000,
-2,
-1.5,
-1,
-1.00001e-200,
-1e-200,
0,
1e-200,
1.00001e-200,
1,
2,
10000,
1.7e308,
- 1/0,
+ 1 / 0,
new Date("1750-01-02"),
new Date("1800-12-31T12:34:56.001Z"),
new Date(-1000),
new Date(-10),
new Date(-1),
new Date(0),
new Date(1),
new Date(2),
@@ -92,48 +92,48 @@ function* testSteps()
"\uDBFF",
"\uDC00",
"\uDFFF\uD800",
"\uFFFE",
"\uFFFF",
"\uFFFF\x00",
"\uFFFFZZZ",
[],
- [-1/0],
+ [-1 / 0],
[-1],
[0],
[1],
[1, "a"],
[1, []],
[1, [""]],
[2, 3],
[2, 3.0000000000001],
[12, [[]]],
[12, [[[]]]],
[12, [[[""]]]],
[12, [[["foo"]]]],
[12, [[[[[3]]]]]],
[12, [[[[[[3]]]]]]],
- [12, [[[[[[3],[[[[[4.2]]]]]]]]]]],
+ [12, [[[[[[3], [[[[[4.2]]]]]]]]]]],
[new Date(-1)],
[new Date(1)],
[""],
["", [[]]],
["", [[[]]]],
["abc"],
["abc", "def"],
["abc\x00"],
["abc\x00", "\x00\x01"],
["abc\x00", "\x00def"],
["abc\x00\x00def"],
["x", [[]]],
["x", [[[]]]],
[[]],
- [[],"foo"],
- [[],[]],
+ [[], "foo"],
+ [[], []],
[[[]]],
[[[]], []],
[[[]], [[]]],
[[[]], [[1]]],
[[[]], [[[]]]],
[[[1]]],
[[[[]], []]],
];
--- a/dom/indexedDB/test/unit/test_schema21upgrade.js
+++ b/dom/indexedDB/test/unit/test_schema21upgrade.js
@@ -4,32 +4,32 @@
*/
var testGenerator = testSteps();
function* testSteps()
{
const testName = "schema21upgrade";
const testKeys = [
- -1/0,
+ -1 / 0,
-1.7e308,
-10000,
-2,
-1.5,
-1,
-1.00001e-200,
-1e-200,
0,
1e-200,
1.00001e-200,
1,
2,
10000,
1.7e308,
- 1/0,
+ 1 / 0,
new Date("1750-01-02"),
new Date("1800-12-31T12:34:56.001Z"),
new Date(-1000),
new Date(-10),
new Date(-1),
new Date(0),
new Date(1),
new Date(2),
@@ -92,48 +92,48 @@ function* testSteps()
"\uDBFF",
"\uDC00",
"\uDFFF\uD800",
"\uFFFE",
"\uFFFF",
"\uFFFF\x00",
"\uFFFFZZZ",
[],
- [-1/0],
+ [-1 / 0],
[-1],
[0],
[1],
[1, "a"],
[1, []],
[1, [""]],
[2, 3],
[2, 3.0000000000001],
[12, [[]]],
[12, [[[]]]],
[12, [[[""]]]],
[12, [[["foo"]]]],
[12, [[[[[3]]]]]],
[12, [[[[[[3]]]]]]],
- [12, [[[[[[3],[[[[[4.2]]]]]]]]]]],
+ [12, [[[[[[3], [[[[[4.2]]]]]]]]]]],
[new Date(-1)],
[new Date(1)],
[""],
["", [[]]],
["", [[[]]]],
["abc"],
["abc", "def"],
["abc\x00"],
["abc\x00", "\x00\x01"],
["abc\x00", "\x00def"],
["abc\x00\x00def"],
["x", [[]]],
["x", [[[]]]],
[[]],
- [[],"foo"],
- [[],[]],
+ [[], "foo"],
+ [[], []],
[[[]]],
[[[]], []],
[[[]], [[]]],
[[[]], [[1]]],
[[[]], [[[]]]],
[[[1]]],
[[[[]], []]],
];
--- a/dom/indexedDB/test/unit/test_storage_manager_estimate.js
+++ b/dom/indexedDB/test/unit/test_storage_manager_estimate.js
@@ -2,20 +2,20 @@ var testGenerator = testSteps();
function* testSteps()
{
const name = this.window ? window.location.pathname :
"test_storage_manager_estimate.js";
const objectStoreName = "storagesManager";
const arraySize = 1e6;
- ok('estimate' in navigator.storage, 'Has estimate function');
- is(typeof navigator.storage.estimate, 'function', 'estimate is function');
+ ok("estimate" in navigator.storage, "Has estimate function");
+ is(typeof navigator.storage.estimate, "function", "estimate is function");
ok(navigator.storage.estimate() instanceof Promise,
- 'estimate() method exists and returns a Promise');
+ "estimate() method exists and returns a Promise");
navigator.storage.estimate().then(estimation => {
testGenerator.next(estimation.usage);
});
let before = yield undefined;
let request = indexedDB.open(name, 1);
@@ -29,34 +29,34 @@ function* testSteps()
let objectStore = db.createObjectStore(objectStoreName, { });
yield undefined;
navigator.storage.estimate().then(estimation => {
testGenerator.next(estimation.usage);
});
let usageAfterCreate = yield undefined;
- ok(usageAfterCreate > before, 'estimated usage must increase after createObjectStore');
+ ok(usageAfterCreate > before, "estimated usage must increase after createObjectStore");
let txn = db.transaction(objectStoreName, "readwrite");
objectStore = txn.objectStore(objectStoreName);
- objectStore.put(new Uint8Array(arraySize), 'k');
+ objectStore.put(new Uint8Array(arraySize), "k");
txn.oncomplete = continueToNextStep;
txn.onabort = errorHandler;
txn.onerror = errorHandler;
event = yield undefined;
navigator.storage.estimate().then(estimation => {
testGenerator.next(estimation.usage);
});
let usageAfterPut = yield undefined;
- ok(usageAfterPut > usageAfterCreate, 'estimated usage must increase after putting large object');
+ ok(usageAfterPut > usageAfterCreate, "estimated usage must increase after putting large object");
db.close();
finishTest();
}
function setup()
{
SpecialPowers.pushPrefEnv({
"set": [["dom.storageManager.enabled", true]]
- }, runTest);
+ }, runTest);
}
--- a/dom/indexedDB/test/unit/test_transaction_abort.js
+++ b/dom/indexedDB/test/unit/test_transaction_abort.js
@@ -203,17 +203,17 @@ function* testSteps()
let keys = [];
let abortEventCount = 0;
function abortErrorHandler(event) {
is(event.target.error.name, "AbortError",
"Good error");
abortEventCount++;
event.preventDefault();
- };
+ }
objectStore = db.transaction("foo", "readwrite").objectStore("foo");
for (let i = 0; i < 10; i++) {
request = objectStore.add({});
request.onerror = abortErrorHandler;
request.onsuccess = function(event) {
keys.push(event.target.result);
if (keys.length == 5) {
--- a/dom/indexedDB/test/unit/test_transaction_abort_hang.js
+++ b/dom/indexedDB/test/unit/test_transaction_abort_hang.js
@@ -71,17 +71,17 @@ function* testSteps()
transaction.oncomplete = function(event) {
ok(true, "Completed transaction " + ++completedTransactionCount);
};
}
if (readonly) {
transaction.objectStore(objStoreName).get(0);
} else {
- try { transaction.objectStore(objStoreName).add({}); } catch(e) { }
+ try { transaction.objectStore(objStoreName).add({}); } catch (e) { }
}
}
ok(true, "Created all transactions");
event = yield undefined;
ok(true, "Completed transaction " + ++completedTransactionCount);
ok(caughtError, "Caught the error event when we aborted the transaction");
--- a/dom/indexedDB/test/unit/test_unique_index_update.js
+++ b/dom/indexedDB/test/unit/test_unique_index_update.js
@@ -14,17 +14,17 @@ function* testSteps()
let event = yield undefined;
let db = event.target.result;
for (let autoIncrement of [false, true]) {
let objectStore =
db.createObjectStore(autoIncrement, { keyPath: "id",
- autoIncrement: autoIncrement });
+ autoIncrement });
objectStore.createIndex("", "index", { unique: true });
for (let i = 0; i < 10; i++) {
objectStore.add({ id: i, index: i });
}
}
event = yield undefined;
--- a/dom/indexedDB/test/unit/test_wasm_cursors.js
+++ b/dom/indexedDB/test/unit/test_wasm_cursors.js
@@ -14,17 +14,17 @@ function* testSteps()
const wasmData = { key: 1, value: null };
if (!isWasmSupported()) {
finishTest();
return;
}
- getWasmBinary('(module (func (nop)))');
+ getWasmBinary("(module (func (nop)))");
let binary = yield undefined;
wasmData.value = getWasmModule(binary);
info("Opening database");
let request = indexedDB.open(name);
request.onerror = errorHandler;
request.onupgradeneeded = continueToNextStepSync;
--- a/dom/indexedDB/test/unit/test_wasm_getAll.js
+++ b/dom/indexedDB/test/unit/test_wasm_getAll.js
@@ -18,45 +18,45 @@ function* testSteps()
{ key: 3, value: [null, null, null, null, null] }
];
if (!isWasmSupported()) {
finishTest();
return;
}
- getWasmBinary('(module (func (result i32) (i32.const 1)))');
+ getWasmBinary("(module (func (result i32) (i32.const 1)))");
let binary = yield undefined;
wasmData[1].value[0] = getWasmModule(binary);
- getWasmBinary('(module (func (result i32) (i32.const 2)))');
+ getWasmBinary("(module (func (result i32) (i32.const 2)))");
binary = yield undefined;
wasmData[1].value[1] = getWasmModule(binary);
- getWasmBinary('(module (func (result i32) (i32.const 3)))');
+ getWasmBinary("(module (func (result i32) (i32.const 3)))");
binary = yield undefined;
wasmData[1].value[2] = getWasmModule(binary);
- getWasmBinary('(module (func (result i32) (i32.const 4)))');
+ getWasmBinary("(module (func (result i32) (i32.const 4)))");
binary = yield undefined;
wasmData[2].value[0] = getWasmModule(binary);
- getWasmBinary('(module (func (result i32) (i32.const 5)))');
+ getWasmBinary("(module (func (result i32) (i32.const 5)))");
binary = yield undefined;
wasmData[2].value[1] = getWasmModule(binary);
- getWasmBinary('(module (func (result i32) (i32.const 6)))');
+ getWasmBinary("(module (func (result i32) (i32.const 6)))");
binary = yield undefined;
wasmData[2].value[2] = getWasmModule(binary);
- getWasmBinary('(module (func (result i32) (i32.const 7)))');
+ getWasmBinary("(module (func (result i32) (i32.const 7)))");
binary = yield undefined;
wasmData[2].value[3] = getWasmModule(binary);
- getWasmBinary('(module (func (result i32) (i32.const 8)))');
+ getWasmBinary("(module (func (result i32) (i32.const 8)))");
binary = yield undefined;
wasmData[2].value[4] = getWasmModule(binary);
let request = indexedDB.open(name, 1);
request.onerror = errorHandler;
request.onupgradeneeded = continueToNextStepSync;
request.onsuccess = unexpectedSuccessHandler;
yield undefined;
--- a/dom/indexedDB/test/unit/test_wasm_index_getAllObjects.js
+++ b/dom/indexedDB/test/unit/test_wasm_index_getAllObjects.js
@@ -20,45 +20,45 @@ function* testSteps()
const indexData = { name: "nameIndex", keyPath: "name", options: { } };
if (!isWasmSupported()) {
finishTest();
return;
}
- getWasmBinary('(module (func (result i32) (i32.const 1)))');
+ getWasmBinary("(module (func (result i32) (i32.const 1)))");
let binary = yield undefined;
wasmData[1].value.data[0] = getWasmModule(binary);
- getWasmBinary('(module (func (result i32) (i32.const 2)))');
+ getWasmBinary("(module (func (result i32) (i32.const 2)))");
binary = yield undefined;
wasmData[1].value.data[1] = getWasmModule(binary);
- getWasmBinary('(module (func (result i32) (i32.const 3)))');
+ getWasmBinary("(module (func (result i32) (i32.const 3)))");
binary = yield undefined;
wasmData[1].value.data[2] = getWasmModule(binary);
- getWasmBinary('(module (func (result i32) (i32.const 4)))');
+ getWasmBinary("(module (func (result i32) (i32.const 4)))");
binary = yield undefined;
wasmData[2].value.data[0] = getWasmModule(binary);
- getWasmBinary('(module (func (result i32) (i32.const 5)))');
+ getWasmBinary("(module (func (result i32) (i32.const 5)))");
binary = yield undefined;
wasmData[2].value.data[1] = getWasmModule(binary);
- getWasmBinary('(module (func (result i32) (i32.const 6)))');
+ getWasmBinary("(module (func (result i32) (i32.const 6)))");
binary = yield undefined;
wasmData[2].value.data[2] = getWasmModule(binary);
- getWasmBinary('(module (func (result i32) (i32.const 7)))');
+ getWasmBinary("(module (func (result i32) (i32.const 7)))");
binary = yield undefined;
wasmData[2].value.data[3] = getWasmModule(binary);
- getWasmBinary('(module (func (result i32) (i32.const 8)))');
+ getWasmBinary("(module (func (result i32) (i32.const 8)))");
binary = yield undefined;
wasmData[2].value.data[4] = getWasmModule(binary);
let request = indexedDB.open(name, 1);
request.onerror = errorHandler;
request.onupgradeneeded = continueToNextStepSync;
request.onsuccess = unexpectedSuccessHandler;
yield undefined;
--- a/dom/indexedDB/test/unit/test_wasm_indexes.js
+++ b/dom/indexedDB/test/unit/test_wasm_indexes.js
@@ -16,17 +16,17 @@ function* testSteps()
const indexData = { name: "nameIndex", keyPath: "name", options: { } };
if (!isWasmSupported()) {
finishTest();
return;
}
- getWasmBinary('(module (func (nop)))');
+ getWasmBinary("(module (func (nop)))");
let binary = yield undefined;
wasmData.value.data = getWasmModule(binary);
info("Opening database");
let request = indexedDB.open(name);
request.onerror = errorHandler;
request.onupgradeneeded = continueToNextStepSync;
--- a/dom/indexedDB/test/unit/test_wasm_put_get_values.js
+++ b/dom/indexedDB/test/unit/test_wasm_put_get_values.js
@@ -14,17 +14,17 @@ function* testSteps()
const wasmData = { key: 1, value: null };
if (!isWasmSupported()) {
finishTest();
return;
}
- getWasmBinary('(module (func (nop)))');
+ getWasmBinary("(module (func (nop)))");
let binary = yield undefined;
wasmData.value = getWasmModule(binary);
info("Opening database");
let request = indexedDB.open(name);
request.onerror = errorHandler;
request.onupgradeneeded = continueToNextStepSync;
--- a/dom/indexedDB/test/unit/test_wasm_recompile.js
+++ b/dom/indexedDB/test/unit/test_wasm_recompile.js
@@ -16,17 +16,17 @@ function* testSteps()
// The goal of this test is to prove that wasm is recompiled and the on-disk
// copy updated.
if (!isWasmSupported()) {
finishTest();
yield undefined;
}
- getWasmBinary('(module (func (nop)))');
+ getWasmBinary("(module (func (nop)))");
let binary = yield undefined;
wasmData.wasm = getWasmModule(binary);
info("Installing profile");
clearAllDatabases(continueToNextStepSync);
yield undefined;
--- a/dom/indexedDB/test/unit/xpcshell-head-child-process.js
+++ b/dom/indexedDB/test/unit/xpcshell-head-child-process.js
@@ -1,15 +1,15 @@
/**
* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
function run_test() {
- const { 'classes': Cc, 'interfaces': Ci, 'utils': Cu } = Components;
+ const { "classes": Cc, "interfaces": Ci, "utils": Cu } = Components;
const INDEXEDDB_HEAD_FILE = "xpcshell-head-parent-process.js";
const INDEXEDDB_PREF_EXPERIMENTAL = "dom.indexedDB.experimental";
// IndexedDB needs a profile.
do_get_profile();
let thisTest = _TEST_FILE.toString().replace(/\\/g, "/");
--- a/dom/indexedDB/test/unit/xpcshell-head-parent-process.js
+++ b/dom/indexedDB/test/unit/xpcshell-head-parent-process.js
@@ -1,17 +1,17 @@
/**
* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
// Tests using testGenerator are expected to define it themselves.
/* global testGenerator */
-var { 'classes': Cc, 'interfaces': Ci, 'utils': Cu } = Components;
+var { "classes": Cc, "interfaces": Ci, "utils": Cu } = Components;
if (!("self" in this)) {
this.self = this;
}
const DOMException = Ci.nsIDOMDOMException;
var bufferCache = [];
@@ -37,17 +37,17 @@ function todo(condition, name, diag) {
}
function info(name, message) {
do_print(name);
}
function run_test() {
runTest();
-};
+}
if (!this.runTest) {
this.runTest = function()
{
if (SpecialPowers.isMainProcess()) {
// XPCShell does not get a profile by default.
do_get_profile();
@@ -69,17 +69,17 @@ function finishTest()
resetTesting();
SpecialPowers.notifyObserversInParentProcess(null, "disk-space-watcher",
"free");
}
SpecialPowers.removeFiles();
- do_execute_soon(function(){
+ do_execute_soon(function() {
do_test_finished();
})
}
function grabEventAndContinueHandler(event)
{
testGenerator.next(event);
}
@@ -90,17 +90,17 @@ function continueToNextStep()
testGenerator.next();
});
}
function errorHandler(event)
{
try {
dump("indexedDB error: " + event.target.error.name);
- } catch(e) {
+ } catch (e) {
dump("indexedDB error: " + e);
}
do_check_true(false);
finishTest();
}
function unexpectedSuccessHandler()
{
@@ -124,17 +124,17 @@ function expectUncaughtException(expecti
}
function ExpectError(name, preventDefault)
{
this._name = name;
this._preventDefault = preventDefault;
}
ExpectError.prototype = {
- handleEvent: function(event)
+ handleEvent(event)
{
do_check_eq(event.type, "error");
do_check_eq(this._name, event.target.error.name);
if (this._preventDefault) {
event.preventDefault();
event.stopPropagation();
}
grabEventAndContinueHandler(event);
@@ -225,17 +225,17 @@ function scheduleGC()
{
SpecialPowers.exactGC(continueToNextStep);
}
function setTimeout(fun, timeout) {
let timer = Components.classes["@mozilla.org/timer;1"]
.createInstance(Components.interfaces.nsITimer);
var event = {
- notify: function (timer) {
+ notify(timer) {
fun();
}
};
timer.initWithCallback(event, timeout,
Components.interfaces.nsITimer.TYPE_ONE_SHOT);
return timer;
}
@@ -259,17 +259,17 @@ function resetOrClearAllDatabases(callba
let request;
try {
if (clear) {
request = quotaManagerService.clear();
} else {
request = quotaManagerService.reset();
}
- } catch(e) {
+ } catch (e) {
if (oldPrefValue !== undefined) {
SpecialPowers.setBoolPref(quotaPref, oldPrefValue);
} else {
SpecialPowers.clearUserPref(quotaPref);
}
throw e;
}
@@ -310,30 +310,30 @@ function installPackagedProfile(packageN
}
entryNames.sort();
for (let entryName of entryNames) {
let zipentry = zipReader.getEntry(entryName);
let file = profileDir.clone();
let split = entryName.split("/");
- for(let i = 0; i < split.length; i++) {
+ for (let i = 0; i < split.length; i++) {
file.append(split[i]);
}
if (zipentry.isDirectory) {
file.create(Ci.nsIFile.DIRECTORY_TYPE, parseInt("0755", 8));
} else {
let istream = zipReader.getInputStream(entryName);
var ostream = Cc["@mozilla.org/network/file-output-stream;1"]
.createInstance(Ci.nsIFileOutputStream);
ostream.init(file, -1, parseInt("0644", 8), 0);
- let bostream = Cc['@mozilla.org/network/buffered-output-stream;1']
+ let bostream = Cc["@mozilla.org/network/buffered-output-stream;1"]
.createInstance(Ci.nsIBufferedOutputStream);
bostream.init(ostream, 32768);
bostream.writeFrom(istream, istream.available());
istream.close();
bostream.close();
}
@@ -386,17 +386,17 @@ function getRandomView(size)
function getBlob(str)
{
return new Blob([str], {type: "type/text"});
}
function getFile(name, type, str)
{
- return new File([str], name, {type: type});
+ return new File([str], name, {type});
}
function isWasmSupported()
{
let testingFunctions = Cu.getJSTestingFunctions();
return testingFunctions.wasmIsSupported();
}
@@ -561,46 +561,46 @@ function getPrincipal(url)
.getService(Ci.nsIIOService)
.newURI(url);
let ssm = Cc["@mozilla.org/scriptsecuritymanager;1"]
.getService(Ci.nsIScriptSecurityManager);
return ssm.createCodebasePrincipal(uri, {});
}
var SpecialPowers = {
- isMainProcess: function() {
+ isMainProcess() {
return Components.classes["@mozilla.org/xre/app-info;1"]
.getService(Components.interfaces.nsIXULRuntime)
.processType == Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
},
- notifyObservers: function(subject, topic, data) {
- var obsvc = Cc['@mozilla.org/observer-service;1']
+ notifyObservers(subject, topic, data) {
+ var obsvc = Cc["@mozilla.org/observer-service;1"]
.getService(Ci.nsIObserverService);
obsvc.notifyObservers(subject, topic, data);
},
- notifyObserversInParentProcess: function(subject, topic, data) {
+ notifyObserversInParentProcess(subject, topic, data) {
if (subject) {
throw new Error("Can't send subject to another process!");
}
return this.notifyObservers(subject, topic, data);
},
- getBoolPref: function(prefName) {
+ getBoolPref(prefName) {
return this._getPrefs().getBoolPref(prefName);
},
- setBoolPref: function(prefName, value) {
+ setBoolPref(prefName, value) {
this._getPrefs().setBoolPref(prefName, value);
},
- setIntPref: function(prefName, value) {
+ setIntPref(prefName, value) {
this._getPrefs().setIntPref(prefName, value);
},
- clearUserPref: function(prefName) {
+ clearUserPref(prefName) {
this._getPrefs().clearUserPref(prefName);
},
// Copied (and slightly adjusted) from specialpowersAPI.js
- exactGC: function(callback) {
+ exactGC(callback) {
let count = 0;
function doPreciseGCandCC() {
function scheduledGCCallback() {
Components.utils.forceCC();
if (++count < 2) {
doPreciseGCandCC();
@@ -610,17 +610,17 @@ var SpecialPowers = {
}
Components.utils.schedulePreciseGC(scheduledGCCallback);
}
doPreciseGCandCC();
},
- _getPrefs: function() {
+ _getPrefs() {
var prefService =
Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefService);
return prefService.getBranch(null);
},
get Cc() {
return Cc;
},
@@ -629,17 +629,17 @@ var SpecialPowers = {
return Ci;
},
get Cu() {
return Cu;
},
// Based on SpecialPowersObserver.prototype.receiveMessage
- createFiles: function(requests, callback) {
+ createFiles(requests, callback) {
let dirSvc = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties);
let filePaths = new Array;
if (!this._createdFiles) {
this._createdFiles = new Array;
}
let createdFiles = this._createdFiles;
let promises = [];
requests.forEach(function(request) {
@@ -659,25 +659,25 @@ var SpecialPowers = {
}
promises.push(File.createFromFileName(testFile.path, request.options).then(function(file) {
filePaths.push(file);
}));
createdFiles.push(testFile);
});
Promise.all(promises).then(function() {
- setTimeout(function () {
+ setTimeout(function() {
callback(filePaths);
}, 0);
});
},
- removeFiles: function() {
+ removeFiles() {
if (this._createdFiles) {
- this._createdFiles.forEach(function (testFile) {
+ this._createdFiles.forEach(function(testFile) {
try {
testFile.remove(false);
} catch (e) {}
});
this._createdFiles = null;
}
},
};