Bug 1279494 - Fix crash in SetReferrerWithPolicy, add null check the triggeringPrincipal. r=ckerschb
authorThomas Nguyen <tnguyen@mozilla.com>
Mon, 04 Jul 2016 17:05:57 +0800
changeset 303573 4069c4e3a0da07534acd4d6a82fd365aa43723f4
parent 303572 066be6391756b49ee36358a34c8b7ee34ed1f82f
child 303574 990aca9e4d11f4973f71e438f324579e3f217cae
push id30394
push userphilringnalda@gmail.com
push dateMon, 04 Jul 2016 22:02:32 +0000
treeherdermozilla-central@c9a70b64f2fa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersckerschb
bugs1279494
milestone50.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 1279494 - Fix crash in SetReferrerWithPolicy, add null check the triggeringPrincipal. r=ckerschb 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()));
       }