Backed out changeset b21f364898eb (bug 1678389) for causing Android gv-unit failures CLOSED TREE

This commit is contained in:
Noemi Erli
2020-11-22 04:24:23 +02:00
parent 76b5f2e184
commit 460b27e8f6
16 changed files with 46 additions and 36 deletions

View File

@@ -661,15 +661,19 @@ nsColorPickerShownCallback::Done(const nsAString& aColor) {
NS_IMPL_ISUPPORTS(nsColorPickerShownCallback, nsIColorPickerShownCallback)
static bool IsPopupBlocked(Document* aDoc) {
if (aDoc->ConsumeTransientUserGestureActivation()) {
return false;
bool HTMLInputElement::IsPopupBlocked() const {
nsCOMPtr<nsPIDOMWindowOuter> win = OwnerDoc()->GetWindow();
MOZ_ASSERT(win, "window should not be null");
if (!win) {
return true;
}
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag, "DOM"_ns, aDoc,
nsContentUtils::eDOM_PROPERTIES,
"InputPickerBlockedNoUserActivation");
return true;
// Check if page can open a popup without abuse regardless of allowed events
if (PopupBlocker::GetPopupControlState() <= PopupBlocker::openBlocked) {
return !PopupBlocker::TryUsePopupOpeningToken(OwnerDoc()->NodePrincipal());
}
return !PopupBlocker::CanShowPopupByPermission(OwnerDoc()->NodePrincipal());
}
nsresult HTMLInputElement::InitColorPicker() {
@@ -685,7 +689,7 @@ nsresult HTMLInputElement::InitColorPicker() {
return NS_ERROR_FAILURE;
}
if (IsPopupBlocked(doc)) {
if (IsPopupBlocked()) {
return NS_OK;
}
@@ -730,7 +734,7 @@ nsresult HTMLInputElement::InitFilePicker(FilePickerType aType) {
return NS_ERROR_FAILURE;
}
if (IsPopupBlocked(doc)) {
if (IsPopupBlocked()) {
return NS_OK;
}