mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-15 04:39:31 +00:00
Backed out changeset 826cc48624a3 (bug 1280590) for windows m-oth and xpc crashes
--HG-- extra : rebase_source : 895634096f3c1e275ab4f74f1d93691f5b55e22c
This commit is contained in:
parent
9ff039635f
commit
c89ca66d22
2
CLOBBER
2
CLOBBER
@ -22,4 +22,4 @@
|
||||
# changes to stick? As of bug 928195, this shouldn't be necessary! Please
|
||||
# don't change CLOBBER for WebIDL changes any more.
|
||||
|
||||
Bug 1280590 - xpcshell failure in windows7
|
||||
Merge day clobber
|
@ -115,7 +115,6 @@ var SessionCookiesInternal = {
|
||||
* Restores a given list of session cookies.
|
||||
*/
|
||||
restore(cookies) {
|
||||
|
||||
for (let cookie of cookies) {
|
||||
let expiry = "expiry" in cookie ? cookie.expiry : MAX_EXPIRY;
|
||||
let cookieObj = {
|
||||
@ -123,7 +122,7 @@ var SessionCookiesInternal = {
|
||||
path: cookie.path || "",
|
||||
name: cookie.name || ""
|
||||
};
|
||||
if (!Services.cookies.cookieExists(cookieObj, cookie.originAttributes || {})) {
|
||||
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 || {});
|
||||
|
@ -4356,51 +4356,10 @@ nsCookieService::PurgeCookies(int64_t aCurrentTimeInUsec)
|
||||
// find whether a given cookie has been previously set. this is provided by the
|
||||
// nsICookieManager2 interface.
|
||||
NS_IMETHODIMP
|
||||
nsCookieService::CookieExists(nsICookie2* aCookie,
|
||||
JS::HandleValue aOriginAttributes,
|
||||
JSContext* aCx,
|
||||
uint8_t aArgc,
|
||||
bool* aFoundCookie)
|
||||
nsCookieService::CookieExists(nsICookie2 *aCookie,
|
||||
bool *aFoundCookie)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aCookie);
|
||||
NS_ENSURE_ARG_POINTER(aCx);
|
||||
NS_ENSURE_ARG_POINTER(aFoundCookie);
|
||||
|
||||
MOZ_ASSERT(aArgc == 0 || aArgc == 1);
|
||||
|
||||
nsresult rv;
|
||||
NeckoOriginAttributes attrs;
|
||||
|
||||
if (aArgc == 0) {
|
||||
JS::Rooted<JS::Value> value(aCx);
|
||||
rv = aCookie->GetOriginAttributes(aCx, &value);
|
||||
// We ignore this failure because nsICookie2 could be implemented in JS and
|
||||
// this getter will failed because marked [implicit_jscontext].
|
||||
if (NS_SUCCEEDED(rv) &&
|
||||
(!value.isObject() || !attrs.Init(aCx, value))) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
} else {
|
||||
rv = InitializeOriginAttributes(&attrs,
|
||||
aOriginAttributes,
|
||||
aCx,
|
||||
aArgc,
|
||||
u"nsICookieManager2.cookieExists()",
|
||||
u"2");
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
return CookieExistsNative(aCookie, &attrs, aFoundCookie);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(nsresult)
|
||||
nsCookieService::CookieExistsNative(nsICookie2* aCookie,
|
||||
NeckoOriginAttributes* aOriginAttributes,
|
||||
bool* aFoundCookie)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aCookie);
|
||||
NS_ENSURE_ARG_POINTER(aOriginAttributes);
|
||||
NS_ENSURE_ARG_POINTER(aFoundCookie);
|
||||
|
||||
if (!mDBState) {
|
||||
NS_WARNING("No DBState! Profile already closed?");
|
||||
@ -4420,8 +4379,7 @@ nsCookieService::CookieExistsNative(nsICookie2* aCookie,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsListIter iter;
|
||||
*aFoundCookie = FindCookie(nsCookieKey(baseDomain, *aOriginAttributes),
|
||||
host, name, path, iter);
|
||||
*aFoundCookie = FindCookie(DEFAULT_APP_KEY(baseDomain), host, name, path, iter);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -76,23 +76,11 @@ interface nsICookieManager2 : nsICookieManager
|
||||
*
|
||||
* @param aCookie
|
||||
* the cookie to look for
|
||||
* @param aOriginAttributes
|
||||
* nsICookie2 contains an originAttributes but if nsICookie2 is
|
||||
* implemented in JS, we can't retrieve its originAttributes because
|
||||
* the getter is marked [implicit_jscontext]. This optional parameter
|
||||
* is a workaround.
|
||||
*
|
||||
* @return true if a cookie was found which matches the host, path, and name
|
||||
* fields of aCookie
|
||||
*/
|
||||
[implicit_jscontext, optional_argc]
|
||||
boolean cookieExists(in nsICookie2 aCookie,
|
||||
[optional] in jsval aOriginAttributes);
|
||||
|
||||
[notxpcom]
|
||||
nsresult cookieExistsNative(in nsICookie2 aCookie,
|
||||
in NeckoOriginAttributesPtr aOriginAttributes,
|
||||
out boolean aExists);
|
||||
boolean cookieExists(in nsICookie2 aCookie);
|
||||
|
||||
/**
|
||||
* Count how many cookies exist within the base domain of 'aHost'.
|
||||
|
@ -757,9 +757,9 @@ main(int32_t argc, char *argv[])
|
||||
uint32_t hostCookies = 0;
|
||||
rv[8] = NS_SUCCEEDED(cookieMgr2->CountCookiesFromHost(NS_LITERAL_CSTRING("cookiemgr.test"), &hostCookies)) &&
|
||||
hostCookies == 2;
|
||||
// check CookieExistsNative() using the third cookie
|
||||
// check CookieExists() using the third cookie
|
||||
bool found;
|
||||
rv[9] = NS_SUCCEEDED(cookieMgr2->CookieExistsNative(newDomainCookie, &attrs, &found)) && found;
|
||||
rv[9] = NS_SUCCEEDED(cookieMgr2->CookieExists(newDomainCookie, &found)) && found;
|
||||
|
||||
|
||||
// remove the cookie, block it, and ensure it can't be added again
|
||||
@ -768,7 +768,7 @@ main(int32_t argc, char *argv[])
|
||||
NS_LITERAL_CSTRING("/rabbit"), // path
|
||||
true, // is blocked
|
||||
&attrs)); // originAttributes
|
||||
rv[11] = NS_SUCCEEDED(cookieMgr2->CookieExistsNative(newDomainCookie, &attrs, &found)) && !found;
|
||||
rv[11] = NS_SUCCEEDED(cookieMgr2->CookieExists(newDomainCookie, &found)) && !found;
|
||||
rv[12] = NS_SUCCEEDED(cookieMgr2->AddNative(NS_LITERAL_CSTRING("new.domain"), // domain
|
||||
NS_LITERAL_CSTRING("/rabbit"), // path
|
||||
NS_LITERAL_CSTRING("test3"), // name
|
||||
@ -778,14 +778,14 @@ main(int32_t argc, char *argv[])
|
||||
true, // is session
|
||||
INT64_MIN, // expiry time
|
||||
&attrs)); // originAttributes
|
||||
rv[13] = NS_SUCCEEDED(cookieMgr2->CookieExistsNative(newDomainCookie, &attrs, &found)) && !found;
|
||||
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());
|
||||
// check that both CountCookiesFromHost() and CookieExistsNative() count the
|
||||
// check that both CountCookiesFromHost() and CookieExists() count the
|
||||
// expired cookie
|
||||
rv[14] = NS_SUCCEEDED(cookieMgr2->CountCookiesFromHost(NS_LITERAL_CSTRING("cookiemgr.test"), &hostCookies)) &&
|
||||
hostCookies == 2;
|
||||
rv[15] = NS_SUCCEEDED(cookieMgr2->CookieExistsNative(expiredCookie, &attrs, &found)) && found;
|
||||
rv[15] = NS_SUCCEEDED(cookieMgr2->CookieExists(expiredCookie, &found)) && found;
|
||||
// double-check RemoveAll() using the enumerator
|
||||
rv[16] = NS_SUCCEEDED(cookieMgr->RemoveAll());
|
||||
rv[17] = NS_SUCCEEDED(cookieMgr->GetEnumerator(getter_AddRefs(enumerator))) &&
|
||||
|
Loading…
x
Reference in New Issue
Block a user