mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
add additional logging to diagnose 268245, sr=mscott
This commit is contained in:
parent
25396bfe1a
commit
0b8edec57d
@ -106,6 +106,6 @@ interface nsISpamSettings: nsISupports {
|
||||
void ensureLogFile();
|
||||
void flushLogIfNecessary();
|
||||
void logJunkHit(in nsIMsgDBHdr aMsgHdr, in boolean aMoveMessage);
|
||||
|
||||
void logJunkString(in string aLogText);
|
||||
void clone(in nsISpamSettings aSpamSettings);
|
||||
};
|
||||
|
@ -474,10 +474,6 @@ NS_IMETHODIMP nsSpamSettings::LogJunkHit(nsIMsgDBHdr *aMsgHdr, PRBool aMoveMessa
|
||||
if (!loggingEnabled)
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr <nsIOutputStream> logStream;
|
||||
rv = GetLogStream(getter_AddRefs(logStream));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
PRTime date;
|
||||
char dateStr[40]; /* 30 probably not enough */
|
||||
|
||||
@ -520,6 +516,22 @@ NS_IMETHODIMP nsSpamSettings::LogJunkHit(nsIMsgDBHdr *aMsgHdr, PRBool aMoveMessa
|
||||
buffer += junkFolderURI.get();
|
||||
buffer += "\n";
|
||||
}
|
||||
|
||||
return LogJunkString(buffer.get());
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSpamSettings::LogJunkString(const char *string)
|
||||
{
|
||||
PRBool loggingEnabled;
|
||||
nsresult rv = GetLoggingEnabled(&loggingEnabled);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
if (!loggingEnabled)
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr <nsIOutputStream> logStream;
|
||||
rv = GetLogStream(getter_AddRefs(logStream));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
PRUint32 writeCount;
|
||||
|
||||
@ -530,13 +542,13 @@ NS_IMETHODIMP nsSpamSettings::LogJunkHit(nsIMsgDBHdr *aMsgHdr, PRBool aMoveMessa
|
||||
// html escape the log for security reasons.
|
||||
// we don't want some to send us a message with a subject with
|
||||
// html tags, especially <script>
|
||||
char *escapedBuffer = nsEscapeHTML(buffer.get());
|
||||
char *escapedBuffer = nsEscapeHTML(string);
|
||||
if (!escapedBuffer)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
PRUint32 escapedBufferLen = strlen(escapedBuffer);
|
||||
rv = logStream->Write(escapedBuffer, escapedBufferLen, &writeCount);
|
||||
PR_FREEIF(escapedBuffer);
|
||||
PR_Free(escapedBuffer);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
NS_ASSERTION(writeCount == escapedBufferLen, "failed to write out log hit");
|
||||
|
||||
@ -546,7 +558,6 @@ NS_IMETHODIMP nsSpamSettings::LogJunkHit(nsIMsgDBHdr *aMsgHdr, PRBool aMoveMessa
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsSpamSettings::OnStartRunningUrl(nsIURI* aURL)
|
||||
{
|
||||
// do nothing
|
||||
|
Loading…
Reference in New Issue
Block a user