Backed out 4 changesets (bug 1743329) for causing failures at browser_popupNotification_security_delay.js. CLOSED TREE
Backed out changeset 6d33ea38cd14 (bug 1743329) Backed out changeset 0f9bffa357a5 (bug 1743329) Backed out changeset cd96c48488eb (bug 1743329) Backed out changeset 209a41c449e1 (bug 1743329)
This commit is contained in:
@@ -17,10 +17,8 @@
|
|||||||
#include "mozilla/dom/BrowsingContext.h"
|
#include "mozilla/dom/BrowsingContext.h"
|
||||||
#include "mozilla/dom/Document.h"
|
#include "mozilla/dom/Document.h"
|
||||||
#include "mozilla/dom/Element.h"
|
#include "mozilla/dom/Element.h"
|
||||||
#include "mozilla/dom/PointerEventHandler.h"
|
|
||||||
#include "mozilla/dom/WindowContext.h"
|
#include "mozilla/dom/WindowContext.h"
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsMenuPopupFrame.h"
|
|
||||||
#include "nsSandboxFlags.h"
|
#include "nsSandboxFlags.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
@@ -88,25 +86,6 @@ static void DispatchPointerLockError(Document* aTarget, const char* aMessage) {
|
|||||||
aMessage);
|
aMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool IsPopupOpened() {
|
|
||||||
// Check if any popup is open.
|
|
||||||
nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
|
|
||||||
if (!pm) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsTArray<nsMenuPopupFrame*> popups;
|
|
||||||
pm->GetVisiblePopups(popups, true);
|
|
||||||
|
|
||||||
for (nsMenuPopupFrame* popup : popups) {
|
|
||||||
if (popup->GetPopupType() != widget::PopupType::Tooltip) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char* GetPointerLockError(Element* aElement, Element* aCurrentLock,
|
static const char* GetPointerLockError(Element* aElement, Element* aCurrentLock,
|
||||||
bool aNoFocusCheck = false) {
|
bool aNoFocusCheck = false) {
|
||||||
// Check if pointer lock pref is enabled
|
// Check if pointer lock pref is enabled
|
||||||
@@ -157,10 +136,6 @@ static const char* GetPointerLockError(Element* aElement, Element* aCurrentLock,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsPopupOpened()) {
|
|
||||||
return "PointerLockDeniedFailedToLock";
|
|
||||||
}
|
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -192,14 +167,6 @@ void PointerLockManager::RequestLock(Element* aElement,
|
|||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
void PointerLockManager::Unlock(Document* aDoc) {
|
void PointerLockManager::Unlock(Document* aDoc) {
|
||||||
if (sLockedRemoteTarget) {
|
|
||||||
MOZ_ASSERT(XRE_IsParentProcess());
|
|
||||||
MOZ_ASSERT(!sIsLocked);
|
|
||||||
Unused << sLockedRemoteTarget->SendReleasePointerLock();
|
|
||||||
sLockedRemoteTarget = nullptr;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!sIsLocked) {
|
if (!sIsLocked) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -344,24 +311,14 @@ bool PointerLockManager::IsInLockContext(BrowsingContext* aContext) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
void PointerLockManager::SetLockedRemoteTarget(BrowserParent* aBrowserParent,
|
bool PointerLockManager::SetLockedRemoteTarget(BrowserParent* aBrowserParent) {
|
||||||
nsACString& aError) {
|
|
||||||
MOZ_ASSERT(XRE_IsParentProcess());
|
MOZ_ASSERT(XRE_IsParentProcess());
|
||||||
if (sLockedRemoteTarget) {
|
if (sLockedRemoteTarget) {
|
||||||
if (sLockedRemoteTarget != aBrowserParent) {
|
return sLockedRemoteTarget == aBrowserParent;
|
||||||
aError = "PointerLockDeniedInUse"_ns;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if any popup is open.
|
|
||||||
if (IsPopupOpened()) {
|
|
||||||
aError = "PointerLockDeniedFailedToLock"_ns;
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sLockedRemoteTarget = aBrowserParent;
|
sLockedRemoteTarget = aBrowserParent;
|
||||||
PointerEventHandler::ReleaseAllPointerCaptureRemoteTarget();
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
|
|||||||
@@ -47,8 +47,7 @@ class PointerLockManager final {
|
|||||||
|
|
||||||
// Set/release pointer lock remote target. Should only be called in parent
|
// Set/release pointer lock remote target. Should only be called in parent
|
||||||
// process.
|
// process.
|
||||||
static void SetLockedRemoteTarget(dom::BrowserParent* aBrowserParent,
|
static bool SetLockedRemoteTarget(dom::BrowserParent* aBrowserParent);
|
||||||
nsACString& aError);
|
|
||||||
static void ReleaseLockedRemoteTarget(dom::BrowserParent* aBrowserParent);
|
static void ReleaseLockedRemoteTarget(dom::BrowserParent* aBrowserParent);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -30,7 +30,6 @@
|
|||||||
#include "mozilla/MouseEvents.h"
|
#include "mozilla/MouseEvents.h"
|
||||||
#include "mozilla/NativeKeyBindingsType.h"
|
#include "mozilla/NativeKeyBindingsType.h"
|
||||||
#include "mozilla/NullPrincipal.h"
|
#include "mozilla/NullPrincipal.h"
|
||||||
#include "mozilla/PointerLockManager.h"
|
|
||||||
#include "mozilla/PresShell.h"
|
#include "mozilla/PresShell.h"
|
||||||
#include "mozilla/ProcessHangMonitor.h"
|
#include "mozilla/ProcessHangMonitor.h"
|
||||||
#include "mozilla/ProfilerLabels.h"
|
#include "mozilla/ProfilerLabels.h"
|
||||||
@@ -3195,11 +3194,6 @@ mozilla::ipc::IPCResult BrowserChild::RecvReleaseAllPointerCapture() {
|
|||||||
return IPC_OK();
|
return IPC_OK();
|
||||||
}
|
}
|
||||||
|
|
||||||
mozilla::ipc::IPCResult BrowserChild::RecvReleasePointerLock() {
|
|
||||||
PointerLockManager::Unlock();
|
|
||||||
return IPC_OK();
|
|
||||||
}
|
|
||||||
|
|
||||||
PPaymentRequestChild* BrowserChild::AllocPPaymentRequestChild() {
|
PPaymentRequestChild* BrowserChild::AllocPPaymentRequestChild() {
|
||||||
MOZ_CRASH(
|
MOZ_CRASH(
|
||||||
"We should never be manually allocating PPaymentRequestChild actors");
|
"We should never be manually allocating PPaymentRequestChild actors");
|
||||||
|
|||||||
@@ -673,8 +673,6 @@ class BrowserChild final : public nsMessageManagerScriptExecutor,
|
|||||||
|
|
||||||
mozilla::ipc::IPCResult RecvReleaseAllPointerCapture();
|
mozilla::ipc::IPCResult RecvReleaseAllPointerCapture();
|
||||||
|
|
||||||
mozilla::ipc::IPCResult RecvReleasePointerLock();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void HandleDoubleTap(const CSSPoint& aPoint, const Modifiers& aModifiers,
|
void HandleDoubleTap(const CSSPoint& aPoint, const Modifiers& aModifiers,
|
||||||
const ScrollableLayerGuid& aGuid,
|
const ScrollableLayerGuid& aGuid,
|
||||||
|
|||||||
@@ -4086,14 +4086,15 @@ static BrowserParent* GetTopLevelBrowserParent(BrowserParent* aBrowserParent) {
|
|||||||
|
|
||||||
mozilla::ipc::IPCResult BrowserParent::RecvRequestPointerLock(
|
mozilla::ipc::IPCResult BrowserParent::RecvRequestPointerLock(
|
||||||
RequestPointerLockResolver&& aResolve) {
|
RequestPointerLockResolver&& aResolve) {
|
||||||
if (sTopLevelWebFocus != GetTopLevelBrowserParent(this)) {
|
|
||||||
aResolve("PointerLockDeniedNotFocused"_ns);
|
|
||||||
return IPC_OK();
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCString error;
|
nsCString error;
|
||||||
PointerLockManager::SetLockedRemoteTarget(this, error);
|
if (sTopLevelWebFocus != GetTopLevelBrowserParent(this)) {
|
||||||
aResolve(std::move(error));
|
error = "PointerLockDeniedNotFocused";
|
||||||
|
} else if (!PointerLockManager::SetLockedRemoteTarget(this)) {
|
||||||
|
error = "PointerLockDeniedInUse";
|
||||||
|
} else {
|
||||||
|
PointerEventHandler::ReleaseAllPointerCaptureRemoteTarget();
|
||||||
|
}
|
||||||
|
aResolve(error);
|
||||||
return IPC_OK();
|
return IPC_OK();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -553,23 +553,18 @@ parent:
|
|||||||
|
|
||||||
async ImageLoadComplete(nsresult aResult);
|
async ImageLoadComplete(nsresult aResult);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Child informs the parent that a pointer lock has requested/released.
|
||||||
|
*/
|
||||||
|
async RequestPointerLock() returns (nsCString error);
|
||||||
|
async ReleasePointerLock();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Child informs the parent that a pointer capture has requested/released.
|
* Child informs the parent that a pointer capture has requested/released.
|
||||||
*/
|
*/
|
||||||
async RequestPointerCapture(uint32_t aPointerId) returns (bool aSuccess);
|
async RequestPointerCapture(uint32_t aPointerId) returns (bool aSuccess);
|
||||||
async ReleasePointerCapture(uint32_t aPointerId);
|
async ReleasePointerCapture(uint32_t aPointerId);
|
||||||
|
|
||||||
/**
|
|
||||||
* Child informs the parent that a pointer lock has requested.
|
|
||||||
*/
|
|
||||||
async RequestPointerLock() returns (nsCString error);
|
|
||||||
|
|
||||||
both:
|
|
||||||
/**
|
|
||||||
* informs that a pointer lock has released.
|
|
||||||
*/
|
|
||||||
async ReleasePointerLock();
|
|
||||||
|
|
||||||
child:
|
child:
|
||||||
async NativeSynthesisResponse(uint64_t aObserverId, nsCString aResponse);
|
async NativeSynthesisResponse(uint64_t aObserverId, nsCString aResponse);
|
||||||
async UpdateSHistory();
|
async UpdateSHistory();
|
||||||
|
|||||||
@@ -8692,21 +8692,17 @@ void PresShell::EventHandler::MaybeHandleKeyboardEventBeforeDispatch(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (XRE_IsParentProcess() &&
|
nsCOMPtr<Document> pointerLockedDoc = PointerLockManager::GetLockedDocument();
|
||||||
!mPresShell->mIsLastChromeOnlyEscapeKeyConsumed) {
|
if (!mPresShell->mIsLastChromeOnlyEscapeKeyConsumed && pointerLockedDoc) {
|
||||||
if (PointerLockManager::GetLockedRemoteTarget() ||
|
|
||||||
PointerLockManager::IsLocked()) {
|
|
||||||
// XXX See above comment to understand the reason why this needs
|
// XXX See above comment to understand the reason why this needs
|
||||||
// to claim that the Escape key event is consumed by content
|
// to claim that the Escape key event is consumed by content
|
||||||
// even though it will be dispatched only into chrome.
|
// even though it will be dispatched only into chrome.
|
||||||
aKeyboardEvent->PreventDefaultBeforeDispatch(
|
aKeyboardEvent->PreventDefaultBeforeDispatch(CrossProcessForwarding::eStop);
|
||||||
CrossProcessForwarding::eStop);
|
|
||||||
aKeyboardEvent->mFlags.mOnlyChromeDispatch = true;
|
aKeyboardEvent->mFlags.mOnlyChromeDispatch = true;
|
||||||
if (aKeyboardEvent->mMessage == eKeyUp) {
|
if (aKeyboardEvent->mMessage == eKeyUp) {
|
||||||
PointerLockManager::Unlock();
|
PointerLockManager::Unlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PresShell::EventHandler::RecordEventPreparationPerformance(
|
void PresShell::EventHandler::RecordEventPreparationPerformance(
|
||||||
|
|||||||
@@ -142,7 +142,6 @@
|
|||||||
#include "nsIScrollableFrame.h"
|
#include "nsIScrollableFrame.h"
|
||||||
#include "nsIWidget.h"
|
#include "nsIWidget.h"
|
||||||
#include "nsListControlFrame.h"
|
#include "nsListControlFrame.h"
|
||||||
#include "nsMenuPopupFrame.h"
|
|
||||||
#include "nsPIDOMWindow.h"
|
#include "nsPIDOMWindow.h"
|
||||||
#include "nsPlaceholderFrame.h"
|
#include "nsPlaceholderFrame.h"
|
||||||
#include "nsPresContext.h"
|
#include "nsPresContext.h"
|
||||||
@@ -1638,10 +1637,10 @@ nsIFrame* nsLayoutUtils::GetPopupFrameForPoint(
|
|||||||
if (!pm) {
|
if (!pm) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
nsTArray<nsMenuPopupFrame*> popups;
|
nsTArray<nsIFrame*> popups;
|
||||||
pm->GetVisiblePopups(popups);
|
pm->GetVisiblePopups(popups);
|
||||||
// Search from top to bottom
|
// Search from top to bottom
|
||||||
for (nsMenuPopupFrame* popup : popups) {
|
for (nsIFrame* popup : popups) {
|
||||||
if (popup->PresContext()->GetRootPresContext() != aRootPresContext) {
|
if (popup->PresContext()->GetRootPresContext() != aRootPresContext) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,6 @@
|
|||||||
#include "mozilla/EventStateManager.h"
|
#include "mozilla/EventStateManager.h"
|
||||||
#include "mozilla/LookAndFeel.h"
|
#include "mozilla/LookAndFeel.h"
|
||||||
#include "mozilla/MouseEvents.h"
|
#include "mozilla/MouseEvents.h"
|
||||||
#include "mozilla/PointerLockManager.h"
|
|
||||||
#include "mozilla/PresShell.h"
|
#include "mozilla/PresShell.h"
|
||||||
#include "mozilla/Services.h"
|
#include "mozilla/Services.h"
|
||||||
#include "mozilla/StaticPrefs_ui.h"
|
#include "mozilla/StaticPrefs_ui.h"
|
||||||
@@ -988,7 +987,6 @@ bool nsXULPopupManager::ShowPopupAsNativeMenu(Element* aPopup, int32_t aXPos,
|
|||||||
EventStateManager::ClearGlobalActiveContent(activeESM);
|
EventStateManager::ClearGlobalActiveContent(activeESM);
|
||||||
activeESM->StopTrackingDragGesture(true);
|
activeESM->StopTrackingDragGesture(true);
|
||||||
}
|
}
|
||||||
PointerLockManager::Unlock();
|
|
||||||
PresShell::ReleaseCapturingContent();
|
PresShell::ReleaseCapturingContent();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -1203,10 +1201,6 @@ void nsXULPopupManager::ShowPopupCallback(Element* aPopup,
|
|||||||
// Caret visibility may have been affected, ensure that
|
// Caret visibility may have been affected, ensure that
|
||||||
// the caret isn't now drawn when it shouldn't be.
|
// the caret isn't now drawn when it shouldn't be.
|
||||||
CheckCaretDrawingState();
|
CheckCaretDrawingState();
|
||||||
|
|
||||||
if (popupType != PopupType::Tooltip) {
|
|
||||||
PointerLockManager::Unlock();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsMenuChainItem* nsXULPopupManager::FindPopup(Element* aPopup) const {
|
nsMenuChainItem* nsXULPopupManager::FindPopup(Element* aPopup) const {
|
||||||
@@ -1856,17 +1850,8 @@ nsIContent* nsXULPopupManager::GetTopActiveMenuItemContent() {
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsXULPopupManager::GetVisiblePopups(nsTArray<nsMenuPopupFrame*>& aPopups,
|
void nsXULPopupManager::GetVisiblePopups(nsTArray<nsIFrame*>& aPopups) {
|
||||||
bool aIncludeNativeMenu) {
|
|
||||||
aPopups.Clear();
|
aPopups.Clear();
|
||||||
if (aIncludeNativeMenu && mNativeMenu) {
|
|
||||||
nsCOMPtr<nsIContent> popup = mNativeMenu->Element();
|
|
||||||
nsMenuPopupFrame* popupFrame = GetPopupFrameForContent(popup, true);
|
|
||||||
if (popupFrame && popupFrame->IsVisible() &&
|
|
||||||
!popupFrame->IsMouseTransparent()) {
|
|
||||||
aPopups.AppendElement(popupFrame);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (nsMenuChainItem* item = mPopups.get(); item; item = item->GetParent()) {
|
for (nsMenuChainItem* item = mPopups.get(); item; item = item->GetParent()) {
|
||||||
// Skip panels which are not visible as well as popups that are transparent
|
// Skip panels which are not visible as well as popups that are transparent
|
||||||
// to mouse events.
|
// to mouse events.
|
||||||
|
|||||||
@@ -601,10 +601,8 @@ class nsXULPopupManager final : public nsIDOMEventListener,
|
|||||||
/**
|
/**
|
||||||
* Return an array of all the open and visible popup frames for
|
* Return an array of all the open and visible popup frames for
|
||||||
* menus, in order from top to bottom.
|
* menus, in order from top to bottom.
|
||||||
* XXX should we always include native menu?
|
|
||||||
*/
|
*/
|
||||||
void GetVisiblePopups(nsTArray<nsMenuPopupFrame*>& aPopups,
|
void GetVisiblePopups(nsTArray<nsIFrame*>& aPopups);
|
||||||
bool aIncludeNativeMenu = false);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the node that last triggered a popup or tooltip in the document
|
* Get the node that last triggered a popup or tooltip in the document
|
||||||
|
|||||||
Reference in New Issue
Block a user