Bug 760157 - Determining what is a feed message should use the new FeedMsg flag. r=mkmelin

This commit is contained in:
alta88@gmail.com 2014-01-02 10:31:23 -05:00
Родитель acec8fb09d
Коммит 0603af4258
2 изменённых файлов: 38 добавлений и 2 удалений

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

@ -14,6 +14,7 @@
* - Reply email compose window
* - Forward email compose window
* - Content tab
* - Feed message
*/
// make SOLO_TEST=content-policy/test-general-content-policy.js mozmill-one
@ -234,6 +235,29 @@ function checkContentTab(test) {
throw new Error("The content tab didn't close");
}
/**
* Check remote content is not blocked in feed message (flagged with
* nsMsgMessageFlags::FeedMsg)
*/
function checkAllowFeedMsg(test) {
let msgDbHdr = addToFolder(test.type + " test feed message " + gMsgNo,
msgBodyStart + test.body + msgBodyEnd, folder);
msgDbHdr.OrFlags(Ci.nsMsgMessageFlags.FeedMsg);
// select the newly created message
let msgHdr = select_click_row(gMsgNo);
assert_equals(msgDbHdr, msgHdr);
assert_selected_and_displayed(gMsgNo);
// Now check that the content hasn't been blocked
if (!test.checkForAllowed(mozmill.getMail3PaneController()
.window.content.document.getElementById("testelement")))
throw new Error(test.type + " has been unexpectedly blocked in feed message content.");
++gMsgNo;
}
function test_generalContentPolicy() {
let folderTab = mc.tabmail.currentTabInfo;
be_in_folder(folder);
@ -264,10 +288,13 @@ function test_generalContentPolicy() {
// Check allowed in forward window
checkComposeWindow(TESTS[i], false, true);
// Check allowed in standalone message window
checkStandaloneMessageWindow(TESTS[i], true);
// Check allowed in standalone message window
checkStandaloneMessageWindow(TESTS[i], true);
// Check allowed in content tab
checkContentTab(TESTS[i]);
// Check allowed in a feed message
checkAllowFeedMsg(TESTS[i]);
}
}

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

@ -7,6 +7,7 @@
#include "nsIMsgHdr.h"
#include "nsMsgUtils.h"
#include "nsMsgFolderFlags.h"
#include "nsMsgMessageFlags.h"
#include "nsStringGlue.h"
#include "nsIServiceManager.h"
#include "nsCOMPtr.h"
@ -1030,9 +1031,17 @@ nsresult IsRSSArticle(nsIURI * aMsgURI, bool *aIsRSSArticle)
rv = GetMessageServiceFromURI(resourceURI, getter_AddRefs(msgService));
NS_ENSURE_SUCCESS(rv, rv);
// Check if the message is a feed message, regardless of folder.
uint32_t flags;
nsCOMPtr<nsIMsgDBHdr> msgHdr;
rv = msgService->MessageURIToMsgHdr(resourceURI.get(), getter_AddRefs(msgHdr));
NS_ENSURE_SUCCESS(rv, rv);
msgHdr->GetFlags(&flags);
if (flags & nsMsgMessageFlags::FeedMsg)
{
*aIsRSSArticle = true;
return rv;
}
nsCOMPtr<nsIMsgMailNewsUrl> mailnewsUrl = do_QueryInterface(aMsgURI, &rv);
NS_ENSURE_SUCCESS(rv, rv);