diff --git a/mozglue/misc/PreXULSkeletonUI.cpp b/mozglue/misc/PreXULSkeletonUI.cpp index 447911183e33..e548212712f6 100644 --- a/mozglue/misc/PreXULSkeletonUI.cpp +++ b/mozglue/misc/PreXULSkeletonUI.cpp @@ -535,4 +535,11 @@ MFBT_API void SetPreXULSkeletonUIEnabled(bool value) { sPreXULSkeletonUIEnabled = true; } +MFBT_API void PollPreXULSkeletonUIEvents() { + if (sPreXULSkeletonUIEnabled && sPreXULSkeletonUIWindow) { + MSG outMsg = {}; + PeekMessageW(&outMsg, sPreXULSkeletonUIWindow, 0, 0, 0); + } +} + } // namespace mozilla diff --git a/mozglue/misc/PreXULSkeletonUI.h b/mozglue/misc/PreXULSkeletonUI.h index f8083d99acd8..0f6dc59c4fe1 100644 --- a/mozglue/misc/PreXULSkeletonUI.h +++ b/mozglue/misc/PreXULSkeletonUI.h @@ -19,6 +19,7 @@ MFBT_API void PersistPreXULSkeletonUIValues(int screenX, int screenY, int width, double cssToDevPixelScaling); MFBT_API bool GetPreXULSkeletonUIEnabled(); MFBT_API void SetPreXULSkeletonUIEnabled(bool value); +MFBT_API void PollPreXULSkeletonUIEvents(); } // namespace mozilla diff --git a/xpcom/glue/standalone/nsXPCOMGlue.cpp b/xpcom/glue/standalone/nsXPCOMGlue.cpp index cf8e2659215e..6b91507d4ca8 100644 --- a/xpcom/glue/standalone/nsXPCOMGlue.cpp +++ b/xpcom/glue/standalone/nsXPCOMGlue.cpp @@ -33,6 +33,7 @@ typedef void (*NSFuncPtr)(); # include # include # include "mozilla/WindowsVersion.h" +# include "mozilla/PreXULSkeletonUI.h" typedef HINSTANCE LibHandleType; @@ -310,6 +311,18 @@ static nsresult XPCOMGlueLoad(const char* aXPCOMFile, XPCOMGlueUnload(); return NS_ERROR_FAILURE; } + +# ifdef XP_WIN + // We call PollPreXULSkeletonUIEvents here in order to not get flagged by + // Windows as nonresponsive. In order to not be flagged as such, we seem to + // simply need to respond to *a* message every few seconds. The halfway + // point on slow systems between process start and nsWindow taking over the + // skeleton UI window seems to be XUL being loaded. Accordingly, placing + // this call here covers the most ground (as we will call this after + // prefetching and loading all of the dlls in dependentlibs.list, which + // includes xul.dll.) + PollPreXULSkeletonUIEvents(); +# endif } #endif return NS_OK;