From 9b94f1132fe58ec7b0b1f4de1a2f9ccaf5c70e92 Mon Sep 17 00:00:00 2001 From: Dave Townsend Date: Thu, 3 Dec 2015 10:00:06 -0800 Subject: [PATCH] Bug 1229519: Fix toolkit/components/contentprefs to pass eslint checks. r=mconley --- .../contentprefs/nsContentPrefService.js | 4 +++- .../tests/unit_cps2/AsyncRunner.jsm | 23 ++++++++---------- .../contentprefs/tests/unit_cps2/head.js | 10 ++++---- .../tests/unit_cps2/test_getCached.js | 14 +++++------ .../unit_cps2/test_getCachedSubdomains.js | 24 +++++++++---------- .../tests/unit_cps2/test_getSubdomains.js | 12 +++++----- .../unit_cps2/test_migrationToSchema4.js | 2 +- .../tests/unit_cps2/test_observers.js | 14 +++++------ .../tests/unit_cps2/test_remove.js | 18 +++++++------- .../tests/unit_cps2/test_removeAllDomains.js | 10 ++++---- .../unit_cps2/test_removeAllDomainsSince.js | 12 +++++----- .../tests/unit_cps2/test_removeByDomain.js | 18 +++++++------- .../tests/unit_cps2/test_removeByName.js | 10 ++++---- .../tests/unit_cps2/test_setGet.js | 20 ++++++++-------- 14 files changed, 95 insertions(+), 96 deletions(-) diff --git a/toolkit/components/contentprefs/nsContentPrefService.js b/toolkit/components/contentprefs/nsContentPrefService.js index b8b54ed7aa3..7c9da9493da 100644 --- a/toolkit/components/contentprefs/nsContentPrefService.js +++ b/toolkit/components/contentprefs/nsContentPrefService.js @@ -1070,7 +1070,9 @@ ContentPrefService.prototype = { } // If the connection isn't ready after we open the database, that means // the database has been corrupted, so we back it up and then recreate it. - catch (e if e.result == Cr.NS_ERROR_FILE_CORRUPTED) { + catch (e) { + if (e.result != Cr.NS_ERROR_FILE_CORRUPTED) + throw e; dbConnection = this._dbBackUpAndRecreate(dbService, dbFile, dbConnection); } diff --git a/toolkit/components/contentprefs/tests/unit_cps2/AsyncRunner.jsm b/toolkit/components/contentprefs/tests/unit_cps2/AsyncRunner.jsm index f7af9a72a16..ac878c28cd7 100644 --- a/toolkit/components/contentprefs/tests/unit_cps2/AsyncRunner.jsm +++ b/toolkit/components/contentprefs/tests/unit_cps2/AsyncRunner.jsm @@ -24,23 +24,20 @@ AsyncRunner.prototype = { this._iteratorQueue.push(iter); }, - next: function AR_next(/* ... */) { + next: function AR_next(arg) { if (!this._iteratorQueue.length) { this.destroy(); this._callbacks.done(); return; } - // send() discards all arguments after the first, so there's no choice here - // but to send only one argument to the yielder. - let args = [arguments.length <= 1 ? arguments[0] : Array.slice(arguments)]; try { - var val = this._iteratorQueue[0].send.apply(this._iteratorQueue[0], args); - } - catch (err if err instanceof StopIteration) { - this._iteratorQueue.shift(); - this.next(); - return; + var { done, value } = this._iteratorQueue[0].next(arg); + if (done) { + this._iteratorQueue.shift(); + this.next(); + return; + } } catch (err) { this._callbacks.error(err); @@ -48,9 +45,9 @@ AsyncRunner.prototype = { // val is truthy => call next // val is an iterator => prepend it to the queue and start on it - if (val) { - if (typeof(val) != "boolean") - this._iteratorQueue.unshift(val); + if (value) { + if (typeof(value) != "boolean") + this._iteratorQueue.unshift(value); this.next(); } }, diff --git a/toolkit/components/contentprefs/tests/unit_cps2/head.js b/toolkit/components/contentprefs/tests/unit_cps2/head.js index 6b74808730f..b86abe208a3 100644 --- a/toolkit/components/contentprefs/tests/unit_cps2/head.js +++ b/toolkit/components/contentprefs/tests/unit_cps2/head.js @@ -62,7 +62,7 @@ function runAsyncTests(tests, dontResetBefore = false) { }); tests.forEach(function (test) { - function gen() { + function* gen() { do_print("Running " + test.name); yield test(); yield reset(); @@ -196,7 +196,7 @@ function prefOK(actual, expected, strict) { equal(actual.value, expected.value); } -function getOK(args, expectedVal, expectedGroup, strict) { +function* getOK(args, expectedVal, expectedGroup, strict) { if (args.length == 2) args.push(undefined); let expectedPrefs = expectedVal === undefined ? [] : @@ -206,7 +206,7 @@ function getOK(args, expectedVal, expectedGroup, strict) { yield getOKEx("getByDomainAndName", args, expectedPrefs, strict); } -function getSubdomainsOK(args, expectedGroupValPairs) { +function* getSubdomainsOK(args, expectedGroupValPairs) { if (args.length == 2) args.push(undefined); let expectedPrefs = expectedGroupValPairs.map(function ([group, val]) { @@ -215,7 +215,7 @@ function getSubdomainsOK(args, expectedGroupValPairs) { yield getOKEx("getBySubdomainAndName", args, expectedPrefs); } -function getGlobalOK(args, expectedVal) { +function* getGlobalOK(args, expectedVal) { if (args.length == 1) args.push(undefined); let expectedPrefs = expectedVal === undefined ? [] : @@ -223,7 +223,7 @@ function getGlobalOK(args, expectedVal) { yield getOKEx("getGlobal", args, expectedPrefs); } -function getOKEx(methodName, args, expectedPrefs, strict, context) { +function* getOKEx(methodName, args, expectedPrefs, strict, context) { let actualPrefs = []; args.push(makeCallback({ handleResult: pref => actualPrefs.push(pref) diff --git a/toolkit/components/contentprefs/tests/unit_cps2/test_getCached.js b/toolkit/components/contentprefs/tests/unit_cps2/test_getCached.js index 980bb66f54c..33a965b7f7f 100644 --- a/toolkit/components/contentprefs/tests/unit_cps2/test_getCached.js +++ b/toolkit/components/contentprefs/tests/unit_cps2/test_getCached.js @@ -8,19 +8,19 @@ function run_test() { var tests = [ - function nonexistent() { + function* nonexistent() { getCachedOK(["a.com", "foo"], false, undefined); getCachedGlobalOK(["foo"], false, undefined); yield true; }, - function isomorphicDomains() { + function* isomorphicDomains() { yield set("a.com", "foo", 1); getCachedOK(["a.com", "foo"], true, 1); getCachedOK(["http://a.com/huh", "foo"], true, 1, "a.com"); }, - function names() { + function* names() { yield set("a.com", "foo", 1); getCachedOK(["a.com", "foo"], true, 1); @@ -40,14 +40,14 @@ var tests = [ getCachedGlobalOK(["bar"], true, 4); }, - function subdomains() { + function* subdomains() { yield set("a.com", "foo", 1); yield set("b.a.com", "foo", 2); getCachedOK(["a.com", "foo"], true, 1); getCachedOK(["b.a.com", "foo"], true, 2); }, - function privateBrowsing() { + function* privateBrowsing() { yield set("a.com", "foo", 1); yield set("a.com", "bar", 2); yield setGlobal("foo", 3); @@ -70,7 +70,7 @@ var tests = [ getCachedOK(["b.com", "foo"], true, 5); }, - function erroneous() { + function* erroneous() { do_check_throws(() => cps.getCachedByDomainAndName(null, "foo", null)); do_check_throws(() => cps.getCachedByDomainAndName("", "foo", null)); do_check_throws(() => cps.getCachedByDomainAndName("a.com", "", null)); @@ -80,7 +80,7 @@ var tests = [ yield true; }, - function casts() { + function* casts() { // SQLite casts booleans to integers. This makes sure the values stored in // the cache are the same as the casted values in the database. diff --git a/toolkit/components/contentprefs/tests/unit_cps2/test_getCachedSubdomains.js b/toolkit/components/contentprefs/tests/unit_cps2/test_getCachedSubdomains.js index ff2b3e14e57..9f2599708fe 100644 --- a/toolkit/components/contentprefs/tests/unit_cps2/test_getCachedSubdomains.js +++ b/toolkit/components/contentprefs/tests/unit_cps2/test_getCachedSubdomains.js @@ -8,18 +8,18 @@ function run_test() { var tests = [ - function nonexistent() { + function* nonexistent() { getCachedSubdomainsOK(["a.com", "foo"], []); yield true; }, - function isomorphicDomains() { + function* isomorphicDomains() { yield set("a.com", "foo", 1); getCachedSubdomainsOK(["a.com", "foo"], [["a.com", 1]]); getCachedSubdomainsOK(["http://a.com/huh", "foo"], [["a.com", 1]]); }, - function names() { + function* names() { yield set("a.com", "foo", 1); getCachedSubdomainsOK(["a.com", "foo"], [["a.com", 1]]); @@ -39,14 +39,14 @@ var tests = [ getCachedGlobalOK(["bar"], true, 4); }, - function subdomains() { + function* subdomains() { yield set("a.com", "foo", 1); yield set("b.a.com", "foo", 2); getCachedSubdomainsOK(["a.com", "foo"], [["a.com", 1], ["b.a.com", 2]]); getCachedSubdomainsOK(["b.a.com", "foo"], [["b.a.com", 2]]); }, - function populateViaGet() { + function* populateViaGet() { yield cps.getByDomainAndName("a.com", "foo", null, makeCallback()); getCachedSubdomainsOK(["a.com", "foo"], [["a.com", undefined]]); @@ -55,12 +55,12 @@ var tests = [ getCachedGlobalOK(["foo"], true, undefined); }, - function populateViaGetSubdomains() { + function* populateViaGetSubdomains() { yield cps.getBySubdomainAndName("a.com", "foo", null, makeCallback()); getCachedSubdomainsOK(["a.com", "foo"], [["a.com", undefined]]); }, - function populateViaRemove() { + function* populateViaRemove() { yield cps.removeByDomainAndName("a.com", "foo", null, makeCallback()); getCachedSubdomainsOK(["a.com", "foo"], [["a.com", undefined]]); @@ -97,7 +97,7 @@ var tests = [ getCachedSubdomainsOK(["b.a.com", "foo"], [["b.a.com", undefined]]); }, - function populateViaRemoveByDomain() { + function* populateViaRemoveByDomain() { yield set("a.com", "foo", 1); yield set("a.com", "bar", 2); yield set("b.a.com", "foo", 3); @@ -123,7 +123,7 @@ var tests = [ getCachedGlobalOK(["bar"], true, undefined); }, - function populateViaRemoveAllDomains() { + function* populateViaRemoveAllDomains() { yield set("a.com", "foo", 1); yield set("a.com", "bar", 2); yield set("b.com", "foo", 3); @@ -135,7 +135,7 @@ var tests = [ getCachedSubdomainsOK(["b.com", "bar"], [["b.com", undefined]]); }, - function populateViaRemoveByName() { + function* populateViaRemoveByName() { yield set("a.com", "foo", 1); yield set("a.com", "bar", 2); yield setGlobal("foo", 3); @@ -153,7 +153,7 @@ var tests = [ getCachedGlobalOK(["bar"], true, undefined); }, - function privateBrowsing() { + function* privateBrowsing() { yield set("a.com", "foo", 1); yield set("a.com", "bar", 2); yield setGlobal("foo", 3); @@ -176,7 +176,7 @@ var tests = [ getCachedSubdomainsOK(["b.com", "foo"], [["b.com", 5]]); }, - function erroneous() { + function* erroneous() { do_check_throws(() => cps.getCachedBySubdomainAndName(null, "foo", null)); do_check_throws(() => cps.getCachedBySubdomainAndName("", "foo", null)); do_check_throws(() => cps.getCachedBySubdomainAndName("a.com", "", null)); diff --git a/toolkit/components/contentprefs/tests/unit_cps2/test_getSubdomains.js b/toolkit/components/contentprefs/tests/unit_cps2/test_getSubdomains.js index 344039f7ece..d08d6fe695b 100644 --- a/toolkit/components/contentprefs/tests/unit_cps2/test_getSubdomains.js +++ b/toolkit/components/contentprefs/tests/unit_cps2/test_getSubdomains.js @@ -8,17 +8,17 @@ function run_test() { var tests = [ - function get_nonexistent() { + function* get_nonexistent() { yield getSubdomainsOK(["a.com", "foo"], []); }, - function isomorphicDomains() { + function* isomorphicDomains() { yield set("a.com", "foo", 1); yield getSubdomainsOK(["a.com", "foo"], [["a.com", 1]]); yield getSubdomainsOK(["http://a.com/huh", "foo"], [["a.com", 1]]); }, - function names() { + function* names() { yield set("a.com", "foo", 1); yield getSubdomainsOK(["a.com", "foo"], [["a.com", 1]]); @@ -31,14 +31,14 @@ var tests = [ yield getSubdomainsOK(["a.com", "bar"], [["a.com", 2]]); }, - function subdomains() { + function* subdomains() { yield set("a.com", "foo", 1); yield set("b.a.com", "foo", 2); yield getSubdomainsOK(["a.com", "foo"], [["a.com", 1], ["b.a.com", 2]]); yield getSubdomainsOK(["b.a.com", "foo"], [["b.a.com", 2]]); }, - function privateBrowsing() { + function* privateBrowsing() { yield set("a.com", "foo", 1); yield set("a.com", "bar", 2); yield setGlobal("foo", 3); @@ -57,7 +57,7 @@ var tests = [ yield getSubdomainsOK(["b.com", "foo"], [["b.com", 5]]); }, - function erroneous() { + function* erroneous() { do_check_throws(() => cps.getBySubdomainAndName(null, "foo", null, {})); do_check_throws(() => cps.getBySubdomainAndName("", "foo", null, {})); do_check_throws(() => cps.getBySubdomainAndName("a.com", "", null, {})); diff --git a/toolkit/components/contentprefs/tests/unit_cps2/test_migrationToSchema4.js b/toolkit/components/contentprefs/tests/unit_cps2/test_migrationToSchema4.js index e9b1c6bfca8..85d23e35581 100644 --- a/toolkit/components/contentprefs/tests/unit_cps2/test_migrationToSchema4.js +++ b/toolkit/components/contentprefs/tests/unit_cps2/test_migrationToSchema4.js @@ -55,7 +55,7 @@ function run_test() { // the fact that we ContentPrefService constructor is run only once per test file // and so migration will be run only once. var tests = [ - function testMigration() { + function* testMigration() { // Test migrated db content. schemaVersionIs(4); let dbExpectedState = [ diff --git a/toolkit/components/contentprefs/tests/unit_cps2/test_observers.js b/toolkit/components/contentprefs/tests/unit_cps2/test_observers.js index 3e3fde215d6..721d6677949 100644 --- a/toolkit/components/contentprefs/tests/unit_cps2/test_observers.js +++ b/toolkit/components/contentprefs/tests/unit_cps2/test_observers.js @@ -8,7 +8,7 @@ function run_test() { var tests = [ - function observerForName_set() { + function* observerForName_set() { yield set("a.com", "foo", 1); let args = yield on("Set", ["foo", null, "bar"]); observerArgsOK(args.foo, [["a.com", "foo", 1]]); @@ -22,7 +22,7 @@ var tests = [ observerArgsOK(args.bar, []); }, - function observerForName_remove() { + function* observerForName_remove() { yield set("a.com", "foo", 1); yield setGlobal("foo", 2); @@ -45,7 +45,7 @@ var tests = [ observerArgsOK(args.bar, []); }, - function observerForName_removeByDomain() { + function* observerForName_removeByDomain() { yield set("a.com", "foo", 1); yield set("b.a.com", "bar", 2); yield setGlobal("foo", 3); @@ -69,7 +69,7 @@ var tests = [ observerArgsOK(args.bar, []); }, - function observerForName_removeAllDomainsSince() { + function* observerForName_removeAllDomainsSince() { yield setWithDate("a.com", "foo", 1, 100); yield setWithDate("b.com", "foo", 2, 200); yield setWithDate("c.com", "foo", 3, 300); @@ -88,7 +88,7 @@ var tests = [ observerArgsOK(args.null, [["b.com", "foo"], ["c.com", "bar"], ["c.com", "foo"]]); }, - function observerForName_removeAllDomains() { + function* observerForName_removeAllDomains() { yield set("a.com", "foo", 1); yield setGlobal("foo", 2); yield set("b.com", "bar", 3); @@ -100,7 +100,7 @@ var tests = [ observerArgsOK(args.bar, [["b.com", "bar"]]); }, - function observerForName_removeByName() { + function* observerForName_removeByName() { yield set("a.com", "foo", 1); yield set("a.com", "bar", 2); yield setGlobal("foo", 3); @@ -118,7 +118,7 @@ var tests = [ observerArgsOK(args.bar, []); }, - function removeObserverForName() { + function* removeObserverForName() { let args = yield on("Set", ["foo", null, "bar"], true); cps.removeObserverForName("foo", args.foo.observer); diff --git a/toolkit/components/contentprefs/tests/unit_cps2/test_remove.js b/toolkit/components/contentprefs/tests/unit_cps2/test_remove.js index 261ef9a69f4..9853293fc76 100644 --- a/toolkit/components/contentprefs/tests/unit_cps2/test_remove.js +++ b/toolkit/components/contentprefs/tests/unit_cps2/test_remove.js @@ -8,7 +8,7 @@ function run_test() { var tests = [ - function nonexistent() { + function* nonexistent() { yield set("a.com", "foo", 1); yield setGlobal("foo", 2); @@ -45,7 +45,7 @@ var tests = [ yield getGlobalOK(["foo"], 2); }, - function isomorphicDomains() { + function* isomorphicDomains() { yield set("a.com", "foo", 1); yield cps.removeByDomainAndName("a.com", "foo", null, makeCallback()); yield dbOK([]); @@ -58,7 +58,7 @@ var tests = [ yield getOK(["a.com", "foo"], undefined); }, - function names() { + function* names() { yield set("a.com", "foo", 1); yield set("a.com", "bar", 2); yield setGlobal("foo", 3); @@ -103,7 +103,7 @@ var tests = [ yield getGlobalOK(["bar"], undefined); }, - function subdomains() { + function* subdomains() { yield set("a.com", "foo", 1); yield set("b.a.com", "foo", 2); yield cps.removeByDomainAndName("a.com", "foo", null, makeCallback()); @@ -138,7 +138,7 @@ var tests = [ yield getSubdomainsOK(["b.a.com", "foo"], []); }, - function privateBrowsing() { + function* privateBrowsing() { yield set("a.com", "foo", 1); yield set("a.com", "bar", 2); yield setGlobal("foo", 3); @@ -176,7 +176,7 @@ var tests = [ yield getOK(["b.com", "bar"], 7); }, - function erroneous() { + function* erroneous() { do_check_throws(() => cps.removeByDomainAndName(null, "foo", null)); do_check_throws(() => cps.removeByDomainAndName("", "foo", null)); do_check_throws(() => cps.removeByDomainAndName("a.com", "foo", null, @@ -192,7 +192,7 @@ var tests = [ yield true; }, - function removeByDomainAndName_invalidateCache() { + function* removeByDomainAndName_invalidateCache() { yield set("a.com", "foo", 1); getCachedOK(["a.com", "foo"], true, 1); cps.removeByDomainAndName("a.com", "foo", null, makeCallback()); @@ -200,7 +200,7 @@ var tests = [ yield; }, - function removeBySubdomainAndName_invalidateCache() { + function* removeBySubdomainAndName_invalidateCache() { yield set("a.com", "foo", 1); yield set("b.a.com", "foo", 2); getCachedSubdomainsOK(["a.com", "foo"], [ @@ -212,7 +212,7 @@ var tests = [ yield; }, - function removeGlobal_invalidateCache() { + function* removeGlobal_invalidateCache() { yield setGlobal("foo", 1); getCachedGlobalOK(["foo"], true, 1); cps.removeGlobal("foo", null, makeCallback()); diff --git a/toolkit/components/contentprefs/tests/unit_cps2/test_removeAllDomains.js b/toolkit/components/contentprefs/tests/unit_cps2/test_removeAllDomains.js index bc6bc9e139e..63e1b0552eb 100644 --- a/toolkit/components/contentprefs/tests/unit_cps2/test_removeAllDomains.js +++ b/toolkit/components/contentprefs/tests/unit_cps2/test_removeAllDomains.js @@ -8,7 +8,7 @@ function run_test() { var tests = [ - function nonexistent() { + function* nonexistent() { yield setGlobal("foo", 1); yield cps.removeAllDomains(null, makeCallback()); yield dbOK([ @@ -17,7 +17,7 @@ var tests = [ yield getGlobalOK(["foo"], 1); }, - function domains() { + function* domains() { yield set("a.com", "foo", 1); yield set("a.com", "bar", 2); yield setGlobal("foo", 3); @@ -38,7 +38,7 @@ var tests = [ yield getOK(["b.com", "bar"], undefined); }, - function privateBrowsing() { + function* privateBrowsing() { yield set("a.com", "foo", 1); yield set("a.com", "bar", 2); yield setGlobal("foo", 3); @@ -66,12 +66,12 @@ var tests = [ yield getOK(["b.com", "foo"], undefined); }, - function erroneous() { + function* erroneous() { do_check_throws(() => cps.removeAllDomains(null, "bogus")); yield true; }, - function invalidateCache() { + function* invalidateCache() { yield set("a.com", "foo", 1); yield set("b.com", "bar", 2); yield setGlobal("baz", 3); diff --git a/toolkit/components/contentprefs/tests/unit_cps2/test_removeAllDomainsSince.js b/toolkit/components/contentprefs/tests/unit_cps2/test_removeAllDomainsSince.js index 33f9f8ab793..fa0bf31c37b 100644 --- a/toolkit/components/contentprefs/tests/unit_cps2/test_removeAllDomainsSince.js +++ b/toolkit/components/contentprefs/tests/unit_cps2/test_removeAllDomainsSince.js @@ -8,13 +8,13 @@ function run_test() { var tests = [ - function nonexistent() { + function* nonexistent() { yield setGlobal("foo", 1); yield cps.removeAllDomainsSince(0, null, makeCallback()); yield getGlobalOK(["foo"], 1); }, - function domainsAll() { + function* domainsAll() { yield set("a.com", "foo", 1); yield set("a.com", "bar", 2); yield setGlobal("foo", 3); @@ -35,7 +35,7 @@ var tests = [ yield getOK(["b.com", "bar"], undefined); }, - function domainsWithDate() { + function* domainsWithDate() { yield setWithDate("a.com", "foobar", 0, 0); yield setWithDate("a.com", "foo", 1, 1000); yield setWithDate("a.com", "bar", 2, 4000); @@ -55,7 +55,7 @@ var tests = [ ]); }, - function privateBrowsing() { + function* privateBrowsing() { yield set("a.com", "foo", 1); yield set("a.com", "bar", 2); yield setGlobal("foo", 3); @@ -83,12 +83,12 @@ var tests = [ yield getOK(["b.com", "foo"], undefined); }, - function erroneous() { + function* erroneous() { do_check_throws(() => cps.removeAllDomainsSince(null, "bogus")); yield true; }, - function invalidateCache() { + function* invalidateCache() { yield setWithDate("a.com", "foobar", 0, 0); yield setWithDate("a.com", "foo", 1, 1000); yield setWithDate("a.com", "bar", 2, 4000); diff --git a/toolkit/components/contentprefs/tests/unit_cps2/test_removeByDomain.js b/toolkit/components/contentprefs/tests/unit_cps2/test_removeByDomain.js index a1861be0a97..e9ed2fbe216 100644 --- a/toolkit/components/contentprefs/tests/unit_cps2/test_removeByDomain.js +++ b/toolkit/components/contentprefs/tests/unit_cps2/test_removeByDomain.js @@ -8,7 +8,7 @@ function run_test() { var tests = [ - function nonexistent() { + function* nonexistent() { yield set("a.com", "foo", 1); yield setGlobal("foo", 2); @@ -29,7 +29,7 @@ var tests = [ yield getGlobalOK(["foo"], 2); }, - function isomorphicDomains() { + function* isomorphicDomains() { yield set("a.com", "foo", 1); yield cps.removeByDomain("a.com", null, makeCallback()); yield dbOK([]); @@ -41,7 +41,7 @@ var tests = [ yield getOK(["a.com", "foo"], undefined); }, - function domains() { + function* domains() { yield set("a.com", "foo", 1); yield set("a.com", "bar", 2); yield setGlobal("foo", 3); @@ -86,7 +86,7 @@ var tests = [ yield getOK(["b.com", "bar"], undefined); }, - function subdomains() { + function* subdomains() { yield set("a.com", "foo", 1); yield set("b.a.com", "foo", 2); yield cps.removeByDomain("a.com", null, makeCallback()); @@ -121,7 +121,7 @@ var tests = [ yield getSubdomainsOK(["b.a.com", "foo"], []); }, - function privateBrowsing() { + function* privateBrowsing() { yield set("a.com", "foo", 1); yield set("a.com", "bar", 2); yield setGlobal("foo", 3); @@ -149,7 +149,7 @@ var tests = [ yield getOK(["b.com", "foo"], 5); }, - function erroneous() { + function* erroneous() { do_check_throws(() => cps.removeByDomain(null, null)); do_check_throws(() => cps.removeByDomain("", null)); do_check_throws(() => cps.removeByDomain("a.com", null, "bogus")); @@ -160,7 +160,7 @@ var tests = [ yield true; }, - function removeByDomain_invalidateCache() { + function* removeByDomain_invalidateCache() { yield set("a.com", "foo", 1); yield set("a.com", "bar", 2); getCachedOK(["a.com", "foo"], true, 1); @@ -171,7 +171,7 @@ var tests = [ yield; }, - function removeBySubdomain_invalidateCache() { + function* removeBySubdomain_invalidateCache() { yield set("a.com", "foo", 1); yield set("b.a.com", "foo", 2); getCachedSubdomainsOK(["a.com", "foo"], [ @@ -183,7 +183,7 @@ var tests = [ yield; }, - function removeAllGlobals_invalidateCache() { + function* removeAllGlobals_invalidateCache() { yield setGlobal("foo", 1); yield setGlobal("bar", 2); getCachedGlobalOK(["foo"], true, 1); diff --git a/toolkit/components/contentprefs/tests/unit_cps2/test_removeByName.js b/toolkit/components/contentprefs/tests/unit_cps2/test_removeByName.js index 96829d1463b..fa04656e25c 100644 --- a/toolkit/components/contentprefs/tests/unit_cps2/test_removeByName.js +++ b/toolkit/components/contentprefs/tests/unit_cps2/test_removeByName.js @@ -8,7 +8,7 @@ function run_test() { var tests = [ - function nonexistent() { + function* nonexistent() { yield set("a.com", "foo", 1); yield setGlobal("foo", 2); @@ -21,7 +21,7 @@ var tests = [ yield getGlobalOK(["foo"], 2); }, - function names() { + function* names() { yield set("a.com", "foo", 1); yield set("a.com", "bar", 2); yield setGlobal("foo", 3); @@ -43,7 +43,7 @@ var tests = [ yield getOK(["b.com", "bar"], 6); }, - function privateBrowsing() { + function* privateBrowsing() { yield set("a.com", "foo", 1); yield set("a.com", "bar", 2); yield setGlobal("foo", 3); @@ -76,14 +76,14 @@ var tests = [ yield getOK(["b.com", "bar"], undefined); }, - function erroneous() { + function* erroneous() { do_check_throws(() => cps.removeByName("", null)); do_check_throws(() => cps.removeByName(null, null)); do_check_throws(() => cps.removeByName("foo", null, "bogus")); yield true; }, - function invalidateCache() { + function* invalidateCache() { yield set("a.com", "foo", 1); yield set("b.com", "foo", 2); getCachedOK(["a.com", "foo"], true, 1); diff --git a/toolkit/components/contentprefs/tests/unit_cps2/test_setGet.js b/toolkit/components/contentprefs/tests/unit_cps2/test_setGet.js index 56f44b0ceb7..b10a05bbc27 100644 --- a/toolkit/components/contentprefs/tests/unit_cps2/test_setGet.js +++ b/toolkit/components/contentprefs/tests/unit_cps2/test_setGet.js @@ -8,12 +8,12 @@ function run_test() { var tests = [ - function get_nonexistent() { + function* get_nonexistent() { yield getOK(["a.com", "foo"], undefined); yield getGlobalOK(["foo"], undefined); }, - function isomorphicDomains() { + function* isomorphicDomains() { yield set("a.com", "foo", 1); yield dbOK([ ["a.com", "foo", 1], @@ -29,7 +29,7 @@ var tests = [ yield getOK(["http://a.com/yeah", "foo"], 2, "a.com"); }, - function names() { + function* names() { yield set("a.com", "foo", 1); yield dbOK([ ["a.com", "foo", 1], @@ -67,7 +67,7 @@ var tests = [ yield getGlobalOK(["bar"], 4); }, - function subdomains() { + function* subdomains() { yield set("a.com", "foo", 1); yield set("b.a.com", "foo", 2); yield dbOK([ @@ -78,7 +78,7 @@ var tests = [ yield getOK(["b.a.com", "foo"], 2); }, - function privateBrowsing() { + function* privateBrowsing() { yield set("a.com", "foo", 1); yield set("a.com", "bar", 2); yield setGlobal("foo", 3); @@ -108,7 +108,7 @@ var tests = [ yield getOK(["b.com", "foo"], 5); }, - function set_erroneous() { + function* set_erroneous() { do_check_throws(() => cps.set(null, "foo", 1, null)); do_check_throws(() => cps.set("", "foo", 1, null)); do_check_throws(() => cps.set("a.com", "", 1, null)); @@ -122,7 +122,7 @@ var tests = [ yield true; }, - function get_erroneous() { + function* get_erroneous() { do_check_throws(() => cps.getByDomainAndName(null, "foo", null, {})); do_check_throws(() => cps.getByDomainAndName("", "foo", null, {})); do_check_throws(() => cps.getByDomainAndName("a.com", "", null, {})); @@ -134,7 +134,7 @@ var tests = [ yield true; }, - function set_invalidateCache() { + function* set_invalidateCache() { // (1) Set a pref and wait for it to finish. yield set("a.com", "foo", 1); @@ -169,7 +169,7 @@ var tests = [ yield; }, - function get_nameOnly() { + function* get_nameOnly() { yield set("a.com", "foo", 1); yield set("a.com", "bar", 2); yield set("b.com", "foo", 3); @@ -191,7 +191,7 @@ var tests = [ ]); }, - function setSetsCurrentDate() { + function* setSetsCurrentDate() { // Because Date.now() is not guaranteed to be monotonically increasing // we just do here rough sanity check with one minute tolerance. const MINUTE = 60 * 1000;