Backed out changeset 27d3d97f875f (bug 1696908) build bustage at nsFocusManager.cpp on a CLOSED TREE

This commit is contained in:
Andreea Pavel 2021-03-31 19:32:11 +03:00
Родитель 35eeef915f
Коммит 4674e1b5e2
8 изменённых файлов: 47 добавлений и 256 удалений

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

@ -160,8 +160,7 @@ void BrowsingContextGroup::Subscribe(ContentParent* aProcess) {
if (focused || active) {
Unused << aProcess->SendSetupFocusedAndActive(
focused, fm->GetActionIdForFocusedBrowsingContextInChrome(), active,
fm->GetActionIdForActiveBrowsingContextInChrome());
focused, active, fm->GetActionIdForActiveBrowsingContextInChrome());
}
}
}

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

@ -175,8 +175,6 @@ static const char* kObservedPrefs[] = {"accessibility.browsewithcaret",
nsFocusManager::nsFocusManager()
: mActionIdForActiveBrowsingContextInContent(0),
mActionIdForActiveBrowsingContextInChrome(0),
mActionIdForFocusedBrowsingContextInContent(0),
mActionIdForFocusedBrowsingContextInChrome(0),
mActiveBrowsingContextInContentSetFromOtherProcess(false),
mEventHandlingNeedsFlush(false) {}
@ -239,10 +237,8 @@ nsFocusManager::Observe(nsISupports* aSubject, const char* aTopic,
mActiveWindow = nullptr;
mActiveBrowsingContextInContent = nullptr;
mActionIdForActiveBrowsingContextInContent = 0;
mActionIdForFocusedBrowsingContextInContent = 0;
mActiveBrowsingContextInChrome = nullptr;
mActionIdForActiveBrowsingContextInChrome = 0;
mActionIdForFocusedBrowsingContextInChrome = 0;
mFocusedWindow = nullptr;
mFocusedBrowsingContextInContent = nullptr;
mFocusedBrowsingContextInChrome = nullptr;
@ -258,7 +254,6 @@ nsFocusManager::Observe(nsISupports* aSubject, const char* aTopic,
static bool ActionIdComparableAndLower(uint64_t aActionId,
uint64_t aReference) {
MOZ_ASSERT(aActionId, "Uninitialized action id");
auto [actionProc, actionId] =
nsContentUtils::SplitProcessSpecificId(aActionId);
auto [refProc, refId] = nsContentUtils::SplitProcessSpecificId(aReference);
@ -977,8 +972,7 @@ void nsFocusManager::WindowShown(mozIDOMWindowProxy* aWindow,
return;
}
// Sync the window for a newly-created OOP iframe
// Set actionId to zero to signify that it should be ignored.
SetFocusedWindowInternal(window, 0, false);
SetFocusedWindowInternal(window, false);
}
if (aNeedsFocus) {
@ -1105,7 +1099,7 @@ void nsFocusManager::WindowHidden(mozIDOMWindowProxy* aWindow,
#endif
// This call adjusts the focused browsing context and window.
// The latter gets nulled out immediately below.
SetFocusedWindowInternal(window, aActionId);
SetFocusedWindowInternal(window);
}
mFocusedWindow = nullptr;
window->SetFocusedElement(nullptr);
@ -1171,7 +1165,7 @@ void nsFocusManager::WindowHidden(mozIDOMWindowProxy* aWindow,
}
}
SetFocusedWindowInternal(window, aActionId);
SetFocusedWindowInternal(window);
}
}
@ -1211,7 +1205,7 @@ void nsFocusManager::WasNuked(nsPIDOMWindowOuter* aWindow) {
"How come we're nuking a window that's still active?");
if (aWindow == mFocusedWindow) {
mFocusedWindow = nullptr;
SetFocusedBrowsingContext(nullptr, GenerateFocusActionId());
SetFocusedBrowsingContext(nullptr);
mFocusedElement = nullptr;
}
}
@ -2167,7 +2161,7 @@ bool nsFocusManager::Blur(BrowsingContext* aBrowsingContextToClear,
// The expectation is that the blurring would eventually result in an IPC
// message doing this anyway, but this doesn't happen if the focus is in OOP
// iframe which won't try to bounce an IPC message to its parent frame.
SetFocusedWindowInternal(nullptr, aActionId);
SetFocusedWindowInternal(nullptr);
contentChild->SendBlurToParent(
focusedBrowsingContext, aBrowsingContextToClear,
aAncestorBrowsingContextToFocus, aIsLeavingDocument, aAdjustWidget,
@ -2218,20 +2212,10 @@ bool nsFocusManager::BlurImpl(BrowsingContext* aBrowsingContextToClear,
nsCOMPtr<nsIDocShell> docShell = window->GetDocShell();
if (!docShell) {
if (XRE_IsContentProcess() &&
ActionIdComparableAndLower(
aActionId, mActionIdForFocusedBrowsingContextInContent)) {
// Unclear if this ever happens.
LOGFOCUS(
("Ignored an attempt to null out focused BrowsingContext when "
"docShell is null due to a stale action id."));
return true;
}
mFocusedWindow = nullptr;
// Setting focused BrowsingContext to nullptr to avoid leaking in print
// preview.
SetFocusedBrowsingContext(nullptr, aActionId);
SetFocusedBrowsingContext(nullptr);
mFocusedElement = nullptr;
return true;
}
@ -2240,20 +2224,11 @@ bool nsFocusManager::BlurImpl(BrowsingContext* aBrowsingContextToClear,
// the document to be destroyed.
RefPtr<PresShell> presShell = docShell->GetPresShell();
if (!presShell) {
if (XRE_IsContentProcess() &&
ActionIdComparableAndLower(
aActionId, mActionIdForFocusedBrowsingContextInContent)) {
// Unclear if this ever happens.
LOGFOCUS(
("Ignored an attempt to null out focused BrowsingContext when "
"presShell is null due to a stale action id."));
return true;
}
mFocusedElement = nullptr;
mFocusedWindow = nullptr;
// Setting focused BrowsingContext to nullptr to avoid leaking in print
// preview.
SetFocusedBrowsingContext(nullptr, aActionId);
SetFocusedBrowsingContext(nullptr);
return true;
}
@ -2368,7 +2343,7 @@ bool nsFocusManager::BlurImpl(BrowsingContext* aBrowsingContextToClear,
}
}
SetFocusedWindowInternal(nullptr, aActionId);
SetFocusedWindowInternal(nullptr);
mFocusedElement = nullptr;
// pass 1 for the focus method when calling SendFocusOrBlurEvent just so
@ -2452,14 +2427,6 @@ void nsFocusManager::Focus(
focusInOtherContentProcess = !bc->IsInProcess();
}
}
if (ActionIdComparableAndLower(
aActionId, mActionIdForFocusedBrowsingContextInContent)) {
// Unclear if this ever happens.
LOGFOCUS(
("Ignored an attempt to focus an element due to stale action id."));
return;
}
}
// If the focus actually changed, set the focus method (mouse, keyboard, etc).
@ -2513,7 +2480,7 @@ void nsFocusManager::Focus(
aIsNewDocument = true;
}
SetFocusedWindowInternal(aWindow, aActionId);
SetFocusedWindowInternal(aWindow);
if (aAdjustWidget && !sTestMode) {
if (nsViewManager* vm = presShell->GetViewManager()) {
@ -4774,39 +4741,21 @@ class PointerUnlocker : public Runnable {
PointerUnlocker* PointerUnlocker::sActiveUnlocker = nullptr;
void nsFocusManager::SetFocusedBrowsingContext(BrowsingContext* aContext,
uint64_t aActionId) {
if (XRE_IsParentProcess()) {
return;
}
MOZ_ASSERT(!ActionIdComparableAndLower(
aActionId, mActionIdForFocusedBrowsingContextInContent));
void nsFocusManager::SetFocusedBrowsingContext(BrowsingContext* aContext) {
mFocusedBrowsingContextInContent = aContext;
mActionIdForFocusedBrowsingContextInContent = aActionId;
if (aContext) {
// We don't send the unset but instead expect the set from
// elsewhere to take care of it. XXX Is that bad?
if (aContext && !XRE_IsParentProcess()) {
MOZ_ASSERT(aContext->IsInProcess());
mozilla::dom::ContentChild* contentChild =
mozilla::dom::ContentChild::GetSingleton();
MOZ_ASSERT(contentChild);
contentChild->SendSetFocusedBrowsingContext(aContext, aActionId);
contentChild->SendSetFocusedBrowsingContext(aContext);
}
}
void nsFocusManager::SetFocusedBrowsingContextFromOtherProcess(
BrowsingContext* aContext, uint64_t aActionId) {
BrowsingContext* aContext) {
MOZ_ASSERT(!XRE_IsParentProcess());
MOZ_ASSERT(aContext);
if (ActionIdComparableAndLower(aActionId,
mActionIdForFocusedBrowsingContextInContent)) {
// Unclear if this ever happens.
LOGFOCUS(
("Ignored an attempt to set an in-process BrowsingContext [%p] as "
"focused from another process due to stale action id.",
aContext));
return;
}
if (aContext->IsInProcess()) {
// This message has been in transit for long enough that
// the process association of aContext has changed since
@ -4821,21 +4770,12 @@ void nsFocusManager::SetFocusedBrowsingContextFromOtherProcess(
return;
}
mFocusedBrowsingContextInContent = aContext;
mActionIdForFocusedBrowsingContextInContent = aActionId;
mFocusedElement = nullptr;
}
bool nsFocusManager::SetFocusedBrowsingContextInChrome(
mozilla::dom::BrowsingContext* aContext, uint64_t aActionId) {
MOZ_ASSERT(aActionId);
if (ProcessPendingFocusedBrowsingContextActionId(aActionId)) {
MOZ_DIAGNOSTIC_ASSERT(!ActionIdComparableAndLower(
aActionId, mActionIdForFocusedBrowsingContextInChrome));
mFocusedBrowsingContextInChrome = aContext;
mActionIdForFocusedBrowsingContextInChrome = aActionId;
return true;
}
return false;
void nsFocusManager::SetFocusedBrowsingContextInChrome(
mozilla::dom::BrowsingContext* aContext) {
mFocusedBrowsingContextInChrome = aContext;
}
BrowsingContext* nsFocusManager::GetFocusedBrowsingContextInChrome() {
@ -4845,8 +4785,6 @@ BrowsingContext* nsFocusManager::GetFocusedBrowsingContextInChrome() {
void nsFocusManager::BrowsingContextDetached(BrowsingContext* aContext) {
if (mFocusedBrowsingContextInChrome == aContext) {
mFocusedBrowsingContextInChrome = nullptr;
// Deliberately not adjusting the corresponding action id, because
// we don't want changes from the past to take effect.
}
if (mActiveBrowsingContextInChrome == aContext) {
mActiveBrowsingContextInChrome = nullptr;
@ -4972,21 +4910,6 @@ void nsFocusManager::ReviseActiveBrowsingContext(
}
}
void nsFocusManager::ReviseFocusedBrowsingContext(
uint64_t aOldActionId, mozilla::dom::BrowsingContext* aContext,
uint64_t aNewActionId) {
MOZ_ASSERT(XRE_IsContentProcess());
if (mActionIdForFocusedBrowsingContextInContent == aOldActionId) {
mFocusedBrowsingContextInContent = aContext;
mActionIdForFocusedBrowsingContextInContent = aNewActionId;
mFocusedElement = nullptr;
} else {
LOGFOCUS(
("Ignored a stale attempt to revise the focused BrowsingContext [%p].",
aContext));
}
}
bool nsFocusManager::SetActiveBrowsingContextInChrome(
mozilla::dom::BrowsingContext* aContext, uint64_t aActionId) {
MOZ_ASSERT(aActionId);
@ -5004,10 +4927,6 @@ uint64_t nsFocusManager::GetActionIdForActiveBrowsingContextInChrome() const {
return mActionIdForActiveBrowsingContextInChrome;
}
uint64_t nsFocusManager::GetActionIdForFocusedBrowsingContextInChrome() const {
return mActionIdForFocusedBrowsingContextInChrome;
}
BrowsingContext* nsFocusManager::GetActiveBrowsingContextInChrome() {
return mActiveBrowsingContextInChrome;
}
@ -5016,24 +4935,6 @@ void nsFocusManager::InsertNewFocusActionId(uint64_t aActionId) {
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(!mPendingActiveBrowsingContextActions.Contains(aActionId));
mPendingActiveBrowsingContextActions.AppendElement(aActionId);
MOZ_ASSERT(!mPendingFocusedBrowsingContextActions.Contains(aActionId));
mPendingFocusedBrowsingContextActions.AppendElement(aActionId);
}
static void RemoveContentInitiatedActionsUntil(
nsTArray<uint64_t>& aPendingActions,
nsTArray<uint64_t>::index_type aUntil) {
nsTArray<uint64_t>::index_type i = 0;
while (i < aUntil) {
auto [actionProc, actionId] =
nsContentUtils::SplitProcessSpecificId(aPendingActions[i]);
if (actionProc) {
aPendingActions.RemoveElementAt(i);
--aUntil;
continue;
}
++i;
}
}
bool nsFocusManager::ProcessPendingActiveBrowsingContextActionId(
@ -5049,41 +4950,7 @@ bool nsFocusManager::ProcessPendingActiveBrowsingContextActionId(
if (aSettingToNonNull) {
index++;
}
auto [actionProc, actionId] =
nsContentUtils::SplitProcessSpecificId(aActionId);
if (actionProc) {
// Action from content: We allow parent-initiated actions
// to take precedence over content-initiated ones, so we
// remove only prior content-initiated actions.
RemoveContentInitiatedActionsUntil(mPendingActiveBrowsingContextActions,
index);
} else {
// Action from chrome
mPendingActiveBrowsingContextActions.RemoveElementsAt(0, index);
}
return true;
}
bool nsFocusManager::ProcessPendingFocusedBrowsingContextActionId(
uint64_t aActionId) {
MOZ_ASSERT(XRE_IsParentProcess());
auto index = mPendingFocusedBrowsingContextActions.IndexOf(aActionId);
if (index == nsTArray<uint64_t>::NoIndex) {
return false;
}
auto [actionProc, actionId] =
nsContentUtils::SplitProcessSpecificId(aActionId);
if (actionProc) {
// Action from content: We allow parent-initiated actions
// to take precedence over content-initiated ones, so we
// remove only prior content-initiated actions.
RemoveContentInitiatedActionsUntil(mPendingFocusedBrowsingContextActions,
index);
} else {
// Action from chrome
mPendingFocusedBrowsingContextActions.RemoveElementsAt(0, index);
}
mPendingActiveBrowsingContextActions.RemoveElementsAt(0, index);
return true;
}
@ -5111,7 +4978,6 @@ static bool IsInPointerLockContext(nsPIDOMWindowOuter* aWin) {
}
void nsFocusManager::SetFocusedWindowInternal(nsPIDOMWindowOuter* aWindow,
uint64_t aActionId,
bool aSyncBrowsingContext) {
if (XRE_IsParentProcess() && !PointerUnlocker::sActiveUnlocker &&
IsInPointerLockContext(mFocusedWindow) &&
@ -5129,24 +4995,10 @@ void nsFocusManager::SetFocusedWindowInternal(nsPIDOMWindowOuter* aWindow,
}
}
// This function may be called with zero action id to indicate that the
// action id should be ignored.
if (XRE_IsContentProcess() && aActionId &&
ActionIdComparableAndLower(aActionId,
mActionIdForFocusedBrowsingContextInContent)) {
// Unclear if this ever happens.
LOGFOCUS(
("Ignored an attempt to set an in-process BrowsingContext as "
"focused due to stale action id."));
return;
}
mFocusedWindow = aWindow;
BrowsingContext* bc = aWindow ? aWindow->GetBrowsingContext() : nullptr;
if (aSyncBrowsingContext) {
MOZ_ASSERT(aActionId,
"aActionId must not be zero if aSyncBrowsingContext is true");
SetFocusedBrowsingContext(bc, aActionId);
SetFocusedBrowsingContext(bc);
} else if (XRE_IsContentProcess()) {
MOZ_ASSERT(mFocusedBrowsingContextInContent == bc,
"Not syncing BrowsingContext even when different.");

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

@ -755,7 +755,7 @@ class nsFocusManager final : public nsIFocusManager,
int32_t aFlags, bool aGettingFocus,
bool aShouldShowFocusRing);
void SetFocusedWindowInternal(nsPIDOMWindowOuter* aWindow, uint64_t aActionId,
void SetFocusedWindowInternal(nsPIDOMWindowOuter* aWindow,
bool aSyncBrowsingContext = true);
bool TryDocumentNavigation(nsIContent* aCurrentContent,
@ -770,29 +770,25 @@ class nsFocusManager final : public nsIFocusManager,
// Sets the focused BrowsingContext and, if appropriate, syncs it to
// other processes.
void SetFocusedBrowsingContext(mozilla::dom::BrowsingContext* aContext,
uint64_t aActionId);
void SetFocusedBrowsingContext(mozilla::dom::BrowsingContext* aContext);
// Content-only
// Called when receiving an IPC message about another process setting
// the focused BrowsingContext.
void SetFocusedBrowsingContextFromOtherProcess(
mozilla::dom::BrowsingContext* aContext, uint64_t aActionId);
mozilla::dom::BrowsingContext* aContext);
// Chrome-only
// When returning true, sets the chrome process notion of what
// BrowsingContext is focused in content. When returning false,
// ignores the attempt to set as out-of-sequence.
bool SetFocusedBrowsingContextInChrome(
mozilla::dom::BrowsingContext* aContext, uint64_t aActionId);
// Sets the chrome process notion of what BrowsingContext is focused
// in content.
void SetFocusedBrowsingContextInChrome(
mozilla::dom::BrowsingContext* aContext);
void InsertNewFocusActionId(uint64_t aActionId);
bool ProcessPendingActiveBrowsingContextActionId(uint64_t aActionId,
bool aSettingToNonNull);
bool ProcessPendingFocusedBrowsingContextActionId(uint64_t aActionId);
public:
// Chrome-only
// Gets the chrome process notion of what BrowsingContext is focused
@ -836,17 +832,6 @@ class nsFocusManager final : public nsIFocusManager,
mozilla::dom::BrowsingContext* aContext,
uint64_t aNewActionId);
// Receives a notification from parent that this content process's
// attempt to set the focused browsing context was late and the
// prevailing browsing context is instead the second argument of
// this method call. This should be ignored if the first argument
// doesn't match the latest action id associated with setting the
// active browsing context in this process, because in that case,
// this revision is late.
void ReviseFocusedBrowsingContext(uint64_t aOldActionId,
mozilla::dom::BrowsingContext* aContext,
uint64_t aNewActionId);
// Chrome-only
// Sets the chrome process notion of what content believes to be
// the top-level BrowsingContext in the frontmost tab when focus
@ -864,8 +849,6 @@ class nsFocusManager final : public nsIFocusManager,
uint64_t GetActionIdForActiveBrowsingContextInChrome() const;
uint64_t GetActionIdForFocusedBrowsingContextInChrome() const;
static uint64_t GenerateFocusActionId();
private:
@ -899,16 +882,6 @@ class nsFocusManager final : public nsIFocusManager,
uint64_t mActionIdForActiveBrowsingContextInChrome;
// If this content process set mFocusedBrowsingContextInContent, this
// field holds the corresponding actionId so that
// mFocusedBrowsingContextInContent can be revised of the parent rejects
// the update. This field is used for accepting revisions only if nothing
// else has updated mFocusedBrowsingContextInContent before the revision
// arrives.
uint64_t mActionIdForFocusedBrowsingContextInContent;
uint64_t mActionIdForFocusedBrowsingContextInChrome;
// Whether or not mActiveBrowsingContextInContent was set from another process
// or from this process.
bool mActiveBrowsingContextInContentSetFromOtherProcess;
@ -1007,12 +980,14 @@ class nsFocusManager final : public nsIFocusManager,
// the act of using an actionId to set the active browsing context
// is used to delete stale items from the array to avoid excessive
// growth of the array.
//
// This arrangement raises the obvious question: Shouldn't
// out-of-order attempts to set the focused browsing context
// also have an array of actionIds ensuring a coherent global
// ordering? Probably yes, but a concrete need has not been
// demonstrated, yet.
nsTArray<uint64_t> mPendingActiveBrowsingContextActions;
// Like mPendingActiveBrowsingContextActions but for the focused
// browsing context.
nsTArray<uint64_t> mPendingFocusedBrowsingContextActions;
// If set to true, layout of the document of the event target should be
// flushed before handling focus depending events.
bool mEventHandlingNeedsFlush;

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

@ -3776,7 +3776,7 @@ mozilla::ipc::IPCResult ContentChild::RecvClearFocus(
}
mozilla::ipc::IPCResult ContentChild::RecvSetFocusedBrowsingContext(
const MaybeDiscarded<BrowsingContext>& aContext, uint64_t aActionId) {
const MaybeDiscarded<BrowsingContext>& aContext) {
if (aContext.IsNullOrDiscarded()) {
MOZ_LOG(BrowsingContext::GetLog(), LogLevel::Debug,
("ChildIPC: Trying to send a message to dead or detached context"));
@ -3785,7 +3785,7 @@ mozilla::ipc::IPCResult ContentChild::RecvSetFocusedBrowsingContext(
nsFocusManager* fm = nsFocusManager::GetFocusManager();
if (fm) {
fm->SetFocusedBrowsingContextFromOtherProcess(aContext.get(), aActionId);
fm->SetFocusedBrowsingContextFromOtherProcess(aContext.get());
}
return IPC_OK();
}
@ -3896,18 +3896,17 @@ mozilla::ipc::IPCResult ContentChild::RecvBlurToChild(
mozilla::ipc::IPCResult ContentChild::RecvSetupFocusedAndActive(
const MaybeDiscarded<BrowsingContext>& aFocusedBrowsingContext,
uint64_t aActionIdForFocused,
const MaybeDiscarded<BrowsingContext>& aActiveBrowsingContext,
uint64_t aActionIdForActive) {
uint64_t aActionId) {
nsFocusManager* fm = nsFocusManager::GetFocusManager();
if (fm) {
if (!aActiveBrowsingContext.IsNullOrDiscarded()) {
fm->SetActiveBrowsingContextFromOtherProcess(aActiveBrowsingContext.get(),
aActionIdForActive);
aActionId);
}
if (!aFocusedBrowsingContext.IsNullOrDiscarded()) {
fm->SetFocusedBrowsingContextFromOtherProcess(
aFocusedBrowsingContext.get(), aActionIdForFocused);
aFocusedBrowsingContext.get());
}
}
return IPC_OK();
@ -3925,18 +3924,6 @@ mozilla::ipc::IPCResult ContentChild::RecvReviseActiveBrowsingContext(
return IPC_OK();
}
mozilla::ipc::IPCResult ContentChild::RecvReviseFocusedBrowsingContext(
uint64_t aOldActionId,
const MaybeDiscarded<BrowsingContext>& aFocusedBrowsingContext,
uint64_t aNewActionId) {
nsFocusManager* fm = nsFocusManager::GetFocusManager();
if (fm && !aFocusedBrowsingContext.IsNullOrDiscarded()) {
fm->ReviseFocusedBrowsingContext(
aOldActionId, aFocusedBrowsingContext.get(), aNewActionId);
}
return IPC_OK();
}
mozilla::ipc::IPCResult ContentChild::RecvMaybeExitFullscreen(
const MaybeDiscarded<BrowsingContext>& aContext) {
if (aContext.IsNullOrDiscarded()) {

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

@ -710,7 +710,7 @@ class ContentChild final : public PContentChild,
mozilla::ipc::IPCResult RecvClearFocus(
const MaybeDiscarded<BrowsingContext>& aContext);
mozilla::ipc::IPCResult RecvSetFocusedBrowsingContext(
const MaybeDiscarded<BrowsingContext>& aContext, uint64_t aActionId);
const MaybeDiscarded<BrowsingContext>& aContext);
mozilla::ipc::IPCResult RecvSetActiveBrowsingContext(
const MaybeDiscarded<BrowsingContext>& aContext, uint64_t aActionId);
mozilla::ipc::IPCResult RecvAbortOrientationPendingPromises(
@ -729,17 +729,12 @@ class ContentChild final : public PContentChild,
bool aIsLeavingDocument, bool aAdjustWidget, uint64_t aActionId);
mozilla::ipc::IPCResult RecvSetupFocusedAndActive(
const MaybeDiscarded<BrowsingContext>& aFocusedBrowsingContext,
uint64_t aActionIdForFocused,
const MaybeDiscarded<BrowsingContext>& aActiveBrowsingContext,
uint64_t aActionIdForActive);
uint64_t aActionId);
mozilla::ipc::IPCResult RecvReviseActiveBrowsingContext(
uint64_t aOldActionId,
const MaybeDiscarded<BrowsingContext>& aActiveBrowsingContext,
uint64_t aNewActionId);
mozilla::ipc::IPCResult RecvReviseFocusedBrowsingContext(
uint64_t aOldActionId,
const MaybeDiscarded<BrowsingContext>& aFocusedBrowsingContext,
uint64_t aNewActionId);
mozilla::ipc::IPCResult RecvMaybeExitFullscreen(
const MaybeDiscarded<BrowsingContext>& aContext);

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

@ -6870,7 +6870,7 @@ mozilla::ipc::IPCResult ContentParent::RecvClearFocus(
}
mozilla::ipc::IPCResult ContentParent::RecvSetFocusedBrowsingContext(
const MaybeDiscarded<BrowsingContext>& aContext, uint64_t aActionId) {
const MaybeDiscarded<BrowsingContext>& aContext) {
if (aContext.IsNullOrDiscarded()) {
MOZ_LOG(
BrowsingContext::GetLog(), LogLevel::Debug,
@ -6880,25 +6880,13 @@ mozilla::ipc::IPCResult ContentParent::RecvSetFocusedBrowsingContext(
CanonicalBrowsingContext* context = aContext.get_canonical();
nsFocusManager* fm = nsFocusManager::GetFocusManager();
if (!fm) {
return IPC_OK();
if (fm) {
fm->SetFocusedBrowsingContextInChrome(context);
BrowserParent::UpdateFocusFromBrowsingContext();
}
if (!fm->SetFocusedBrowsingContextInChrome(context, aActionId)) {
LOGFOCUS((
"Ignoring out-of-sequence attempt [%p] to set focused browsing context "
"in parent.",
context));
Unused << SendReviseFocusedBrowsingContext(
aActionId, fm->GetFocusedBrowsingContextInChrome(),
fm->GetActionIdForFocusedBrowsingContextInChrome());
return IPC_OK();
}
BrowserParent::UpdateFocusFromBrowsingContext();
context->Group()->EachOtherParent(this, [&](ContentParent* aParent) {
Unused << aParent->SendSetFocusedBrowsingContext(context, aActionId);
Unused << aParent->SendSetFocusedBrowsingContext(context);
});
return IPC_OK();

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

@ -690,7 +690,7 @@ class ContentParent final
mozilla::ipc::IPCResult RecvClearFocus(
const MaybeDiscarded<BrowsingContext>& aContext);
mozilla::ipc::IPCResult RecvSetFocusedBrowsingContext(
const MaybeDiscarded<BrowsingContext>& aContext, uint64_t aActionId);
const MaybeDiscarded<BrowsingContext>& aContext);
mozilla::ipc::IPCResult RecvSetActiveBrowsingContext(
const MaybeDiscarded<BrowsingContext>& aContext, uint64_t aActionId);
mozilla::ipc::IPCResult RecvUnsetActiveBrowsingContext(

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

@ -1800,7 +1800,7 @@ both:
CallerType aCallerType);
async RaiseWindow(MaybeDiscardedBrowsingContext aContext, CallerType aCallerType, uint64_t aActionId);
async ClearFocus(MaybeDiscardedBrowsingContext aContext);
async SetFocusedBrowsingContext(MaybeDiscardedBrowsingContext aContext, uint64_t aActionId);
async SetFocusedBrowsingContext(MaybeDiscardedBrowsingContext aContext);
async SetActiveBrowsingContext(MaybeDiscardedBrowsingContext aContext, uint64_t aActionId);
async UnsetActiveBrowsingContext(MaybeDiscardedBrowsingContext aContext, uint64_t aActionId);
async SetFocusedElement(MaybeDiscardedBrowsingContext aContext, bool aNeedsFocus);
@ -1820,15 +1820,10 @@ child:
MaybeDiscardedBrowsingContext aAncestorBrowsingContextToFocus,
bool aIsLeavingDocument, bool aAdjustWidget, uint64_t aActionId);
async SetupFocusedAndActive(MaybeDiscardedBrowsingContext aFocusedBrowsingContext,
uint64_t aActionIdForFocused,
MaybeDiscardedBrowsingContext aActiveBrowsingContext,
uint64_t aActionId);
async ReviseActiveBrowsingContext(uint64_t aOldActionId,
MaybeDiscardedBrowsingContext aActiveBrowsingContext,
async ReviseActiveBrowsingContext(uint64_t aOldActionId, MaybeDiscardedBrowsingContext aActiveBrowsingContext,
uint64_t aNewActionId);
async ReviseFocusedBrowsingContext(uint64_t aOldActionId,
MaybeDiscardedBrowsingContext aFocusedBrowsingContext,
uint64_t aNewActionId);
both:
async MaybeExitFullscreen(MaybeDiscardedBrowsingContext aContext);
async WindowPostMessage(MaybeDiscardedBrowsingContext aContext,