Backout 7a0fe388a24b, 2a9fbd15cad4, 320c1567e431 & d907ac7bf669 (bug 722850) for xpcshell & browser-chrome failures

This commit is contained in:
Ed Morley
2012-11-16 14:18:41 +00:00
parent e6525d56b3
commit f4e14a730a
12 changed files with 228 additions and 214 deletions

View File

@@ -669,23 +669,6 @@ GetPrivacyFromNPP(NPP npp, bool* aPrivate)
return NS_OK;
}
static already_AddRefed<nsIChannel>
GetChannelFromNPP(NPP npp)
{
nsCOMPtr<nsIDocument> doc = GetDocumentFromNPP(npp);
if (!doc)
return nullptr;
nsCOMPtr<nsPIDOMWindow> domwindow = doc->GetWindow();
nsCOMPtr<nsIChannel> channel;
if (domwindow) {
nsCOMPtr<nsIDocShell> docShell = domwindow->GetDocShell();
if (docShell) {
docShell->GetCurrentDocumentChannel(getter_AddRefs(channel));
}
}
return channel.forget();
}
static NPIdentifier
doGetIdentifier(JSContext *cx, const NPUTF8* name)
{
@@ -2657,9 +2640,7 @@ _getvalueforurl(NPP instance, NPNURLVariable variable, const char *url,
return NPERR_GENERIC_ERROR;
}
nsCOMPtr<nsIChannel> channel = GetChannelFromNPP(instance);
if (NS_FAILED(cookieService->GetCookieString(uri, channel, value)) ||
if (NS_FAILED(cookieService->GetCookieString(uri, nullptr, value)) ||
!*value) {
return NPERR_GENERIC_ERROR;
}
@@ -2712,12 +2693,10 @@ _setvalueforurl(NPP instance, NPNURLVariable variable, const char *url,
nsCOMPtr<nsIPrompt> prompt;
nsPluginHost::GetPrompt(nullptr, getter_AddRefs(prompt));
nsCOMPtr<nsIChannel> channel = GetChannelFromNPP(instance);
char *cookie = (char*)value;
char c = cookie[len];
cookie[len] = '\0';
rv = cookieService->SetCookieString(uriIn, prompt, cookie, channel);
rv = cookieService->SetCookieString(uriIn, prompt, cookie, nullptr);
cookie[len] = c;
if (NS_SUCCEEDED(rv))
return NPERR_NO_ERROR;