Bug 796938 - Use GetEntryGlobal in nsGlobalWindow::FireAbuseEvents. r=smaug
authorBobby Holley <bobbyholley@gmail.com>
Tue, 19 Aug 2014 12:02:07 -0700
changeset 214762 7e06192172e09f55ddeea6d69a4a7ebe86b21e44
parent 214761 abc88c4f9bb7739eb77df547b0b4bfb58623f93d
child 214763 f1552d58d3149d4a6e4165766f3bf30f8ef15deb
push idunknown
push userunknown
push dateunknown
reviewerssmaug
bugs796938
milestone34.0a1
Bug 796938 - Use GetEntryGlobal in nsGlobalWindow::FireAbuseEvents. r=smaug
dom/base/nsGlobalWindow.cpp
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -7524,30 +7524,17 @@ nsGlobalWindow::FireAbuseEvents(bool aBl
 
   // build the URI of the would-have-been popup window
   // (see nsWindowWatcher::URIfromURL)
 
   // first, fetch the opener's base URI
 
   nsIURI *baseURL = nullptr;
 
-  JSContext *cx = nsContentUtils::GetCurrentJSContext();
-  nsCOMPtr<nsPIDOMWindow> contextWindow;
-
-  if (cx) {
-    nsIScriptContext *currentCX = nsJSUtils::GetDynamicScriptContext(cx);
-    if (currentCX) {
-      contextWindow = do_QueryInterface(currentCX->GetGlobalObject());
-    }
-  }
-  if (!contextWindow) {
-    contextWindow = this;
-  }
-
-  nsCOMPtr<nsIDocument> doc = contextWindow->GetDoc();
+  nsCOMPtr<nsIDocument> doc = GetEntryDocument();
   if (doc)
     baseURL = doc->GetDocBaseURI();
 
   // use the base URI to build what would have been the popup's URI
   nsCOMPtr<nsIIOService> ios(do_GetService(NS_IOSERVICE_CONTRACTID));
   if (ios)
     ios->NewURI(NS_ConvertUTF16toUTF8(aPopupURL), 0, baseURL,
                 getter_AddRefs(popupURI));