Bug 1645715 - Check if uri is null in ComputeCrossOriginOpenerPolicyMismatch r=michal,necko-reviewers
authorValentin Gosu <valentin.gosu@gmail.com>
Wed, 17 Jun 2020 13:59:53 +0000
changeset 536113 00d535d4004d9c4ca5b34ce95c34e59ba54bf3ec
parent 536112 cc70c96b63e099507005de8cc9ab23d79b4beb1d
child 536114 6fbdf96ceeb6bab2897adc99d05aaf62186ba9ee
push id119243
push uservalentin.gosu@gmail.com
push dateWed, 17 Jun 2020 14:24:51 +0000
treeherderautoland@00d535d4004d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmichal, necko-reviewers
bugs1645715
milestone79.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 1645715 - Check if uri is null in ComputeCrossOriginOpenerPolicyMismatch r=michal,necko-reviewers Differential Revision: https://phabricator.services.mozilla.com/D79657
netwerk/protocol/http/HttpBaseChannel.cpp
--- a/netwerk/protocol/http/HttpBaseChannel.cpp
+++ b/netwerk/protocol/http/HttpBaseChannel.cpp
@@ -2317,22 +2317,26 @@ nsresult HttpBaseChannel::ComputeCrossOr
   bool compareResult = CompareCrossOriginOpenerPolicies(
       documentPolicy, documentOrigin, resultPolicy, resultOrigin);
 
   if (LOG_ENABLED()) {
     LOG(
         ("HttpBaseChannel::HasCrossOriginOpenerPolicyMismatch - "
          "doc:%d result:%d - compare:%d\n",
          documentPolicy, resultPolicy, compareResult));
-    nsAutoCString docOrigin;
+    nsAutoCString docOrigin("(null)");
     nsCOMPtr<nsIURI> uri = documentOrigin->GetURI();
-    uri->GetSpec(docOrigin);
-    nsAutoCString resOrigin;
+    if (uri) {
+      uri->GetSpec(docOrigin);
+    }
+    nsAutoCString resOrigin("(null)");
     uri = resultOrigin->GetURI();
-    uri->GetSpec(resOrigin);
+    if (uri) {
+      uri->GetSpec(resOrigin);
+    }
     LOG(("doc origin:%s - res origin: %s\n", docOrigin.get(), resOrigin.get()));
   }
 
   if (compareResult) {
     return NS_OK;
   }
 
   // If one of the following is false: