Bug 1245184 - Update mochitests, r=me

This commit is contained in:
Andrea Marchesini 2016-02-25 16:41:13 +01:00
parent 8cd3c16e81
commit b1768e7ec3
15 changed files with 27 additions and 25 deletions

View File

@ -623,7 +623,7 @@ Cookies.prototype = {
// a domain cookie. See bug 222343.
if (host.length > 0) {
// Fist delete any possible extant matching host cookie.
Services.cookies.remove(host, name, path, false);
Services.cookies.remove(host, name, path, {}, false);
// Now make it a domain cookie.
if (host[0] != "." && !hostIsIPAddress(host))
host = "." + host;

View File

@ -135,7 +135,8 @@ exports.items = [
let cookie = enm.getNext().QueryInterface(Ci.nsICookie);
if (isCookieAtHost(cookie, host)) {
if (cookie.name == args.name) {
cookieMgr.remove(cookie.host, cookie.name, cookie.path, false);
cookieMgr.remove(cookie.host, cookie.name, cookie.path,
cookie.originAttributes, false);
}
}
}

View File

@ -28,9 +28,9 @@ function run_test() {
do_check_throws(function() {
cm.countCookiesFromHost("..baz.com");
}, Cr.NS_ERROR_ILLEGAL_VALUE);
cm.remove("BAZ.com.", "foo", "/", false);
cm.remove("BAZ.com.", "foo", "/", {}, false);
do_check_eq(cm.countCookiesFromHost("baz.com"), 1);
cm.remove("baz.com", "foo", "/", false);
cm.remove("baz.com", "foo", "/", {}, false);
do_check_eq(cm.countCookiesFromHost("baz.com"), 0);
// Test that 'baz.com' and 'baz.com.' are treated differently
@ -40,9 +40,9 @@ function run_test() {
do_check_eq(cm.countCookiesFromHost(".baz.com"), 0);
do_check_eq(cm.countCookiesFromHost("baz.com."), 1);
do_check_eq(cm.countCookiesFromHost(".baz.com."), 1);
cm.remove("baz.com", "foo", "/", false);
cm.remove("baz.com", "foo", "/", {}, false);
do_check_eq(cm.countCookiesFromHost("baz.com."), 1);
cm.remove("baz.com.", "foo", "/", false);
cm.remove("baz.com.", "foo", "/", {}, false);
do_check_eq(cm.countCookiesFromHost("baz.com."), 0);
// test that domain cookies are illegal for IP addresses, aliases such as
@ -174,10 +174,10 @@ function run_test() {
}, Cr.NS_ERROR_ILLEGAL_VALUE);
do_check_eq(getCookieCount(), 1);
cm.remove("", "foo2", "/", false);
cm.remove("", "foo2", "/", {}, false);
do_check_eq(getCookieCount(), 0);
do_check_throws(function() {
cm.remove(".", "foo3", "/", false);
cm.remove(".", "foo3", "/", {}, false);
}, Cr.NS_ERROR_ILLEGAL_VALUE);
// test that the 'domain' attribute accepts a leading dot for IP addresses,

View File

@ -58,7 +58,7 @@ function do_run_test() {
}, Cr.NS_ERROR_NOT_AVAILABLE);
do_check_throws(function() {
Services.cookiemgr.remove("foo.com", "", "oh4", false);
Services.cookiemgr.remove("foo.com", "", "oh4", {}, false);
}, Cr.NS_ERROR_NOT_AVAILABLE);
do_check_throws(function() {

View File

@ -86,11 +86,11 @@ function do_run_test() {
// remove some of the cookies, in both reverse and forward order
for (let i = 100; i-- > 0; ) {
let host = i.toString() + ".com";
Services.cookiemgr.remove(host, "oh", "/", false);
Services.cookiemgr.remove(host, "oh", "/", {}, false);
}
for (let i = CMAX - 100; i < CMAX; ++i) {
let host = i.toString() + ".com";
Services.cookiemgr.remove(host, "oh", "/", false);
Services.cookiemgr.remove(host, "oh", "/", {}, false);
}
// check the count

View File

@ -2371,10 +2371,7 @@ nsCookieService::Remove(const nsACString &aHost,
JSContext* aCx)
{
NeckoOriginAttributes attrs;
if (!attrs.Init(aCx, aOriginAttributes)) {
return NS_ERROR_FAILURE;
}
MOZ_ASSERT(attrs.Init(aCx, aOriginAttributes));
return RemoveNative(aHost, aName, aPath, &attrs, aBlocked);
}

View File

@ -755,4 +755,6 @@ main(int32_t argc, char *argv[])
// Stubs to make this test happy
mozilla::dom::OriginAttributesDictionary::OriginAttributesDictionary() {}
mozilla::dom::OriginAttributesDictionary::OriginAttributesDictionary()
: mAppId(0), mInBrowser(false), mUserContextId(0)
{}

View File

@ -2319,6 +2319,7 @@ GeckoDriver.prototype.deleteAllCookies = function*(cmd, resp) {
cookie.host,
cookie.name,
cookie.path,
cookie.originAttributes,
false);
return true;
};
@ -2336,6 +2337,7 @@ GeckoDriver.prototype.deleteCookie = function*(cmd, resp) {
cookie.host,
cookie.name,
cookie.path,
cookie.originAttributes,
false);
return true;
};

View File

@ -295,7 +295,7 @@ extensions.registerSchemaAPI("cookies", "cookies", (extension, context) => {
remove: function(details) {
for (let cookie of query(details, ["url", "name", "storeId"], extension)) {
Services.cookies.remove(cookie.host, cookie.name, cookie.path, false);
Services.cookies.remove(cookie.host, cookie.name, cookie.path, cookie.originAttributes, false);
// Todo: could there be multiple per subdomain?
return Promise.resolve({
url: details.url,

View File

@ -117,7 +117,7 @@ function* testCookies(options) {
yield extension.awaitMessage("change-cookies");
cookieSvc.add(domain, "/", "x", "y", options.secure, false, false, options.expiry);
cookieSvc.add(domain, "/", "x", "z", options.secure, false, false, options.expiry);
cookieSvc.remove(domain, "x", "/", false);
cookieSvc.remove(domain, "x", "/", {}, false);
extension.sendMessage("cookies-changed");
yield extension.awaitFinish("cookie-permissions");
@ -168,7 +168,7 @@ function* testCookies(options) {
}
for (let cookie of cookies) {
cookieSvc.remove(cookie.host, cookie.name, "/", false);
cookieSvc.remove(cookie.host, cookie.name, "/", {}, false);
}
// Make sure we don't silently poison subsequent tests if something goes wrong.
is(getCookies(options.domain).length, 0, "cookies cleared");

View File

@ -111,8 +111,8 @@ var tests = {
is(data[0].value, "burger", "cookie has the correct value");
is(data[1].name, "moar", "cookie has the correct name");
is(data[1].value, "bacon", "cookie has the correct value");
Services.cookies.remove('.example.com', '/', 'cheez', false);
Services.cookies.remove('.example.com', '/', 'moar', false);
Services.cookies.remove('.example.com', '/', 'cheez', {}, false);
Services.cookies.remove('.example.com', '/', 'moar', {}, false);
port.close();
next();
}

View File

@ -77,7 +77,7 @@ this.ForgetAboutSite = {
let enumerator = cm.getCookiesFromHost(aDomain);
while (enumerator.hasMoreElements()) {
let cookie = enumerator.getNext().QueryInterface(Ci.nsICookie);
cm.remove(cookie.host, cookie.name, cookie.path, false);
cm.remove(cookie.host, cookie.name, cookie.path, cookie.originAttributes, false);
}
// EME

View File

@ -31,7 +31,7 @@ function finish_test(count) {
var cm = Components.classes["@mozilla.org/cookiemanager;1"]
.getService(Components.interfaces.nsICookieManager2);
cm.remove("example.com", "xpinstall", "/browser/" + RELATIVE_DIR, false);
cm.remove("example.com", "xpinstall", "/browser/" + RELATIVE_DIR, {}, false);
Services.perms.remove(makeURI("http://example.com"), "install");

View File

@ -33,7 +33,7 @@ function finish_test(count) {
var cm = Components.classes["@mozilla.org/cookiemanager;1"]
.getService(Components.interfaces.nsICookieManager2);
cm.remove("example.com", "xpinstall", "/browser/" + RELATIVE_DIR, false);
cm.remove("example.com", "xpinstall", "/browser/" + RELATIVE_DIR, {}, false);
Services.prefs.clearUserPref("network.cookie.cookieBehavior");

View File

@ -33,7 +33,7 @@ function finish_test(count) {
is(count, 0, "No add-ons should have been installed");
var cm = Components.classes["@mozilla.org/cookiemanager;1"]
.getService(Components.interfaces.nsICookieManager2);
cm.remove("example.org", "xpinstall", "/browser/" + RELATIVE_DIR, false);
cm.remove("example.org", "xpinstall", "/browser/" + RELATIVE_DIR, {}, false);
Services.prefs.clearUserPref("network.cookie.cookieBehavior");
Services.perms.remove(makeURI("http://example.com"), "install");