Bug 322169: Clear Private Data does not clear JS Console, patch by Simon B�nzli <zeniko@gmail.com>, r=mconnor, r=darin

This commit is contained in:
gavin@gavinsharp.com
2006-07-19 12:49:33 +00:00
parent 691015fecd
commit 1b38a14957
4 changed files with 55 additions and 8 deletions

View File

@@ -20,6 +20,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Simon Bünzli <zeniko@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
@@ -319,3 +320,23 @@ nsConsoleService::GetProxyForListener(nsIConsoleListener* aListener,
NS_PROXY_ASYNC | NS_PROXY_ALWAYS,
(void**) aProxy);
}
NS_IMETHODIMP
nsConsoleService::Reset()
{
/*
* Make sure nobody trips into the buffer while it's being reset
*/
nsAutoLock lock(mLock);
mCurrent = 0;
mFull = PR_FALSE;
/*
* Free all messages stored so far (cf. destructor)
*/
for (PRUint32 i = 0; i < mBufferSize && mMessages[i] != nsnull; i++)
NS_RELEASE(mMessages[i]);
return NS_OK;
}