diff -r 7e26c7da4463 -r fc2d59ddac77 netwerk/cookie/nsCookie.cpp --- a/netwerk/cookie/nsCookie.cpp Wed Dec 31 06:55:50 2014 +0100 +++ b/netwerk/cookie/nsCookie.cpp Wed Dec 31 07:22:50 2014 +0100 @@ -19,10 +19,12 @@ const nsACString &aSource2, const nsACString &aSource3, const nsACString &aSource4, + const nsACString &aSource5, char *&aDest1, char *&aDest2, char *&aDest3, char *&aDest4, + char *&aDest5, char *&aDestEnd) { char *toBegin = aDest1; @@ -35,6 +37,8 @@ *copy_string(aSource3.BeginReading(fromBegin), aSource3.EndReading(fromEnd), toBegin) = char(0); aDest4 = ++toBegin; *copy_string(aSource4.BeginReading(fromBegin), aSource4.EndReading(fromEnd), toBegin) = char(0); + aDest5 = ++toBegin; + *copy_string(aSource5.BeginReading(fromBegin), aSource5.EndReading(fromEnd), toBegin) = char(0); aDestEnd = toBegin; } @@ -70,6 +74,7 @@ nsCookie::Create(const nsACString &aName, const nsACString &aValue, const nsACString &aHost, + const nsACString &aOrigin, const nsACString &aPath, int64_t aExpiry, int64_t aLastAccessed, @@ -84,9 +89,10 @@ nsAutoCString aUTF8Value; converter.ConvertStringToUTF8(aValue, "UTF-8", false, true, 1, aUTF8Value); - // find the required string buffer size, adding 4 for the terminating nulls + // find the required string buffer size, accommodating terminating nulls const uint32_t stringLength = aName.Length() + aUTF8Value.Length() + - aHost.Length() + aPath.Length() + 4; + aHost.Length() + aOrigin.Length() + + aPath.Length() + 5; // allocate contiguous space for the nsCookie and its strings - // we store the strings in-line with the nsCookie to save allocations @@ -95,10 +101,10 @@ return nullptr; // assign string members - char *name, *value, *host, *path, *end; + char *name, *value, *host, *origin, *path, *end; name = static_cast(place) + sizeof(nsCookie); - StrBlockCopy(aName, aUTF8Value, aHost, aPath, - name, value, host, path, end); + StrBlockCopy(aName, aUTF8Value, aHost, aOrigin, aPath, + name, value, host, origin, path, end); // If the creationTime given to us is higher than the running maximum, update // our maximum. @@ -106,7 +112,7 @@ gLastCreationTime = aCreationTime; // construct the cookie. placement new, oh yeah! - return new (place) nsCookie(name, value, host, path, end, + return new (place) nsCookie(name, value, host, origin, path, end, aExpiry, aLastAccessed, aCreationTime, aIsSession, aIsSecure, aIsHttpOnly); } @@ -127,6 +133,7 @@ // xpcom getters NS_IMETHODIMP nsCookie::GetName(nsACString &aName) { aName = Name(); return NS_OK; } NS_IMETHODIMP nsCookie::GetValue(nsACString &aValue) { aValue = Value(); return NS_OK; } +NS_IMETHODIMP nsCookie::GetOrigin(nsACString &aOrigin) { aOrigin = Origin(); return NS_OK; } NS_IMETHODIMP nsCookie::GetHost(nsACString &aHost) { aHost = Host(); return NS_OK; } NS_IMETHODIMP nsCookie::GetRawHost(nsACString &aHost) { aHost = RawHost(); return NS_OK; } NS_IMETHODIMP nsCookie::GetPath(nsACString &aPath) { aPath = Path(); return NS_OK; }