mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:18:48 +00:00
import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1224810 - "TraceLogger: Add the script information for the event created by BytecodeCompiler". r=hv1989 (12b6891fa7)
- Bug 1227677 - Simplify emitting of comprehension variables. r=shu (4e9ea2fee7)
- bug 1223529 - remove ipc/chromium/Makefile.in. r=gps (8d71334ca0)
- Bug 1225682 - Don't use nsAuto{,C}String as class member variables in widget/. r=roc (4355625107)
- Bug 1225188. Implement window.onstorage. r=smaug (50168cdffb)
- Bug 1286158 - Add Android 64bit support for libevent. r=billm (b33cb1fccf)
- Bug 1162524: Fix error handling |UnixSocketWatcher::Connect|, r=kmachulis (04e67535b4)
- Bug 1178514 - Mark one-argument constructors in IPDL tests as 'explicit'. r=bent (cc6fde1e1c)
- some warnings stuff (68ecef6622)
- Bug 1170231: Part 1 - Remove condition that may cause deadlock in IPC when mediating interrupt races; r=dvander (79dd6902a2)
- Bug 1170231: Part 2 - Regression test for IPC race mediation deadlock; r=dvander (eabe33218f)
- Bug 1167396 - Make ProtocolCloneContext::mContentParent a smart pointer. r=bent (519ad9f47e)
- Bug 1213567: Prevent neutering from occurring during CreateWindow(Ex) calls; r=jimm (6550685051)
- Bug 1177013 - Bug fixes for CPOW cancelation (r=dvander) (b50da43c07)
- Bug 1217640 - MessageChannel::Call() should delete aMsg when the channel is not connected. r=jld (899b0e6349)
- Bug 1159037: Ensure correct parent and child message are passed to MessageListener::MediateInterruptRace; r=dvander (96c1f42029)
- Bug 1177013 - Telemetry for CPOW cancelation (r=dvander) (ec704af72c)
- Bug 1050122 - Part 2: Disable preallocate when proc loader is not initialized. r=khuey (2d35b8e25e)
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIXULAppInfo.h"
|
||||
#include "nsWindowsDllInterceptor.h"
|
||||
#include "WinUtils.h"
|
||||
|
||||
#include "mozilla/ArrayUtils.h"
|
||||
@@ -436,6 +437,93 @@ ProcessOrDeferMessage(HWND hwnd,
|
||||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
* It is bad to subclass a window when neutering is active because you'll end
|
||||
* up subclassing the *neutered* window procedure instead of the real window
|
||||
* procedure. Since CreateWindow* fires WM_CREATE (and could thus trigger
|
||||
* neutering), we intercept these calls and suppress neutering for the duration
|
||||
* of the call. This ensures that any subsequent subclassing replaces the
|
||||
* correct window procedure.
|
||||
*/
|
||||
WindowsDllInterceptor sUser32Interceptor;
|
||||
typedef HWND (WINAPI *CreateWindowExWPtr)(DWORD,LPCWSTR,LPCWSTR,DWORD,int,int,int,int,HWND,HMENU,HINSTANCE,LPVOID);
|
||||
typedef HWND (WINAPI *CreateWindowExAPtr)(DWORD,LPCSTR,LPCSTR,DWORD,int,int,int,int,HWND,HMENU,HINSTANCE,LPVOID);
|
||||
typedef HWND (WINAPI *CreateWindowWPtr)(LPCWSTR,LPCWSTR,DWORD,int,int,int,int,HWND,HMENU,HINSTANCE,LPVOID);
|
||||
typedef HWND (WINAPI *CreateWindowAPtr)(LPCSTR,LPCSTR,DWORD,int,int,int,int,HWND,HMENU,HINSTANCE,LPVOID);
|
||||
|
||||
CreateWindowExWPtr sCreateWindowExWStub = nullptr;
|
||||
CreateWindowExAPtr sCreateWindowExAStub = nullptr;
|
||||
CreateWindowWPtr sCreateWindowWStub = nullptr;
|
||||
CreateWindowAPtr sCreateWindowAStub = nullptr;
|
||||
|
||||
HWND WINAPI
|
||||
CreateWindowExWHook(DWORD aExStyle, LPCWSTR aClassName, LPCWSTR aWindowName,
|
||||
DWORD aStyle, int aX, int aY, int aWidth, int aHeight,
|
||||
HWND aParent, HMENU aMenu, HINSTANCE aInstance,
|
||||
LPVOID aParam)
|
||||
{
|
||||
SuppressedNeuteringRegion doNotNeuterThisWindowYet;
|
||||
return sCreateWindowExWStub(aExStyle, aClassName, aWindowName, aStyle, aX, aY,
|
||||
aWidth, aHeight, aParent, aMenu, aInstance, aParam);
|
||||
}
|
||||
|
||||
HWND WINAPI
|
||||
CreateWindowExAHook(DWORD aExStyle, LPCSTR aClassName, LPCSTR aWindowName,
|
||||
DWORD aStyle, int aX, int aY, int aWidth, int aHeight,
|
||||
HWND aParent, HMENU aMenu, HINSTANCE aInstance,
|
||||
LPVOID aParam)
|
||||
{
|
||||
SuppressedNeuteringRegion doNotNeuterThisWindowYet;
|
||||
return sCreateWindowExAStub(aExStyle, aClassName, aWindowName, aStyle, aX, aY,
|
||||
aWidth, aHeight, aParent, aMenu, aInstance, aParam);
|
||||
}
|
||||
|
||||
HWND WINAPI
|
||||
CreateWindowWHook(LPCWSTR aClassName, LPCWSTR aWindowName, DWORD aStyle, int aX,
|
||||
int aY, int aWidth, int aHeight, HWND aParent, HMENU aMenu,
|
||||
HINSTANCE aInstance, LPVOID aParam)
|
||||
{
|
||||
SuppressedNeuteringRegion doNotNeuterThisWindowYet;
|
||||
return sCreateWindowWStub(aClassName, aWindowName, aStyle, aX, aY, aWidth,
|
||||
aHeight, aParent, aMenu, aInstance, aParam);
|
||||
}
|
||||
|
||||
HWND WINAPI
|
||||
CreateWindowAHook(LPCSTR aClassName, LPCSTR aWindowName, DWORD aStyle, int aX,
|
||||
int aY, int aWidth, int aHeight, HWND aParent, HMENU aMenu,
|
||||
HINSTANCE aInstance, LPVOID aParam)
|
||||
{
|
||||
SuppressedNeuteringRegion doNotNeuterThisWindowYet;
|
||||
return sCreateWindowAStub(aClassName, aWindowName, aStyle, aX, aY, aWidth,
|
||||
aHeight, aParent, aMenu, aInstance, aParam);
|
||||
}
|
||||
|
||||
void
|
||||
InitCreateWindowHook()
|
||||
{
|
||||
sUser32Interceptor.Init("user32.dll");
|
||||
if (!sCreateWindowExWStub) {
|
||||
sUser32Interceptor.AddHook("CreateWindowExW",
|
||||
reinterpret_cast<intptr_t>(CreateWindowExWHook),
|
||||
(void**) &sCreateWindowExWStub);
|
||||
}
|
||||
if (!sCreateWindowExAStub) {
|
||||
sUser32Interceptor.AddHook("CreateWindowExA",
|
||||
reinterpret_cast<intptr_t>(CreateWindowExAHook),
|
||||
(void**) &sCreateWindowExAStub);
|
||||
}
|
||||
if (!sCreateWindowWStub) {
|
||||
sUser32Interceptor.AddHook("CreateWindowW",
|
||||
reinterpret_cast<intptr_t>(CreateWindowWHook),
|
||||
(void**) &sCreateWindowWStub);
|
||||
}
|
||||
if (!sCreateWindowAStub) {
|
||||
sUser32Interceptor.AddHook("CreateWindowA",
|
||||
reinterpret_cast<intptr_t>(CreateWindowAHook),
|
||||
(void**) &sCreateWindowAStub);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
// We need the pointer value of this in PluginInstanceChild.
|
||||
@@ -610,7 +698,9 @@ CallWindowProcedureHook(int nCode,
|
||||
|
||||
HWND hWnd = reinterpret_cast<CWPSTRUCT*>(lParam)->hwnd;
|
||||
|
||||
if (!gNeuteredWindows->Contains(hWnd) && NeuterWindowProcedure(hWnd)) {
|
||||
if (!gNeuteredWindows->Contains(hWnd) &&
|
||||
!SuppressedNeuteringRegion::IsNeuteringSuppressed() &&
|
||||
NeuterWindowProcedure(hWnd)) {
|
||||
if (!gNeuteredWindows->AppendElement(hWnd)) {
|
||||
NS_ERROR("Out of memory!");
|
||||
RestoreWindowProcedure(hWnd);
|
||||
@@ -710,6 +800,8 @@ InitUIThread()
|
||||
gCOMWindow = FindCOMWindow();
|
||||
}
|
||||
MOZ_ASSERT(gWinEventHook);
|
||||
|
||||
InitCreateWindowHook();
|
||||
}
|
||||
|
||||
} // namespace windows
|
||||
@@ -943,6 +1035,26 @@ DeneuteredWindowRegion::~DeneuteredWindowRegion()
|
||||
}
|
||||
}
|
||||
|
||||
SuppressedNeuteringRegion::SuppressedNeuteringRegion(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_IN_IMPL)
|
||||
: mReenable(::gUIThreadId == ::GetCurrentThreadId() && ::gWindowHook)
|
||||
{
|
||||
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
|
||||
if (mReenable) {
|
||||
MOZ_ASSERT(!sSuppressNeutering);
|
||||
sSuppressNeutering = true;
|
||||
}
|
||||
}
|
||||
|
||||
SuppressedNeuteringRegion::~SuppressedNeuteringRegion()
|
||||
{
|
||||
if (mReenable) {
|
||||
MOZ_ASSERT(sSuppressNeutering);
|
||||
sSuppressNeutering = false;
|
||||
}
|
||||
}
|
||||
|
||||
bool SuppressedNeuteringRegion::sSuppressNeutering = false;
|
||||
|
||||
bool
|
||||
MessageChannel::WaitForSyncNotify(bool aHandleWindowsMessages)
|
||||
{
|
||||
@@ -997,6 +1109,8 @@ MessageChannel::WaitForSyncNotify(bool aHandleWindowsMessages)
|
||||
NS_ASSERTION(timerId, "SetTimer failed!");
|
||||
}
|
||||
|
||||
NeuteredWindowRegion neuteredRgn(true);
|
||||
|
||||
{
|
||||
while (1) {
|
||||
MSG msg = { 0 };
|
||||
|
||||
Reference in New Issue
Block a user