[Bug 659925] msgHeaderSink properties are never reset after streaming r=standard8 sr=bienvenu

This commit is contained in:
Jonathan Protzenko 2011-06-03 23:41:30 +02:00
Родитель c12cb9820c
Коммит 014d9bd301
4 изменённых файлов: 36 добавлений и 2 удалений

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

@ -707,6 +707,10 @@ var messageHeaderSink = {
this.mProperties = Components.classes["@mozilla.org/hash-property-bag;1"].
createInstance(Components.interfaces.nsIWritablePropertyBag2);
return this.mProperties;
},
resetProperties: function() {
this.mProperties = null;
}
};

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

@ -1091,6 +1091,11 @@ NS_IMETHODIMP TokenStreamListener::GetDummyMsgHeader(nsIMsgDBHdr **aMsgDBHdr)
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP TokenStreamListener::ResetProperties()
{
return NS_OK;
}
NS_IMETHODIMP TokenStreamListener::GetProperties(nsIWritablePropertyBag2 * *aProperties)
{
return NS_ERROR_NOT_IMPLEMENTED;

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

@ -61,7 +61,7 @@ interface nsIMimeMiscStatus : nsISupports{
// this is a simple interface which allows someone to listen to all the headers
// that are discovered by mime. We can use this when displaying a message to update
// the msg header in JS.
[scriptable, uuid(AD0CB800-CCD0-11DF-BD3B-0800200C9A66)]
[scriptable, uuid(2a709e6f-48ec-4273-9d4c-7b1115a2e756)]
interface nsIMsgHeaderSink : nsISupports
{
// You must finish consuming the iterators before returning from processHeaders. aHeaderNames and aHeaderValues will ALWAYS have the same
@ -97,4 +97,7 @@ interface nsIMsgHeaderSink : nsISupports
// be accessed by other parts of the code, e.g., UI code.
// TODO - Should replace securityInfo
readonly attribute nsIWritablePropertyBag2 properties;
// When streaming a new message, properties should be reset, so that there are
// not previous values lurking around.
void resetProperties();
};

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

@ -76,6 +76,7 @@
#include "nsIURI.h"
#include "nsNetCID.h"
#include "nsIMsgWindow.h"
#include "nsIMimeMiscStatus.h"
#include "nsMsgUtils.h"
#include "nsIChannel.h"
#include "nsICacheEntryDescriptor.h"
@ -766,6 +767,25 @@ SetMailCharacterSetToMsgWindow(MimeObject *obj, const char *aCharacterSet)
return rv;
}
static void ResetMsgHeaderSinkProps(nsIURI *uri)
{
nsCOMPtr<nsIMsgMailNewsUrl> msgurl(do_QueryInterface(uri));
if (!msgurl)
return;
nsCOMPtr<nsIMsgWindow> msgWindow;
msgurl->GetMsgWindow(getter_AddRefs(msgWindow));
if (!msgWindow)
return;
nsCOMPtr<nsIMsgHeaderSink> msgHeaderSink;
msgWindow->GetMsgHeaderSink(getter_AddRefs(msgHeaderSink));
if (!msgHeaderSink)
return;
msgHeaderSink->ResetProperties();
}
static char *
mime_file_type (const char *filename, void *stream_closure)
{
@ -1668,7 +1688,7 @@ mime_bridge_create_display_stream(
msd->options->output_fn = mime_output_fn;
msd->options->whattodo = whattodo;
msd->options->whattodo = whattodo;
msd->options->charset_conversion_fn = mime_convert_charset;
msd->options->rfc1522_conversion_p = PR_TRUE;
msd->options->file_type_fn = mime_file_type;
@ -1710,6 +1730,8 @@ mime_bridge_create_display_stream(
return 0;
}
ResetMsgHeaderSinkProps(uri);
memset (stream, 0, sizeof (*stream));
stream->name = "MIME Conversion Stream";
stream->complete = mime_display_stream_complete;