Bug 1594887 - Remove xpidl [array] use in nsIJunkMailPlugin. r=mkmelin DONTBUILD

--HG--
extra : amend_source : 761f4624542ad113d30b772471adf9c16f8e159f
extra : histedit_source : bb2e6f96b32d6406c2311ccdb2d0b078babdeddf
This commit is contained in:
Ben Campbell 2019-11-26 17:11:54 +13:00
Родитель 346de65fed
Коммит 7bf30c9070
10 изменённых файлов: 108 добавлений и 169 удалений

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

@ -138,8 +138,7 @@ interface nsIJunkMailPlugin : nsIMsgFilterPlugin
void classifyMessage(in string aMsgURI, in nsIMsgWindow aMsgWindow,
in nsIJunkMailClassificationListener aListener);
void classifyMessages(in unsigned long aCount,
[array, size_is(aCount)] in string aMsgURIs,
void classifyMessages(in Array<ACString> aMsgURIs,
in nsIMsgWindow aMsgWindow,
in nsIJunkMailClassificationListener aListener);
@ -148,7 +147,6 @@ interface nsIJunkMailPlugin : nsIMsgFilterPlugin
* traits according to the current training set.
*
* @param aMsgURI URI of the message to be evaluated
* @param aTraitCount length of aProTraits, aAntiTraits arrays
* @param aProTraits array of trait ids for trained messages that
* match the tested trait (for example,
* JUNK_TRAIT if testing for junk)
@ -161,10 +159,9 @@ interface nsIJunkMailPlugin : nsIMsgFilterPlugin
*/
void classifyTraitsInMessage(
in string aMsgURI,
in unsigned long aTraitCount,
[array, size_is(aTraitCount)] in unsigned long aProTraits,
[array, size_is(aTraitCount)] in unsigned long aAntiTraits,
in ACString aMsgURI,
in Array<unsigned long> aProTraits,
in Array<unsigned long> aAntiTraits,
in nsIMsgTraitClassificationListener aTraitListener,
[optional] in nsIMsgWindow aMsgWindow,
[optional] in nsIJunkMailClassificationListener aJunkListener);
@ -173,9 +170,7 @@ interface nsIJunkMailPlugin : nsIMsgFilterPlugin
* Given an array of message URIs, evaluate their relative match to a
* list of traits according to the current training set.
*
* @param aCount Number of messages to evaluate
* @param aMsgURIs array of URIs of the messages to be evaluated
* @param aTraitCount length of aProTraits, aAntiTraits arrays
* @param aProTraits array of trait ids for trained messages that
* match the tested trait (for example,
* JUNK_TRAIT if testing for junk)
@ -188,11 +183,9 @@ interface nsIJunkMailPlugin : nsIMsgFilterPlugin
*/
void classifyTraitsInMessages(
in unsigned long aCount,
[array, size_is(aCount)] in string aMsgURIs,
in unsigned long aTraitCount,
[array, size_is(aTraitCount)] in unsigned long aProTraits,
[array, size_is(aTraitCount)] in unsigned long aAntiTraits,
in Array<ACString> aMsgURIs,
in Array<unsigned long> aProTraits,
in Array<unsigned long> aAntiTraits,
in nsIMsgTraitClassificationListener aTraitListener,
[optional] in nsIMsgWindow aMsgWindow,
[optional] in nsIJunkMailClassificationListener aJunkListener);
@ -218,10 +211,8 @@ interface nsIJunkMailPlugin : nsIMsgFilterPlugin
* Should cause the training set to be updated appropriately.
*
* @param aMsgURI URI of the message to be classified
* @param aOldCount length of aOldTraits array
* @param aOldTraits array of trait IDs of the old
* message classification(s), if any
* @param aNewCount length of aNewTraits array
* @param aNewTraits array of trait IDs of the new
* message classification(s), if any
* @param aTraitListener trait-oriented listener (may be null)
@ -230,10 +221,8 @@ interface nsIJunkMailPlugin : nsIMsgFilterPlugin
*/
void setMsgTraitClassification(
in string aMsgURI,
in unsigned long aOldCount,
[array, size_is(aOldCount)] in unsigned long aOldTraits,
in unsigned long aNewCount,
[array, size_is(aNewCount)] in unsigned long aNewTraits,
in Array<unsigned long> aOldTraits,
in Array<unsigned long> aNewTraits,
[optional] in nsIMsgTraitClassificationListener aTraitListener,
[optional] in nsIMsgWindow aMsgWindow,
[optional] in nsIJunkMailClassificationListener aJunkListener);
@ -285,6 +274,11 @@ interface nsIMsgCorpus : nsISupports
/**
* Update corpus data from a file.
* Uses the parallel arrays aFromTraits and aToTraits. These arrays allow
* conversion of the trait id stored in the file (which may be originated
* externally) to the trait id used in the local corpus (which is defined
* locally using nsIMsgTraitService, and mapped by that interface to a
* globally unique trait id string).
*
* @param aFile the file with the data, in the format:
*
@ -300,14 +294,6 @@ interface nsIMsgCorpus : nsISupports
* @param aIsAdd should the data be added, or removed? True if
* adding, false if removing.
*
* @param aRemapCount number of items in the parallel arrays aFromTraits,
* aToTraits. These arrays allow conversion of the
* trait id stored in the file (which may be originated
* externally) to the trait id used in the local corpus
* (which is defined locally using nsIMsgTraitService, and
* mapped by that interface to a globally unique trait
* id string).
*
* @param aFromTraits array of trait ids used in aFile. If aFile contains
* trait ids that are not in this array, they are not
* remapped, but assumed to be local trait ids.
@ -317,9 +303,8 @@ interface nsIMsgCorpus : nsISupports
* be used in storing data from aFile into the local corpus.
*/
void updateData(in nsIFile aFile, in boolean aIsAdd,
[optional] in unsigned long aRemapCount,
[optional, array, size_is(aRemapCount)] in unsigned long aFromTraits,
[optional, array, size_is(aRemapCount)] in unsigned long aToTraits);
[optional] in Array<unsigned long> aFromTraits,
[optional] in Array<unsigned long> aToTraits);
/**
* Get the corpus count for a token as a string.

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

@ -195,13 +195,11 @@ function startCommand() {
proArray.push(gTest.traitId);
MailServices.junk.setMsgTraitClassification(
getSpec(gTest.fileName), // in string aMsgURI
0,
null, // in nsIArray aOldTraits
proArray.length,
proArray, // in nsIArray aNewTraits
classifyListener
); // [optional] in nsIMsgTraitClassificationListener aTraitListener
getSpec(gTest.fileName), // aMsgURI
[], // aOldTraits
proArray, // aNewTraits
classifyListener // aTraitListener
);
// null, // [optional] in nsIMsgWindow aMsgWindow
// null, // [optional] in nsIJunkMailClassificationListener aJunkListener
break;

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

@ -2136,9 +2136,9 @@ nsresult nsMsgDBFolder::SpamFilterClassifyMessage(
rv = traitService->GetEnabledAntiIndices(antiIndices);
NS_ENSURE_SUCCESS(rv, rv);
rv = aJunkMailPlugin->ClassifyTraitsInMessage(
aURI, proIndices.Length(), proIndices.Elements(), antiIndices.Elements(),
this, aMsgWindow, this);
rv = aJunkMailPlugin->ClassifyTraitsInMessage(nsDependentCString(aURI),
proIndices, antiIndices, this,
aMsgWindow, this);
return rv;
}
@ -2160,9 +2160,11 @@ nsresult nsMsgDBFolder::SpamFilterClassifyMessages(
rv = traitService->GetEnabledAntiIndices(antiIndices);
NS_ENSURE_SUCCESS(rv, rv);
nsTArray<nsCString> tmpURIs(aURICount);
tmpURIs.AppendElements(aURIArray, aURICount);
rv = aJunkMailPlugin->ClassifyTraitsInMessages(
aURICount, aURIArray, proIndices.Length(), proIndices.Elements(),
antiIndices.Elements(), this, aMsgWindow, this);
tmpURIs, proIndices, antiIndices, this, aMsgWindow, this);
return rv;
}

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

@ -1191,9 +1191,10 @@ class MessageClassifier : public TokenAnalyzer {
nsIJunkMailClassificationListener* aJunkListener,
nsIMsgTraitClassificationListener* aTraitListener,
nsIMsgTraitDetailListener* aDetailListener,
nsTArray<uint32_t>& aProTraits,
nsTArray<uint32_t>& aAntiTraits, nsIMsgWindow* aMsgWindow,
uint32_t aNumMessagesToClassify, const char** aMessageURIs)
const nsTArray<uint32_t>& aProTraits,
const nsTArray<uint32_t>& aAntiTraits,
nsIMsgWindow* aMsgWindow,
const nsTArray<nsCString>& aMessageURIs)
: mFilter(aFilter),
mJunkMailPlugin(aFilter),
mJunkListener(aJunkListener),
@ -1201,40 +1202,30 @@ class MessageClassifier : public TokenAnalyzer {
mDetailListener(aDetailListener),
mProTraits(aProTraits),
mAntiTraits(aAntiTraits),
mMsgWindow(aMsgWindow) {
mCurMessageToClassify = 0;
mNumMessagesToClassify = aNumMessagesToClassify;
mMessageURIs = (char**)moz_xmalloc(sizeof(char*) * aNumMessagesToClassify);
for (uint32_t i = 0; i < aNumMessagesToClassify; i++)
mMessageURIs[i] = PL_strdup(aMessageURIs[i]);
mMsgWindow(aMsgWindow),
mMessageURIs(aMessageURIs),
mCurMessageToClassify(0) {
MOZ_ASSERT(aProTraits.Length() == aAntiTraits.Length());
}
// junk-only classifier
MessageClassifier(nsBayesianFilter* aFilter,
nsIJunkMailClassificationListener* aJunkListener,
nsIMsgWindow* aMsgWindow, uint32_t aNumMessagesToClassify,
const char** aMessageURIs)
nsIMsgWindow* aMsgWindow,
const nsTArray<nsCString>& aMessageURIs)
: mFilter(aFilter),
mJunkMailPlugin(aFilter),
mJunkListener(aJunkListener),
mTraitListener(nullptr),
mDetailListener(nullptr),
mMsgWindow(aMsgWindow) {
mCurMessageToClassify = 0;
mNumMessagesToClassify = aNumMessagesToClassify;
mMessageURIs = (char**)moz_xmalloc(sizeof(char*) * aNumMessagesToClassify);
for (uint32_t i = 0; i < aNumMessagesToClassify; i++)
mMessageURIs[i] = PL_strdup(aMessageURIs[i]);
mMsgWindow(aMsgWindow),
mMessageURIs(aMessageURIs),
mCurMessageToClassify(0) {
mProTraits.AppendElement(kJunkTrait);
mAntiTraits.AppendElement(kGoodTrait);
}
virtual ~MessageClassifier() {
if (mMessageURIs) {
NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(mNumMessagesToClassify,
mMessageURIs);
}
}
virtual ~MessageClassifier() {}
virtual void analyzeTokens(Tokenizer& tokenizer) {
mFilter->classifyMessage(tokenizer, mTokenSource.get(), mProTraits,
mAntiTraits, mJunkListener, mTraitListener,
@ -1244,12 +1235,12 @@ class MessageClassifier : public TokenAnalyzer {
}
virtual void classifyNextMessage() {
if (++mCurMessageToClassify < mNumMessagesToClassify &&
mMessageURIs[mCurMessageToClassify]) {
if (++mCurMessageToClassify < mMessageURIs.Length()) {
MOZ_LOG(BayesianFilterLogModule, LogLevel::Warning,
("classifyNextMessage(%s)", mMessageURIs[mCurMessageToClassify]));
mFilter->tokenizeMessage(mMessageURIs[mCurMessageToClassify], mMsgWindow,
this);
("classifyNextMessage(%s)",
mMessageURIs[mCurMessageToClassify].get()));
mFilter->tokenizeMessage(mMessageURIs[mCurMessageToClassify].get(),
mMsgWindow, this);
} else {
// call all listeners with null parameters to signify end of batch
if (mJunkListener)
@ -1276,9 +1267,8 @@ class MessageClassifier : public TokenAnalyzer {
nsTArray<uint32_t> mProTraits;
nsTArray<uint32_t> mAntiTraits;
nsCOMPtr<nsIMsgWindow> mMsgWindow;
int32_t mNumMessagesToClassify;
int32_t mCurMessageToClassify; // 0-based index
char** mMessageURIs;
nsTArray<nsCString> mMessageURIs;
uint32_t mCurMessageToClassify; // 0-based index
};
nsresult nsBayesianFilter::tokenizeMessage(const char* aMessageURI,
@ -1700,8 +1690,9 @@ NS_IMETHODIMP nsBayesianFilter::GetShouldDownloadAllHeaders(
NS_IMETHODIMP nsBayesianFilter::ClassifyMessage(
const char* aMessageURL, nsIMsgWindow* aMsgWindow,
nsIJunkMailClassificationListener* aListener) {
AutoTArray<nsCString, 1> urls = {nsDependentCString(aMessageURL)};
MessageClassifier* analyzer =
new MessageClassifier(this, aListener, aMsgWindow, 1, &aMessageURL);
new MessageClassifier(this, aListener, aMsgWindow, urls);
NS_ENSURE_TRUE(analyzer, NS_ERROR_OUT_OF_MEMORY);
TokenStreamListener* tokenListener = new TokenStreamListener(analyzer);
NS_ENSURE_TRUE(tokenListener, NS_ERROR_OUT_OF_MEMORY);
@ -1709,20 +1700,19 @@ NS_IMETHODIMP nsBayesianFilter::ClassifyMessage(
return tokenizeMessage(aMessageURL, aMsgWindow, analyzer);
}
/* void classifyMessages (in unsigned long aCount, [array, size_is (aCount)] in
* string aMsgURLs, in nsIJunkMailClassificationListener aListener); */
/* void classifyMessages(in Array<ACString> aMsgURIs,
* in nsIMsgWindow aMsgWindow,
* in nsIJunkMailClassificationListener aListener); */
NS_IMETHODIMP nsBayesianFilter::ClassifyMessages(
uint32_t aCount, const char** aMsgURLs, nsIMsgWindow* aMsgWindow,
const nsTArray<nsCString>& aMsgURLs, nsIMsgWindow* aMsgWindow,
nsIJunkMailClassificationListener* aListener) {
NS_ENSURE_ARG_POINTER(aMsgURLs);
TokenAnalyzer* analyzer =
new MessageClassifier(this, aListener, aMsgWindow, aCount, aMsgURLs);
new MessageClassifier(this, aListener, aMsgWindow, aMsgURLs);
NS_ENSURE_TRUE(analyzer, NS_ERROR_OUT_OF_MEMORY);
TokenStreamListener* tokenListener = new TokenStreamListener(analyzer);
NS_ENSURE_TRUE(tokenListener, NS_ERROR_OUT_OF_MEMORY);
analyzer->setTokenListener(tokenListener);
return tokenizeMessage(aMsgURLs[0], aMsgWindow, analyzer);
return tokenizeMessage(aMsgURLs[0].get(), aMsgWindow, analyzer);
}
nsresult nsBayesianFilter::setAnalysis(Token& token, uint32_t aTraitIndex,
@ -1783,46 +1773,36 @@ uint32_t nsBayesianFilter::getAnalysisIndex(Token& token,
}
NS_IMETHODIMP nsBayesianFilter::ClassifyTraitsInMessage(
const char* aMsgURI, uint32_t aTraitCount, uint32_t* aProTraits,
uint32_t* aAntiTraits, nsIMsgTraitClassificationListener* aTraitListener,
nsIMsgWindow* aMsgWindow,
const nsACString& aMsgURI, const nsTArray<uint32_t>& aProTraits,
const nsTArray<uint32_t>& aAntiTraits,
nsIMsgTraitClassificationListener* aTraitListener, nsIMsgWindow* aMsgWindow,
nsIJunkMailClassificationListener* aJunkListener) {
return ClassifyTraitsInMessages(1, &aMsgURI, aTraitCount, aProTraits,
aAntiTraits, aTraitListener, aMsgWindow,
aJunkListener);
AutoTArray<nsCString, 1> uris = {PromiseFlatCString(aMsgURI)};
return ClassifyTraitsInMessages(uris, aProTraits, aAntiTraits, aTraitListener,
aMsgWindow, aJunkListener);
}
NS_IMETHODIMP nsBayesianFilter::ClassifyTraitsInMessages(
uint32_t aCount, const char** aMsgURIs, uint32_t aTraitCount,
uint32_t* aProTraits, uint32_t* aAntiTraits,
const nsTArray<nsCString>& aMsgURIs, const nsTArray<uint32_t>& aProTraits,
const nsTArray<uint32_t>& aAntiTraits,
nsIMsgTraitClassificationListener* aTraitListener, nsIMsgWindow* aMsgWindow,
nsIJunkMailClassificationListener* aJunkListener) {
AutoTArray<uint32_t, kTraitAutoCapacity> proTraits;
AutoTArray<uint32_t, kTraitAutoCapacity> antiTraits;
if (aTraitCount > kTraitAutoCapacity) {
proTraits.SetCapacity(aTraitCount);
antiTraits.SetCapacity(aTraitCount);
}
proTraits.AppendElements(aProTraits, aTraitCount);
antiTraits.AppendElements(aAntiTraits, aTraitCount);
MessageClassifier* analyzer = new MessageClassifier(
this, aJunkListener, aTraitListener, nullptr, proTraits, antiTraits,
aMsgWindow, aCount, aMsgURIs);
NS_ENSURE_TRUE(analyzer, NS_ERROR_OUT_OF_MEMORY);
MOZ_ASSERT(aProTraits.Length() == aAntiTraits.Length());
MessageClassifier* analyzer =
new MessageClassifier(this, aJunkListener, aTraitListener, nullptr,
aProTraits, aAntiTraits, aMsgWindow, aMsgURIs);
TokenStreamListener* tokenListener = new TokenStreamListener(analyzer);
NS_ENSURE_TRUE(tokenListener, NS_ERROR_OUT_OF_MEMORY);
analyzer->setTokenListener(tokenListener);
return tokenizeMessage(aMsgURIs[0], aMsgWindow, analyzer);
return tokenizeMessage(aMsgURIs[0].get(), aMsgWindow, analyzer);
}
class MessageObserver : public TokenAnalyzer {
public:
MessageObserver(nsBayesianFilter* filter,
nsTArray<uint32_t>& aOldClassifications,
nsTArray<uint32_t>& aNewClassifications,
const nsTArray<uint32_t>& aOldClassifications,
const nsTArray<uint32_t>& aNewClassifications,
nsIJunkMailClassificationListener* aJunkListener,
nsIMsgTraitClassificationListener* aTraitListener)
: mFilter(filter),
@ -1849,19 +1829,12 @@ class MessageObserver : public TokenAnalyzer {
};
NS_IMETHODIMP nsBayesianFilter::SetMsgTraitClassification(
const char* aMsgURI, uint32_t aOldCount, uint32_t* aOldTraits,
uint32_t aNewCount, uint32_t* aNewTraits,
const char* aMsgURI, const nsTArray<uint32_t>& aOldTraits,
const nsTArray<uint32_t>& aNewTraits,
nsIMsgTraitClassificationListener* aTraitListener, nsIMsgWindow* aMsgWindow,
nsIJunkMailClassificationListener* aJunkListener) {
AutoTArray<uint32_t, kTraitAutoCapacity> oldTraits;
AutoTArray<uint32_t, kTraitAutoCapacity> newTraits;
if (aOldCount > kTraitAutoCapacity) oldTraits.SetCapacity(aOldCount);
if (aNewCount > kTraitAutoCapacity) newTraits.SetCapacity(aNewCount);
oldTraits.AppendElements(aOldTraits, aOldCount);
newTraits.AppendElements(aNewTraits, aNewCount);
MessageObserver* analyzer = new MessageObserver(
this, oldTraits, newTraits, aJunkListener, aTraitListener);
this, aOldTraits, aNewTraits, aJunkListener, aTraitListener);
NS_ENSURE_TRUE(analyzer, NS_ERROR_OUT_OF_MEMORY);
TokenStreamListener* tokenListener = new TokenStreamListener(analyzer);
@ -1999,14 +1972,13 @@ NS_IMETHODIMP nsBayesianFilter::ResetTrainingData() {
NS_IMETHODIMP nsBayesianFilter::DetailMessage(
const char* aMsgURI, uint32_t aProTrait, uint32_t aAntiTrait,
nsIMsgTraitDetailListener* aDetailListener, nsIMsgWindow* aMsgWindow) {
AutoTArray<uint32_t, 1> proTraits;
AutoTArray<uint32_t, 1> antiTraits;
proTraits.AppendElement(aProTrait);
antiTraits.AppendElement(aAntiTrait);
AutoTArray<uint32_t, 1> proTraits = {aProTrait};
AutoTArray<uint32_t, 1> antiTraits = {aAntiTrait};
AutoTArray<nsCString, 1> uris = {nsDependentCString(aMsgURI)};
MessageClassifier* analyzer =
new MessageClassifier(this, nullptr, nullptr, aDetailListener, proTraits,
antiTraits, aMsgWindow, 1, &aMsgURI);
antiTraits, aMsgWindow, uris);
NS_ENSURE_TRUE(analyzer, NS_ERROR_OUT_OF_MEMORY);
TokenStreamListener* tokenListener = new TokenStreamListener(analyzer);
@ -2032,9 +2004,11 @@ NS_IMETHODIMP nsBayesianFilter::ClearTrait(uint32_t aTrait) {
}
NS_IMETHODIMP
nsBayesianFilter::UpdateData(nsIFile* aFile, bool aIsAdd, uint32_t aRemapCount,
uint32_t* aFromTraits, uint32_t* aToTraits) {
return mCorpus.UpdateData(aFile, aIsAdd, aRemapCount, aFromTraits, aToTraits);
nsBayesianFilter::UpdateData(nsIFile* aFile, bool aIsAdd,
const nsTArray<uint32_t>& aFromTraits,
const nsTArray<uint32_t>& aToTraits) {
MOZ_ASSERT(aFromTraits.Length() == aToTraits.Length());
return mCorpus.UpdateData(aFile, aIsAdd, aFromTraits, aToTraits);
}
NS_IMETHODIMP
@ -2377,7 +2351,8 @@ void CorpusStore::readTrainingData() {
rv = mTraitFile->Exists(&exists);
if (NS_FAILED(rv) || !exists) return;
rv = UpdateData(mTraitFile, true, 0, nullptr, nullptr);
nsTArray<uint32_t> empty;
rv = UpdateData(mTraitFile, true, empty, empty);
if (NS_FAILED(rv)) {
NS_WARNING("failed to read training data.");
@ -2501,13 +2476,10 @@ void CorpusStore::setMessageCount(uint32_t aTraitId, uint32_t aCount) {
}
nsresult CorpusStore::UpdateData(nsIFile* aFile, bool aIsAdd,
uint32_t aRemapCount, uint32_t* aFromTraits,
uint32_t* aToTraits) {
const nsTArray<uint32_t>& aFromTraits,
const nsTArray<uint32_t>& aToTraits) {
NS_ENSURE_ARG_POINTER(aFile);
if (aRemapCount) {
NS_ENSURE_ARG_POINTER(aFromTraits);
NS_ENSURE_ARG_POINTER(aToTraits);
}
MOZ_ASSERT(aFromTraits.Length() == aToTraits.Length());
int64_t fileSize;
nsresult rv = aFile->GetFileSize(&fileSize);
@ -2532,7 +2504,7 @@ nsresult CorpusStore::UpdateData(nsIFile* aFile, bool aIsAdd,
uint32_t localTrait = fileTrait;
// remap the trait
for (uint32_t i = 0; i < aRemapCount; i++) {
for (uint32_t i = 0; i < aFromTraits.Length(); i++) {
if (aFromTraits[i] == fileTrait) localTrait = aToTraits[i];
}

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

@ -255,12 +255,6 @@ class CorpusStore : public TokenHash {
* @param aIsAdd should the data be added, or removed? true if adding,
* else removing.
*
* @param aRemapCount number of items in the parallel arrays aFromTraits,
* aToTraits. These arrays allow conversion of the
* trait id stored in the file (which may be originated
* externally) to the trait id used in the local corpus
* (which is defined locally using nsIMsgTraitService).
*
* @param aFromTraits array of trait ids used in aFile. If aFile contains
* trait ids that are not in this array, they are not
* remapped, but assumed to be local trait ids.
@ -270,8 +264,9 @@ class CorpusStore : public TokenHash {
* used in storing data from aFile into the local corpus.
*
*/
nsresult UpdateData(nsIFile* aFile, bool aIsAdd, uint32_t aRemapCount,
uint32_t* aFromTraits, uint32_t* aToTraits);
nsresult UpdateData(nsIFile* aFile, bool aIsAdd,
const nsTArray<uint32_t>& aFromTraits,
const nsTArray<uint32_t>& aToTraits);
/**
* remove all counts (message and tokens) for a trait id

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

@ -170,11 +170,9 @@ function startCommand() {
// train message
MailServices.junk.setMsgTraitClassification(
getSpec(gTest.fileName), // in string aMsgURI
0,
null, // in nsIArray aOldTraits
kProArray.length,
kProArray, // in nsIArray aNewTraits
getSpec(gTest.fileName), // aMsgURI
[], // aOldTraits
kProArray, // aNewTraits
listener
); // [optional] in nsIMsgTraitClassificationListener aTraitListener
// null, // [optional] in nsIMsgWindow aMsgWindow

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

@ -498,15 +498,13 @@ function startCommand() {
case kTrainT:
// train message using trait call
MailServices.junk.setMsgTraitClassification(
getSpec(fileName), // in string aMsgURI
0, // length of aOldTraits array
null, // in array aOldTraits
gProArray.length, // length of array
junkPercent == kIsSpamScore ? gProArray : gAntiArray, // in array aNewTraits
tListener ? traitListener : null, // in nsIMsgTraitClassificationListener aTraitListener
null, // in nsIMsgWindow aMsgWindow
getSpec(fileName), // aMsgURI
[], // aOldTraits
junkPercent == kIsSpamScore ? gProArray : gAntiArray, // aNewTraits
tListener ? traitListener : null, // aTraitListener
null, // aMsgWindow
jListener ? junkListener : null
); // in nsIJunkMailClassificationListener aJunkListener
);
break;
case kClassJ:
@ -522,7 +520,6 @@ function startCommand() {
// classify message using trait call
MailServices.junk.classifyTraitsInMessage(
getSpec(fileName), // in string aMsgURI
gProArray.length, // length of traits arrays
gProArray, // in array aProTraits,
gAntiArray, // in array aAntiTraits
tListener ? traitListener : null, // in nsIMsgTraitClassificationListener aTraitListener
@ -546,10 +543,8 @@ function startCommand() {
// forget message using trait call
MailServices.junk.setMsgTraitClassification(
getSpec(fileName), // in string aMsgURI
gProArray.length, // length of aOldTraits array (1 in this test)
junkPercent == kIsSpamScore ? gProArray : gAntiArray, // in array aOldTraits
0, // length of aNewTraits array
null, // in array aNewTraits
[], // in array aNewTraits
tListener ? traitListener : null, // in nsIMsgTraitClassificationListener aTraitListener
null, // in nsIMsgWindow aMsgWindow
jListener ? junkListener : null

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

@ -71,7 +71,7 @@ var gTests = [
function loadWithRemap() {
let fileName = "msgCorpus.dat";
let file = do_get_file("resources/" + fileName);
msgCorpus.updateData(file, true, 2, [1001, 1003], [1, 3]);
msgCorpus.updateData(file, true, [1001, 1003], [1, 3]);
for (let i = 0; i < tokenData.length; i++) {
let id = tokenData[i][0] - 1000;

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

@ -163,7 +163,6 @@ function startCommand() {
MailServices.junk.classifyTraitsInMessage(
getSpec(gTest.fileName), // in string aMsgURI
proArray.length, // length of traits arrays
proArray, // in array aProTraits,
antiArray, // in array aAntiTraits
listener

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

@ -208,11 +208,9 @@ function startCommand() {
gTest.callbacks = 1;
nsIJunkMailPlugin.setMsgTraitClassification(
getSpec(gTest.fileName), // in string aMsgURI
0,
null, // in nsIArray aOldTraits
proArray.length,
proArray, // in nsIArray aNewTraits
getSpec(gTest.fileName), // aMsgURI
[], // aOldTraits
proArray, // aNewTraits
listener
); // [optional] in nsIMsgTraitClassificationListener aTraitListener
// null, // [optional] in nsIMsgWindow aMsgWindow
@ -237,7 +235,6 @@ function startCommand() {
// use the singular classifier
nsIJunkMailPlugin.classifyTraitsInMessage(
getSpec(gTest.fileName), // in string aMsgURI
proArray.length, // length of traits arrays
proArray, // in array aProTraits,
antiArray, // in array aAntiTraits
listener
@ -247,9 +244,7 @@ function startCommand() {
} else {
// use the plural classifier
nsIJunkMailPlugin.classifyTraitsInMessages(
gTest.files.length, // in unsigned long aCount,
gTest.files, // [array, size_is(aCount)] in string aMsgURIs,
proArray.length, // length of traits arrays
gTest.files, // in Array<ACString> aMsgURIs,
proArray, // in array aProTraits,
antiArray, // in array aAntiTraits
listener