mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Fix for bug 462947 ("ASSERTION: already initialized" - nsMimeTypeArray::GetMimeTypes). r/sr=bz
This commit is contained in:
parent
24a73db424
commit
aeb2860a5e
@ -209,6 +209,7 @@ nsMimeTypeArray::NamedItem(const nsAString& aName, nsIDOMMimeType** aReturn)
|
||||
|
||||
void nsMimeTypeArray::Clear()
|
||||
{
|
||||
mInited = PR_FALSE;
|
||||
mMimeTypeArray.Clear();
|
||||
mPluginMimeTypeCount = 0;
|
||||
}
|
||||
@ -229,7 +230,7 @@ nsresult nsMimeTypeArray::GetMimeTypes()
|
||||
if (rv == NS_OK) {
|
||||
// count up all possible MimeTypes, and collect them here. Later,
|
||||
// we'll remove duplicates.
|
||||
mPluginMimeTypeCount = 0;
|
||||
PRUint32 pluginMimeTypeCount = 0;
|
||||
PRUint32 pluginCount = 0;
|
||||
rv = pluginArray->GetLength(&pluginCount);
|
||||
if (rv == NS_OK) {
|
||||
@ -240,12 +241,16 @@ nsresult nsMimeTypeArray::GetMimeTypes()
|
||||
plugin) {
|
||||
PRUint32 mimeTypeCount = 0;
|
||||
if (plugin->GetLength(&mimeTypeCount) == NS_OK)
|
||||
mPluginMimeTypeCount += mimeTypeCount;
|
||||
pluginMimeTypeCount += mimeTypeCount;
|
||||
}
|
||||
}
|
||||
// now we know how many there are, start gathering them.
|
||||
if (!mMimeTypeArray.SetCapacity(mPluginMimeTypeCount))
|
||||
if (!mMimeTypeArray.SetCapacity(pluginMimeTypeCount))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
mPluginMimeTypeCount = pluginMimeTypeCount;
|
||||
mInited = PR_TRUE;
|
||||
|
||||
PRUint32 k;
|
||||
for (k = 0; k < pluginCount; k++) {
|
||||
nsIDOMPlugin* plugin = nsnull;
|
||||
|
Loading…
Reference in New Issue
Block a user