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

This commit is contained in:
danm%netscape.com 2002-09-11 02:22:25 +00:00
Родитель 8667c2c992
Коммит e14500e398
1 изменённых файлов: 14 добавлений и 26 удалений

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

@ -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;