Bug 1219502 - Build failure: trayToolkit.cpp: error: 'GetDocument' : is not a member of 'nsIDOMWindow', r=aleth.
authorFlorian Quèze <florian@queze.net>
Thu, 29 Oct 2015 01:06:06 +0100
changeset 18525 fcd1a6bd0e04e59a82ed2fec609282dc9178cf3a
parent 18524 62a58b74439fb3b428b0ac249f37a25791226c3e
child 18526 deac832faa428dca80632aac59cc211bb968c430
push id11342
push userflorian@queze.net
push dateThu, 29 Oct 2015 00:06:35 +0000
treeherdercomm-central@fcd1a6bd0e04 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaleth
bugs1219502
Bug 1219502 - Build failure: trayToolkit.cpp: error: 'GetDocument' : is not a member of 'nsIDOMWindow', r=aleth.
im/components/mintrayr/trayToolkit.cpp
--- a/im/components/mintrayr/trayToolkit.cpp
+++ b/im/components/mintrayr/trayToolkit.cpp
@@ -4,17 +4,19 @@
 
 #include "trayToolkit.h"
 #include "trayPlatform.h"
 
 #include "nsCOMPtr.h"
 #include "nsStringAPI.h"
 #include "nsServiceManagerUtils.h"
 
+#include "nsPIDOMWindow.h"
 #include "nsIDOMWindow.h"
+#include "nsIDocument.h"
 #include "nsIDOMDocument.h"
 
 #include "nsIDOMEvent.h"
 #include "nsIDOMEventTarget.h"
 #include "nsIDOMMouseEvent.h"
 
 #include "nsIWebNavigation.h"
 
@@ -78,19 +80,24 @@ NS_IMETHODIMP GetBaseWindow(nsIDOMWindow
  * Helper: Dispatch a trusted general event
  */
 NS_IMETHODIMP DispatchTrustedEvent(nsIDOMWindow *aWindow, const nsAString& aEventName)
 {
   NS_ENSURE_ARG_POINTER(aWindow);
 
   nsresult rv;
 
-  nsCOMPtr<nsIDOMDocument> domDocument;
-  rv = aWindow->GetDocument(getter_AddRefs(domDocument));
-  NS_ENSURE_SUCCESS(rv, rv);
+  nsCOMPtr<nsPIDOMWindow> window(do_QueryInterface(aWindow));
+  NS_ENSURE_STATE(window);
+
+  nsCOMPtr<nsIDocument> doc = window->GetExtantDoc();
+  NS_ENSURE_STATE(doc);
+
+  nsCOMPtr<nsIDOMDocument> domDocument(do_QueryInterface(doc));
+  NS_ENSURE_STATE(domDocument);
 
   nsCOMPtr<nsIDOMEventTarget> target(do_QueryInterface(domDocument));
   NS_ENSURE_TRUE(target, NS_ERROR_INVALID_ARG);
 
   nsCOMPtr<nsIDOMEvent> event;
   rv = domDocument->CreateEvent(NS_LITERAL_STRING("Events"), getter_AddRefs(event));
   NS_ENSURE_SUCCESS(rv, rv);
 
@@ -221,19 +228,24 @@ NS_IMETHODIMP TrayIconImpl::Init(nsIDOMW
 
   return NS_OK;
 }
 
 NS_IMETHODIMP TrayIconImpl::DispatchMouseEvent(const nsAString& aEventName, PRUint16 aButton, nsPoint& pt, bool aCtrlKey, bool aAltKey, bool aShiftKey)
 {
   nsresult rv;
 
-  nsCOMPtr<nsIDOMDocument> domDocument;
-  rv = mWindow->GetDocument(getter_AddRefs(domDocument));
-  NS_ENSURE_SUCCESS(rv, rv);
+  nsCOMPtr<nsPIDOMWindow> window(do_QueryInterface(mWindow));
+  NS_ENSURE_TRUE(window, NS_ERROR_INVALID_ARG);
+
+  nsCOMPtr<nsIDocument> doc = window->GetExtantDoc();
+  NS_ENSURE_STATE(doc);
+
+  nsCOMPtr<nsIDOMDocument> domDocument(do_QueryInterface(doc));
+  NS_ENSURE_STATE(domDocument);
 
   nsCOMPtr<nsIDOMEventTarget> target(do_QueryInterface(domDocument));
   NS_ENSURE_TRUE(target, NS_ERROR_INVALID_ARG);
 
   nsCOMPtr<nsIDOMEvent> event;
   rv = domDocument->CreateEvent(NS_LITERAL_STRING("MouseEvents"), getter_AddRefs(event));
   NS_ENSURE_SUCCESS(rv, rv);