Bug 666801 - Add DOMWindowID and isTopLevel to nsIWebProgress (r=smaug)
--- a/toolkit/components/statusfilter/nsBrowserStatusFilter.cpp
+++ b/toolkit/components/statusfilter/nsBrowserStatusFilter.cpp
@@ -70,16 +70,32 @@ nsBrowserStatusFilter::RemoveProgressLis
NS_IMETHODIMP
nsBrowserStatusFilter::GetDOMWindow(nsIDOMWindow **aResult)
{
NS_NOTREACHED("nsBrowserStatusFilter::GetDOMWindow");
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)
{
NS_NOTREACHED("nsBrowserStatusFilter::GetIsLoadingDocument");
return NS_ERROR_NOT_IMPLEMENTED;
}
//-----------------------------------------------------------------------------
--- a/uriloader/base/nsDocLoader.cpp
+++ b/uriloader/base/nsDocLoader.cpp
@@ -930,16 +930,53 @@ nsDocLoader::RemoveProgressListener(nsIW
NS_IMETHODIMP
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)
{
*aIsLoadingDocument = mIsLoadingDocument;
return NS_OK;
}
int64_t nsDocLoader::GetMaxTotalProgress()
--- a/uriloader/base/nsIWebProgress.idl
+++ b/uriloader/base/nsIWebProgress.idl
@@ -21,17 +21,17 @@ interface nsIWebProgressListener;
* instances is not made explicit by this interface, but the relationship may
* exist in some implementations.
*
* A nsIWebProgressListener instance receives notifications for the
* nsIWebProgress instance to which it added itself, and it may also receive
* 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
{
/**
* The following flags may be combined to form the aNotifyMask parameter for
* the addProgressListener method. They limit the set of events that are
* delivered to an nsIWebProgressListener instance.
*/
@@ -127,15 +127,21 @@ interface nsIWebProgress : nsISupports
/**
* The DOM window associated with this nsIWebProgress instance.
*
* @throw NS_ERROR_FAILURE
* 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
* in the context of this nsIWebProgress instance.
*/
readonly attribute boolean isLoadingDocument;
};