Bug 1279494 - Fix crash in SetReferrerWithPolicy, add null check the triggeringPrincipal. r=ckerschb, a=gchang
authorThomas Nguyen <tnguyen@mozilla.com>
Mon, 04 Jul 2016 17:05:57 +0800
changeset 333571 48a5986567e5fca5bb44735576f3b85bde178c8a
parent 333570 1a8e1e5125daafac3b0bb182c10a390690c19bf3
child 333572 a3cadedba916ac12950fc30f16ec1e4abc19c6f6
push id6174
push usercbook@mozilla.com
push dateWed, 06 Jul 2016 14:33:00 +0000
treeherdermozilla-beta@f574e40a75b5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersckerschb, gchang
bugs1279494
milestone48.0
Bug 1279494 - Fix crash in SetReferrerWithPolicy, add null check the triggeringPrincipal. r=ckerschb, a=gchang MozReview-Commit-ID: ho0StGNqc8
netwerk/protocol/http/HttpBaseChannel.cpp
--- a/netwerk/protocol/http/HttpBaseChannel.cpp
+++ b/netwerk/protocol/http/HttpBaseChannel.cpp
@@ -1387,17 +1387,20 @@ HttpBaseChannel::SetReferrerWithPolicy(n
     }
   }
 
   // for cross-origin-based referrer changes (not just host-based), figure out
   // if the referrer is being sent cross-origin.
   nsCOMPtr<nsIURI> triggeringURI;
   bool isCrossOrigin = true;
   if (mLoadInfo) {
-    mLoadInfo->TriggeringPrincipal()->GetURI(getter_AddRefs(triggeringURI));
+    nsCOMPtr<nsIPrincipal> triggeringPrincipal = mLoadInfo->TriggeringPrincipal();
+    if (triggeringPrincipal) {
+      triggeringPrincipal->GetURI(getter_AddRefs(triggeringURI));
+    }
   }
   if (triggeringURI) {
     if (LOG_ENABLED()) {
       nsAutoCString triggeringURISpec;
       rv = triggeringURI->GetAsciiSpec(triggeringURISpec);
       if (!NS_FAILED(rv)) {
         LOG(("triggeringURI=%s\n", triggeringURISpec.get()));
       }