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
This commit is contained in:
Ray Kraesig 2023-02-16 00:48:08 +00:00
parent 5878f95ed4
commit ed6362abd2
3 changed files with 12 additions and 10 deletions

View File

@ -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;
}

View File

@ -54,13 +54,11 @@ std::unordered_set<UINT> 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()) {

View File

@ -43,21 +43,25 @@ extern std::unordered_map<UINT, EventMsgInfo> 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<long> 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<bool> mResult;
LRESULT mRetValue = 0;
bool mShouldLogPostCall;
};