Fix test failure from bug 767778, r=sstamm, a=akeybl
authorDaniel Veditz <dveditz@cruzio.com>
Tue, 10 Jul 2012 10:15:49 -0700
changeset 98756 098fbc184428c2902a789d2b70354669c001d63b
parent 98755 f87cba6f0581aadbf96ddcc927caa9fd84c5f398
child 98757 102443258731dc5ba78e8d167669d60397a66194
child 106534 7aa128dbd1a9e5b9272376aa9a1f4aa23afd8787
push idunknown
push userunknown
push dateunknown
reviewerssstamm, akeybl
bugs767778
milestone16.0a1
Fix test failure from bug 767778, r=sstamm, a=akeybl
content/base/src/contentSecurityPolicy.js
--- a/content/base/src/contentSecurityPolicy.js
+++ b/content/base/src/contentSecurityPolicy.js
@@ -193,19 +193,21 @@ ContentSecurityPolicy.prototype = {
     // Save the docRequest for fetching a policy-uri
     this._docRequest = aChannel;
 
     // save the document URI (minus <fragment>) and referrer for reporting
     let uri = aChannel.URI.cloneIgnoringRef();
     uri.userPass = '';
     this._request = uri.asciiSpec;
 
-    let referrer = aChannel.referrer.cloneIgnoringRef();
-    referrer.userPass = '';
-    this._referrer = referrer.asciiSpec;
+    if (aChannel.referrer) {
+      let referrer = aChannel.referrer.cloneIgnoringRef();
+      referrer.userPass = '';
+      this._referrer = referrer.asciiSpec;
+    }
   },
 
 /* ........ Methods .............. */
 
   /**
    * Given a new policy, intersects the currently enforced policy with the new
    * one and stores the result.  The effect is a "tightening" or refinement of
    * an old policy.  This is called any time a new policy is encountered and