Bug 852687 - getCurrentInnerWindowWithId for nsIWindowMediator. r=bz

This commit is contained in:
Gabor Krizsanits 2013-05-14 17:34:12 +02:00
parent 17dec0c1bc
commit 968ce4b78d
3 changed files with 32 additions and 4 deletions

View File

@ -17,5 +17,4 @@
#
# Modifying this file will now automatically clobber the buildbot machines \o/
#
Bug 866093 - Change in .gyp file for Android builds.
Bug 861039 - Nuking and rebuilding gfx/angle without clobber caused: "No rule to make target `../../../../gfx/angle/src/compiler/ArrayBoundsClamper.cpp', needed by `ArrayBoundsClamper.o'. Stop."
Bug 852687 - changing an idl without clobbering resulted test failures

View File

@ -8,8 +8,8 @@
%{C++
#define NS_WINDOWMEDIATOR_CID \
{ 0x808b2fa3, 0x8a02, 0x49ca, \
{ 0x91, 0x04, 0x5f, 0x77, 0x29, 0x9e, 0x09, 0x0b } }
{ 0x79a2b7cc, 0xf05b, 0x4605, \
{ 0xbf, 0xa0, 0xfa, 0xc5, 0x4f, 0x27, 0xee, 0xc8 } }
#define NS_WINDOWMEDIATOR_CONTRACTID \
"@mozilla.org/appshell/window-mediator;1"
@ -74,6 +74,13 @@ interface nsIWindowMediator: nsISupports
*/
nsIDOMWindow getOuterWindowWithId(in unsigned long long aOuterWindowID);
/**
* Return the outer window with the given current window ID, if any.
* Can return null if no inner window with the ID exists or if it's not
* a current inner anymore.
*/
nsIDOMWindow getCurrentInnerWindowWithId(in unsigned long long aInnerWindowID);
/** Add the window to the list of known windows. Listeners (see
* addListener) will be notified through their onOpenWindow method.
* @param aWindow the window to add

View File

@ -330,6 +330,28 @@ nsWindowMediator::GetOuterWindowWithId(uint64_t aWindowID,
return NS_OK;
}
NS_IMETHODIMP
nsWindowMediator::GetCurrentInnerWindowWithId(uint64_t aWindowID,
nsIDOMWindow** aWindow)
{
nsCOMPtr<nsPIDOMWindow> inner = nsGlobalWindow::GetInnerWindowWithId(aWindowID);
// not found
if (!inner)
return NS_OK;
nsCOMPtr<nsPIDOMWindow> outer = inner->GetOuterWindow();
NS_ENSURE_TRUE(outer, NS_ERROR_UNEXPECTED);
// outer is already using another inner, so it's same as not found
if (outer->GetCurrentInnerWindow() != inner)
return NS_OK;
nsCOMPtr<nsIDOMWindow> ret = do_QueryInterface(outer);
ret.forget(aWindow);
return NS_OK;
}
NS_IMETHODIMP
nsWindowMediator::UpdateWindowTimeStamp(nsIXULWindow* inWindow)
{