Bug 746978 - sync CSP directive parsing and directive names with w3c CSP 1.0 spec - part 6 - fix up toString (r=sstamm)
authorIan Melven <imelven@mozilla.com>
Wed, 09 Jan 2013 10:57:05 -0800
changeset 118283 eb9e62dc084bdbca33db99855575bd1980e5dd5f
parent 118282 3ff903c405aa260fef6db265496014d351cfcb79
child 118284 2a1d1669d81377a1750a377c7a3d5dae695e4b3b
push id24159
push useremorley@mozilla.com
push dateThu, 10 Jan 2013 08:59:47 +0000
treeherdermozilla-central@a2c46e2c7df1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssstamm
bugs746978
milestone21.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 746978 - sync CSP directive parsing and directive names with w3c CSP 1.0 spec - part 6 - fix up toString (r=sstamm)
content/base/src/CSPUtils.jsm
--- a/content/base/src/CSPUtils.jsm
+++ b/content/base/src/CSPUtils.jsm
@@ -707,17 +707,17 @@ CSPRep.prototype = {
 
   /**
    * Generates canonical string representation of the policy.
    */
   toString:
   function csp_toString() {
     var dirs = [];
 
-    if (this._allowEval || this._allowInlineScripts) {
+    if (!this._specCompliant && (this._allowEval || this._allowInlineScripts)) {
       dirs.push("options" + (this._allowEval ? " eval-script" : "")
                            + (this._allowInlineScripts ? " inline-script" : ""));
     }
     for (var i in this._directives) {
       if (this._directives[i]) {
         dirs.push(i + " " + this._directives[i].toString());
       }
     }
@@ -1487,16 +1487,22 @@ CSPSource.prototype = {
   /**
    * Generates canonical string representation of the Source.
    */
   toString:
   function() {
     if (this._isSelf)
       return this._self.toString();
 
+    if (this._allowUnsafeInline)
+      return "unsafe-inline";
+
+    if (this._allowUnsafeEval)
+      return "unsafe-eval";
+
     var s = "";
     if (this.scheme)
       s = s + this.scheme + "://";
     if (this._host)
       s = s + this._host;
     if (this.port)
       s = s + ":" + this.port;
     return s;