moving most of the popup window abuse check to WindowCreator. bug 166442 r=jag,jst,timeless

git-svn-id: svn://10.0.0.236/trunk@129209 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
danm%netscape.com 2002-09-11 02:22:25 +00:00
parent 8027bf7358
commit 85887d5360

View File

@ -2842,36 +2842,24 @@ GlobalWindowImpl::CheckForAbusePoint ()
if (!prefs)
return PR_FALSE;
if (!mIsDocumentLoaded || mRunningTimeout) {
PRBool blockOpenOnLoad = PR_FALSE;
prefs->GetBoolPref("dom.disable_open_during_load", &blockOpenOnLoad);
if (blockOpenOnLoad) {
PRInt32 clickDelay = 0;
prefs->GetIntPref("dom.disable_open_click_delay", &clickDelay);
if (clickDelay) {
PRTime now, ll_delta;
PRInt32 delta;
now = PR_Now();
LL_SUB(ll_delta, now, mLastMouseButtonAction);
LL_L2I(delta, ll_delta);
delta /= 1000;
if (delta > clickDelay)
{
#ifdef DEBUG
printf ("*** Scripts executed during (un)load or as a result of "
"setTimeout() are potential javascript abuse points.\n");
printf ("*** Scripts executed more than %ims after a mouse button "
"action are potential javascript abuse points (%i.)\n",
clickDelay, delta);
#endif
return PR_TRUE;
}
} else {
PRInt32 clickDelay = 0;
prefs->GetIntPref("dom.disable_open_click_delay", &clickDelay);
if (clickDelay) {
PRTime now, ll_delta;
PRInt32 delta;
now = PR_Now();
LL_SUB(ll_delta, now, mLastMouseButtonAction);
LL_L2I(delta, ll_delta);
delta /= 1000;
if (delta > clickDelay)
{
#ifdef DEBUG
printf ("*** Scripts executed more than %ims after a mouse button "
"action are potential javascript abuse points (%i.)\n",
clickDelay, delta);
#endif
return PR_TRUE;
}
}
}
return PR_FALSE;