diff --git a/browser/components/migration/ChromeProfileMigrator.js b/browser/components/migration/ChromeProfileMigrator.js index e6e0b94cd430..6f3cefd69d19 100644 --- a/browser/components/migration/ChromeProfileMigrator.js +++ b/browser/components/migration/ChromeProfileMigrator.js @@ -378,8 +378,7 @@ function GetCookiesResource(aProfileFolder) { row.getResultByName("secure"), row.getResultByName("httponly"), false, - parseInt(expiresUtc), - {}); + parseInt(expiresUtc)); } catch (e) { Cu.reportError(e); } diff --git a/browser/components/migration/MSMigrationUtils.jsm b/browser/components/migration/MSMigrationUtils.jsm index 4b60ffc0be44..3727e25d3d18 100644 --- a/browser/components/migration/MSMigrationUtils.jsm +++ b/browser/components/migration/MSMigrationUtils.jsm @@ -646,8 +646,7 @@ Cookies.prototype = { Number(flags) & 0x1, // secure false, // httpOnly false, // session - expireTime, - {}); + expireTime); } } }; diff --git a/browser/components/migration/tests/unit/test_Chrome_cookies.js b/browser/components/migration/tests/unit/test_Chrome_cookies.js index 6802f37dced6..1161a5cdd3c4 100644 --- a/browser/components/migration/tests/unit/test_Chrome_cookies.js +++ b/browser/components/migration/tests/unit/test_Chrome_cookies.js @@ -34,7 +34,7 @@ add_task(function* () { "Migrated the expected number of encrypted cookies"); // Now check the cookie details. - let enumerator = Services.cookies.getCookiesFromHost(COOKIE.host, {}); + let enumerator = Services.cookies.getCookiesFromHost(COOKIE.host); Assert.ok(enumerator.hasMoreElements(), "Cookies available"); let foundCookie = enumerator.getNext().QueryInterface(Ci.nsICookie2); diff --git a/browser/components/migration/tests/unit/test_IE_cookies.js b/browser/components/migration/tests/unit/test_IE_cookies.js index 729e03aff0d8..e58b491bf1b8 100644 --- a/browser/components/migration/tests/unit/test_IE_cookies.js +++ b/browser/components/migration/tests/unit/test_IE_cookies.js @@ -98,7 +98,7 @@ add_task(function* () { "Migrated the expected number of cookies"); // Now check the cookie details. - let enumerator = Services.cookies.getCookiesFromHost(COOKIE.host, {}); + let enumerator = Services.cookies.getCookiesFromHost(COOKIE.host); Assert.ok(enumerator.hasMoreElements()); let foundCookie = enumerator.getNext().QueryInterface(Ci.nsICookie2); diff --git a/browser/components/sessionstore/SessionCookies.jsm b/browser/components/sessionstore/SessionCookies.jsm index 219937e26867..01a03cbbb0db 100644 --- a/browser/components/sessionstore/SessionCookies.jsm +++ b/browser/components/sessionstore/SessionCookies.jsm @@ -125,7 +125,7 @@ var SessionCookiesInternal = { if (!Services.cookies.cookieExists(cookieObj)) { Services.cookies.add(cookie.host, cookie.path || "", cookie.name || "", cookie.value, !!cookie.secure, !!cookie.httponly, - /* isSession = */ true, expiry, cookie.originAttributes); + /* isSession = */ true, expiry); } } }, @@ -417,10 +417,6 @@ var CookieStore = { jscookie.expiry = cookie.expiry; } - if (cookie.originAttributes) { - jscookie.originAttributes = cookie.originAttributes; - } - this._ensureMap(cookie).set(cookie.name, jscookie); }, diff --git a/browser/extensions/pocket/content/pktApi.jsm b/browser/extensions/pocket/content/pktApi.jsm index df07f2e782de..150c7ad471e9 100644 --- a/browser/extensions/pocket/content/pktApi.jsm +++ b/browser/extensions/pocket/content/pktApi.jsm @@ -161,7 +161,7 @@ var pktApi = (function() { function getCookiesFromPocket() { var cookieManager = Cc["@mozilla.org/cookiemanager;1"].getService(Ci.nsICookieManager2); - var pocketCookies = cookieManager.getCookiesFromHost(pocketSiteHost, {}); + var pocketCookies = cookieManager.getCookiesFromHost(pocketSiteHost); var cookies = {}; while (pocketCookies.hasMoreElements()) { var cookie = pocketCookies.getNext().QueryInterface(Ci.nsICookie2); diff --git a/devtools/server/actors/storage.js b/devtools/server/actors/storage.js index 1dda80e2f4a5..f25ee6b5beda 100644 --- a/devtools/server/actors/storage.js +++ b/devtools/server/actors/storage.js @@ -465,10 +465,8 @@ StorageActors.createActor({ populateStoresForHost(host) { this.hostVsStores.set(host, new Map()); - let doc = this.storageActor.document; - let cookies = this.getCookiesFromHost(host, doc.nodePrincipal - .originAttributes); + let cookies = this.getCookiesFromHost(host); for (let cookie of cookies) { if (this.isCookieAtHost(cookie, host)) { @@ -572,22 +570,15 @@ StorageActors.createActor({ * See editCookie() for format details. */ editItem: Task.async(function* (data) { - let doc = this.storageActor.document; - data.originAttributes = doc.nodePrincipal - .originAttributes; this.editCookie(data); }), removeItem: Task.async(function* (host, name) { - let doc = this.storageActor.document; - this.removeCookie(host, name, doc.nodePrincipal - .originAttributes); + this.removeCookie(host, name); }), removeAll: Task.async(function* (host, domain) { - let doc = this.storageActor.document; - this.removeAllCookies(host, domain, doc.nodePrincipal - .originAttributes); + this.removeAllCookies(host, domain); }), maybeSetupChildProcess() { @@ -657,13 +648,13 @@ StorageActors.createActor({ }); var cookieHelpers = { - getCookiesFromHost(host, originAttributes) { + getCookiesFromHost(host) { // Local files have no host. if (host.startsWith("file:///")) { host = ""; } - let cookies = Services.cookies.getCookiesFromHost(host, originAttributes); + let cookies = Services.cookies.getCookiesFromHost(host); let store = []; while (cookies.hasMoreElements()) { @@ -707,7 +698,7 @@ var cookieHelpers = { let origPath = field === "path" ? oldValue : data.items.path; let cookie = null; - let enumerator = Services.cookies.getCookiesFromHost(origHost, data.originAttributes || {}); + let enumerator = Services.cookies.getCookiesFromHost(origHost); while (enumerator.hasMoreElements()) { let nsiCookie = enumerator.getNext().QueryInterface(Ci.nsICookie2); if (nsiCookie.name === origName && nsiCookie.host === origHost) { @@ -778,8 +769,7 @@ var cookieHelpers = { cookie.isSecure, cookie.isHttpOnly, cookie.isSession, - cookie.isSession ? MAX_COOKIE_EXPIRY : cookie.expires, - cookie.originAttributes + cookie.isSession ? MAX_COOKIE_EXPIRY : cookie.expires ); }, @@ -794,7 +784,7 @@ var cookieHelpers = { return cookieHost == host; } - let enumerator = Services.cookies.getCookiesFromHost(host, opts.originAttributes || {}); + let enumerator = Services.cookies.getCookiesFromHost(host); while (enumerator.hasMoreElements()) { let cookie = enumerator.getNext().QueryInterface(Ci.nsICookie2); if (hostMatches(cookie.host, host) && @@ -811,14 +801,14 @@ var cookieHelpers = { } }, - removeCookie(host, name, originAttributes) { + removeCookie(host, name) { if (name !== undefined) { - this._removeCookies(host, { name, originAttributes }); + this._removeCookies(host, { name }); } }, - removeAllCookies(host, domain, originAttributes) { - this._removeCookies(host, { domain, originAttributes }); + removeAllCookies(host, domain) { + this._removeCookies(host, { domain }); }, addCookieObservers() { @@ -871,8 +861,7 @@ var cookieHelpers = { switch (msg.json.method) { case "getCookiesFromHost": { let host = msg.data.args[0]; - let originAttributes = msg.data.args[1]; - let cookies = cookieHelpers.getCookiesFromHost(host, originAttributes); + let cookies = cookieHelpers.getCookiesFromHost(host); return JSON.stringify(cookies); } case "addCookieObservers": { @@ -888,14 +877,12 @@ var cookieHelpers = { case "removeCookie": { let host = msg.data.args[0]; let name = msg.data.args[1]; - let originAttributes = msg.data.args[2]; - return cookieHelpers.removeCookie(host, name, originAttributes); + return cookieHelpers.removeCookie(host, name); } case "removeAllCookies": { let host = msg.data.args[0]; let domain = msg.data.args[1]; - let originAttributes = msg.data.args[2]; - return cookieHelpers.removeAllCookies(host, domain, originAttributes); + return cookieHelpers.removeAllCookies(host, domain); } default: console.error("ERR_DIRECTOR_PARENT_UNKNOWN_METHOD", msg.json.method); diff --git a/devtools/shared/gcli/commands/cookie.js b/devtools/shared/gcli/commands/cookie.js index 1a0b3e642719..782ff3fbf005 100644 --- a/devtools/shared/gcli/commands/cookie.js +++ b/devtools/shared/gcli/commands/cookie.js @@ -86,11 +86,8 @@ exports.items = [ "see bug 1221488"); } let host = new URL(context.environment.target.url).host; - let contentWindow = context.environment.window; host = sanitizeHost(host); - let enm = cookieMgr.getCookiesFromHost(host, contentWindow.document. - nodePrincipal. - originAttributes); + let enm = cookieMgr.getCookiesFromHost(host); let cookies = []; while (enm.hasMoreElements()) { @@ -131,11 +128,8 @@ exports.items = [ "see bug 1221488"); } let host = new URL(context.environment.target.url).host; - let contentWindow = context.environment.window; host = sanitizeHost(host); - let enm = cookieMgr.getCookiesFromHost(host, contentWindow.document. - nodePrincipal. - originAttributes); + let enm = cookieMgr.getCookiesFromHost(host); while (enm.hasMoreElements()) { let cookie = enm.getNext().QueryInterface(Ci.nsICookie); @@ -277,7 +271,7 @@ exports.items = [ let host = new URL(context.environment.target.url).host; host = sanitizeHost(host); let time = Date.parse(args.expires) / 1000; - let contentWindow = context.environment.window; + cookieMgr.add(args.domain ? "." + args.domain : host, args.path ? args.path : "/", args.name, @@ -285,10 +279,7 @@ exports.items = [ args.secure, args.httpOnly, args.session, - time, - contentWindow.document. - nodePrincipal. - originAttributes); + time); } } ]; diff --git a/extensions/cookie/test/file_testloadflags_chromescript.js b/extensions/cookie/test/file_testloadflags_chromescript.js index 26eedacd9608..ad9b0fe53e23 100644 --- a/extensions/cookie/test/file_testloadflags_chromescript.js +++ b/extensions/cookie/test/file_testloadflags_chromescript.js @@ -86,7 +86,7 @@ addMessageListener("init", ({ domain }) => { info(count + " cookies"); cs.removeAll(); - cs.add(domain, "", "oh", "hai", false, false, true, Math.pow(2, 62), {}); + cs.add(domain, "", "oh", "hai", false, false, true, Math.pow(2, 62)); is(cs.countCookiesFromHost(domain), 1, "number of cookies for domain " + domain); gObs = new obs(); diff --git a/extensions/cookie/test/unit/test_bug526789.js b/extensions/cookie/test/unit/test_bug526789.js index 27a14ac4417c..7e4384dcdf84 100644 --- a/extensions/cookie/test/unit/test_bug526789.js +++ b/extensions/cookie/test/unit/test_bug526789.js @@ -13,7 +13,7 @@ function run_test() { // test that variants of 'baz.com' get normalized appropriately, but that // malformed hosts are rejected - cm.add("baz.com", "/", "foo", "bar", false, false, true, expiry, {}); + cm.add("baz.com", "/", "foo", "bar", false, false, true, expiry); do_check_eq(cm.countCookiesFromHost("baz.com"), 1); do_check_eq(cm.countCookiesFromHost("BAZ.com"), 1); do_check_eq(cm.countCookiesFromHost(".baz.com"), 1); @@ -34,7 +34,7 @@ function run_test() { do_check_eq(cm.countCookiesFromHost("baz.com"), 0); // Test that 'baz.com' and 'baz.com.' are treated differently - cm.add("baz.com.", "/", "foo", "bar", false, false, true, expiry, {}); + cm.add("baz.com.", "/", "foo", "bar", false, false, true, expiry); do_check_eq(cm.countCookiesFromHost("baz.com"), 0); do_check_eq(cm.countCookiesFromHost("BAZ.com"), 0); do_check_eq(cm.countCookiesFromHost(".baz.com"), 0); @@ -47,7 +47,7 @@ function run_test() { // test that domain cookies are illegal for IP addresses, aliases such as // 'localhost', and eTLD's such as 'co.uk' - cm.add("192.168.0.1", "/", "foo", "bar", false, false, true, expiry, {}); + cm.add("192.168.0.1", "/", "foo", "bar", false, false, true, expiry); do_check_eq(cm.countCookiesFromHost("192.168.0.1"), 1); do_check_eq(cm.countCookiesFromHost("192.168.0.1."), 0); do_check_throws(function() { @@ -57,7 +57,7 @@ function run_test() { cm.countCookiesFromHost(".192.168.0.1."); }, Cr.NS_ERROR_ILLEGAL_VALUE); - cm.add("localhost", "/", "foo", "bar", false, false, true, expiry, {}); + cm.add("localhost", "/", "foo", "bar", false, false, true, expiry); do_check_eq(cm.countCookiesFromHost("localhost"), 1); do_check_eq(cm.countCookiesFromHost("localhost."), 0); do_check_throws(function() { @@ -67,7 +67,7 @@ function run_test() { cm.countCookiesFromHost(".localhost."); }, Cr.NS_ERROR_ILLEGAL_VALUE); - cm.add("co.uk", "/", "foo", "bar", false, false, true, expiry, {}); + cm.add("co.uk", "/", "foo", "bar", false, false, true, expiry); do_check_eq(cm.countCookiesFromHost("co.uk"), 1); do_check_eq(cm.countCookiesFromHost("co.uk."), 0); do_check_throws(function() { @@ -105,26 +105,26 @@ function run_test() { cm.countCookiesFromHost(".."); }, Cr.NS_ERROR_ILLEGAL_VALUE); - var e = cm.getCookiesFromHost("", {}); + var e = cm.getCookiesFromHost(""); do_check_false(e.hasMoreElements()); do_check_throws(function() { - cm.getCookiesFromHost(".", {}); + cm.getCookiesFromHost("."); }, Cr.NS_ERROR_ILLEGAL_VALUE); do_check_throws(function() { - cm.getCookiesFromHost("..", {}); + cm.getCookiesFromHost(".."); }, Cr.NS_ERROR_ILLEGAL_VALUE); - e = cm.getCookiesFromHost("baz.com", {}); + e = cm.getCookiesFromHost("baz.com"); do_check_true(e.hasMoreElements()); do_check_eq(e.getNext().QueryInterface(Ci.nsICookie2).name, "foo"); do_check_false(e.hasMoreElements()); - e = cm.getCookiesFromHost("", {}); + e = cm.getCookiesFromHost(""); do_check_false(e.hasMoreElements()); do_check_throws(function() { - cm.getCookiesFromHost(".", {}); + cm.getCookiesFromHost("."); }, Cr.NS_ERROR_ILLEGAL_VALUE); do_check_throws(function() { - cm.getCookiesFromHost("..", {}); + cm.getCookiesFromHost(".."); }, Cr.NS_ERROR_ILLEGAL_VALUE); cm.removeAll(); @@ -151,26 +151,26 @@ function run_test() { cm.countCookiesFromHost("."); }, Cr.NS_ERROR_ILLEGAL_VALUE); - e = cm.getCookiesFromHost("baz.com", {}); + e = cm.getCookiesFromHost("baz.com"); do_check_false(e.hasMoreElements()); - e = cm.getCookiesFromHost("", {}); + e = cm.getCookiesFromHost(""); do_check_true(e.hasMoreElements()); e.getNext(); do_check_true(e.hasMoreElements()); e.getNext(); do_check_false(e.hasMoreElements()); do_check_throws(function() { - cm.getCookiesFromHost(".", {}); + cm.getCookiesFromHost("."); }, Cr.NS_ERROR_ILLEGAL_VALUE); cm.removeAll(); // test that an empty host to add() or remove() works, // but a host of '.' doesn't - cm.add("", "/", "foo2", "bar", false, false, true, expiry, {}); + cm.add("", "/", "foo2", "bar", false, false, true, expiry); do_check_eq(getCookieCount(), 1); do_check_throws(function() { - cm.add(".", "/", "foo3", "bar", false, false, true, expiry, {}); + cm.add(".", "/", "foo3", "bar", false, false, true, expiry); }, Cr.NS_ERROR_ILLEGAL_VALUE); do_check_eq(getCookieCount(), 1); @@ -216,13 +216,13 @@ function testDomainCookie(uriString, domain) { var uri = NetUtil.newURI(uriString); cs.setCookieString(uri, null, "foo=bar; domain=" + domain, null); - var e = cm.getCookiesFromHost(domain, {}); + var e = cm.getCookiesFromHost(domain); do_check_true(e.hasMoreElements()); do_check_eq(e.getNext().QueryInterface(Ci.nsICookie2).host, domain); cm.removeAll(); cs.setCookieString(uri, null, "foo=bar; domain=." + domain, null); - e = cm.getCookiesFromHost(domain, {}); + e = cm.getCookiesFromHost(domain); do_check_true(e.hasMoreElements()); do_check_eq(e.getNext().QueryInterface(Ci.nsICookie2).host, domain); cm.removeAll(); diff --git a/extensions/cookie/test/unit/test_bug650522.js b/extensions/cookie/test/unit/test_bug650522.js index 1d99cb23348e..d790bff7ca14 100644 --- a/extensions/cookie/test/unit/test_bug650522.js +++ b/extensions/cookie/test/unit/test_bug650522.js @@ -10,7 +10,7 @@ function run_test() { // Test our handling of host names with a single character at the beginning // followed by a dot. - cm.add("e.mail.com", "/", "foo", "bar", false, false, true, expiry, {}); + cm.add("e.mail.com", "/", "foo", "bar", false, false, true, expiry); do_check_eq(cm.countCookiesFromHost("e.mail.com"), 1); do_check_eq(cs.getCookieString(NetUtil.newURI("http://e.mail.com"), null), "foo=bar"); } diff --git a/extensions/cookie/test/unit/test_bug667087.js b/extensions/cookie/test/unit/test_bug667087.js index 2400dea51d4f..3d2ab0133d20 100644 --- a/extensions/cookie/test/unit/test_bug667087.js +++ b/extensions/cookie/test/unit/test_bug667087.js @@ -10,7 +10,7 @@ function run_test() { // Test our handling of host names with a single character consisting only // of a single character - cm.add("a", "/", "foo", "bar", false, false, true, expiry, {}); + cm.add("a", "/", "foo", "bar", false, false, true, expiry); do_check_eq(cm.countCookiesFromHost("a"), 1); do_check_eq(cs.getCookieString(NetUtil.newURI("http://a"), null), "foo=bar"); } diff --git a/extensions/cookie/test/unit/test_cookies_async_failure.js b/extensions/cookie/test/unit/test_cookies_async_failure.js index 628553a4e653..024e309127b2 100644 --- a/extensions/cookie/test/unit/test_cookies_async_failure.js +++ b/extensions/cookie/test/unit/test_cookies_async_failure.js @@ -158,7 +158,7 @@ function run_test_1(generator) // Attempt to insert a cookie with the same (name, host, path) triplet. Services.cookiemgr.add(cookie.host, cookie.path, cookie.name, "hallo", - cookie.isSecure, cookie.isHttpOnly, cookie.isSession, cookie.expiry, {}); + cookie.isSecure, cookie.isHttpOnly, cookie.isSession, cookie.expiry); // Check that the cookie service accepted the new cookie. do_check_eq(Services.cookiemgr.countCookiesFromHost(cookie.host), 1); @@ -189,7 +189,7 @@ function run_test_1(generator) do_load_profile(); do_check_eq(Services.cookiemgr.countCookiesFromHost("foo.com"), 1); - let enumerator = Services.cookiemgr.getCookiesFromHost(cookie.host, {}); + let enumerator = Services.cookiemgr.getCookiesFromHost(cookie.host); do_check_true(enumerator.hasMoreElements()); let dbcookie = enumerator.getNext().QueryInterface(Ci.nsICookie2); do_check_eq(dbcookie.value, "hallo"); diff --git a/extensions/cookie/test/unit/test_cookies_profile_close.js b/extensions/cookie/test/unit/test_cookies_profile_close.js index bae6e3a59a17..b1a3dec785d0 100644 --- a/extensions/cookie/test/unit/test_cookies_profile_close.js +++ b/extensions/cookie/test/unit/test_cookies_profile_close.js @@ -54,7 +54,7 @@ function do_run_test() { }, Cr.NS_ERROR_NOT_AVAILABLE); do_check_throws(function() { - Services.cookiemgr.add("foo.com", "", "oh4", "hai", false, false, false, 0, {}); + Services.cookiemgr.add("foo.com", "", "oh4", "hai", false, false, false, 0); }, Cr.NS_ERROR_NOT_AVAILABLE); do_check_throws(function() { @@ -76,7 +76,7 @@ function do_run_test() { }, Cr.NS_ERROR_NOT_AVAILABLE); do_check_throws(function() { - Services.cookies.getCookiesFromHost("foo.com", {}); + Services.cookies.getCookiesFromHost("foo.com"); }, Cr.NS_ERROR_NOT_AVAILABLE); // Wait for the database to finish closing. diff --git a/extensions/cookie/test/unit/test_domain_eviction.js b/extensions/cookie/test/unit/test_domain_eviction.js index 349f6d77e13a..e63958f2457a 100644 --- a/extensions/cookie/test/unit/test_domain_eviction.js +++ b/extensions/cookie/test/unit/test_domain_eviction.js @@ -68,16 +68,16 @@ function do_run_test() let shortExpiry = Math.floor(Date.now() / 1000 + 2); setCookies("captchart.com", 49, futureExpiry); Services.cookiemgr.add("captchart.com", "", "test100", "eviction", - false, false, false, shortExpiry, {}); + false, false, false, shortExpiry); do_timeout(2100, continue_test); yield; do_check_eq(countCookies("captchart.com", "captchart.com"), 50); Services.cookiemgr.add("captchart.com", "", "test200", "eviction", - false, false, false, futureExpiry, {}); + false, false, false, futureExpiry); do_check_eq(countCookies("captchart.com", "captchart.com"), 50); - enumerator = Services.cookiemgr.getCookiesFromHost("captchart.com", {}); + enumerator = Services.cookiemgr.getCookiesFromHost("captchart.com"); while (enumerator.hasMoreElements()) { let cookie = enumerator.getNext().QueryInterface(Ci.nsICookie2); do_check_true(cookie.expiry == futureExpiry); @@ -92,7 +92,7 @@ setCookies(aHost, aNumber, aExpiry) { for (let i = 0; i < aNumber; ++i) Services.cookiemgr.add(aHost, "", "test" + i, "eviction", - false, false, false, aExpiry, {}); + false, false, false, aExpiry); } // count how many cookies are within domain 'aBaseDomain', using three @@ -123,7 +123,7 @@ countCookies(aBaseDomain, aHost) cookies.length); do_check_eq(Services.cookiemgr.countCookiesFromHost(aHost), cookies.length); - enumerator = Services.cookiemgr.getCookiesFromHost(aHost, {}); + enumerator = Services.cookiemgr.getCookiesFromHost(aHost); while (enumerator.hasMoreElements()) { let cookie = enumerator.getNext().QueryInterface(Ci.nsICookie2); diff --git a/extensions/cookie/test/unit/test_eviction.js b/extensions/cookie/test/unit/test_eviction.js index 7b155020831b..5c0cf010fcdf 100644 --- a/extensions/cookie/test/unit/test_eviction.js +++ b/extensions/cookie/test/unit/test_eviction.js @@ -199,7 +199,7 @@ function set_cookies(begin, end, expiry) for (let i = begin; i < end; ++i) { let host = "eviction." + i + ".tests"; Services.cookiemgr.add(host, "", "test", "eviction", false, false, false, - expiry, {}); + expiry); if (i == begin) beginTime = get_creationTime(i); @@ -219,7 +219,7 @@ function set_cookies(begin, end, expiry) function get_creationTime(i) { let host = "eviction." + i + ".tests"; - let enumerator = Services.cookiemgr.getCookiesFromHost(host, {}); + let enumerator = Services.cookiemgr.getCookiesFromHost(host); do_check_true(enumerator.hasMoreElements()); let cookie = enumerator.getNext().QueryInterface(Ci.nsICookie2); return cookie.creationTime; diff --git a/extensions/cookie/test/unit/test_schema_2_migration.js b/extensions/cookie/test/unit/test_schema_2_migration.js index 7dc5e823c62f..cb5ecaf29997 100644 --- a/extensions/cookie/test/unit/test_schema_2_migration.js +++ b/extensions/cookie/test/unit/test_schema_2_migration.js @@ -88,7 +88,7 @@ function do_run_test() { // 3) Only one cookie remains, and it's the one with the highest expiration // time. do_check_eq(Services.cookiemgr.countCookiesFromHost("baz.com"), 1); - let enumerator = Services.cookiemgr.getCookiesFromHost("baz.com", {}); + let enumerator = Services.cookiemgr.getCookiesFromHost("baz.com"); let cookie = enumerator.getNext().QueryInterface(Ci.nsICookie2); do_check_eq(cookie.expiry, futureExpiry + 44); diff --git a/extensions/cookie/test/unit/test_schema_3_migration.js b/extensions/cookie/test/unit/test_schema_3_migration.js index 40a23f7e4754..a5349b935635 100644 --- a/extensions/cookie/test/unit/test_schema_3_migration.js +++ b/extensions/cookie/test/unit/test_schema_3_migration.js @@ -88,7 +88,7 @@ function do_run_test() { // 3) Only one cookie remains, and it's the one with the highest expiration // time. do_check_eq(Services.cookiemgr.countCookiesFromHost("baz.com"), 1); - let enumerator = Services.cookiemgr.getCookiesFromHost("baz.com", {}); + let enumerator = Services.cookiemgr.getCookiesFromHost("baz.com"); let cookie = enumerator.getNext().QueryInterface(Ci.nsICookie2); do_check_eq(cookie.expiry, futureExpiry + 44); @@ -116,7 +116,7 @@ function do_run_test() { // Test the expected set of cookies. do_check_eq(Services.cookiemgr.countCookiesFromHost("cat.com"), 20); - enumerator = Services.cookiemgr.getCookiesFromHost("cat.com", {}); + enumerator = Services.cookiemgr.getCookiesFromHost("cat.com"); cookie = enumerator.getNext().QueryInterface(Ci.nsICookie2); do_check_eq(cookie.creationTime, 0); diff --git a/netwerk/cookie/nsCookieService.cpp b/netwerk/cookie/nsCookieService.cpp index 50d05e2a9c3c..cc5c47eea16f 100644 --- a/netwerk/cookie/nsCookieService.cpp +++ b/netwerk/cookie/nsCookieService.cpp @@ -2260,45 +2260,6 @@ nsCookieService::GetEnumerator(nsISimpleEnumerator **aEnumerator) return NS_NewArrayEnumerator(aEnumerator, cookieList); } -static nsresult -InitializeOriginAttributes(NeckoOriginAttributes* aAttrs, - JS::HandleValue aOriginAttributes, - JSContext* aCx, - uint8_t aArgc, - const char16_t* aAPI, - const char16_t* aInterfaceSuffix) -{ - MOZ_ASSERT(aAttrs); - MOZ_ASSERT(aCx); - MOZ_ASSERT(aAPI); - MOZ_ASSERT(aInterfaceSuffix); - - if (aArgc == 0) { - const char16_t* params[] = { - aAPI, - aInterfaceSuffix - }; - - // This is supposed to be temporary and in 1 or 2 releases we want to - // have originAttributes param as mandatory. But for now, we don't want to - // break existing addons, so we write a console message to inform the addon - // developers about it. - nsContentUtils::ReportToConsole(nsIScriptError::warningFlag, - NS_LITERAL_CSTRING("Cookie Manager"), - nullptr, - nsContentUtils::eNECKO_PROPERTIES, - "nsICookieManagerAPIDeprecated", - params, ArrayLength(params)); - } else if (aArgc == 1) { - if (!aOriginAttributes.isObject() || - !aAttrs->Init(aCx, aOriginAttributes)) { - return NS_ERROR_INVALID_ARG; - } - } - - return NS_OK; -} - NS_IMETHODIMP nsCookieService::Add(const nsACString &aHost, const nsACString &aPath, @@ -2307,41 +2268,8 @@ nsCookieService::Add(const nsACString &aHost, bool aIsSecure, bool aIsHttpOnly, bool aIsSession, - int64_t aExpiry, - JS::HandleValue aOriginAttributes, - JSContext* aCx, - uint8_t aArgc) + int64_t aExpiry) { - MOZ_ASSERT(aArgc == 0 || aArgc == 1); - - NeckoOriginAttributes attrs; - nsresult rv = InitializeOriginAttributes(&attrs, - aOriginAttributes, - aCx, - aArgc, - MOZ_UTF16("nsICookieManager2.add()"), - MOZ_UTF16("2")); - NS_ENSURE_SUCCESS(rv, rv); - - return AddNative(aHost, aPath, aName, aValue, aIsSecure, aIsHttpOnly, - aIsSession, aExpiry, &attrs); -} - -NS_IMETHODIMP_(nsresult) -nsCookieService::AddNative(const nsACString &aHost, - const nsACString &aPath, - const nsACString &aName, - const nsACString &aValue, - bool aIsSecure, - bool aIsHttpOnly, - bool aIsSession, - int64_t aExpiry, - NeckoOriginAttributes* aOriginAttributes) -{ - if (NS_WARN_IF(!aOriginAttributes)) { - return NS_ERROR_FAILURE; - } - if (!mDBState) { NS_WARNING("No DBState! Profile already closed?"); return NS_ERROR_NOT_AVAILABLE; @@ -2359,7 +2287,7 @@ nsCookieService::AddNative(const nsACString &aHost, NS_ENSURE_SUCCESS(rv, rv); int64_t currentTimeInUsec = PR_Now(); - nsCookieKey key = nsCookieKey(baseDomain, *aOriginAttributes); + nsCookieKey key = DEFAULT_APP_KEY(baseDomain); RefPtr cookie = nsCookie::Create(aName, aValue, host, aPath, @@ -2442,16 +2370,24 @@ nsCookieService::Remove(const nsACString &aHost, uint8_t aArgc) { MOZ_ASSERT(aArgc == 0 || aArgc == 1); + if (aArgc == 0) { + // This is supposed to be temporary and in 1 or 2 releases we want to + // have originAttributes param as mandatory. But for now, we don't want to + // break existing addons, so we write a console message to inform the addon + // developers about it. + nsContentUtils::ReportToConsole(nsIScriptError::warningFlag, + NS_LITERAL_CSTRING("Cookie Manager"), + nullptr, + nsContentUtils::eNECKO_PROPERTIES, + "nsICookieManagerRemoveDeprecated"); + } NeckoOriginAttributes attrs; - nsresult rv = InitializeOriginAttributes(&attrs, - aOriginAttributes, - aCx, - aArgc, - MOZ_UTF16("nsICookieManager.remove()"), - MOZ_UTF16("")); - NS_ENSURE_SUCCESS(rv, rv); - + if (aArgc == 1 && + (!aOriginAttributes.isObject() || + !attrs.Init(aCx, aOriginAttributes))) { + return NS_ERROR_INVALID_ARG; + } return RemoveNative(aHost, aName, aPath, aBlocked, &attrs); } @@ -4362,13 +4298,8 @@ nsCookieService::CountCookiesFromHost(const nsACString &aHost, // nsICookieManager2 interface. NS_IMETHODIMP nsCookieService::GetCookiesFromHost(const nsACString &aHost, - JS::HandleValue aOriginAttributes, - JSContext* aCx, - uint8_t aArgc, nsISimpleEnumerator **aEnumerator) { - MOZ_ASSERT(aArgc == 0 || aArgc == 1); - if (!mDBState) { NS_WARNING("No DBState! Profile already closed?"); return NS_ERROR_NOT_AVAILABLE; @@ -4383,16 +4314,7 @@ nsCookieService::GetCookiesFromHost(const nsACString &aHost, rv = GetBaseDomainFromHost(host, baseDomain); NS_ENSURE_SUCCESS(rv, rv); - NeckoOriginAttributes attrs; - rv = InitializeOriginAttributes(&attrs, - aOriginAttributes, - aCx, - aArgc, - MOZ_UTF16("nsICookieManager2.getCookiesFromHost()"), - MOZ_UTF16("2")); - NS_ENSURE_SUCCESS(rv, rv); - - nsCookieKey key = nsCookieKey(baseDomain, attrs); + nsCookieKey key = DEFAULT_APP_KEY(baseDomain); EnsureReadDomain(key); nsCookieEntry *entry = mDBState->hostTable.GetEntry(key); diff --git a/netwerk/cookie/nsICookieManager2.idl b/netwerk/cookie/nsICookieManager2.idl index e5c1e4f9eace..88d67d5e54e5 100644 --- a/netwerk/cookie/nsICookieManager2.idl +++ b/netwerk/cookie/nsICookieManager2.idl @@ -46,10 +46,7 @@ interface nsICookieManager2 : nsICookieManager * expiration date, in seconds since midnight (00:00:00), January 1, * 1970 UTC. note that expiry time will also be honored for session cookies; * in this way, the more restrictive of the two will take effect. - * @param aOriginAttributes The originAttributes of this cookie. This - * attribute is optional to avoid breaking add-ons. */ - [implicit_jscontext, optional_argc] void add(in AUTF8String aHost, in AUTF8String aPath, in ACString aName, @@ -57,19 +54,7 @@ interface nsICookieManager2 : nsICookieManager in boolean aIsSecure, in boolean aIsHttpOnly, in boolean aIsSession, - in int64_t aExpiry, - [optional] in jsval aOriginAttributes); - - [notxpcom] - nsresult addNative(in AUTF8String aHost, - in AUTF8String aPath, - in ACString aName, - in ACString aValue, - in boolean aIsSecure, - in boolean aIsHttpOnly, - in boolean aIsSession, - in int64_t aExpiry, - in NeckoOriginAttributesPtr aOriginAttributes); + in int64_t aExpiry); /** * Find whether a given cookie already exists. @@ -107,17 +92,12 @@ interface nsICookieManager2 : nsICookieManager * the host string to search for, e.g. "google.com". this should consist * of only the host portion of a URI. see @add for a description of * acceptable host strings. - * @param aOriginAttributes The originAttributes of cookies that would be - * retrived. This attribute is optional to avoid - * breaking add-ons. * * @return an nsISimpleEnumerator of nsICookie2 objects. * * @see countCookiesFromHost */ - [implicit_jscontext, optional_argc] - nsISimpleEnumerator getCookiesFromHost(in AUTF8String aHost, - [optional] in jsval aOriginAttributes); + nsISimpleEnumerator getCookiesFromHost(in AUTF8String aHost); /** * Import an old-style cookie file. Imported cookies will be added to the diff --git a/netwerk/cookie/test/unit/test_bug1267910.js b/netwerk/cookie/test/unit/test_bug1267910.js deleted file mode 100644 index 93ea5e132845..000000000000 --- a/netwerk/cookie/test/unit/test_bug1267910.js +++ /dev/null @@ -1,196 +0,0 @@ -/* - * Bug 1267910 - Add test cases for the backward compatiability and originAttributes - * of nsICookieManager2. - */ - -var {utils: Cu, interfaces: Ci, classes: Cc} = Components; - -Cu.import("resource://gre/modules/Services.jsm"); - -const BASE_URL = "http://example.org/"; - -const COOKIE = { - host: BASE_URL, - path: "/", - name: "test1", - value: "yes", - isSecure: false, - isHttpOnly: false, - isSession: true, - expiry: 2145934800, -}; - -const COOKIE_OA_DEFAULT = { - host: BASE_URL, - path: "/", - name: "test0", - value: "yes0", - isSecure: false, - isHttpOnly: false, - isSession: true, - expiry: 2145934800, - originAttributes: {}, -}; - -const COOKIE_OA_1 = { - host: BASE_URL, - path: "/", - name: "test1", - value: "yes1", - isSecure: false, - isHttpOnly: false, - isSession: true, - expiry: 2145934800, - originAttributes: {userContextId: 1}, -}; - -function checkCookie(cookie, cookieObj) { - for (let prop of Object.keys(cookieObj)) { - if (prop === "originAttributes") { - ok(ChromeUtils.isOriginAttributesEqual(cookie[prop], cookieObj[prop]), - "Check cookie: " + prop); - } else { - equal(cookie[prop], cookieObj[prop], "Check cookie: " + prop); - } - } -} - -function countCookies(enumerator) { - let cnt = 0; - - while (enumerator.hasMoreElements()) { - cnt++; - enumerator.getNext(); - } - - return cnt; -} - -function run_test() { - // Allow all cookies. - Services.prefs.setIntPref("network.cookie.cookieBehavior", 0); - - // Enable user context id - Services.prefs.setBoolPref("privacy.userContext.enabled", true); - - add_test(test_backward_compatiability); - add_test(test_originAttributes); - - - run_next_test(); -} - -/* - * Test for backward compatiablility that APIs works correctly without - * originAttributes. - */ -function test_backward_compatiability() { - // Clear cookies. - Services.cookies.removeAll(); - - // Call Add() to add a cookie without originAttributes - Services.cookies.add(COOKIE.host, - COOKIE.path, - COOKIE.name, - COOKIE.value, - COOKIE.isSecure, - COOKIE.isHttpOnly, - COOKIE.isSession, - COOKIE.expiry); - - // Call getCookiesFromHost() to get cookies without originAttributes - let enumerator = Services.cookies.getCookiesFromHost(BASE_URL); - - ok(enumerator.hasMoreElements(), "Cookies available"); - let foundCookie = enumerator.getNext().QueryInterface(Ci.nsICookie2); - - checkCookie(foundCookie, COOKIE); - - ok(!enumerator.hasMoreElements(), "We should get only one cookie"); - - run_next_test(); -} - -/* - * Test for originAttributes. - */ -function test_originAttributes() { - // Clear cookies. - Services.cookies.removeAll(); - - // Add a cookie for default originAttributes. - Services.cookies.add(COOKIE_OA_DEFAULT.host, - COOKIE_OA_DEFAULT.path, - COOKIE_OA_DEFAULT.name, - COOKIE_OA_DEFAULT.value, - COOKIE_OA_DEFAULT.isSecure, - COOKIE_OA_DEFAULT.isHttpOnly, - COOKIE_OA_DEFAULT.isSession, - COOKIE_OA_DEFAULT.expiry, - COOKIE_OA_DEFAULT.originAttributes); - - // Get cookies for default originAttributes. - let enumerator = Services.cookies.getCookiesFromHost(BASE_URL, COOKIE_OA_DEFAULT.originAttributes); - - // Check that do we get cookie correctly. - ok(enumerator.hasMoreElements(), "Cookies available"); - let foundCookie = enumerator.getNext().QueryInterface(Ci.nsICookie2); - checkCookie(foundCookie, COOKIE_OA_DEFAULT); - - // We should only get one cookie. - ok(!enumerator.hasMoreElements(), "We should get only one cookie"); - - // Get cookies for originAttributes with user context id 1. - enumerator = Services.cookies.getCookiesFromHost(BASE_URL, COOKIE_OA_1.originAttributes); - - // Check that we will not get cookies if the originAttributes is different. - ok(!enumerator.hasMoreElements(), "No cookie should be here"); - - // Add a cookie for originAttributes with user context id 1. - Services.cookies.add(COOKIE_OA_1.host, - COOKIE_OA_1.path, - COOKIE_OA_1.name, - COOKIE_OA_1.value, - COOKIE_OA_1.isSecure, - COOKIE_OA_1.isHttpOnly, - COOKIE_OA_1.isSession, - COOKIE_OA_1.expiry, - COOKIE_OA_1.originAttributes); - - // Get cookies for originAttributes with user context id 1. - enumerator = Services.cookies.getCookiesFromHost(BASE_URL, COOKIE_OA_1.originAttributes); - - // Check that do we get cookie correctly. - ok(enumerator.hasMoreElements(), "Cookies available"); - foundCookie = enumerator.getNext().QueryInterface(Ci.nsICookie2); - checkCookie(foundCookie, COOKIE_OA_1); - - // We should only get one cookie. - ok(!enumerator.hasMoreElements(), "We should get only one cookie"); - - // Check that add a cookie will not affect cookies in different originAttributes. - enumerator = Services.cookies.getCookiesFromHost(BASE_URL, COOKIE_OA_DEFAULT.originAttributes); - equal(countCookies(enumerator), 1, "We should get only one cookie for default originAttributes"); - - // Remove a cookie for originAttributes with user context id 1. - Services.cookies.remove(COOKIE_OA_1.host, COOKIE_OA_1.name, COOKIE_OA_1.path, - false, COOKIE_OA_1.originAttributes); - - // Check that remove will not affect cookies in default originAttributes. - enumerator = Services.cookies.getCookiesFromHost(BASE_URL, COOKIE_OA_DEFAULT.originAttributes); - equal(countCookies(enumerator), 1, "Get one cookie for default originAttributes."); - - // Check that should be no cookie for originAttributes with user context id 1. - enumerator = Services.cookies.getCookiesFromHost(BASE_URL, COOKIE_OA_1.originAttributes); - equal(countCookies(enumerator), 0, "No cookie shold be here"); - - // Remove a cookie for default originAttributes. - Services.cookies.remove(COOKIE_OA_DEFAULT.host, COOKIE_OA_DEFAULT.name, COOKIE_OA_DEFAULT.path, - false, COOKIE_OA_DEFAULT.originAttributes); - - // Check remove() works correctly for default originAttributes. - enumerator = Services.cookies.getCookiesFromHost(BASE_URL, COOKIE_OA_DEFAULT.originAttributes); - equal(countCookies(enumerator), 0, "No cookie shold be here"); - - run_next_test(); -} diff --git a/netwerk/cookie/test/unit/xpcshell.ini b/netwerk/cookie/test/unit/xpcshell.ini index 78f40fd14d61..8a889b04006c 100644 --- a/netwerk/cookie/test/unit/xpcshell.ini +++ b/netwerk/cookie/test/unit/xpcshell.ini @@ -5,6 +5,5 @@ skip-if = toolkit == 'gonk' [test_bug643051.js] [test_bug1155169.js] -[test_bug1267910.js] [test_parser_0001.js] [test_parser_0019.js] diff --git a/netwerk/locales/en-US/necko.properties b/netwerk/locales/en-US/necko.properties index f7f65c60938b..f83f824d990c 100644 --- a/netwerk/locales/en-US/necko.properties +++ b/netwerk/locales/en-US/necko.properties @@ -44,5 +44,5 @@ TrackingUriBlocked=The resource at “%1$S” was blocked because tracking prote # %1$S is the deprected API; %2$S is the API function that should be used. APIDeprecationWarning=Warning: ‘%1$S’ deprecated, please use ‘%2$S’ -# LOCALIZATION NOTE (nsICookieManagerDeprecated): don't localize originAttributes. -nsICookieManagerAPIDeprecated=“%1$S” is changed. Update your code and pass the correct originAttributes. Read more on MDN: https://developer.mozilla.org/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsICookieManager%2$S +# LOCALIZATION NOTE (nsICookieManagerRemoveDeprecated): don't localize nsICookieManager.remove() and originAttributes. +nsICookieManagerRemoveDeprecated=“nsICookieManager.remove()” is changed. Update your code and pass the correct originAttributes. Read more on MDN: https://developer.mozilla.org/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsICookieManager diff --git a/netwerk/test/TestCookie.cpp b/netwerk/test/TestCookie.cpp index 783b4033bf5e..2225b0c3771c 100644 --- a/netwerk/test/TestCookie.cpp +++ b/netwerk/test/TestCookie.cpp @@ -597,38 +597,33 @@ main(int32_t argc, char *argv[]) nsCOMPtr cookieMgr2 = do_QueryInterface(cookieMgr); if (!cookieMgr2) return -1; - mozilla::NeckoOriginAttributes attrs; - // first, ensure a clean slate rv[0] = NS_SUCCEEDED(cookieMgr->RemoveAll()); // add some cookies - rv[1] = NS_SUCCEEDED(cookieMgr2->AddNative(NS_LITERAL_CSTRING("cookiemgr.test"), // domain + rv[1] = NS_SUCCEEDED(cookieMgr2->Add(NS_LITERAL_CSTRING("cookiemgr.test"), // domain NS_LITERAL_CSTRING("/foo"), // path NS_LITERAL_CSTRING("test1"), // name NS_LITERAL_CSTRING("yes"), // value false, // is secure false, // is httponly true, // is session - INT64_MAX, // expiry time - &attrs)); // originAttributes - rv[2] = NS_SUCCEEDED(cookieMgr2->AddNative(NS_LITERAL_CSTRING("cookiemgr.test"), // domain + INT64_MAX)); // expiry time + rv[2] = NS_SUCCEEDED(cookieMgr2->Add(NS_LITERAL_CSTRING("cookiemgr.test"), // domain NS_LITERAL_CSTRING("/foo"), // path NS_LITERAL_CSTRING("test2"), // name NS_LITERAL_CSTRING("yes"), // value false, // is secure true, // is httponly true, // is session - PR_Now() / PR_USEC_PER_SEC + 2, // expiry time - &attrs)); // originAttributes - rv[3] = NS_SUCCEEDED(cookieMgr2->AddNative(NS_LITERAL_CSTRING("new.domain"), // domain + PR_Now() / PR_USEC_PER_SEC + 2)); // expiry time + rv[3] = NS_SUCCEEDED(cookieMgr2->Add(NS_LITERAL_CSTRING("new.domain"), // domain NS_LITERAL_CSTRING("/rabbit"), // path NS_LITERAL_CSTRING("test3"), // name NS_LITERAL_CSTRING("yes"), // value false, // is secure false, // is httponly true, // is session - INT64_MAX, // expiry time - &attrs)); // originAttributes + INT64_MAX)); // expiry time // confirm using enumerator nsCOMPtr enumerator; rv[4] = NS_SUCCEEDED(cookieMgr->GetEnumerator(getter_AddRefs(enumerator))); @@ -664,6 +659,7 @@ main(int32_t argc, char *argv[]) bool found; rv[9] = NS_SUCCEEDED(cookieMgr2->CookieExists(newDomainCookie, &found)) && found; + mozilla::NeckoOriginAttributes attrs; // remove the cookie, block it, and ensure it can't be added again rv[10] = NS_SUCCEEDED(cookieMgr->RemoveNative(NS_LITERAL_CSTRING("new.domain"), // domain @@ -672,15 +668,14 @@ main(int32_t argc, char *argv[]) true, // is blocked &attrs)); // originAttributes rv[11] = NS_SUCCEEDED(cookieMgr2->CookieExists(newDomainCookie, &found)) && !found; - rv[12] = NS_SUCCEEDED(cookieMgr2->AddNative(NS_LITERAL_CSTRING("new.domain"), // domain + rv[12] = NS_SUCCEEDED(cookieMgr2->Add(NS_LITERAL_CSTRING("new.domain"), // domain NS_LITERAL_CSTRING("/rabbit"), // path NS_LITERAL_CSTRING("test3"), // name NS_LITERAL_CSTRING("yes"), // value false, // is secure false, // is httponly true, // is session - INT64_MIN, // expiry time - &attrs)); // originAttributes + INT64_MIN)); // expiry time rv[13] = NS_SUCCEEDED(cookieMgr2->CookieExists(newDomainCookie, &found)) && !found; // sleep four seconds, to make sure the second cookie has expired PR_Sleep(4 * PR_TicksPerSecond()); diff --git a/netwerk/test/unit/test_bug411952.js b/netwerk/test/unit/test_bug411952.js index 9ac9d1d7454b..63e3603b516f 100644 --- a/netwerk/test/unit/test_bug411952.js +++ b/netwerk/test/unit/test_bug411952.js @@ -5,7 +5,7 @@ function run_test() { do_check_neq(cm, null, "Retrieving the cookie manager failed"); const time = (new Date("Jan 1, 2030")).getTime() / 1000; - cm.add("example.com", "/", "C", "V", false, true, false, time, {}); + cm.add("example.com", "/", "C", "V", false, true, false, time); const now = Math.floor((new Date()).getTime() / 1000); var enumerator = cm.enumerator, found = false; diff --git a/testing/marionette/driver.js b/testing/marionette/driver.js index c5b633f52b41..290ac5d0682d 100644 --- a/testing/marionette/driver.js +++ b/testing/marionette/driver.js @@ -2058,8 +2058,7 @@ GeckoDriver.prototype.addCookie = function*(cmd, resp) { cookie.secure, cookie.httpOnly, cookie.session, - cookie.expiry, - {}); // originAttributes + cookie.expiry); return true; }; this.mm.addMessageListener("Marionette:addCookie", cb); @@ -2622,7 +2621,7 @@ GeckoDriver.prototype.receiveMessage = function(message) { let isForCurrentPath = path => currentPath.indexOf(path) != -1; let results = []; - let en = cookieManager.getCookiesFromHost(host, {}); + let en = cookieManager.getCookiesFromHost(host); while (en.hasMoreElements()) { let cookie = en.getNext().QueryInterface(Ci.nsICookie2); // take the hostname and progressively shorten diff --git a/toolkit/components/extensions/ext-cookies.js b/toolkit/components/extensions/ext-cookies.js index 8f4dfe3c03ae..09afe121ffb2 100644 --- a/toolkit/components/extensions/ext-cookies.js +++ b/toolkit/components/extensions/ext-cookies.js @@ -146,13 +146,13 @@ function* query(detailsIn, props, extension) { if ("url" in details) { try { uri = NetUtil.newURI(details.url).QueryInterface(Ci.nsIURL); - enumerator = Services.cookies.getCookiesFromHost(uri.host, {}); + enumerator = Services.cookies.getCookiesFromHost(uri.host); } catch (ex) { // This often happens for about: URLs return; } } else if ("domain" in details) { - enumerator = Services.cookies.getCookiesFromHost(details.domain, {}); + enumerator = Services.cookies.getCookiesFromHost(details.domain); } else { enumerator = Services.cookies.enumerator; } @@ -288,7 +288,7 @@ extensions.registerSchemaAPI("cookies", "cookies", (extension, context) => { // The permission check may have modified the domain, so use // the new value instead. Services.cookies.add(cookieAttrs.host, path, name, value, - secure, httpOnly, isSession, expiry, {}); + secure, httpOnly, isSession, expiry); return self.cookies.get(details); }, diff --git a/toolkit/components/extensions/test/mochitest/test_ext_cookies_permissions.html b/toolkit/components/extensions/test/mochitest/test_ext_cookies_permissions.html index ef49688358fd..2057c52c27ec 100644 --- a/toolkit/components/extensions/test/mochitest/test_ext_cookies_permissions.html +++ b/toolkit/components/extensions/test/mochitest/test_ext_cookies_permissions.html @@ -126,7 +126,7 @@ function* testCookies(options) { function getCookies(host) { let cookies = []; - let enum_ = cookieSvc.getCookiesFromHost(host, {}); + let enum_ = cookieSvc.getCookiesFromHost(host); while (enum_.hasMoreElements()) { cookies.push(enum_.getNext().QueryInterface(SpecialPowers.Ci.nsICookie2)); } diff --git a/toolkit/forgetaboutsite/ForgetAboutSite.jsm b/toolkit/forgetaboutsite/ForgetAboutSite.jsm index 84217f112203..dae1be8c1f89 100644 --- a/toolkit/forgetaboutsite/ForgetAboutSite.jsm +++ b/toolkit/forgetaboutsite/ForgetAboutSite.jsm @@ -74,7 +74,7 @@ this.ForgetAboutSite = { // Cookies let cm = Cc["@mozilla.org/cookiemanager;1"]. getService(Ci.nsICookieManager2); - let enumerator = cm.getCookiesFromHost(aDomain, {}); + let enumerator = cm.getCookiesFromHost(aDomain); while (enumerator.hasMoreElements()) { let cookie = enumerator.getNext().QueryInterface(Ci.nsICookie); cm.remove(cookie.host, cookie.name, cookie.path, false, cookie.originAttributes); diff --git a/toolkit/forgetaboutsite/test/unit/test_removeDataFromDomain.js b/toolkit/forgetaboutsite/test/unit/test_removeDataFromDomain.js index 9c01750f95bb..03ccb501640d 100644 --- a/toolkit/forgetaboutsite/test/unit/test_removeDataFromDomain.js +++ b/toolkit/forgetaboutsite/test/unit/test_removeDataFromDomain.js @@ -83,7 +83,7 @@ function add_cookie(aDomain) check_cookie_exists(aDomain, false); let cm = Cc["@mozilla.org/cookiemanager;1"].getService(Ci.nsICookieManager2); cm.add(aDomain, COOKIE_PATH, COOKIE_NAME, "", false, false, false, - COOKIE_EXPIRY, {}); + COOKIE_EXPIRY); check_cookie_exists(aDomain, true); } diff --git a/toolkit/mozapps/extensions/test/xpinstall/browser_cookies2.js b/toolkit/mozapps/extensions/test/xpinstall/browser_cookies2.js index 1ef2b482f839..3bfda22d954c 100644 --- a/toolkit/mozapps/extensions/test/xpinstall/browser_cookies2.js +++ b/toolkit/mozapps/extensions/test/xpinstall/browser_cookies2.js @@ -10,7 +10,7 @@ function test() { var cm = Components.classes["@mozilla.org/cookiemanager;1"] .getService(Components.interfaces.nsICookieManager2); cm.add("example.com", "/browser/" + RELATIVE_DIR, "xpinstall", "true", false, - false, true, (Date.now() / 1000) + 60, {}); + false, true, (Date.now() / 1000) + 60); var pm = Services.perms; pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION); diff --git a/toolkit/mozapps/extensions/test/xpinstall/browser_cookies3.js b/toolkit/mozapps/extensions/test/xpinstall/browser_cookies3.js index 833562d15447..48aed5cbf882 100644 --- a/toolkit/mozapps/extensions/test/xpinstall/browser_cookies3.js +++ b/toolkit/mozapps/extensions/test/xpinstall/browser_cookies3.js @@ -10,7 +10,7 @@ function test() { var cm = Components.classes["@mozilla.org/cookiemanager;1"] .getService(Components.interfaces.nsICookieManager2); cm.add("example.com", "/browser/" + RELATIVE_DIR, "xpinstall", "true", false, - false, true, (Date.now() / 1000) + 60, {}); + false, true, (Date.now() / 1000) + 60); var pm = Services.perms; pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION); diff --git a/toolkit/mozapps/extensions/test/xpinstall/browser_cookies4.js b/toolkit/mozapps/extensions/test/xpinstall/browser_cookies4.js index 792146c6486f..b42b279ba198 100644 --- a/toolkit/mozapps/extensions/test/xpinstall/browser_cookies4.js +++ b/toolkit/mozapps/extensions/test/xpinstall/browser_cookies4.js @@ -11,7 +11,7 @@ function test() { var cm = Components.classes["@mozilla.org/cookiemanager;1"] .getService(Components.interfaces.nsICookieManager2); cm.add("example.org", "/browser/" + RELATIVE_DIR, "xpinstall", "true", false, - false, true, (Date.now() / 1000) + 60, {}); + false, true, (Date.now() / 1000) + 60); var pm = Services.perms; pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);