From 3a40fd71ea828839ba710a55f154b9d6d359aaf7 Mon Sep 17 00:00:00 2001 From: Jim Mathies Date: Mon, 1 Apr 2019 16:53:04 +0000 Subject: [PATCH] Bug 1539581 - Cleanup use of RegisterWindowMessgae in nsAppShell. r=bobowen Differential Revision: https://phabricator.services.mozilla.com/D25235 --HG-- extra : moz-landing-system : lando --- ipc/glue/WindowsMessageLoop.cpp | 8 ++------ widget/windows/nsAppShell.cpp | 19 +++++++++++-------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/ipc/glue/WindowsMessageLoop.cpp b/ipc/glue/WindowsMessageLoop.cpp index 5981a61dfe58..41d74c0a5cc5 100644 --- a/ipc/glue/WindowsMessageLoop.cpp +++ b/ipc/glue/WindowsMessageLoop.cpp @@ -76,12 +76,8 @@ using namespace mozilla::ipc::windows; extern const wchar_t* kPropNameTabContent; #endif -// widget related message id constants we need to defer -namespace mozilla { -namespace widget { +// widget related message id constants we need to defer, see nsAppShell. extern UINT sAppShellGeckoMsgId; -} -} // namespace mozilla namespace { @@ -390,7 +386,7 @@ ProcessOrDeferMessage(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { default: { // Unknown messages only are logged in debug builds and sent to // DefWindowProc. - if (uMsg && uMsg == mozilla::widget::sAppShellGeckoMsgId) { + if (uMsg && uMsg == sAppShellGeckoMsgId) { // Widget's registered native event callback deferred = new DeferredSendMessage(hwnd, uMsg, wParam, lParam); } diff --git a/widget/windows/nsAppShell.cpp b/widget/windows/nsAppShell.cpp index a06a3f1e95f2..4764142bacc0 100644 --- a/widget/windows/nsAppShell.cpp +++ b/widget/windows/nsAppShell.cpp @@ -157,13 +157,11 @@ SingleNativeEventPump::AfterProcessNextEvent(nsIThreadInternal* aThread, return NS_OK; } -namespace mozilla { -namespace widget { -// Native event callback message. -UINT sAppShellGeckoMsgId = RegisterWindowMessageW(L"nsAppShell:EventID"); -} // namespace widget -} // namespace mozilla - +// RegisterWindowMessage values +// Native event callback message +const wchar_t* kAppShellGeckoEventId = L"nsAppShell:EventID"; +UINT sAppShellGeckoMsgId; +// Taskbar button creation message const wchar_t* kTaskbarButtonEventId = L"TaskbarButtonCreated"; UINT sTaskbarButtonCreatedMsg; @@ -331,8 +329,13 @@ nsresult nsAppShell::Init() { // The hidden message window is used for interrupting the processing of native // events, so that we can process gecko events. Therefore, we only need it if - // we are processing native events. + // we are processing native events. Disabling this is required for win32k + // syscall lockdown. if (XRE_UseNativeEventProcessing()) { + sAppShellGeckoMsgId = ::RegisterWindowMessageW(kAppShellGeckoEventId); + NS_ASSERTION(sAppShellGeckoMsgId, + "Could not register hidden window event message!"); + mLastNativeEventScheduled = TimeStamp::NowLoRes(); WNDCLASSW wc;