Bug 1363311 - Honor Set-Cookie headers in multipart/mixed response boundary headers in e10s mode; r=jdm

This commit is contained in:
Ehsan Akhgari 2017-05-20 00:47:59 -04:00
parent c200b63e89
commit 87f01dcea3
8 changed files with 22 additions and 10 deletions

View File

@ -144,7 +144,8 @@ nsresult
CookieServiceChild::SetCookieStringInternal(nsIURI *aHostURI,
nsIChannel *aChannel,
const char *aCookieString,
const char *aServerTime)
const char *aServerTime,
bool aFromHttp)
{
NS_ENSURE_ARG(aHostURI);
NS_ENSURE_ARG_POINTER(aCookieString);
@ -179,7 +180,7 @@ CookieServiceChild::SetCookieStringInternal(nsIURI *aHostURI,
// Synchronously call the parent.
SendSetCookieString(uriParams, !!isForeign, cookieString, serverTime,
attrs);
attrs, aFromHttp);
return NS_OK;
}
@ -220,7 +221,8 @@ CookieServiceChild::SetCookieString(nsIURI *aHostURI,
const char *aCookieString,
nsIChannel *aChannel)
{
return SetCookieStringInternal(aHostURI, aChannel, aCookieString, nullptr);
return SetCookieStringInternal(aHostURI, aChannel, aCookieString,
nullptr, false);
}
NS_IMETHODIMP
@ -231,7 +233,8 @@ CookieServiceChild::SetCookieStringFromHttp(nsIURI *aHostURI,
const char *aServerTime,
nsIChannel *aChannel)
{
return NS_ERROR_NOT_IMPLEMENTED;
return SetCookieStringInternal(aHostURI, aChannel, aCookieString,
aServerTime, true);
}
} // namespace net

View File

@ -47,7 +47,8 @@ protected:
nsresult SetCookieStringInternal(nsIURI *aHostURI,
nsIChannel *aChannel,
const char *aCookieString,
const char *aServerTime);
const char *aServerTime,
bool aFromHttp);
void PrefChanged(nsIPrefBranch *aPrefBranch);

View File

@ -109,7 +109,8 @@ CookieServiceParent::RecvSetCookieString(const URIParams& aHost,
const bool& aIsForeign,
const nsCString& aCookieString,
const nsCString& aServerTime,
const OriginAttributes& aAttrs)
const OriginAttributes& aAttrs,
const bool& aFromHttp)
{
if (!mCookieService)
return IPC_OK();
@ -134,7 +135,7 @@ CookieServiceParent::RecvSetCookieString(const URIParams& aHost,
// NB: dummyChannel could be null if something failed in CreateDummyChannel.
nsDependentCString cookieString(aCookieString, 0);
mCookieService->SetCookieStringInternal(hostURI, aIsForeign, cookieString,
aServerTime, false, aAttrs,
aServerTime, aFromHttp, aAttrs,
dummyChannel);
return IPC_OK();
}

View File

@ -32,7 +32,8 @@ protected:
const bool& aIsForeign,
const nsCString& aCookieString,
const nsCString& aServerTime,
const OriginAttributes& aAttrs) override;
const OriginAttributes& aAttrs,
const bool& aFromHttp) override;
RefPtr<nsCookieService> mCookieService;
};

View File

@ -97,7 +97,8 @@ parent:
bool isForeign,
nsCString cookieString,
nsCString serverTime,
OriginAttributes attrs);
OriginAttributes attrs,
bool aFromHttp);
async __delete__();
};

View File

@ -11,7 +11,7 @@ function make_channel(url) {
return NetUtil.newChannel({uri: url, loadUsingSystemPrincipal: true});
}
var multipartBody = "--boundary\r\n\r\nSome text\r\n--boundary\r\nContent-Type: text/x-test\r\n\r\n<?xml version='1.1'?>\r\n<root/>\r\n--boundary\r\n\r\n<?xml version='1.0'?><root/>\r\n--boundary--";
var multipartBody = "--boundary\r\nSet-Cookie: foo=bar\r\n\r\nSome text\r\n--boundary\r\nContent-Type: text/x-test\r\n\r\n<?xml version='1.1'?>\r\n<root/>\r\n--boundary\r\n\r\n<?xml version='1.0'?><root/>\r\n--boundary--";
function contentHandler(metadata, response)
{

View File

@ -0,0 +1,3 @@
function run_test() {
run_test_in_child("../unit/test_multipart_streamconv.js");
}

View File

@ -56,6 +56,7 @@ support-files =
!/netwerk/test/unit/test_alt-data_simple.js
!/netwerk/test/unit/test_alt-data_stream.js
!/netwerk/test/unit/test_channel_priority.js
!/netwerk/test/unit/test_multipart_streamconv.js
[test_bug528292_wrap.js]
[test_bug248970_cookie_wrap.js]
@ -101,3 +102,4 @@ skip-if = true
[test_trackingProtection_annotateChannels_wrap1.js]
[test_trackingProtection_annotateChannels_wrap2.js]
[test_channel_priority_wrap.js]
[test_multipart_streamconv_wrap.js]