From ed6362abd2ceac83a2f15319ae381f2ab4fdaebd Mon Sep 17 00:00:00 2001 From: Ray Kraesig Date: Thu, 16 Feb 2023 00:48:08 +0000 Subject: [PATCH] Bug 1814532 [1/4] - actually record WindowProc return values r=gstoll The value currently being logged as the WndProc LRESULT is actually garbage. Log the actual LRESULT after calling ProcessMessageInternal(), instead. Differential Revision: https://phabricator.services.mozilla.com/D168874 --- widget/windows/nsWindow.cpp | 4 ++-- widget/windows/nsWindowDbg.cpp | 4 +--- widget/windows/nsWindowDbg.h | 14 +++++++++----- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/widget/windows/nsWindow.cpp b/widget/windows/nsWindow.cpp index 32244d654969..0abe408f888a 100644 --- a/widget/windows/nsWindow.cpp +++ b/widget/windows/nsWindow.cpp @@ -5100,9 +5100,9 @@ bool nsWindow::ProcessMessage(UINT msg, WPARAM& wParam, LPARAM& lParam, LRESULT* aRetValue) { // For some events we might change the parameter values, so log // before and after we process them. - PrintEvent printEvent(mWnd, msg, wParam, lParam, *aRetValue); + PrintEvent printEvent(mWnd, msg, wParam, lParam); bool result = ProcessMessageInternal(msg, wParam, lParam, aRetValue); - printEvent.SetResult(result); + printEvent.SetResult(*aRetValue, result); return result; } diff --git a/widget/windows/nsWindowDbg.cpp b/widget/windows/nsWindowDbg.cpp index a6d63f3aefa6..7b27f56820f4 100644 --- a/widget/windows/nsWindowDbg.cpp +++ b/widget/windows/nsWindowDbg.cpp @@ -54,13 +54,11 @@ std::unordered_set gEventsToRecordInAboutPage = {WM_WINDOWPOSCHANGING, WM_MOVING, WM_GETMINMAXINFO}; -PrintEvent::PrintEvent(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, - LRESULT retValue) +PrintEvent::PrintEvent(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) : mHwnd(hwnd), mMsg(msg), mWParam(wParam), mLParam(lParam), - mRetValue(retValue), mResult(mozilla::Nothing()), mShouldLogPostCall(false) { if (PrintEventInternal()) { diff --git a/widget/windows/nsWindowDbg.h b/widget/windows/nsWindowDbg.h index 672ec9756b60..9e2ed15384fd 100644 --- a/widget/windows/nsWindowDbg.h +++ b/widget/windows/nsWindowDbg.h @@ -43,21 +43,25 @@ extern std::unordered_map gAllEvents; // RAII-style class to log before and after an event is handled. class PrintEvent final { public: - PrintEvent(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, - LRESULT retValue); - void SetResult(bool result) { mResult = mozilla::Some(result); } + PrintEvent(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); + void SetResult(LRESULT lresult, bool result) { + mRetValue = lresult; + mResult = mozilla::Some(result); + } ~PrintEvent(); private: bool PrintEventInternal(); + const HWND mHwnd; const UINT mMsg; const WPARAM mWParam; const LPARAM mLParam; - const LRESULT mRetValue; mozilla::Maybe mEventCounter; - // not const because it will be set after the event is handled + // not const because these will be set after the event is handled mozilla::Maybe mResult; + LRESULT mRetValue = 0; + bool mShouldLogPostCall; };