Bug #313341 --> Allow Software Update to Set and Access Cookies in Thunderbird. Allow docshells with chrome

priveleges to set cookies.

sr=darin
a=me

(not part of the firefox build, thunderbird only)
This commit is contained in:
scott%scott-macgregor.org 2005-10-24 05:41:54 +00:00
Родитель 512d3f118f
Коммит bd8949dd9b
1 изменённых файлов: 16 добавлений и 1 удалений

Просмотреть файл

@ -63,6 +63,8 @@
#include "nsCExternalHandlerService.h"
// needed for the cookie policy manager
#include "nsNetUtil.h"
#include "nsIDocShellTreeItem.h"
#include "nsICookie2.h"
#include "nsICookieManager2.h"
@ -413,13 +415,26 @@ NS_IMETHODIMP nsMsgCookiePolicy::CanAccess(nsIURI *aURI,
{
// by default we deny all cookies in mail
*aResult = ACCESS_DENY;
NS_ENSURE_ARG_POINTER(aChannel);
// If aFirstURI is an RSS article, then we do allow cookies.
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem;
NS_QueryNotificationCallbacks(aChannel, docShellTreeItem);
NS_ENSURE_TRUE(docShellTreeItem, NS_OK);
PRInt32 itemType;
docShellTreeItem->GetItemType(&itemType);
// allow chome docshells to set cookies
if (itemType == nsIDocShellTreeItem::typeChrome)
*aResult = ACCESS_DEFAULT;
else // allow RSS articles in content to access cookies
{
NS_ENSURE_TRUE(aFirstURI, NS_OK);
PRBool isRSS = PR_FALSE;
IsRSSArticle(aFirstURI, &isRSS);
if (isRSS)
*aResult = ACCESS_DEFAULT;
}
return NS_OK;
}