[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

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



commit baca89fcad30603ccac4a2fe1f51ab3f0d0b8518
Author: Arthur Edelstein <arthuredelstein@xxxxxxxxx>
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

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits