Fixing bug 123273. Don't let JS timeouts run with 0 delay, always force at least a 10ms delay. r=bzbarsky@mit.edu, sr=rpotts@netscape.com

This commit is contained in:
jst%netscape.com 2002-06-19 00:42:23 +00:00
parent 57e782b463
commit 53ecd021aa

View File

@ -144,6 +144,9 @@
#include "nsIXBLService.h"
#define DOM_MIN_TIMEOUT_VALUE 10 // 10ms
static nsIEntropyCollector* gEntropyCollector = nsnull;
static PRInt32 gRefCnt = 0;
nsIXPConnect *GlobalWindowImpl::sXPConnect = nsnull;
@ -4264,6 +4267,13 @@ GlobalWindowImpl::SetTimeoutOrInterval(PRBool aIsInterval, PRInt32 *aReturn)
return ncc->SetExceptionWasThrown(PR_TRUE);
}
if (interval < DOM_MIN_TIMEOUT_VALUE) {
// Don't allow timeouts less than DOM_MIN_TIMEOUT_VALUE from
// now...
interval = DOM_MIN_TIMEOUT_VALUE;
}
timeout = new nsTimeoutImpl();
if (!timeout)
return NS_ERROR_OUT_OF_MEMORY;