1.1 --- a/netwerk/cookie/nsCookie.cpp Wed Dec 31 06:55:50 2014 +0100 1.2 +++ b/netwerk/cookie/nsCookie.cpp Wed Dec 31 07:22:50 2014 +0100 1.3 @@ -19,10 +19,12 @@ 1.4 const nsACString &aSource2, 1.5 const nsACString &aSource3, 1.6 const nsACString &aSource4, 1.7 + const nsACString &aSource5, 1.8 char *&aDest1, 1.9 char *&aDest2, 1.10 char *&aDest3, 1.11 char *&aDest4, 1.12 + char *&aDest5, 1.13 char *&aDestEnd) 1.14 { 1.15 char *toBegin = aDest1; 1.16 @@ -35,6 +37,8 @@ 1.17 *copy_string(aSource3.BeginReading(fromBegin), aSource3.EndReading(fromEnd), toBegin) = char(0); 1.18 aDest4 = ++toBegin; 1.19 *copy_string(aSource4.BeginReading(fromBegin), aSource4.EndReading(fromEnd), toBegin) = char(0); 1.20 + aDest5 = ++toBegin; 1.21 + *copy_string(aSource5.BeginReading(fromBegin), aSource5.EndReading(fromEnd), toBegin) = char(0); 1.22 aDestEnd = toBegin; 1.23 } 1.24 1.25 @@ -70,6 +74,7 @@ 1.26 nsCookie::Create(const nsACString &aName, 1.27 const nsACString &aValue, 1.28 const nsACString &aHost, 1.29 + const nsACString &aOrigin, 1.30 const nsACString &aPath, 1.31 int64_t aExpiry, 1.32 int64_t aLastAccessed, 1.33 @@ -84,9 +89,10 @@ 1.34 nsAutoCString aUTF8Value; 1.35 converter.ConvertStringToUTF8(aValue, "UTF-8", false, true, 1, aUTF8Value); 1.36 1.37 - // find the required string buffer size, adding 4 for the terminating nulls 1.38 + // find the required string buffer size, accommodating terminating nulls 1.39 const uint32_t stringLength = aName.Length() + aUTF8Value.Length() + 1.40 - aHost.Length() + aPath.Length() + 4; 1.41 + aHost.Length() + aOrigin.Length() + 1.42 + aPath.Length() + 5; 1.43 1.44 // allocate contiguous space for the nsCookie and its strings - 1.45 // we store the strings in-line with the nsCookie to save allocations 1.46 @@ -95,10 +101,10 @@ 1.47 return nullptr; 1.48 1.49 // assign string members 1.50 - char *name, *value, *host, *path, *end; 1.51 + char *name, *value, *host, *origin, *path, *end; 1.52 name = static_cast<char *>(place) + sizeof(nsCookie); 1.53 - StrBlockCopy(aName, aUTF8Value, aHost, aPath, 1.54 - name, value, host, path, end); 1.55 + StrBlockCopy(aName, aUTF8Value, aHost, aOrigin, aPath, 1.56 + name, value, host, origin, path, end); 1.57 1.58 // If the creationTime given to us is higher than the running maximum, update 1.59 // our maximum. 1.60 @@ -106,7 +112,7 @@ 1.61 gLastCreationTime = aCreationTime; 1.62 1.63 // construct the cookie. placement new, oh yeah! 1.64 - return new (place) nsCookie(name, value, host, path, end, 1.65 + return new (place) nsCookie(name, value, host, origin, path, end, 1.66 aExpiry, aLastAccessed, aCreationTime, 1.67 aIsSession, aIsSecure, aIsHttpOnly); 1.68 } 1.69 @@ -127,6 +133,7 @@ 1.70 // xpcom getters 1.71 NS_IMETHODIMP nsCookie::GetName(nsACString &aName) { aName = Name(); return NS_OK; } 1.72 NS_IMETHODIMP nsCookie::GetValue(nsACString &aValue) { aValue = Value(); return NS_OK; } 1.73 +NS_IMETHODIMP nsCookie::GetOrigin(nsACString &aOrigin) { aOrigin = Origin(); return NS_OK; } 1.74 NS_IMETHODIMP nsCookie::GetHost(nsACString &aHost) { aHost = Host(); return NS_OK; } 1.75 NS_IMETHODIMP nsCookie::GetRawHost(nsACString &aHost) { aHost = RawHost(); return NS_OK; } 1.76 NS_IMETHODIMP nsCookie::GetPath(nsACString &aPath) { aPath = Path(); return NS_OK; }