mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 827976: Part 1 - Create hidden windows lazily on non-Mac platforms. r=bzbarsky
This commit is contained in:
parent
17dee1ecf0
commit
6aab2c174a
@ -359,12 +359,16 @@ nsCCUncollectableMarker::Observe(nsISupports* aSubject, const char* aTopic,
|
||||
do_GetService(NS_APPSHELLSERVICE_CONTRACTID);
|
||||
if (appShell) {
|
||||
nsCOMPtr<nsIXULWindow> hw;
|
||||
appShell->GetHiddenWindow(getter_AddRefs(hw));
|
||||
if (hw) {
|
||||
nsCOMPtr<nsIDocShell> shell;
|
||||
hw->GetDocShell(getter_AddRefs(shell));
|
||||
nsCOMPtr<nsIDocShellTreeNode> shellTreeNode = do_QueryInterface(shell);
|
||||
MarkDocShell(shellTreeNode, cleanupJS, prepareForCC);
|
||||
bool hasHiddenWindow = false;
|
||||
appShell->GetHasHiddenWindow(&hasHiddenWindow);
|
||||
if (hasHiddenWindow) {
|
||||
appShell->GetHiddenWindow(getter_AddRefs(hw));
|
||||
if (hw) {
|
||||
nsCOMPtr<nsIDocShell> shell;
|
||||
hw->GetDocShell(getter_AddRefs(shell));
|
||||
nsCOMPtr<nsIDocShellTreeNode> shellTreeNode = do_QueryInterface(shell);
|
||||
MarkDocShell(shellTreeNode, cleanupJS, prepareForCC);
|
||||
}
|
||||
}
|
||||
bool hasHiddenPrivateWindow = false;
|
||||
appShell->GetHasHiddenPrivateWindow(&hasHiddenPrivateWindow);
|
||||
|
@ -3803,8 +3803,12 @@ XREMain::XRE_mainRun()
|
||||
SaveToEnv("XRE_BINARY_PATH=");
|
||||
|
||||
if (!mShuttingDown) {
|
||||
#ifdef XP_MACOSX
|
||||
// The hidden window is always needed on Mac to provide the menu bar
|
||||
// when no other windows are open.
|
||||
rv = appStartup->CreateHiddenWindow();
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_DESKTOP_STARTUP_ID) && defined(MOZ_WIDGET_GTK)
|
||||
nsGTKToolkit* toolkit = nsGTKToolkit::GetToolkit();
|
||||
|
@ -16,7 +16,7 @@ interface nsIAppShell;
|
||||
struct JSContext;
|
||||
%}
|
||||
|
||||
[scriptable, uuid(5c19ab54-67bf-46d0-ac5b-21abd9050c3b)]
|
||||
[scriptable, uuid(1ae1e51a-cd69-4c18-805e-ad09b39b1f4c)]
|
||||
interface nsIAppShellService : nsISupports
|
||||
{
|
||||
/**
|
||||
@ -118,6 +118,12 @@ interface nsIAppShellService : nsISupports
|
||||
*/
|
||||
void unregisterTopLevelWindow(in nsIXULWindow aWindow);
|
||||
|
||||
/**
|
||||
* Whether the hidden non-private window has been lazily created.
|
||||
*/
|
||||
[noscript]
|
||||
readonly attribute boolean hasHiddenWindow;
|
||||
|
||||
/**
|
||||
* Whether the hidden private window has been lazily created.
|
||||
*/
|
||||
|
@ -86,6 +86,12 @@ nsAppShellService::CreateHiddenWindow()
|
||||
return CreateHiddenWindowHelper(false);
|
||||
}
|
||||
|
||||
void
|
||||
nsAppShellService::EnsureHiddenWindow()
|
||||
{
|
||||
CreateHiddenWindow();
|
||||
}
|
||||
|
||||
void
|
||||
nsAppShellService::EnsurePrivateHiddenWindow()
|
||||
{
|
||||
@ -437,6 +443,8 @@ nsAppShellService::GetHiddenWindow(nsIXULWindow **aWindow)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aWindow);
|
||||
|
||||
EnsureHiddenWindow();
|
||||
|
||||
*aWindow = mHiddenWindow;
|
||||
NS_IF_ADDREF(*aWindow);
|
||||
return *aWindow ? NS_OK : NS_ERROR_FAILURE;
|
||||
@ -445,6 +453,8 @@ nsAppShellService::GetHiddenWindow(nsIXULWindow **aWindow)
|
||||
NS_IMETHODIMP
|
||||
nsAppShellService::GetHiddenDOMWindow(nsIDOMWindow **aWindow)
|
||||
{
|
||||
EnsureHiddenWindow();
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIDocShell> docShell;
|
||||
NS_ENSURE_TRUE(mHiddenWindow, NS_ERROR_FAILURE);
|
||||
@ -472,6 +482,15 @@ nsAppShellService::GetHiddenPrivateWindow(nsIXULWindow **aWindow)
|
||||
return *aWindow ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAppShellService::GetHasHiddenWindow(bool* aHasHiddenWindow)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aHasHiddenWindow);
|
||||
|
||||
*aHasHiddenWindow = !!mHiddenWindow;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAppShellService::GetHiddenPrivateDOMWindow(nsIDOMWindow **aWindow)
|
||||
{
|
||||
|
@ -33,6 +33,7 @@ protected:
|
||||
~nsAppShellService();
|
||||
|
||||
nsresult CreateHiddenWindowHelper(bool aIsPrivate);
|
||||
void EnsureHiddenWindow();
|
||||
void EnsurePrivateHiddenWindow();
|
||||
|
||||
nsresult JustCreateTopWindow(nsIXULWindow *aParent,
|
||||
|
Loading…
Reference in New Issue
Block a user