[tor-commits] [tor-browser/tor-browser-38.3.0esr-5.0-2] fixup! Bug #5742: API allows you to get the url bar URI for a channel or nsIDocument.

mikeperry at torproject.org mikeperry at torproject.org
Thu Sep 17 21:11:13 UTC 2015


commit bf0222961ed34874922c51ba1948439839f8d715
Author: Arthur Edelstein <arthuredelstein at gmail.com>
Date:   Thu Sep 17 12:46:45 2015 -0700

    fixup! Bug #5742: API allows you to get the url bar URI for a channel or nsIDocument.
---
 dom/base/ThirdPartyUtil.cpp |   18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/dom/base/ThirdPartyUtil.cpp b/dom/base/ThirdPartyUtil.cpp
index e8ec06c..6f0a358 100644
--- a/dom/base/ThirdPartyUtil.cpp
+++ b/dom/base/ThirdPartyUtil.cpp
@@ -648,13 +648,17 @@ ThirdPartyUtil::GetFirstPartyURIInternal(nsIChannel *aChannel,
 
     if (aDoc->GetWindow()) {
       aDoc->GetWindow()->GetTop(getter_AddRefs(top));
-      top->GetDocument(getter_AddRefs(topDDoc));
-
-      nsCOMPtr<nsIDocument> topDoc(do_QueryInterface(topDDoc));
-      docURI = topDoc->GetOriginalURI();
-      if (docURI) {
-        // Give us a mutable URI and also addref
-        rv = NS_EnsureSafeToReturn(docURI, aOutput);
+      if (top) {
+        top->GetDocument(getter_AddRefs(topDDoc));
+
+        nsCOMPtr<nsIDocument> topDoc(do_QueryInterface(topDDoc));
+        if (topDoc) {
+          docURI = topDoc->GetOriginalURI();
+          if (docURI) {
+            // Give us a mutable URI and also addref
+            rv = NS_EnsureSafeToReturn(docURI, aOutput);
+          }
+        }
       }
     } else {
       // XXX: Chrome callers (such as NoScript) can end up here



More information about the tor-commits mailing list