Backed out changesets 180e7905987e, 91101cbcc319, and 211567afcc5f (bug 1108547) for timeouts in the new test.
CLOSED TREE
This commit is contained in:
@@ -1225,32 +1225,6 @@ nsHTMLDocument::GetCookie(nsAString& aCookie)
|
||||
return rv.ErrorCode();
|
||||
}
|
||||
|
||||
already_AddRefed<nsIChannel>
|
||||
nsHTMLDocument::CreateDummyChannelForCookies(nsIURI* aCodebaseURI)
|
||||
{
|
||||
// The cookie service reads the privacy status of the channel we pass to it in
|
||||
// order to determine which cookie database to query. In some cases we don't
|
||||
// have a proper channel to hand it to the cookie service though. This
|
||||
// function creates a dummy channel that is not used to load anything, for the
|
||||
// sole purpose of handing it to the cookie service. DO NOT USE THIS CHANNEL
|
||||
// FOR ANY OTHER PURPOSE.
|
||||
MOZ_ASSERT(!mChannel);
|
||||
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
NS_NewChannel(getter_AddRefs(channel), aCodebaseURI, this,
|
||||
nsILoadInfo::SEC_NORMAL,
|
||||
nsIContentPolicy::TYPE_INVALID);
|
||||
nsCOMPtr<nsIPrivateBrowsingChannel> pbChannel =
|
||||
do_QueryInterface(channel);
|
||||
nsCOMPtr<nsIDocShell> docShell(mDocumentContainer);
|
||||
nsCOMPtr<nsILoadContext> loadContext = do_QueryInterface(docShell);
|
||||
if (!pbChannel || !loadContext) {
|
||||
return nullptr;
|
||||
}
|
||||
pbChannel->SetPrivate(loadContext->UsePrivateBrowsing());
|
||||
return channel.forget();
|
||||
}
|
||||
|
||||
void
|
||||
nsHTMLDocument::GetCookie(nsAString& aCookie, ErrorResult& rv)
|
||||
{
|
||||
@@ -1283,16 +1257,8 @@ nsHTMLDocument::GetCookie(nsAString& aCookie, ErrorResult& rv)
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIChannel> channel(mChannel);
|
||||
if (!channel) {
|
||||
channel = CreateDummyChannelForCookies(codebaseURI);
|
||||
if (!channel) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
nsXPIDLCString cookie;
|
||||
service->GetCookieString(codebaseURI, channel, getter_Copies(cookie));
|
||||
service->GetCookieString(codebaseURI, mChannel, getter_Copies(cookie));
|
||||
// CopyUTF8toUTF16 doesn't handle error
|
||||
// because it assumes that the input is valid.
|
||||
nsContentUtils::ConvertStringFromEncoding(NS_LITERAL_CSTRING("UTF-8"),
|
||||
@@ -1336,16 +1302,8 @@ nsHTMLDocument::SetCookie(const nsAString& aCookie, ErrorResult& rv)
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIChannel> channel(mChannel);
|
||||
if (!channel) {
|
||||
channel = CreateDummyChannelForCookies(codebaseURI);
|
||||
if (!channel) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
NS_ConvertUTF16toUTF8 cookie(aCookie);
|
||||
service->SetCookieString(codebaseURI, nullptr, cookie.get(), channel);
|
||||
service->SetCookieString(codebaseURI, nullptr, cookie.get(), mChannel);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user