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 339836 4f9464b013a53f9830d4db4c83bb642bbab8187c
parent 339835 b00ce8e9bee0ed1a06adb37b4f36b0cafc355e93
child 339837 b869cd449f96380924c184e37c3ea228c6bbdaab
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersckerschb, gchang
bugs1279494
milestone49.0a2
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
@@ -1413,17 +1413,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()));
       }