Bug 666801 - Add DOMWindowID and isTopLevel to nsIWebProgress (r=smaug)

This commit is contained in:
Bill McCloskey 2013-04-24 22:26:13 -07:00
parent d7a8e833c8
commit 3913838d2d
3 changed files with 60 additions and 1 deletions

View File

@ -74,6 +74,22 @@ nsBrowserStatusFilter::GetDOMWindow(nsIDOMWindow **aResult)
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsBrowserStatusFilter::GetDOMWindowID(uint64_t *aResult)
{
*aResult = 0;
NS_NOTREACHED("nsBrowserStatusFilter::GetDOMWindowID");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsBrowserStatusFilter::GetIsTopLevel(bool *aIsTopLevel)
{
*aIsTopLevel = false;
NS_NOTREACHED("nsBrowserStatusFilter::GetIsTopLevel");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsBrowserStatusFilter::GetIsLoadingDocument(bool *aIsLoadingDocument)
{

View File

@ -934,6 +934,43 @@ nsDocLoader::GetDOMWindow(nsIDOMWindow **aResult)
return CallGetInterface(this, aResult);
}
NS_IMETHODIMP
nsDocLoader::GetDOMWindowID(uint64_t *aResult)
{
*aResult = 0;
nsCOMPtr<nsIDOMWindow> window;
nsresult rv = GetDOMWindow(getter_AddRefs(window));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsPIDOMWindow> piwindow = do_QueryInterface(window);
NS_ENSURE_STATE(piwindow);
MOZ_ASSERT(piwindow->IsOuterWindow());
*aResult = piwindow->WindowID();
return NS_OK;
}
NS_IMETHODIMP
nsDocLoader::GetIsTopLevel(bool *aResult)
{
*aResult = false;
nsCOMPtr<nsIDOMWindow> window;
nsresult rv = GetDOMWindow(getter_AddRefs(window));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsPIDOMWindow> piwindow = do_QueryInterface(window);
NS_ENSURE_STATE(piwindow);
nsCOMPtr<nsIDOMWindow> topWindow;
rv = piwindow->GetTop(getter_AddRefs(topWindow));
NS_ENSURE_SUCCESS(rv, rv);
*aResult = piwindow == topWindow;
return NS_OK;
}
NS_IMETHODIMP
nsDocLoader::GetIsLoadingDocument(bool *aIsLoadingDocument)
{

View File

@ -26,7 +26,7 @@ interface nsIWebProgressListener;
* notifications from any nsIWebProgress instances that are children of that
* nsIWebProgress instance.
*/
[scriptable, uuid(570F39D0-EFD0-11d3-B093-00A024FFC08C)]
[scriptable, uuid(1c3437b0-9e2c-11e2-9e96-0800200c9a66)]
interface nsIWebProgress : nsISupports
{
/**
@ -132,6 +132,12 @@ interface nsIWebProgress : nsISupports
* Indicates that there is no associated DOM window.
*/
readonly attribute nsIDOMWindow DOMWindow;
readonly attribute uint64_t DOMWindowID;
/**
* Indicates whether DOMWindow.top == DOMWindow.
*/
readonly attribute boolean isTopLevel;
/**
* Indicates whether or not a document is currently being loaded