mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1221992 - Skip closed windows in GetMostRecentNonPBWindow. r=smaug
This commit is contained in:
parent
348cbf2c9f
commit
4a0c60b2ef
@ -311,7 +311,8 @@ nsWindowMediator::GetMostRecentNonPBWindow(const char16_t* aType, nsIDOMWindow**
|
||||
}
|
||||
|
||||
nsWindowInfo*
|
||||
nsWindowMediator::MostRecentWindowInfo(const char16_t* inType, bool aSkipPrivateBrowsing)
|
||||
nsWindowMediator::MostRecentWindowInfo(const char16_t* inType,
|
||||
bool aSkipPrivateBrowsingOrClosed)
|
||||
{
|
||||
int32_t lastTimeStamp = -1;
|
||||
nsAutoString typeString(inType);
|
||||
@ -334,13 +335,18 @@ nsWindowMediator::MostRecentWindowInfo(const char16_t* inType, bool aSkipPrivate
|
||||
if (!searchInfo->mWindow) {
|
||||
continue;
|
||||
}
|
||||
if (aSkipPrivateBrowsing) {
|
||||
if (aSkipPrivateBrowsingOrClosed) {
|
||||
nsCOMPtr<nsIDocShell> docShell;
|
||||
searchInfo->mWindow->GetDocShell(getter_AddRefs(docShell));
|
||||
nsCOMPtr<nsILoadContext> loadContext = do_QueryInterface(docShell);
|
||||
if (!loadContext || loadContext->UsePrivateBrowsing()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> piwindow = do_QueryInterface(docShell->GetWindow());
|
||||
if (!piwindow || piwindow->Closed()) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
foundInfo = searchInfo;
|
||||
|
@ -57,7 +57,7 @@ private:
|
||||
int32_t AddEnumerator(nsAppShellWindowEnumerator* inEnumerator);
|
||||
int32_t RemoveEnumerator(nsAppShellWindowEnumerator* inEnumerator);
|
||||
nsWindowInfo* MostRecentWindowInfo(const char16_t* inType,
|
||||
bool aSkipPrivateBrowsing = false);
|
||||
bool aSkipPrivateBrowsingOrClosed = false);
|
||||
|
||||
nsresult UnregisterWindow(nsWindowInfo *inInfo);
|
||||
nsWindowInfo *GetInfoFor(nsIXULWindow *aWindow);
|
||||
|
Loading…
Reference in New Issue
Block a user