Bug 1802815 - Remove nsIMsgDBHdr get/setProperty. r=benc
Differential Revision: https://phabricator.services.mozilla.com/D163290 --HG-- extra : rebase_source : e03c9379617f936ab329c5ac5934486076aaa0b8 extra : amend_source : e954726c9111387b5cba162db3b0508a34ee4cf9
This commit is contained in:
Родитель
fcc92f7c9a
Коммит
878e81b84d
|
@ -3092,12 +3092,6 @@ function nsDummyMsgHeader() {}
|
|||
|
||||
nsDummyMsgHeader.prototype = {
|
||||
mProperties: [],
|
||||
getProperty(aProperty) {
|
||||
return this.getStringProperty(aProperty);
|
||||
},
|
||||
setProperty(aProperty, aVal) {
|
||||
return this.setStringProperty(aProperty, aVal);
|
||||
},
|
||||
getStringProperty(aProperty) {
|
||||
if (aProperty in this.mProperties) {
|
||||
return this.mProperties[aProperty];
|
||||
|
|
|
@ -1841,8 +1841,8 @@ function convertMessage(msgHdr, extension) {
|
|||
"@mozilla.org/messengercompose/composefields;1"
|
||||
].createInstance(Ci.nsIMsgCompFields);
|
||||
|
||||
let junkScore = parseInt(msgHdr.getProperty("junkscore"), 10) || 0;
|
||||
let tags = (msgHdr.getProperty("keywords") || "")
|
||||
let junkScore = parseInt(msgHdr.getStringProperty("junkscore"), 10) || 0;
|
||||
let tags = (msgHdr.getStringProperty("keywords") || "")
|
||||
.split(" ")
|
||||
.filter(MailServices.tags.isValidKey);
|
||||
|
||||
|
@ -2128,7 +2128,7 @@ var messageTracker = new (class extends EventEmitter {
|
|||
break;
|
||||
case "Keywords":
|
||||
{
|
||||
let tags = item.getProperty("keywords");
|
||||
let tags = item.getStringProperty("keywords");
|
||||
tags = tags ? tags.split(" ") : [];
|
||||
changes.tags = tags.filter(MailServices.tags.isValidKey);
|
||||
}
|
||||
|
@ -2194,7 +2194,7 @@ var messageTracker = new (class extends EventEmitter {
|
|||
|
||||
msgsJunkStatusChanged(messages) {
|
||||
for (let msgHdr of messages) {
|
||||
let junkScore = parseInt(msgHdr.getProperty("junkscore"), 10) || 0;
|
||||
let junkScore = parseInt(msgHdr.getStringProperty("junkscore"), 10) || 0;
|
||||
this.emit("message-updated", msgHdr, {
|
||||
junk: junkScore >= gJunkThreshold,
|
||||
});
|
||||
|
|
|
@ -104,14 +104,14 @@ add_task(async () => {
|
|||
messages[8].markRead(true);
|
||||
messages[1].markFlagged(true);
|
||||
messages[6].markFlagged(true);
|
||||
messages[0].setProperty("keywords", "$label1");
|
||||
messages[1].setProperty("keywords", "$label2");
|
||||
messages[3].setProperty("keywords", "$label1 $label2");
|
||||
messages[5].setProperty("keywords", "$label2");
|
||||
messages[6].setProperty("keywords", "$label1");
|
||||
messages[7].setProperty("keywords", "$label2 $label3");
|
||||
messages[8].setProperty("keywords", "$label3");
|
||||
messages[9].setProperty("keywords", "$label1 $label2 $label3");
|
||||
messages[0].setStringProperty("keywords", "$label1");
|
||||
messages[1].setStringProperty("keywords", "$label2");
|
||||
messages[3].setStringProperty("keywords", "$label1 $label2");
|
||||
messages[5].setStringProperty("keywords", "$label2");
|
||||
messages[6].setStringProperty("keywords", "$label1");
|
||||
messages[7].setStringProperty("keywords", "$label2 $label3");
|
||||
messages[8].setStringProperty("keywords", "$label3");
|
||||
messages[9].setStringProperty("keywords", "$label1 $label2 $label3");
|
||||
messages[9].markHasAttachments(true);
|
||||
|
||||
// Add an author to the address book.
|
||||
|
|
|
@ -294,7 +294,7 @@ add_task(
|
|||
let message = [...subFolders.test0.messages][0];
|
||||
ok(!message.isFlagged);
|
||||
ok(!message.isRead);
|
||||
equal(message.getProperty("keywords"), "testkeyword");
|
||||
equal(message.getStringProperty("keywords"), "testkeyword");
|
||||
|
||||
await extension.startup();
|
||||
extension.sendMessage({
|
||||
|
@ -320,11 +320,12 @@ add_task(
|
|||
if (IS_IMAP) {
|
||||
// Only IMAP sets the junk/nonjunk keyword.
|
||||
await TestUtils.waitForCondition(
|
||||
() => message.getProperty("keywords") == "testkeyword junk $label1"
|
||||
() =>
|
||||
message.getStringProperty("keywords") == "testkeyword junk $label1"
|
||||
);
|
||||
} else {
|
||||
await TestUtils.waitForCondition(
|
||||
() => message.getProperty("keywords") == "testkeyword $label1"
|
||||
() => message.getStringProperty("keywords") == "testkeyword $label1"
|
||||
);
|
||||
}
|
||||
extension.sendMessage();
|
||||
|
@ -333,11 +334,13 @@ add_task(
|
|||
if (IS_IMAP) {
|
||||
await TestUtils.waitForCondition(
|
||||
() =>
|
||||
message.getProperty("keywords") == "testkeyword junk $label2 $label3"
|
||||
message.getStringProperty("keywords") ==
|
||||
"testkeyword junk $label2 $label3"
|
||||
);
|
||||
} else {
|
||||
await TestUtils.waitForCondition(
|
||||
() => message.getProperty("keywords") == "testkeyword $label2 $label3"
|
||||
() =>
|
||||
message.getStringProperty("keywords") == "testkeyword $label2 $label3"
|
||||
);
|
||||
}
|
||||
extension.sendMessage();
|
||||
|
@ -348,11 +351,13 @@ add_task(
|
|||
if (IS_IMAP) {
|
||||
await TestUtils.waitForCondition(
|
||||
() =>
|
||||
message.getProperty("keywords") == "testkeyword junk $label2 $label3"
|
||||
message.getStringProperty("keywords") ==
|
||||
"testkeyword junk $label2 $label3"
|
||||
);
|
||||
} else {
|
||||
await TestUtils.waitForCondition(
|
||||
() => message.getProperty("keywords") == "testkeyword $label2 $label3"
|
||||
() =>
|
||||
message.getStringProperty("keywords") == "testkeyword $label2 $label3"
|
||||
);
|
||||
}
|
||||
extension.sendMessage();
|
||||
|
@ -365,11 +370,11 @@ add_task(
|
|||
);
|
||||
if (IS_IMAP) {
|
||||
await TestUtils.waitForCondition(
|
||||
() => message.getProperty("keywords") == "testkeyword nonjunk"
|
||||
() => message.getStringProperty("keywords") == "testkeyword nonjunk"
|
||||
);
|
||||
} else {
|
||||
await TestUtils.waitForCondition(
|
||||
() => message.getProperty("keywords") == "testkeyword"
|
||||
() => message.getStringProperty("keywords") == "testkeyword"
|
||||
);
|
||||
}
|
||||
extension.sendMessage();
|
||||
|
|
|
@ -13,10 +13,6 @@ interface nsIUTF8StringEnumerator;
|
|||
[scriptable, uuid(3c11ddbe-c805-40c5-b9c9-d065fad5d0be)]
|
||||
interface nsIMsgDBHdr : nsISupports
|
||||
{
|
||||
/* general property routines - I think this can retrieve any
|
||||
header in the db */
|
||||
AString getProperty(in string propertyName);
|
||||
void setProperty(in string propertyName, in AString propertyStr);
|
||||
void setStringProperty(in string propertyName, in string propertyValue);
|
||||
string getStringProperty(in string propertyName);
|
||||
unsigned long getUint32Property(in string propertyName);
|
||||
|
|
|
@ -319,7 +319,7 @@ class MailNotificationManager {
|
|||
"mail.biff.alert.preview_length",
|
||||
40
|
||||
);
|
||||
let preview = msgHdr.getProperty("preview").slice(0, previewLength);
|
||||
let preview = msgHdr.getStringProperty("preview").slice(0, previewLength);
|
||||
if (preview) {
|
||||
alertBody += (alertBody ? "\n" : "") + preview;
|
||||
}
|
||||
|
|
|
@ -931,11 +931,11 @@ nsresult nsOfflineStoreCompactState::CopyNextMessage(bool& done) {
|
|||
while (m_curIndex < m_keys.Length()) {
|
||||
// Filter out msgs that have the "pendingRemoval" attribute set.
|
||||
nsCOMPtr<nsIMsgDBHdr> hdr;
|
||||
nsString pendingRemoval;
|
||||
nsCString pendingRemoval;
|
||||
nsresult rv =
|
||||
m_db->GetMsgHdrForKey(m_keys[m_curIndex], getter_AddRefs(hdr));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
hdr->GetProperty("pendingRemoval", pendingRemoval);
|
||||
hdr->GetStringProperty("pendingRemoval", getter_Copies(pendingRemoval));
|
||||
if (!pendingRemoval.IsEmpty()) {
|
||||
m_curIndex++;
|
||||
// Turn off offline flag for message, since after the compact is
|
||||
|
|
|
@ -40,7 +40,7 @@ class nsMsgTagService final : public nsIMsgTagService {
|
|||
protected:
|
||||
nsresult SetUnicharPref(const char* prefName, const nsAString& prefValue);
|
||||
nsresult GetUnicharPref(const char* prefName, nsAString& prefValue);
|
||||
nsresult MigrateLabelsToTags();
|
||||
nsresult SetupLabelTags();
|
||||
nsresult RefreshKeyCache();
|
||||
|
||||
nsCOMPtr<nsIPrefBranch> m_tagPrefBranch;
|
||||
|
|
|
@ -206,20 +206,6 @@ NS_IMETHODIMP nsMsgHdr::MarkFlagged(bool bFlagged) {
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgHdr::GetProperty(const char* propertyName,
|
||||
nsAString& resultProperty) {
|
||||
NS_ENSURE_ARG_POINTER(propertyName);
|
||||
if (!m_mdb || !m_mdbRow) return NS_ERROR_NULL_POINTER;
|
||||
return m_mdb->GetPropertyAsNSString(m_mdbRow, propertyName, resultProperty);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgHdr::SetProperty(const char* propertyName,
|
||||
const nsAString& propertyStr) {
|
||||
NS_ENSURE_ARG_POINTER(propertyName);
|
||||
if (!m_mdb || !m_mdbRow) return NS_ERROR_NULL_POINTER;
|
||||
return m_mdb->SetPropertyFromNSString(m_mdbRow, propertyName, propertyStr);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgHdr::SetStringProperty(const char* propertyName,
|
||||
const char* propertyValue) {
|
||||
NS_ENSURE_ARG_POINTER(propertyName);
|
||||
|
|
|
@ -312,7 +312,7 @@ add_task(async function testSearch() {
|
|||
// Test of a custom db header.
|
||||
let customValue = mailTestUtils
|
||||
.firstMsgHdr(IMAPPump.inbox)
|
||||
.getProperty(test.dbHeader);
|
||||
.getStringProperty(test.dbHeader);
|
||||
Assert.equal(customValue, test.testString);
|
||||
} else {
|
||||
await new Promise(resolve => {
|
||||
|
|
|
@ -602,7 +602,7 @@ function testSearch() {
|
|||
dump("testing dbHeader " + test.dbHeader + "\n");
|
||||
let customValue = mailTestUtils
|
||||
.firstMsgHdr(localAccountUtils.inboxFolder)
|
||||
.getProperty(test.dbHeader);
|
||||
.getStringProperty(test.dbHeader);
|
||||
Assert.equal(customValue, test.testString);
|
||||
do_timeout(0, testSearch);
|
||||
} else if (test) {
|
||||
|
|
|
@ -51,7 +51,7 @@ var customTerm = {
|
|||
match(msgHdr, searchValue, searchOp) {
|
||||
switch (searchOp) {
|
||||
case Ci.nsMsgSearchOp.Is:
|
||||
if (msgHdr.getProperty("theTestProperty") == searchValue) {
|
||||
if (msgHdr.getStringProperty("theTestProperty") == searchValue) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче