Bug 1351453 - Deprecate the prettiestName attribute of nsIMsgFolder. r=aceman,jorgk

--HG--
extra : rebase_source : d2d0417842b3deab8c96e3585d3a948b862f7cf3
This commit is contained in:
Kushal Singh ext:(%20and%20aceman%20%3Cacelists%40atlas.sk%3E) 2017-05-29 03:05:06 +05:30
Родитель a8d724298e
Коммит 2ae2c1ce5d
11 изменённых файлов: 49 добавлений и 30 удалений

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

@ -32,7 +32,7 @@ function* test_empty_trash() {
yield async_empty_trash();
verify_empty_view(viewWrapper);
do_check_neq(null, viewWrapper.displayedFolder);
do_check_true(viewWrapper.displayedFolder !== null);
let [msgSet] = make_new_sets_in_folders([trashHandle], [{count: 1}]);
yield wait_for_message_injection();

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

@ -37,6 +37,16 @@ interface nsIMsgFolder : nsISupports {
const nsMsgBiffState nsMsgBiffState_NoMail = 1; // No new mail is waiting.
const nsMsgBiffState nsMsgBiffState_Unknown = 2; // We dunno whether there is new mail.
/* folder name properties */
readonly attribute ACString URI;
attribute AString name;
attribute AString prettyName;
readonly attribute AString abbreviatedName;
// [deprecated]
readonly attribute AString prettiestName;
attribute nsIMsgFolder parent;
/// Returns an enumerator containing the messages within the current database.
readonly attribute nsISimpleEnumerator messages;
@ -46,8 +56,6 @@ interface nsIMsgFolder : nsISupports {
/* get new headers for db */
void updateFolder(in nsIMsgWindow aWindow);
readonly attribute AString prettiestName;
/**
* URL for this folder
*/
@ -616,14 +624,6 @@ interface nsIMsgFolder : nsISupports {
/* does not persist across sessions */
attribute nsMsgKey lastMessageLoaded;
/* old nsIFolder properties and methods */
readonly attribute ACString URI;
attribute AString name;
attribute AString prettyName;
readonly attribute AString abbreviatedName;
attribute nsIMsgFolder parent;
/**
* Returns an enumerator containing a list of nsIMsgFolder items that are
* subfolders of the instance this is called on.

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

@ -69,6 +69,8 @@
#include "mozilla/Services.h"
#include "nsMimeTypes.h"
#include "nsIMsgFilter.h"
#include "nsIConsoleService.h"
#include "nsIScriptError.h"
static PRTime gtimeOfLastPurgeCheck; //variable to know when to check for purge_threshhold
@ -3535,6 +3537,23 @@ NS_IMETHODIMP nsMsgDBFolder::GetChildWithURI(const nsACString& uri, bool deep, b
NS_IMETHODIMP nsMsgDBFolder::GetPrettiestName(nsAString& name)
{
if (NS_IsMainThread()) {
nsCOMPtr<nsIConsoleService> cs = do_GetService(NS_CONSOLESERVICE_CONTRACTID);
if (cs) {
nsCString msg(__FUNCTION__);
msg.AppendLiteral(" is deprecated and will be removed soon.");
nsCOMPtr<nsIScriptError> e = do_CreateInstance(NS_SCRIPTERROR_CONTRACTID);
if (e && NS_SUCCEEDED(e->Init(NS_ConvertUTF8toUTF16(msg), EmptyString(),
EmptyString(), 0, 0,
nsIScriptError::warningFlag, "mailnews"))) {
cs->LogMessage(e);
}
}
}
NS_WARNING("You are trying to use the deprecated attribute 'prettiestName'.");
if (NS_SUCCEEDED(GetPrettyName(name)))
return NS_OK;
return GetName(name);

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

@ -53,14 +53,14 @@ function poke_and_verify_msf_closure(aSynthMessage, aGlodaMessage) {
// get the nsIMsgDBHdr
let header = aGlodaMessage.folderMessage;
// if we don't have a header, this test is unlikely to work...
do_check_neq(header, null);
do_check_true(header !== null);
// we need a reference to the glodaFolder
let glodaFolder = aGlodaMessage.folder;
// -- check that everyone is tracking things correctly
// the message's folder should be holding an XPCOM reference to the folder
do_check_neq(glodaFolder._xpcomFolder, null);
do_check_true(glodaFolder._xpcomFolder !== null);
// the cleanup timer should now be alive
do_check_true(GlodaDatastore._folderCleanupActive);
// live folder count should be one
@ -71,7 +71,7 @@ function poke_and_verify_msf_closure(aSynthMessage, aGlodaMessage) {
// -- verify that things are still as they were before the cleanup firing
// the message's folder should be holding an XPCOM reference to the folder
do_check_neq(glodaFolder._xpcomFolder, null);
do_check_true(glodaFolder._xpcomFolder !== null);
// the cleanup timer should now be alive
do_check_true(GlodaDatastore._folderCleanupActive);
// live folder count should be one
@ -90,7 +90,7 @@ function poke_and_verify_msf_closure(aSynthMessage, aGlodaMessage) {
// -- verify that cleanup has occurred and the cleanup mechanism shutdown.
// the message's folder should no longer be holding an XPCOM reference
do_check_eq(glodaFolder._xpcomFolder, null);
do_check_true(glodaFolder._xpcomFolder === null);
// the cleanup timer should now be dead
do_check_false(GlodaDatastore._folderCleanupActive);
// live folder count should be zero

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

@ -80,9 +80,9 @@ var tests = [
let folder1 = IMAPPump.inbox.getChildNamed("empty 1");
do_check_eq(folderCount(folder1), 2);
let folder2 = IMAPPump.inbox.getChildNamed("empty 2");
do_check_neq(folder2, null);
do_check_true(folder2 !== null);
// folder 1 and 2 should each now have two messages in them.
do_check_neq(folder1, null);
do_check_true(folder1 !== null);
do_check_eq(folderCount(folder2), 2);
// The local inbox folder should now be empty, since the second
// operation was a move.

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

@ -185,7 +185,7 @@ function* crossStreaming() {
* before and after streaming.
*/
let msg2 = fooFolder.msgDatabase.getMsgHdrForMessageID(gMsgId1);
do_check_neq(msg2, null);
do_check_true(msg2 !== null);
let msgURI = fooFolder.getUriForMsg(msg2);
let messenger = Cc["@mozilla.org/messenger;1"].createInstance(Ci.nsIMessenger);
let msgServ = messenger.messageServiceFromURI(msgURI);

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

@ -102,7 +102,7 @@ function* testDetach()
// Get the message header - detached copy has UID 2.
let msgHdr = IMAPPump.inbox.GetMessageHeader(2);
do_check_neq(msgHdr, null);
do_check_true(msgHdr !== null);
let messageContent = getContentFromMessage(msgHdr);
do_check_true(messageContent.includes("AttachmentDetached"));
}

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

@ -91,7 +91,7 @@ function* test_moveMessageToTargetFolder()
let observer = gAutoSyncManager.QueryInterface(Ci.nsIObserver);
observer.observe(null, "mail:appIdle", "back");
let msgHdr = mailTestUtils.firstMsgHdr(IMAPPump.inbox);
do_check_neq(msgHdr, null);
do_check_true(msgHdr !== null);
// Now move this message to the target folder.
let messages = Cc["@mozilla.org/array;1"]

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

@ -45,9 +45,9 @@ var tests = [
dump("found folder2\n");
let folder3 = IMAPPump.inbox.getChildNamed("empty 3");
dump("found folder3\n");
do_check_neq(folder1, null);
do_check_neq(folder2, null);
do_check_neq(folder3, null);
do_check_true(folder1 !== null);
do_check_true(folder2 !== null);
do_check_true(folder3 !== null);
},
function* moveImapFolder1() {
let folders = new Array;
@ -74,9 +74,9 @@ var tests = [
dump("found folder2\n");
let folder3 = folder1.getChildNamed("empty 3");
dump("found folder3\n");
do_check_neq(folder1, null);
do_check_neq(folder2, null);
do_check_neq(folder3, null);
do_check_true(folder1 !== null);
do_check_true(folder2 !== null);
do_check_true(folder3 !== null);
},
function* testImapFolderCopyFailure() {
let folders = new Array;

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

@ -38,9 +38,9 @@ function* setup() {
function check() {
const gDbService = Cc["@mozilla.org/msgDatabase/msgDBService;1"]
.getService(Ci.nsIMsgDBService);
do_check_neq(gDbService.cachedDBForFolder(IMAPPump.inbox), null);
do_check_eq(gDbService.cachedDBForFolder(gFolder1), null);
do_check_eq(gDbService.cachedDBForFolder(gFolder2), null);
do_check_true(gDbService.cachedDBForFolder(IMAPPump.inbox) !== null);
do_check_true(gDbService.cachedDBForFolder(gFolder1) === null);
do_check_true(gDbService.cachedDBForFolder(gFolder2) === null);
}
function teardown() {

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

@ -99,7 +99,7 @@ var tests = [
},
function verifyFolders() {
let msgRestored = IMAPPump.inbox.msgDatabase.getMsgHdrForMessageID(gMsgId1);
do_check_neq(msgRestored, null);
do_check_true(msgRestored !== null);
do_check_eq(IMAPPump.inbox.msgDatabase.dBFolderInfo.numMessages, 4);
},
teardown