fixes bug 322314 "[trunk] Firefox crashes on login Gmail Notifier extension [@ nsStringInputStream::SetData] [@ xpcom_core.dll + 0x3cd2c (0x6034cd2c) cd66f780]" r=biesi sr=bz

This commit is contained in:
darin%meer.net 2006-01-10 01:56:00 +00:00
Родитель 98bc017fe1
Коммит 48a885095c
4 изменённых файлов: 37 добавлений и 21 удалений

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

@ -1902,7 +1902,7 @@ function normalizePostData(aStringData)
function getPostDataStream(aStringData, aKeyword, aEncKeyword, aType)
{
var dataStream = Components.classes["@mozilla.org/io/string-input-stream;1"]
.createInstance(Components.interfaces.nsIStringInputStream);
.createInstance(Components.interfaces.nsIStringInputStream2);
aStringData = aStringData.replace(/%s/g, aEncKeyword).replace(/%S/g, aKeyword);
dataStream.data = aStringData;

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

@ -44,25 +44,14 @@
/**
* nsIStringInputStream
*
* Provides scriptable and specialized C++ only methods for initializing a
* Provides scriptable and specialized C++-only methods for initializing a
* nsIInputStream implementation with a simple character array.
*
* @status UNDER_REVIEW
*/
[scriptable, uuid(8f6053fc-0944-4270-89e1-12c3113d44e8)]
[scriptable, uuid(450cd2d4-f0fd-424d-b365-b1251f80fd53)]
interface nsIStringInputStream : nsIInputStream
{
/**
* Set or get this stream's data. The data may contain null characters.
*
* NOTE: JS callers should understand that assigning a JS string to this
* attribute results in the high-byte of each character being discarded.
* Likewise, assigning this attribute into a JS string results in the
* high-byte of each character in the resulting JS string being set to
* zero.
*/
attribute ACString data;
/**
* SetData - assign data to the input stream (copied on assignment).
*
@ -104,3 +93,22 @@ interface nsIStringInputStream : nsIInputStream
*/
[noscript] void shareData(in string data, in long dataLen);
};
/**
* This interface provides a convenient attribute for setting and getting the
* stream's data.
*/
[scriptable, uuid(0e36fe9e-ecbe-4088-b616-45672d1c3e94)]
interface nsIStringInputStream2 : nsIStringInputStream
{
/**
* Set or get this stream's data. The data may contain null characters.
*
* NOTE: JS callers should understand that assigning a JS string to this
* attribute results in the high-byte of each character being discarded.
* Likewise, assigning this attribute into a JS string results in the
* high-byte of each character in the resulting JS string being set to
* zero.
*/
attribute ACString data;
};

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

@ -66,13 +66,14 @@
// nsIStringInputStream implementation
//-----------------------------------------------------------------------------
class nsStringInputStream : public nsIStringInputStream
class nsStringInputStream : public nsIStringInputStream2
, public nsISeekableStream
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSISTRINGINPUTSTREAM
NS_DECL_NSIINPUTSTREAM
NS_DECL_NSISTRINGINPUTSTREAM
NS_DECL_NSISTRINGINPUTSTREAM2
NS_DECL_NSISEEKABLESTREAM
nsStringInputStream()
@ -112,13 +113,14 @@ private:
// This class needs to support threadsafe refcounting since people often
// allocate a string stream, and then read it from a background thread.
NS_IMPL_THREADSAFE_ISUPPORTS3(nsStringInputStream,
NS_IMPL_THREADSAFE_ISUPPORTS4(nsStringInputStream,
nsIStringInputStream,
nsIStringInputStream2,
nsIInputStream,
nsISeekableStream)
/////////
// nsIStringInputStream implementation
// nsIStringInputStream2 implementation
/////////
NS_IMETHODIMP
@ -138,6 +140,10 @@ nsStringInputStream::SetData(const nsACString &data)
return SetData(iter.get(), iter.size_forward());
}
/////////
// nsIStringInputStream implementation
/////////
NS_IMETHODIMP
nsStringInputStream::SetData(const char *data, PRInt32 dataLen)
{

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

@ -44,9 +44,11 @@
#include "nsMemory.h"
/**
* nsStringInputStream : nsIStringInputStream
* , nsIInputStream
* , nsISeekableStream
* Implements:
* nsIStringInputStream2
* nsIStringInputStream
* nsIInputStream
* nsISeekableStream
*/
#define NS_STRINGINPUTSTREAM_CLASSNAME "nsStringInputStream"
#define NS_STRINGINPUTSTREAM_CONTRACTID "@mozilla.org/io/string-input-stream;1"