Bug 1363795 - Enable some Mozilla ESLint recommended rules for dom/indexedDB/test - automatic fixes. r=bevis

MozReview-Commit-ID: I8FKV241Inw

--HG--
extra : rebase_source : 3efeabcfcf6bec378f0d1eca60c84c920e265bc4
This commit is contained in:
Mark Banner 2017-05-10 17:19:34 +01:00
Родитель e123b6dfb8
Коммит 52a86c565f
33 изменённых файлов: 108 добавлений и 117 удалений

Просмотреть файл

@ -13,17 +13,8 @@ module.exports = {
"rules": {
"brace-style": "off",
"consistent-return": "off",
"key-spacing": "off",
"keyword-spacing": "off",
"no-extra-semi": "off",
"no-native-reassign": "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",
}
};

Просмотреть файл

@ -38,7 +38,7 @@ dump("EXCEPTION IN CREATION: " + e + "\n " + e.stack + "\n");
const BLOB_DATA = ["fun ", "times ", "all ", "around!"];
var blob = new Blob(BLOB_DATA, { type: "text/plain" });
var objectStore = db.transaction("foo", "readwrite").objectStore("foo");
objectStore.add({ blob: blob }, 42).onsuccess = refetchBlob;
objectStore.add({ blob }, 42).onsuccess = refetchBlob;
}
function refetchBlob() {
@ -48,7 +48,7 @@ dump("EXCEPTION IN CREATION: " + e + "\n " + e.stack + "\n");
function fetchedBlobCreateWorkerAndSendBlob(event) {
var idbBlob = event.target.result.blob;
var compositeBlob = new Blob(['I like the following blob: ', idbBlob],
var compositeBlob = new Blob(["I like the following blob: ", idbBlob],
{ type: "text/fancy" });
function workerScript() {
@ -58,7 +58,7 @@ dump("EXCEPTION IN CREATION: " + e + "\n " + e.stack + "\n");
self.holdOntoBlob = event.data;
// Send any message so we can serialize and keep our runtime behaviour
// consistent.
postMessage('kung fu death grip established');
postMessage("kung fu death grip established");
}
}
@ -84,7 +84,7 @@ dump("EXCEPTION IN CREATION: " + e + "\n " + e.stack + "\n");
// Now that worker has latched the blob, clean up the database.
db.close();
db = null;
report('ready');
report("ready");
}
createDatastore();

Просмотреть файл

@ -32,7 +32,7 @@ function test1()
{
// Set database version for domain 1
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
gBrowser.selectedBrowser.addEventListener("load", function () {
gBrowser.selectedBrowser.addEventListener("load", function() {
setFinishedCallback(function(result, exception) {
ok(result == 11, "Set version on database in " + testPageURL1);
ok(!exception, "No exception");
@ -48,7 +48,7 @@ function test2()
{
// Set database version for domain 2
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
gBrowser.selectedBrowser.addEventListener("load", function () {
gBrowser.selectedBrowser.addEventListener("load", function() {
setFinishedCallback(function(result, exception) {
ok(result == 11, "Set version on database in " + testPageURL2);
ok(!exception, "No exception");
@ -73,7 +73,7 @@ function test4()
{
// Get database version for domain 1
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
gBrowser.selectedBrowser.addEventListener("load", function () {
gBrowser.selectedBrowser.addEventListener("load", function() {
setFinishedCallback(function(result, exception) {
ok(result == 11, "Got correct version on database in " + testPageURL3);
ok(!exception, "No exception");
@ -89,7 +89,7 @@ function test5()
{
// Get database version for domain 2
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
gBrowser.selectedBrowser.addEventListener("load", function () {
gBrowser.selectedBrowser.addEventListener("load", function() {
setFinishedCallback(function(result, exception) {
ok(result == 1, "Got correct version on database in " + testPageURL4);
ok(!exception, "No exception");

Просмотреть файл

@ -21,7 +21,7 @@ function test1()
info("creating tab");
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
gBrowser.selectedBrowser.addEventListener("load", function () {
gBrowser.selectedBrowser.addEventListener("load", function() {
setFinishedCallback(function(isIDBDatabase, exception) {
ok(isIDBDatabase,
"First database creation was successful");
@ -33,14 +33,14 @@ function test1()
executeSoon(test2);
});
registerPopupEventHandler("popupshowing", function () {
registerPopupEventHandler("popupshowing", function() {
ok(true, "prompt showing");
});
registerPopupEventHandler("popupshown", function () {
registerPopupEventHandler("popupshown", function() {
ok(true, "prompt shown");
triggerMainCommand(this);
});
registerPopupEventHandler("popuphidden", function () {
registerPopupEventHandler("popuphidden", function() {
ok(true, "prompt hidden");
});
@ -55,7 +55,7 @@ function test2()
info("creating tab");
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
gBrowser.selectedBrowser.addEventListener("load", function () {
gBrowser.selectedBrowser.addEventListener("load", function() {
setFinishedCallback(function(isIDBDatabase, exception) {
ok(isIDBDatabase,
"First database creation was successful");
@ -69,13 +69,13 @@ function test2()
executeSoon(finish);
});
registerPopupEventHandler("popupshowing", function () {
registerPopupEventHandler("popupshowing", function() {
ok(false, "Shouldn't show a popup this time");
});
registerPopupEventHandler("popupshown", function () {
registerPopupEventHandler("popupshown", function() {
ok(false, "Shouldn't show a popup this time");
});
registerPopupEventHandler("popuphidden", function () {
registerPopupEventHandler("popuphidden", function() {
ok(false, "Shouldn't show a popup this time");
});

Просмотреть файл

@ -31,14 +31,14 @@ add_task(function* test1() {
gBrowser.selectedBrowser.loadURI(testPageURL);
yield BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
registerPopupEventHandler("popupshowing", function () {
registerPopupEventHandler("popupshowing", function() {
ok(true, "prompt showing");
});
registerPopupEventHandler("popupshown", function () {
registerPopupEventHandler("popupshown", function() {
ok(true, "prompt shown");
triggerSecondaryCommand(this);
});
registerPopupEventHandler("popuphidden", function () {
registerPopupEventHandler("popuphidden", function() {
ok(true, "prompt hidden");
});
@ -52,22 +52,22 @@ add_task(function* test1() {
add_task(function* test2() {
info("creating private window");
let win = yield BrowserTestUtils.openNewBrowserWindow({ private : true });
let win = yield BrowserTestUtils.openNewBrowserWindow({ private: true });
info("creating private tab");
win.gBrowser.selectedTab = win.gBrowser.addTab();
info("loading test page: " + testPageURL);
win.gBrowser.selectedBrowser.loadURI(testPageURL);
yield BrowserTestUtils.browserLoaded(win.gBrowser.selectedBrowser);
registerPopupEventHandler("popupshowing", function () {
registerPopupEventHandler("popupshowing", function() {
ok(false, "prompt showing");
});
registerPopupEventHandler("popupshown", function () {
registerPopupEventHandler("popupshown", function() {
ok(false, "prompt shown");
});
registerPopupEventHandler("popuphidden", function () {
registerPopupEventHandler("popuphidden", function() {
ok(false, "prompt hidden");
});
yield promiseMessage("InvalidStateError", win.gBrowser);
@ -88,13 +88,13 @@ add_task(function* test3() {
gBrowser.selectedBrowser.loadURI(testPageURL);
yield BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
registerPopupEventHandler("popupshowing", function () {
registerPopupEventHandler("popupshowing", function() {
ok(false, "Shouldn't show a popup this time");
});
registerPopupEventHandler("popupshown", function () {
registerPopupEventHandler("popupshown", function() {
ok(false, "Shouldn't show a popup this time");
});
registerPopupEventHandler("popuphidden", function () {
registerPopupEventHandler("popuphidden", function() {
ok(false, "Shouldn't show a popup this time");
});

Просмотреть файл

@ -23,7 +23,7 @@ function test1()
info("creating tab");
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
gBrowser.selectedBrowser.addEventListener("load", function () {
gBrowser.selectedBrowser.addEventListener("load", function() {
setFinishedCallback(function(isIDBDatabase, exception) {
ok(isIDBDatabase, "First database creation was successful");
ok(!exception, "No exception");
@ -34,14 +34,14 @@ function test1()
executeSoon(test2);
});
registerPopupEventHandler("popupshowing", function () {
registerPopupEventHandler("popupshowing", function() {
ok(true, "prompt showing");
});
registerPopupEventHandler("popupshown", function () {
registerPopupEventHandler("popupshown", function() {
ok(true, "prompt shown");
triggerMainCommand(this);
});
registerPopupEventHandler("popuphidden", function () {
registerPopupEventHandler("popuphidden", function() {
ok(true, "prompt hidden");
});
@ -59,7 +59,7 @@ function test2()
info("creating tab");
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
gBrowser.selectedBrowser.addEventListener("load", function () {
gBrowser.selectedBrowser.addEventListener("load", function() {
setFinishedCallback(function(isIDBDatabase, exception) {
ok(!isIDBDatabase, "First database creation was successful");
ok(exception, "No exception");
@ -70,13 +70,13 @@ function test2()
executeSoon(finish);
});
registerPopupEventHandler("popupshowing", function () {
registerPopupEventHandler("popupshowing", function() {
ok(false, "prompt showing");
});
registerPopupEventHandler("popupshown", function () {
registerPopupEventHandler("popupshown", function() {
ok(false, "prompt shown");
});
registerPopupEventHandler("popuphidden", function () {
registerPopupEventHandler("popuphidden", function() {
ok(false, "prompt hidden");
});

Просмотреть файл

@ -13,9 +13,9 @@
let testException;
function runTest() {
let w = new SharedWorker('browser_permissionsSharedWorker.js');
let w = new SharedWorker("browser_permissionsSharedWorker.js");
w.port.onmessage = function(e) {
if (e.data.status == 'success') {
if (e.data.status == "success") {
testIsIDBDatabase = e.data.isIDBDatabase;
} else {
testException = e.data.error;

Просмотреть файл

@ -5,12 +5,12 @@ onconnect = function(e) {
var request = indexedDB.open(e.data, { version: 1,
storage: "persistent" });
request.onsuccess = function(event) {
e.target.postMessage({ status: 'success',
e.target.postMessage({ status: "success",
isIDBDatabase: (event.target.result instanceof IDBDatabase) });
}
request.onerror = function(event) {
e.target.postMessage({ status: 'error', error: event.target.error.name });
e.target.postMessage({ status: "error", error: event.target.error.name });
}
}
}

Просмотреть файл

@ -13,9 +13,9 @@
let testException;
function runTest() {
let w = new Worker('browser_permissionsWorker.js');
let w = new Worker("browser_permissionsWorker.js");
w.onmessage = function(e) {
if (e.data.status == 'success') {
if (e.data.status == "success") {
testIsIDBDatabase = e.data.isIDBDatabase;
} else {
testException = e.data.error;

Просмотреть файл

@ -4,11 +4,11 @@ onmessage = function(e) {
var request = indexedDB.open(e.data, { version: 1,
storage: "persistent" });
request.onsuccess = function(event) {
postMessage({ status: 'success',
postMessage({ status: "success",
isIDBDatabase: (event.target.result instanceof IDBDatabase) });
}
request.onerror = function(event) {
postMessage({ status: 'error', error: event.target.error.name });
postMessage({ status: "error", error: event.target.error.name });
}
}

Просмотреть файл

@ -18,7 +18,7 @@ function test()
function test1()
{
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
gBrowser.selectedBrowser.addEventListener("load", function () {
gBrowser.selectedBrowser.addEventListener("load", function() {
if (content.location != testPageURL) {
content.location = testPageURL;
return;
@ -49,7 +49,7 @@ function test2()
function test3(win)
{
win.gBrowser.selectedTab = win.gBrowser.addTab();
win.gBrowser.selectedBrowser.addEventListener("load", function () {
win.gBrowser.selectedBrowser.addEventListener("load", function() {
if (win.content.location != testPageURL) {
win.content.location = testPageURL;
return;

Просмотреть файл

@ -3,7 +3,7 @@
* http://creativecommons.org/publicdomain/zero/1.0/
*/
var { 'classes': Cc, 'interfaces': Ci, 'utils': Cu } = Components;
var { "classes": Cc, "interfaces": Ci, "utils": Cu } = Components;
// testSteps is expected to be defined by the file including this file.
/* global testSteps */

Просмотреть файл

@ -58,7 +58,7 @@
let request = indexedDB.open(window.location.pathname, 1);
request.onerror = errorHandler;
request.onsuccess = unexpectedSuccessHandler;
request.onupgradeneeded = function () {
request.onupgradeneeded = function() {
let transaction = request.transaction;
transaction.oncomplete = unexpectedSuccessHandler;
transaction.onabort = grabEventAndContinueHandler
@ -153,7 +153,7 @@
request.onerror = errorHandler;
request = objectStore.add({}, 1);
request.onsuccess = unexpectedSuccessHandler;
request.onerror = function (event) {
request.onerror = function(event) {
event.preventDefault();
throw "STOP";
};

4
dom/indexedDB/test/extensions/bootstrap.js поставляемый
Просмотреть файл

@ -25,7 +25,7 @@ GlobalObjectsComponent.prototype =
{
QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports]),
runTest: function() {
runTest() {
const name = "Splendid Test";
let ok = this.ok;
@ -48,7 +48,7 @@ GlobalObjectsComponent.prototype =
};
var gFactory = {
register: function() {
register() {
var registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
var classID = Components.ID("{d6f85dcb-537d-447e-b783-75d4b405622d}");

Просмотреть файл

@ -59,12 +59,12 @@ function compareBuffers(buffer1, buffer2)
function getBlob(type, view)
{
return new Blob([view], {type: type});
return new Blob([view], {type});
}
function getFile(name, type, view)
{
return new File([view], name, {type: type});
return new File([view], name, {type});
}
function getRandomBlob(size)

Просмотреть файл

@ -6,7 +6,7 @@
var gActiveListeners = {};
function registerPopupEventHandler(eventName, callback) {
gActiveListeners[eventName] = function (event) {
gActiveListeners[eventName] = function(event) {
if (event.target != PopupNotifications.panel)
return;
PopupNotifications.panel.removeEventListener(eventName,
@ -58,7 +58,7 @@ function triggerSecondaryCommand(popup)
function dismissNotification(popup)
{
info("dismissing notification");
executeSoon(function () {
executeSoon(function() {
EventUtils.synthesizeKey("VK_ESCAPE", {});
});
}

Просмотреть файл

@ -15,8 +15,8 @@ var testGenerator = testSteps();
// Even if the real |Components| doesn't exist, we might shim in a simple JS
// placebo for compat. An easy way to differentiate this from the real thing
// is whether the property is read-only or not.
var c = Object.getOwnPropertyDescriptor(this, 'Components');
if ((!c.value || c.writable) && typeof SpecialPowers === 'object')
var c = Object.getOwnPropertyDescriptor(this, "Components");
if ((!c.value || c.writable) && typeof SpecialPowers === "object")
Components = SpecialPowers.Components;
function executeSoon(aFun)
@ -28,7 +28,7 @@ function executeSoon(aFun)
.mainThread;
thread.dispatch({
run: function() {
run() {
aFun();
}
}, Components.interfaces.nsIThread.DISPATCH_NORMAL);
@ -157,7 +157,7 @@ function* testHarnessSteps() {
break;
case "clearAllDatabases":
clearAllDatabases(function(){
clearAllDatabases(function() {
worker.postMessage({ op: "clearAllDatabasesDone" });
});
break;
@ -296,7 +296,7 @@ function ExpectError(name, preventDefault)
this._preventDefault = preventDefault;
}
ExpectError.prototype = {
handleEvent: function(event)
handleEvent(event)
{
is(event.type, "error", "Got an error event");
is(event.target.error.name, this._name, "Expected error was thrown.");
@ -484,7 +484,7 @@ function workerScript() {
this._preventDefault = _preventDefault_;
}
self.ExpectError.prototype = {
handleEvent: function(_event_)
handleEvent(_event_)
{
is(_event_.type, "error", "Got an error event");
is(_event_.target.error.name, this._name, "Expected error was thrown.");

Просмотреть файл

@ -33,7 +33,7 @@ function madeMod() {
doGet();
document.location = "about:blank";
}
}
</script>
</head>

Просмотреть файл

@ -36,7 +36,7 @@
const BLOB_DATA = ["fun ", "times ", "all ", "around!"];
const INDEX_KEY = 5;
let blob = new Blob(BLOB_DATA, { type: "text/plain" });
let data = { blob: blob, index: INDEX_KEY };
let data = { blob, index: INDEX_KEY };
objectStore = db.transaction("foo", "readwrite").objectStore("foo");
objectStore.add(data).onsuccess = grabEventAndContinueHandler;

Просмотреть файл

@ -28,7 +28,7 @@
let iframe = document.getElementById("iframe1");
window.addEventListener("message", grabEventAndContinueHandler);
// Put it in a different origin to be safe
iframe.src = //"http://example.org" +
iframe.src = // "http://example.org" +
window.location.pathname.replace(
"test_blob_worker_crash.html",
"blob_worker_crash_iframe.html");
@ -47,7 +47,7 @@
yield undefined;
info("If we are still alive, then we win!");
ok('Did not crash / trigger an assert!');
ok("Did not crash / trigger an assert!");
finishTest();
}

Просмотреть файл

@ -78,12 +78,12 @@
var xhr = new XMLHttpRequest();
// We just want to make sure the error case doesn't fire; it's fine for
// us to just want a 404.
xhr.open('POST', 'http://mochi.test:8888/does-not-exist', true);
xhr.open("POST", "http://mochi.test:8888/does-not-exist", true);
xhr.onload = function() {
postMessage({ status: xhr.status });
};
xhr.onerror = function() {
postMessage({ status: 'error' });
postMessage({ status: "error" });
}
xhr.send(blob);
}

Просмотреть файл

@ -78,12 +78,12 @@
var xhr = new XMLHttpRequest();
// We just want to make sure the error case doesn't fire; it's fine for
// us to just want a 404.
xhr.open('POST', 'http://mochi.test:8888/does-not-exist', true);
xhr.open("POST", "http://mochi.test:8888/does-not-exist", true);
xhr.onload = function() {
postMessage({ status: xhr.status });
};
xhr.onerror = function() {
postMessage({ status: 'error' });
postMessage({ status: "error" });
}
xhr.send(compositeBlob);
}

Просмотреть файл

@ -76,8 +76,8 @@
var blob = event.data;
var blobUrl = URL.createObjectURL(blob);
var xhr = new XMLHttpRequest();
xhr.open('GET', blobUrl, true);
xhr.responseType = 'text';
xhr.open("GET", blobUrl, true);
xhr.responseType = "text";
xhr.onload = function() {
postMessage({ data: xhr.response });
URL.revokeObjectURL(blobUrl);

Просмотреть файл

@ -78,8 +78,8 @@
var slicedBlob = blob.slice(0, 3, "text/plain");
var blobUrl = URL.createObjectURL(slicedBlob);
var xhr = new XMLHttpRequest();
xhr.open('GET', blobUrl, true);
xhr.responseType = 'text';
xhr.open("GET", blobUrl, true);
xhr.responseType = "text";
xhr.onload = function() {
postMessage({ data: xhr.response });
URL.revokeObjectURL(blobUrl);

Просмотреть файл

@ -18,7 +18,7 @@
// doing this IDBRequest should not be able to retrieve the filename and
// line number.
SimpleTest.requestFlakyTimeout("untriaged");
setTimeout(indexedDB.deleteDatabase.bind(indexedDB), 0, 'x');
setTimeout(indexedDB.deleteDatabase.bind(indexedDB), 0, "x");
setTimeout(function() {
ok(true, "Still alive");
SimpleTest.finish();

Просмотреть файл

@ -91,7 +91,7 @@
// them up. We clobber our existing content, then trigger deletion to
// clean up after it.
SpecialPowers.createFiles(
[{ name: fileRelPath, data: '' }],
[{ name: fileRelPath, data: "" }],
grabEventAndContinueHandler, errorCallbackHandler);
yield undefined;
// This is async without a callback because it's intended for cleanup.

Просмотреть файл

@ -34,11 +34,11 @@
request = mutableFile.getFile();
ok(request instanceof DOMRequest, "Correct interface");
ok(!(request instanceof IDBFileRequest), "Correct interface");
ok(!('fileHandle' in request), "Property should not exist");
ok(!("fileHandle" in request), "Property should not exist");
ok(request.fileHandle === undefined, "Property should not exist");
ok(!('lockedFile' in request), "Property should not exist");
ok(!("lockedFile" in request), "Property should not exist");
ok(request.lockedFile === undefined, "Property should not exist");
ok(!('onprogress' in request), "Property should not exist");
ok(!("onprogress" in request), "Property should not exist");
ok(request.onprogress === undefined, "Property should not exist");
finishTest();

Просмотреть файл

@ -56,7 +56,7 @@
}
stepNumber++;
yield undefined; yield undefined; yield undefined;;
yield undefined; yield undefined; yield undefined;
is(stepNumber, 4, "All callbacks received");
}

Просмотреть файл

@ -47,7 +47,7 @@
function dummyWorkerScript() {
/* eslint-env worker */
onmessage = function(event) {
throw("Shouldn't be called!");
throw ("Shouldn't be called!");
}
}

Просмотреть файл

@ -30,15 +30,15 @@ function childFrameScript() {
Cu.importGlobalProperties(["indexedDB"]);
function info(msg) {
sendAsyncMessage(mmName, { op: "info", msg: msg });
sendAsyncMessage(mmName, { op: "info", msg });
}
function ok(condition, name, diag) {
sendAsyncMessage(mmName,
{ op: "ok",
condition: condition,
name: name,
diag: diag });
condition,
name,
diag });
}
function is(a, b, name) {
@ -48,7 +48,7 @@ function childFrameScript() {
}
function finish(result) {
sendAsyncMessage(mmName, { op: "done", result: result });
sendAsyncMessage(mmName, { op: "done", result });
}
function grabAndContinue(arg) {

Просмотреть файл

@ -21,7 +21,7 @@
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) {
@ -30,8 +30,8 @@
}
for (let storage of storages) {
let request = indexedDB.open(name, { version: version,
storage: storage });
let request = indexedDB.open(name, { version,
storage });
if (storage == "persistent" &&
SpecialPowers.Services.appinfo.widgetToolkit == "android") {

Просмотреть файл

@ -14,10 +14,10 @@ SimpleTest.waitForExplicitFinish();
// The intent being to show that the data store is the same.
function storeValue() {
function createDB_inner() {
var op = indexedDB.open('db');
var op = indexedDB.open("db");
op.onupgradeneeded = e => {
var db = e.target.result;
db.createObjectStore('store');
db.createObjectStore("store");
};
return new Promise(resolve => {
op.onsuccess = e => resolve(e.target.result);
@ -26,8 +26,8 @@ function storeValue() {
function add(k, v) {
return createDB_inner().then(db => {
var tx = db.transaction('store', 'readwrite');
var store = tx.objectStore('store');
var tx = db.transaction("store", "readwrite");
var store = tx.objectStore("store");
var op = store.add(v, k);
return new Promise((resolve, reject) => {
op.onsuccess = e => resolve(e.target.result);
@ -37,17 +37,17 @@ function storeValue() {
});
}
return add('x', [ 10, {} ])
return add("x", [ 10, {} ])
.then(_ => step_done(),
_ => ok(false, 'failed to store'));
_ => ok(false, "failed to store"));
}
function createDB_outer() {
var op = indexedDB.open('db');
var op = indexedDB.open("db");
op.onupgradeneeded = e => {
ok(false, 'upgrade should not be needed');
ok(false, "upgrade should not be needed");
var db = e.target.result;
db.createObjectStore('store');
db.createObjectStore("store");
};
return new Promise(resolve => {
op.onsuccess = e => resolve(e.target.result);
@ -56,8 +56,8 @@ function createDB_outer() {
function get(k) {
return createDB_outer().then(db => {
var tx = db.transaction('store', 'readonly');
var store = tx.objectStore('store');
var tx = db.transaction("store", "readonly");
var store = tx.objectStore("store");
var op = store.get(k);
return new Promise((resolve, reject) => {
op.onsuccess = e => resolve(e.target.result);
@ -68,32 +68,32 @@ function get(k) {
}
function runInSandbox(sandbox, testFunc) {
is(typeof testFunc, 'function');
is(typeof testFunc, "function");
var resolvePromise;
// Step-done is defined in the sandbox and used in the add() function above.
/* global step_done */
var testPromise = new Promise(r => resolvePromise = r);
SpecialPowers.Cu.exportFunction(_ => resolvePromise(), sandbox,
{ defineAs: 'step_done' });
SpecialPowers.Cu.evalInSandbox('(' + testFunc.toSource() + ')()' +
'.then(step_done);', sandbox);
{ defineAs: "step_done" });
SpecialPowers.Cu.evalInSandbox("(" + testFunc.toSource() + ")()" +
".then(step_done);", sandbox);
return testPromise;
}
// Use the window principal for the sandbox; location.origin is not sufficient.
var sb = new SpecialPowers.Cu.Sandbox(window,
{ wantGlobalProperties: ['indexedDB'] });
{ wantGlobalProperties: ["indexedDB"] });
sb.ok = SpecialPowers.Cu.exportFunction(ok, sb);
Promise.resolve()
.then(_ => runInSandbox(sb, storeValue))
.then(_ => get('x'))
.then(_ => get("x"))
.then(x => {
ok(x, 'a value should be present');
ok(x, "a value should be present");
is(x.length, 2);
is(x[0], 10);
is(typeof x[1], 'object');
is(typeof x[1], "object");
is(Object.keys(x[1]).length, 0);
})
.then(_ => SimpleTest.finish());

Просмотреть файл

@ -62,7 +62,7 @@
iframe.addEventListener("load", iframeLoaded);
}
SpecialPowers.pushPrefEnv({
'set': [["network.cookie.cookieBehavior", testData[testIndex].cookieBehavior]]
"set": [["network.cookie.cookieBehavior", testData[testIndex].cookieBehavior]]
}, () => {
iframe.src = testData[testIndex].host + iframe1Path;
});