Bug 1453517 - Consolidate popup permission checks to nsContentUtils; r=bz

Permissions checks for popups were happening in nsIPopupWindowManager,
but that really only required a pref and perm check. The XPCOM
machinery around this isn't really needed, and the check was only
called from two places in content, so this fits in nsContentUtils.

MozReview-Commit-ID: 9x60x1BKWcr
This commit is contained in:
Kyle Machulis
2018-04-11 16:18:20 -07:00
parent bc35fb601c
commit 3ff8407067
4 changed files with 32 additions and 28 deletions

View File

@@ -695,14 +695,7 @@ HTMLInputElement::IsPopupBlocked() const
return false;
}
nsCOMPtr<nsIPopupWindowManager> pm = do_GetService(NS_POPUPWINDOWMANAGER_CONTRACTID);
if (!pm) {
return true;
}
uint32_t permission;
pm->TestPermission(OwnerDoc()->NodePrincipal(), &permission);
return permission == nsIPopupWindowManager::DENY_POPUP;
return !nsContentUtils::CanShowPopup(OwnerDoc()->NodePrincipal());
}
nsresult