mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-26 04:09:50 +00:00
Bug 1912815: Remove some console warnings associated with drag and drop r=mccr8
Gecko was spamming the logs with useless warnings about missing widgets during shutdown. The warning is otherwise helpful, so this blocks out the cases that lead to useless warnings but leaves the warning in the code. One place it was helpful is in EventStateManager::StopTrackingDragGesture. It exposed that the function was clearing tracked browsers in content, and tracking is only done in the parent process. This was harmless (since there could never be any tracked browsers) but surprising. The code is changed to only run in the parent. Differential Revision: https://phabricator.services.mozilla.com/D219584
This commit is contained in:
parent
16abcf7b4a
commit
d46e0bd0cc
@ -6376,7 +6376,12 @@ already_AddRefed<nsIDragSession> nsContentUtils::GetDragSession(
|
||||
/* static */
|
||||
already_AddRefed<nsIDragSession> nsContentUtils::GetDragSession(
|
||||
nsPresContext* aPC) {
|
||||
return GetDragSession(aPC->GetRootWidget());
|
||||
NS_ENSURE_TRUE(aPC, nullptr);
|
||||
auto* widget = aPC->GetRootWidget();
|
||||
if (!widget) {
|
||||
return nullptr;
|
||||
}
|
||||
return GetDragSession(widget);
|
||||
}
|
||||
|
||||
/* static */
|
||||
|
@ -2426,18 +2426,22 @@ void EventStateManager::StopTrackingDragGesture(bool aClearInChildProcesses) {
|
||||
// parent starts the actual drag, the content process will think a drag is
|
||||
// still happening. Inform any child processes with active drags that the drag
|
||||
// should be stopped.
|
||||
if (aClearInChildProcesses) {
|
||||
nsCOMPtr<nsIDragService> dragService =
|
||||
do_GetService("@mozilla.org/widget/dragservice;1");
|
||||
if (dragService) {
|
||||
RefPtr<nsIDragSession> dragSession =
|
||||
dragService->GetCurrentSession(mPresContext->GetRootWidget());
|
||||
if (!dragSession) {
|
||||
// Only notify if there isn't a drag session active.
|
||||
dragService->RemoveAllBrowsers();
|
||||
}
|
||||
}
|
||||
if (!aClearInChildProcesses || !XRE_IsParentProcess()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Only notify if there is NOT a drag session active in the parent.
|
||||
RefPtr<nsIDragSession> dragSession =
|
||||
nsContentUtils::GetDragSession(mPresContext);
|
||||
if (dragSession) {
|
||||
return;
|
||||
}
|
||||
nsCOMPtr<nsIDragService> dragService =
|
||||
do_GetService("@mozilla.org/widget/dragservice;1");
|
||||
if (!dragService) {
|
||||
return;
|
||||
}
|
||||
dragService->RemoveAllBrowsers();
|
||||
}
|
||||
|
||||
void EventStateManager::FillInEventFromGestureDown(WidgetMouseEvent* aEvent) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user