Bug 1703472 - For window.focus, popup abuse level should be checked on the caller. r=smaug,hsivonen

Just like how for window.open() it's checked on the opener, of course.

Note that when sending the focus request via IPC, we trust the check
done on the child (bug 1677899).

Do we have a good test to extend to cover this case?

Differential Revision: https://phabricator.services.mozilla.com/D111107
This commit is contained in:
Emilio Cobos Álvarez 2021-04-07 16:03:11 +00:00
Родитель 77b6b45811
Коммит 4401eff8fe
1 изменённых файлов: 4 добавлений и 2 удалений

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

@ -2213,8 +2213,10 @@ std::tuple<bool, bool> BrowsingContext::CanFocusCheck(CallerType aCallerType) {
bool canFocus = aCallerType == CallerType::System ||
!Preferences::GetBool("dom.disable_window_flip", true);
if (!canFocus && openerBC == callerBC) {
canFocus = (RevisePopupAbuseLevel(PopupBlocker::GetPopupControlState()) <
PopupBlocker::openBlocked);
canFocus =
(callerBC ? callerBC : this)
->RevisePopupAbuseLevel(PopupBlocker::GetPopupControlState()) <
PopupBlocker::openBlocked;
}
bool isActive = false;