Bug 666801 - Add DOMWindowID and isTopLevel to nsIWebProgress (r=smaug)
authorBill McCloskey <wmccloskey@mozilla.com>
Wed, 24 Apr 2013 22:26:13 -0700
changeset 129836 11260d91b2c8b54a1bb141dda05bbda8558d6797
parent 129835 b25be40337874e6405825e937ff2af017a5ecca2
child 129837 a8a547fb44a8bf92e2ad57a395fc50dcff47379a
push id24590
push userryanvm@gmail.com
push dateFri, 26 Apr 2013 01:39:07 +0000
treeherdermozilla-central@7f68735fc8da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs666801
milestone23.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 666801 - Add DOMWindowID and isTopLevel to nsIWebProgress (r=smaug)
toolkit/components/statusfilter/nsBrowserStatusFilter.cpp
uriloader/base/nsDocLoader.cpp
uriloader/base/nsIWebProgress.idl
--- 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;
 };