Back out 5520e123f526 (bug 763879) for b2g mochitest-8 and mochitest-9 failures
authorPhil Ringnalda <philringnalda@gmail.com>
Fri, 22 Feb 2013 20:40:24 -0800
changeset 122720 be239b15a0f1334b216985bd91e6f89834c43b48
parent 122719 1d8799803f37bb83cc8ce5f997206999b25ccb28
child 122721 b2045d4808bf562c52ce668c8597595898505c66
push id24356
push usergszorc@mozilla.com
push dateSun, 24 Feb 2013 01:00:12 +0000
treeherdermozilla-central@195e706140d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs763879
milestone22.0a1
backs out5520e123f52693457d943af9c23fbf18bf2a6f54
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
Back out 5520e123f526 (bug 763879) for b2g mochitest-8 and mochitest-9 failures
content/base/public/nsIContentSecurityPolicy.idl
content/base/src/CSPUtils.jsm
content/base/src/contentSecurityPolicy.js
content/base/src/nsStyleLinkElement.cpp
content/base/src/nsStyledElement.cpp
content/base/test/Makefile.in
content/base/test/file_CSP.css
content/base/test/file_CSP.sjs
content/base/test/file_CSP_inlinescript_main.html
content/base/test/file_CSP_inlinestyle_main.html
content/base/test/file_CSP_inlinestyle_main.html^headers^
content/base/test/file_CSP_inlinestyle_main_spec_compliant.html
content/base/test/file_CSP_inlinestyle_main_spec_compliant.html^headers^
content/base/test/file_CSP_inlinestyle_main_spec_compliant_allowed.html
content/base/test/file_CSP_inlinestyle_main_spec_compliant_allowed.html^headers^
content/base/test/file_CSP_main.html
content/base/test/test_CSP_inlinestyle.html
content/xul/content/src/nsXULElement.cpp
layout/style/nsDOMCSSAttrDeclaration.cpp
layout/style/nsDOMCSSDeclaration.cpp
layout/style/nsDOMCSSDeclaration.h
layout/style/nsStyleAnimation.cpp
layout/style/nsStyleUtil.cpp
layout/style/nsStyleUtil.h
--- a/content/base/public/nsIContentSecurityPolicy.idl
+++ b/content/base/public/nsIContentSecurityPolicy.idl
@@ -8,17 +8,17 @@ interface nsIURI;
 interface nsIHttpChannel;
 interface nsIDocShell;
 
 /**
  * nsIContentSecurityPolicy  
  * Describes an XPCOM component used to model an enforce CSPs.
  */
 
-[scriptable, uuid(230b126d-afc3-4588-9794-3e135594d626)]
+[scriptable, uuid(d1680bb4-1ac0-4772-9437-1188375e44f2)]
 interface nsIContentSecurityPolicy : nsISupports
 {
 
   /**
    * Set to true when the CSP has been read in and parsed and is ready to
    * enforce.  This is a barrier for the nsDocument so it doesn't load any
    * sub-content until either it knows that a CSP is ready or will not be used.
    */
@@ -36,23 +36,16 @@ interface nsIContentSecurityPolicy : nsI
   readonly attribute AString policy;
 
   /**
    * Whether this policy allows in-page script.
    */
   readonly attribute boolean allowsInlineScript;
 
   /**
-   * Whether this policy allows in-page styles.
-   * This includes <style> tags with text content and style="" attributes in
-   * HTML elements.
-   */
-  readonly attribute boolean allowsInlineStyle;
-
-  /**
    * whether this policy allows eval and eval-like functions
    * such as setTimeout("code string", time).
    */
   readonly attribute boolean allowsEval;
 
   /**
    * Log policy violation on the Error Console and send a report if a report-uri
    * is present in the policy
@@ -68,17 +61,16 @@ interface nsIContentSecurityPolicy : nsI
    */
   void logViolationDetails(in unsigned short violationType,
                            in AString sourceFile,
                            in AString scriptSample,
                            in int32_t lineNum);
 
   const unsigned short VIOLATION_TYPE_INLINE_SCRIPT = 1;
   const unsigned short VIOLATION_TYPE_EVAL = 2;
-  const unsigned short VIOLATION_TYPE_INLINE_STYLE = 3;
 
   /**
    * Manually triggers violation report sending given a URI and reason.
    * The URI may be null, in which case "self" is sent.
    * @param blockedURI
    *     the URI that violated the policy
    * @param violatedDirective
    *     the directive that was violated.
--- a/content/base/src/CSPUtils.jsm
+++ b/content/base/src/CSPUtils.jsm
@@ -176,19 +176,16 @@ this.CSPRep = function CSPRep(aSpecCompl
   this._allowInlineScripts = false;
 
   // don't auto-populate _directives, so it is easier to find bugs
   this._directives = {};
 
   // Is this a 1.0 spec compliant CSPRep ?
   // Default to false if not specified.
   this._specCompliant = (aSpecCompliant !== undefined) ? aSpecCompliant : false;
-
-  // Only CSP 1.0 spec compliant policies block inline styles.
-  this._allowInlineStyles = !aSpecCompliant;
 }
 
 // Source directives for our original CSP implementation.
 // These can be removed when the original implementation is deprecated.
 CSPRep.SRC_DIRECTIVES_OLD = {
   DEFAULT_SRC:      "default-src",
   SCRIPT_SRC:       "script-src",
   STYLE_SRC:        "style-src",
@@ -715,18 +712,17 @@ CSPRep.prototype = {
       return false;
     }
     for (var i in this._directives) {
       if (!that._directives[i] || !this._directives[i].equals(that._directives[i])) {
         return false;
       }
     }
     return (this.allowsInlineScripts === that.allowsInlineScripts)
-        && (this.allowsEvalInScripts === that.allowsEvalInScripts)
-        && (this.allowsInlineStyles == that.allowsInlineStyles);
+        && (this.allowsEvalInScripts === that.allowsEvalInScripts);
   },
 
   /**
    * Generates canonical string representation of the policy.
    */
   toString:
   function csp_toString() {
     var dirs = [];
@@ -811,19 +807,16 @@ CSPRep.prototype = {
     }
 
     newRep._allowEval =          this.allowsEvalInScripts
                            && aCSPRep.allowsEvalInScripts;
 
     newRep._allowInlineScripts = this.allowsInlineScripts
                            && aCSPRep.allowsInlineScripts;
 
-    newRep._allowInlineStyles = this.allowsInlineStyles
-                           && aCSPRep.allowsInlineStyles;
-
     newRep._innerWindowID = this._innerWindowID ?
                               this._innerWindowID : aCSPRep._innerWindowID;
 
     return newRep;
   },
 
   /**
    * Copies default source list to each unspecified directive.
@@ -875,24 +868,16 @@ CSPRep.prototype = {
    * Returns true if inline scripts are enabled through the "inline"
    * keyword.
    */
   get allowsInlineScripts () {
     return this._allowInlineScripts;
   },
 
   /**
-   * Returns true if inline styles are enabled through the "inline-style"
-   * keyword.
-   */
-  get allowsInlineStyles () {
-    return this._allowInlineStyles;
-  },
-
-  /**
    * Sends a warning message to the error console and web developer console.
    * @param aMsg
    *        The message to send
    * @param aSource (optional)
    *        The URL of the file in which the error occurred
    * @param aScriptLine (optional)
    *        The line in the source file which the error occurred
    * @param aLineNum (optional)
--- a/content/base/src/contentSecurityPolicy.js
+++ b/content/base/src/contentSecurityPolicy.js
@@ -35,17 +35,16 @@ function ContentSecurityPolicy() {
   CSPdebug("CSP CREATED");
   this._isInitialized = false;
   this._reportOnlyMode = false;
 
   this._policy = CSPRep.fromString("default-src *");
 
   // default options "wide open" since this policy will be intersected soon
   this._policy._allowInlineScripts = true;
-  this._policy._allowInlineStyles = true;
   this._policy._allowEval = true;
 
   this._request = "";
   this._requestOrigin = "";
   this._requestPrincipal = "";
   this._referrer = "";
   this._docRequest = null;
   CSPdebug("CSP POLICY INITED TO 'default-src *'");
@@ -124,20 +123,16 @@ ContentSecurityPolicy.prototype = {
   set isInitialized (foo) {
     this._isInitialized = foo;
   },
 
   get policy () {
     return this._policy.toString();
   },
 
-  get allowsInlineStyle() {
-    return this._reportOnlyMode || this._policy.allowsInlineStyles;
-  },
-
   get allowsInlineScript() {
     return this._reportOnlyMode || this._policy.allowsInlineScripts;
   },
 
   get allowsEval() {
     return this._reportOnlyMode || this._policy.allowsEvalInScripts;
   },
 
@@ -155,22 +150,16 @@ ContentSecurityPolicy.prototype = {
    *     source line number of the violation (if available)
    */
   logViolationDetails:
   function(aViolationType, aSourceFile, aScriptSample, aLineNum) {
     // allowsInlineScript and allowsEval both return true when report-only mode
     // is enabled, resulting in a call to this function. Therefore we need to
     // check that the policy was in fact violated before logging any violations
     switch (aViolationType) {
-    case Ci.nsIContentSecurityPolicy.VIOLATION_TYPE_INLINE_STYLE:
-      if (!this._policy.allowsInlineStyles)
-        this._asyncReportViolation('self',null,'inline style base restriction',
-                                   'violated base restriction: Inline Stylesheets will not apply',
-                                   aSourceFile, aScriptSample, aLineNum);
-      break;
     case Ci.nsIContentSecurityPolicy.VIOLATION_TYPE_INLINE_SCRIPT:
       if (!this._policy.allowsInlineScripts)
         this._asyncReportViolation('self',null,'inline script base restriction',
                                    'violated base restriction: Inline Scripts will not execute',
                                    aSourceFile, aScriptSample, aLineNum);
       break;
     case Ci.nsIContentSecurityPolicy.VIOLATION_TYPE_EVAL:
       if (!this._policy.allowsEvalInScripts)
--- a/content/base/src/nsStyleLinkElement.cpp
+++ b/content/base/src/nsStyleLinkElement.cpp
@@ -21,17 +21,16 @@
 #include "nsIDOMNode.h"
 #include "nsIDOMStyleSheet.h"
 #include "nsNetUtil.h"
 #include "nsUnicharUtils.h"
 #include "nsCRT.h"
 #include "nsXPCOMCIDInternal.h"
 #include "nsUnicharInputStream.h"
 #include "nsContentUtils.h"
-#include "nsStyleUtil.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 nsStyleLinkElement::nsStyleLinkElement()
   : mDontLoadStyle(false)
   , mUpdatesEnabled(true)
   , mLineNumber(1)
@@ -374,21 +373,16 @@ nsStyleLinkElement::DoUpdateStyleSheet(n
   }
 
   bool doneLoading = false;
   nsresult rv = NS_OK;
   if (isInline) {
     nsAutoString text;
     nsContentUtils::GetNodeTextContent(thisContent, false, text);
 
-    if (!nsStyleUtil::CSPAllowsInlineStyle(thisContent->NodePrincipal(),
-                                           doc->GetDocumentURI(),
-                                           mLineNumber, text, &rv))
-      return rv;
-
     // Parse the style sheet.
     rv = doc->CSSLoader()->
       LoadInlineStyle(thisContent, text, mLineNumber, title, media,
                       scopeElement, aObserver, &doneLoading, &isAlternate);
   }
   else {
     // XXXbz clone the URI here to work around content policies modifying URIs.
     nsCOMPtr<nsIURI> clonedURI;
--- a/content/base/src/nsStyledElement.cpp
+++ b/content/base/src/nsStyledElement.cpp
@@ -15,17 +15,16 @@
 #include "nsServiceManagerUtils.h"
 #include "nsIDocument.h"
 #include "mozilla/css/StyleRule.h"
 #include "nsCSSParser.h"
 #include "mozilla/css/Loader.h"
 #include "nsIDOMMutationEvent.h"
 #include "nsXULElement.h"
 #include "nsContentUtils.h"
-#include "nsStyleUtil.h"
 
 namespace css = mozilla::css;
 using namespace mozilla::dom;
 
 //----------------------------------------------------------------------
 // nsIContent methods
 
 nsIAtom*
@@ -231,21 +230,16 @@ nsStyledElementNotElementCSSInlineStyle:
 
 void
 nsStyledElementNotElementCSSInlineStyle::ParseStyleAttribute(const nsAString& aValue,
                                                              nsAttrValue& aResult,
                                                              bool aForceInDataDoc)
 {
   nsIDocument* doc = OwnerDoc();
 
-  if (!nsStyleUtil::CSPAllowsInlineStyle(NodePrincipal(),
-                                         doc->GetDocumentURI(), 0, aValue,
-                                         nullptr))
-    return;
-
   if (aForceInDataDoc ||
       !doc->IsLoadedAsData() ||
       doc->IsStaticDocument()) {
     bool isCSS = true; // assume CSS until proven otherwise
 
     if (!IsInNativeAnonymousSubtree()) {  // native anonymous content
                                           // always assumes CSS
       nsAutoString styleType;
--- a/content/base/test/Makefile.in
+++ b/content/base/test/Makefile.in
@@ -357,17 +357,16 @@ MOCHITEST_FILES_B = \
 		test_copypaste.html \
 		test_bug503481.html \
 		file_bug503481.sjs \
 		test_bug503481b.html \
 		file_bug503481b_inner.html \
 		test_viewport_scroll.html \
 		test_CSP.html \
 		file_CSP.sjs \
-		file_CSP.css \
 		file_CSP_main.html \
 		file_CSP_main.html^headers^ \
 		file_CSP_main_spec_compliant.html \
 		file_CSP_main_spec_compliant.html^headers^ \
 		file_CSP_main.js \
 		file_CSP_main_spec_compliant.js \
 		test_CSP_frameancestors.html \
 		file_CSP_frameancestors.sjs \
@@ -387,23 +386,16 @@ MOCHITEST_FILES_B = \
 		file_CSP_evalscript_main.html \
 		file_CSP_evalscript_main.html^headers^ \
 		file_CSP_evalscript_main.js \
 		file_CSP_evalscript_main_allowed.js \
 		file_CSP_evalscript_main_spec_compliant.html \
 	 	file_CSP_evalscript_main_spec_compliant.html^headers^ \
 		file_CSP_evalscript_main_spec_compliant_allowed.html \
 		file_CSP_evalscript_main_spec_compliant_allowed.html^headers^ \
-		test_CSP_inlinestyle.html \
-		file_CSP_inlinestyle_main.html \
-		file_CSP_inlinestyle_main.html^headers^ \
-		file_CSP_inlinestyle_main_spec_compliant.html \
-		file_CSP_inlinestyle_main_spec_compliant.html^headers^ \
-		file_CSP_inlinestyle_main_spec_compliant_allowed.html \
-		file_CSP_inlinestyle_main_spec_compliant_allowed.html^headers^ \
 		file_csp_bug768029.html \
 		file_csp_bug768029.sjs \
 		file_csp_bug773891.html \
 		file_csp_bug773891.sjs \
 		test_bug540854.html \
 		bug540854.sjs \
 		test_bug548463.html \
 		test_bug545644.html \
deleted file mode 100644
--- a/content/base/test/file_CSP.css
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Moved this CSS from an inline stylesheet to an external file when we added
- * inline-style blocking in bug 763879.
- * This test may hang if the load for this .css file is blocked due to a
- * malfunction of CSP, but should pass if the style_good test passes.
- */
-
-/* CSS font embedding tests */
-@font-face {
-  font-family: "arbitrary_good";
-  src: url('file_CSP.sjs?testid=font_good&type=application/octet-stream');
-}
-@font-face {
-  font-family: "arbitrary_bad";
-  src: url('http://example.org/tests/content/base/test/file_CSP.sjs?testid=font_bad&type=application/octet-stream');
-}
-
-.div_arbitrary_good { font-family: "arbitrary_good"; }
-.div_arbitrary_bad { font-family: "arbitrary_bad"; }
-
--- a/content/base/test/file_CSP.sjs
+++ b/content/base/test/file_CSP.sjs
@@ -16,11 +16,12 @@ function handleRequest(request, response
 
   if ("type" in query) {
     response.setHeader("Content-Type", unescape(query['type']), false);
   } else {
     response.setHeader("Content-Type", "text/html", false);
   }
 
   if ("content" in query) {
+    response.setHeader("Content-Type", "text/html", false);
     response.write(unescape(query['content']));
   }
 }
--- a/content/base/test/file_CSP_inlinescript_main.html
+++ b/content/base/test/file_CSP_inlinescript_main.html
@@ -1,13 +1,8 @@
-<!--
--- The original CSP implementation predates the CSP 1.0 spec and didn't
--- block inline styles, so when the prefixed X-Content-Security-Policy header is used,
--- as it is for this file, inline styles should be allowed.
--->
 <html>
   <head>
     <title>CSP inline script tests</title>
   </head>
   <body onload="window.parent.scriptRan(false, 'eventattr', 'event attribute in body tag fired')">
 
     <script type="text/javascript">
       window.parent.scriptRan(false, "textnode", "text node in a script tag executed.");
deleted file mode 100644
--- a/content/base/test/file_CSP_inlinestyle_main.html
+++ /dev/null
@@ -1,55 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<html>
-  <head>
-    <title>CSP inline script tests</title>
-    <!-- content= "div#linkstylediv { color: #0f0; }" -->
-    <link rel="stylesheet" type="text/css"
-          href='file_CSP.sjs?type=text/css&content=div%23linkstylediv%20%7B%20color%3A%20%230f0%3B%20%7D' />
-  </head>
-  <body>
-
-    <style type="text/css">
-      div#inlinestylediv {
-        color: #00ff00;
-      }
-    </style>
-
-    <div id='linkstylediv'>Link tag (external) stylesheet test (should be green)</div>
-    <div id='attrstylediv' style="color: #00ff00;">Attribute stylesheet test (should be green)</div>
-    <div id='inlinestylediv'>Inline stylesheet test (should be green)</div>
-
-	    <!-- tests for SMIL stuff - animations -->
-    <svg xmlns="http://www.w3.org/2000/svg"
-         xmlns:xlink="http://www.w3.org/1999/xlink"
-         width="100%"
-         height="100px">
-
-      <!-- Animates XML attribute, which is mapped into style. -->
-      <text id="xmlTest" x="0" y="15">
-         This should be green since the animation should be allowed by CSP.
-
-        <animate attributeName="fill" attributeType="XML"
-                  values="lime;green;lime" dur="2s"
-                  repeatCount="indefinite" />
-      </text>
-
-      <!-- Animates override value for CSS property. -->
-      <text id="cssOverrideTest" x="0" y="35">
-         This should be green since the animation should be allowed by CSP.
-
-        <animate attributeName="fill" attributeType="CSS"
-                  values="lime;green;lime" dur="2s"
-                  repeatCount="indefinite" />
-      </text>
-
-      <!-- Animates override value for CSS property targeted via ID. -->
-      <text id="cssOverrideTestById" x="0" y="55">
-         This should be green since the animation should be allowed by CSP.
-      </text>
-      <animate xlink:href="#cssOverrideTestById"
-               attributeName="fill"
-               values="lime;green;lime"
-               dur="2s" repeatCount="indefinite" />
-    </svg>
-  </body>
-</html>
deleted file mode 100644
--- a/content/base/test/file_CSP_inlinestyle_main.html^headers^
+++ /dev/null
@@ -1,2 +0,0 @@
-X-Content-Security-Policy: default-src 'self'
-Cache-Control: no-cache
deleted file mode 100644
--- a/content/base/test/file_CSP_inlinestyle_main_spec_compliant.html
+++ /dev/null
@@ -1,92 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<html>
-  <head>
-    <title>CSP inline script tests</title>
-    <!-- content= "div#linkstylediv { color: #0f0; }" -->
-    <link rel="stylesheet" type="text/css"
-          href='file_CSP.sjs?type=text/css&content=div%23linkstylediv%20%7B%20color%3A%20%230f0%3B%20%7D' />
-	<!-- content= "div#removepropertydiv { color: #0f0; }" -->
-    <link rel="stylesheet" type="text/css"
-          href='file_CSP.sjs?type=text/css&content=div%23removepropertydiv%20%7B%20color%3A%20%230f0%3B%20%7D' />
-	<!-- content= "div#modifydiv { color: #0f0; }" -->
-    <link rel="stylesheet" type="text/css"
-          href='file_CSP.sjs?type=text/css&content=div%23modifydiv%20%7B%20color%3A%20%230f0%3B%20%7D' />
-	<!-- content= "div#modifycsstextdiv { color: #0f0; }" -->
-	<link rel="stylesheet" type="text/css"
-          href='file_CSP.sjs?type=text/css&content=div%23modifycsstextdiv%20%7B%20color%3A%20%230f0%3B%20%7D' />
-    <script>
-      function cssTest() {
-        var elem = document.getElementById('csstextstylediv');
-        elem.style.cssText = "color: #FF0000;";
-
-        elem = document.getElementById('setpropertydiv');
-        elem.style.setProperty("color", "#FF0000");
-
-        var styleObj = document.styleSheets[1].cssRules[0].style;
-        styleObj.removeProperty("color");
-        elem = document.getElementById('removepropertydiv');
-        getComputedStyle(elem, null).color;
-
-        elem = document.getElementById('colorattrdiv');
-        elem.style.color = "#00FF00";
-
-        var styleObj = document.styleSheets[2].cssRules[0].style;
-        styleObj.setProperty("color", "#FF0000");
-
-        document.styleSheets[3].cssRules[0].style.cssText = "color: #FF0000;";
-      }
-    </script>
-  </head>
-  <body onload='cssTest()'>
-
-    <style type="text/css">
-      div#inlinestylediv {
-        color: #FF0000;
-      }
-    </style>
-
-    <div id='linkstylediv'>Link tag (external) stylesheet test (should be green)</div>
-    <div id='inlinestylediv'>Inline stylesheet test (should be black)</div>
-    <div id='attrstylediv' style="color: #FF0000;">Attribute stylesheet test (should be black)</div>
-    <div id='csstextstylediv'>cssText test (should be black)</div>
-    <div id='setpropertydiv'> setProperty test (should be black) </div>
-    <div id='removepropertydiv'> removeProperty test (should be green) </div>
-    <div id='colorattrdiv'> color attribute (should be black) </div>
-    <div id='modifydiv'> modify rule from style sheet (should be green) </div>
-    <div id='modifycsstextdiv'> modify rule from style sheet via cssText(should be green) </div>
-
-    <!-- tests for SMIL stuff - animations -->
-    <svg xmlns="http://www.w3.org/2000/svg"
-         xmlns:xlink="http://www.w3.org/1999/xlink"
-         width="100%"
-         height="100px">
-
-      <!-- Animates XML attribute, which is mapped into style. -->
-      <text id="xmlTest" x="0" y="15">
-         This shouldn't be red since the animation should be blocked by CSP.
-
-        <animate attributeName="fill" attributeType="XML"
-                  values="red;orange;red" dur="2s"
-                  repeatCount="indefinite" />
-      </text>
-
-      <!-- Animates override value for CSS property. -->
-      <text id="cssOverrideTest" x="0" y="35">
-         This shouldn't be red since the animation should be blocked by CSP.
-
-        <animate attributeName="fill" attributeType="CSS"
-                  values="red;orange;red" dur="2s"
-                  repeatCount="indefinite" />
-      </text>
-
-      <!-- Animates override value for CSS property targeted via ID. -->
-      <text id="cssOverrideTestById" x="0" y="55">
-         This shouldn't be red since the animation should be blocked by CSP.
-      </text>
-      <animate xlink:href="#cssOverrideTestById"
-               attributeName="fill"
-               values="red;orange;red"
-               dur="2s" repeatCount="indefinite" />
-    </svg>
-  </body>
-</html>
deleted file mode 100644
--- a/content/base/test/file_CSP_inlinestyle_main_spec_compliant.html^headers^
+++ /dev/null
@@ -1,2 +0,0 @@
-Content-Security-Policy: default-src 'self' ; script-src 'self' 'unsafe-inline'
-Cache-Control: no-cache
deleted file mode 100644
--- a/content/base/test/file_CSP_inlinestyle_main_spec_compliant_allowed.html
+++ /dev/null
@@ -1,104 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<html>
-  <head>
-    <title>CSP inline script tests</title>
-    <!-- content= "div#linkstylediv { color: #0f0; }" -->
-    <link rel="stylesheet" type="text/css"
-          href='file_CSP.sjs?type=text/css&content=div%23linkstylediv%20%7B%20color%3A%20%230f0%3B%20%7D' />
-	<!-- content= "div#removepropertydiv { color: #0f0; }" -->
-    <link rel="stylesheet" type="text/css"
-          href='file_CSP.sjs?type=text/css&content=div%23removepropertydiv%20%7B%20color%3A%20%230f0%3B%20%7D' />
-	<!-- content= "div#modifydiv { color: #f00; }" -->
-    <link rel="stylesheet" type="text/css"
-          href='file_CSP.sjs?type=text/css&content=div%23modifydiv%20%7B%20color%3A%20%23f00%3B%20%7D' />
-	<!-- content= "div#modifycsstextdiv { color: #f00; }" -->
-	<link rel="stylesheet" type="text/css"
-          href='file_CSP.sjs?type=text/css&content=div%23modifycsstextdiv%20%7B%20color%3A%20%23f00%3B%20%7D' />
-    <script>
-      function cssTest() {
-        // CSSStyleDeclaration.cssText
-        var elem = document.getElementById('csstextstylediv');
-        elem.style.cssText = "color: #00FF00;";
-
-        // If I call getComputedStyle as below, this test passes as the parent page
-        // correctly detects that the text is colored green - if I remove this, getComputedStyle
-        // thinks the text is black when called by the parent page.
-        getComputedStyle(elem, null).color;
-
-        elem = document.getElementById('setpropertydiv');
-        elem.style.setProperty("color", "#00FF00");
-        getComputedStyle(elem, null).color;
-
-        var styleObj = document.styleSheets[1].cssRules[0].style;
-        styleObj.removeProperty("color");
-        elem = document.getElementById('removepropertydiv');
-        getComputedStyle(elem, null).color;
-
-        elem = document.getElementById('colorattrdiv');
-        elem.style.color = "#00FF00";
-        getComputedStyle(elem, null).color;
-
-        var styleObj = document.styleSheets[2].cssRules[0].style;
-        styleObj.setProperty("color", "#00FF00");
-        elem = document.getElementById('modifydiv');
-        getComputedStyle(elem, null).color;
-
-        document.styleSheets[3].cssRules[0].style.cssText = "color: #00FF00;";
-        elem = document.getElementById('modifycsstextdiv');
-        getComputedStyle(elem, null).color;
-      }
-    </script>
-  </head>
-  <body onload='cssTest()'>
-
-    <style type="text/css">
-      div#inlinestylediv {
-        color: #00FF00;
-      }
-    </style>
-
-    <div id='linkstylediv'>Link tag (external) stylesheet test (should be green)</div>
-    <div id='inlinestylediv'>Inline stylesheet test (should be green)</div>
-    <div id='attrstylediv' style="color: #00FF00;">Attribute stylesheet test (should be green)</div>
-    <div id='csstextstylediv'>style.cssText test (should be green)</div>
-    <div id='setpropertydiv'> setProperty test (should be green) </div>
-    <div id='removepropertydiv'> removeProperty test (should be black) </div>
-    <div id='colorattrdiv'> color attribute (should be green) </div>
-    <div id='modifydiv'> modify rule from style sheet (should be green) </div>
-    <div id='modifycsstextdiv'> modify rule from style sheet via cssText(should be green) </div>
-
-    <!-- tests for SMIL stuff - animations -->
-    <svg xmlns="http://www.w3.org/2000/svg"
-         xmlns:xlink="http://www.w3.org/1999/xlink"
-         width="100%"
-         height="100px">
-
-      <!-- Animates XML attribute, which is mapped into style. -->
-      <text id="xmlTest" x="0" y="15">
-         This should be green since the animation should be allowed by CSP.
-
-        <animate attributeName="fill" attributeType="XML"
-                  values="lime;green;lime" dur="2s"
-                  repeatCount="indefinite" />
-      </text>
-
-      <!-- Animates override value for CSS property. -->
-      <text id="cssOverrideTest" x="0" y="35">
-         This should be green since the animation should be allowed by CSP.
-
-        <animate attributeName="fill" attributeType="CSS"
-                  values="lime;green;lime" dur="2s"
-                  repeatCount="indefinite" />
-      </text>
-
-      <!-- Animates override value for CSS property targeted via ID. -->
-      <text id="cssOverrideTestById" x="0" y="55">
-         This should be green since the animation should be allowed by CSP.
-      </text>
-      <animate xlink:href="#cssOverrideTestById"
-               attributeName="fill"
-               values="lime;green;lime"
-               dur="2s" repeatCount="indefinite" />
-    </svg>
-  </body>
-</html>
deleted file mode 100644
--- a/content/base/test/file_CSP_inlinestyle_main_spec_compliant_allowed.html^headers^
+++ /dev/null
@@ -1,2 +0,0 @@
-Content-Security-Policy: default-src 'self' ; script-src 'self' 'unsafe-inline' ; style-src 'self' 'unsafe-inline'
-Cache-Control: no-cache
--- a/content/base/test/file_CSP_main.html
+++ b/content/base/test/file_CSP_main.html
@@ -1,20 +1,30 @@
 <html>
   <head>
     <link rel='stylesheet' type='text/css'
           href='http://example.org/tests/content/base/test/file_CSP.sjs?testid=style_bad&type=text/css' />
     <link rel='stylesheet' type='text/css'
           href='file_CSP.sjs?testid=style_good&type=text/css' />
 
-    <!-- Used to embed inline styles here for testing fonts, but can't do that -->
-    <!-- due to bug 763879 (block inline styles). Moved these to an external, CSS -->
-    <!-- file (file_CSP.css).  -->
-    <link rel='stylesheet' type='text/css' href='file_CSP.css' />
 
+    <style>
+      /* CSS font embedding tests */
+      @font-face {
+        font-family: "arbitrary_good";
+        src: url('file_CSP.sjs?testid=font_good&type=application/octet-stream');
+      }
+      @font-face {
+        font-family: "arbitrary_bad";
+        src: url('http://example.org/tests/content/base/test/file_CSP.sjs?testid=font_bad&type=application/octet-stream');
+      }
+
+      .div_arbitrary_good { font-family: "arbitrary_good"; }
+      .div_arbitrary_bad { font-family: "arbitrary_bad"; }
+    </style>
   </head>
   <body>
     <!-- these should be stopped by CSP.  :) -->
     <img src="http://example.org/tests/content/base/test/file_CSP.sjs?testid=img_bad&type=img/png"> </img>
     <audio src="http://example.org/tests/content/base/test/file_CSP.sjs?testid=media_bad&type=audio/vorbis"></audio>
     <script src='http://example.org/tests/content/base/test/file_CSP.sjs?testid=script_bad&type=text/javascript'></script>
     <iframe src='http://example.org/tests/content/base/test/file_CSP.sjs?testid=frame_bad&content=FAIL'></iframe>
     <object width="10" height="10">
deleted file mode 100644
--- a/content/base/test/test_CSP_inlinestyle.html
+++ /dev/null
@@ -1,155 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
-  <title>Test for Content Security Policy inline stylesheets stuff</title>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-</head>
-<body>
-<p id="display"></p>
-<div id="content" style="display: none">
-</div>
-
-<iframe style="width:100%;height:300px;" id='cspframe'></iframe>
-<iframe style="width:100%;height:300px;" id='cspframe2'></iframe>
-<iframe style="width:100%;height:300px;" id='cspframe3'></iframe>
-<script class="testbody" type="text/javascript">
-
-var path = "/tests/content/base/test/";
-
-
-//////////////////////////////////////////////////////////////////////
-// set up and go
-SimpleTest.waitForExplicitFinish();
-
-var done = 0;
-
-// Our original CSP implementation does not block inline styles.
-function checkStyles(evt) {
-  var cspframe = document.getElementById('cspframe');
-  var color;
-
-  // black means the style wasn't applied.  green colors are used for styles
-  //expected to be applied.  A color is red if a style is erroneously applied
-  color = window.getComputedStyle(cspframe.contentDocument.getElementById('linkstylediv'),null)['color'];
-  ok('rgb(0, 255, 0)' === color, 'External Stylesheet (original CSP implementation) (' + color + ')');
-  color = window.getComputedStyle(cspframe.contentDocument.getElementById('inlinestylediv'),null)['color'];
-  ok('rgb(0, 255, 0)' === color, 'Inline Style TAG (original CSP implementation) (' + color + ')');
-  color = window.getComputedStyle(cspframe.contentDocument.getElementById('attrstylediv'),null)['color'];
-  ok('rgb(0, 255, 0)' === color, 'Style Attribute (original CSP implementation) (' + color + ')');
-  // SMIL tests
-  color = window.getComputedStyle(cspframe.contentDocument.getElementById('xmlTest',null))['fill'];
-  ok('rgb(0, 255, 0)' === color, 'XML Attribute styling (SMIL) (' + color + ')');
-  color = window.getComputedStyle(cspframe.contentDocument.getElementById('cssOverrideTest',null))['fill'];
-  ok('rgb(0, 255, 0)' === color, 'CSS Override styling (SMIL) (' + color + ')');
-  color = window.getComputedStyle(cspframe.contentDocument.getElementById('cssOverrideTestById',null))['fill'];
-  ok('rgb(0, 255, 0)' === color, 'CSS Override styling via ID lookup (SMIL) (' + color + ')');
-  checkIfDone();
-}
-
-// When a CSP 1.0 compliant policy is specified we should block inline
-// styles when it's not explicitly allowed.
-function checkStylesSpecCompliant(evt) {
-  var cspframe = document.getElementById('cspframe2');
-  var color;
-
-  // black means the style wasn't applied.  green colors are used for styles
-  //expected to be applied.  A color is red if a style is erroneously applied
-  color = window.getComputedStyle(cspframe2.contentDocument.getElementById('linkstylediv'),null)['color'];
-  ok('rgb(0, 255, 0)' === color, 'External Stylesheet (CSP 1.0 spec compliant) (' + color + ')');
-  color = window.getComputedStyle(cspframe2.contentDocument.getElementById('inlinestylediv'),null)['color'];
-  ok('rgb(0, 0, 0)' === color, 'Inline Style TAG (CSP 1.0 spec compliant) (' + color + ')');
-  color = window.getComputedStyle(cspframe2.contentDocument.getElementById('attrstylediv'),null)['color'];
-  ok('rgb(0, 0, 0)' === color, 'Style Attribute (CSP 1.0 spec compliant) (' + color + ')');
-  color = window.getComputedStyle(cspframe2.contentDocument.getElementById('csstextstylediv'),null)['color'];
-  ok('rgb(0, 0, 0)' === color, 'cssText (CSP 1.0 spec compliant) (' + color + ')');
-  // make sure that not only was the style not applied, but that cssText wasn't set
-  ok(cspframe2.contentDocument.getElementById('csstextstylediv').style.cssText !== "color: rgb(0, 255, 0);", "block the set of style.cssText");
-  // SMIL tests
-  color = window.getComputedStyle(cspframe2.contentDocument.getElementById('xmlTest',null))['fill'];
-  ok('rgb(0, 0, 0)' === color, 'XML Attribute styling (SMIL) (' + color + ')');
-  color = window.getComputedStyle(cspframe2.contentDocument.getElementById('cssOverrideTest',null))['fill'];
-  ok('rgb(0, 0, 0)' === color, 'CSS Override styling (SMIL) (' + color + ')');
-  color = window.getComputedStyle(cspframe2.contentDocument.getElementById('cssOverrideTestById',null))['fill'];
-  ok('rgb(0, 0, 0)' === color, 'CSS Override styling via ID lookup (SMIL) (' + color + ')');
-
-  color = window.getComputedStyle(cspframe2.contentDocument.getElementById('setpropertydiv'),null)['color'];
-  ok('rgb(0, 0, 0)' === color, 'SetProperty(' + color + ')');
-  color = window.getComputedStyle(cspframe2.contentDocument.getElementById('removepropertydiv'),null)['color'];
-  ok('rgb(0, 255, 0)' === color, 'RemoveProperty(' + color + ')');
-  color = window.getComputedStyle(cspframe2.contentDocument.getElementById('modifydiv'),null)['color'];
-  ok('rgb(0, 255, 0)' === color, 'Modify loaded style sheet via setProperty (' + color + ')');
-  color = window.getComputedStyle(cspframe2.contentDocument.getElementById('modifycsstextdiv'),null)['color'];
-  ok('rgb(0, 255, 0)' === color, 'Modify loaded style sheet via cssText (' + color + ')');
-
-  color = window.getComputedStyle(cspframe2.contentDocument.getElementById('colorattrdiv'),null)['color'];
-  ok('rgb(0, 0, 0)' === color, 'Color Attribute (' + color + ')');
-
-  checkIfDone();
-}
-
-// When a CSP 1.0 compliant policy is specified we should allow inline
-// styles when it is explicitly allowed.
-function checkStylesSpecCompliantAllowed(evt) {
-  var cspframe = document.getElementById('cspframe3');
-  var color;
-
-  // black means the style wasn't applied.  green colors are used for styles
-  // expected to be applied.  A color is red if a style is erroneously applied
-  color = window.getComputedStyle(cspframe3.contentDocument.getElementById('linkstylediv'),null)['color'];
-  ok('rgb(0, 255, 0)' === color, 'External Stylesheet (CSP 1.0 spec compliant, allowed) (' + color + ')');
-  color = window.getComputedStyle(cspframe3.contentDocument.getElementById('inlinestylediv'),null)['color'];
-  ok('rgb(0, 255, 0)' === color, 'Inline Style TAG (CSP 1.0 spec compliant, allowed) (' + color + ')');
-  color = window.getComputedStyle(cspframe3.contentDocument.getElementById('attrstylediv'),null)['color'];
-  ok('rgb(0, 255, 0)' === color, 'Style Attribute (CSP 1.0 spec compliant, allowed) (' + color + ')');
-
-  // Note that the below test will fail if "script-src: 'unsafe-inline'" breaks,
-  // since it relies on executing script to set .cssText
-  color = window.getComputedStyle(cspframe3.contentDocument.getElementById('csstextstylediv'),null)['color'];
-  ok('rgb(0, 255, 0)' === color, 'style.cssText (CSP 1.0 spec compliant, allowed) (' + color + ')');
-  // SMIL tests
-  color = window.getComputedStyle(cspframe3.contentDocument.getElementById('xmlTest',null))['fill'];
-  ok('rgb(0, 255, 0)' === color, 'XML Attribute styling (SMIL) (' + color + ')');
-  color = window.getComputedStyle(cspframe3.contentDocument.getElementById('cssOverrideTest',null))['fill'];
-  ok('rgb(0, 255, 0)' === color, 'CSS Override styling (SMIL) (' + color + ')');
-  color = window.getComputedStyle(cspframe3.contentDocument.getElementById('cssOverrideTestById',null))['fill'];
-  ok('rgb(0, 255, 0)' === color, 'CSS Override styling via ID lookup (SMIL) (' + color + ')');
-
-  color = window.getComputedStyle(cspframe3.contentDocument.getElementById('setpropertydiv'),null)['color'];
-  ok('rgb(0, 255, 0)' === color, 'SetProperty (' + color + ')');
-  color = window.getComputedStyle(cspframe3.contentDocument.getElementById('removepropertydiv'),null)['color'];
-  ok('rgb(0, 0, 0)' === color, 'RemoveProperty(' + color + ')');
-  color = window.getComputedStyle(cspframe3.contentDocument.getElementById('modifydiv'),null)['color'];
-  ok('rgb(0, 255, 0)' === color, 'Modify loaded style sheet via setProperty (' + color + ')');
-  color = window.getComputedStyle(cspframe3.contentDocument.getElementById('modifycsstextdiv'),null)['color'];
-  ok('rgb(0, 255, 0)' === color, 'Modify loaded style sheet via cssText (' + color + ')');
-
-  color = window.getComputedStyle(cspframe3.contentDocument.getElementById('colorattrdiv'),null)['color'];
-  ok('rgb(0, 255, 0)' === color, 'Color Attribute (' + color + ')');
-
-  checkIfDone();
-}
-
-function checkIfDone() {
-  done++;
-  if (done == 3)
-    SimpleTest.finish();
-}
-
-SpecialPowers.pushPrefEnv(
-  {'set':[["security.csp.speccompliant", true]]},
-  function() {
-    // save this for last so that our listeners are registered.
-    // ... this loads the testbed of good and bad requests.
-    document.getElementById('cspframe').src = 'file_CSP_inlinestyle_main.html';
-    document.getElementById('cspframe').addEventListener('load', checkStyles, false);
-    document.getElementById('cspframe2').src = 'file_CSP_inlinestyle_main_spec_compliant.html';
-    document.getElementById('cspframe2').addEventListener('load', checkStylesSpecCompliant, false);
-    document.getElementById('cspframe3').src = 'file_CSP_inlinestyle_main_spec_compliant_allowed.html';
-    document.getElementById('cspframe3').addEventListener('load', checkStylesSpecCompliantAllowed, false);
-  }
-);
-</script>
-</pre>
-</body>
-</html>
--- a/content/xul/content/src/nsXULElement.cpp
+++ b/content/xul/content/src/nsXULElement.cpp
@@ -2309,19 +2309,16 @@ nsXULPrototypeElement::SetAttrAt(uint32_
     else if (mAttributes[aPos].mName.Equals(nsGkAtoms::style)) {
         mHasStyleAttribute = true;
         // Parse the element's 'style' attribute
         nsRefPtr<css::StyleRule> rule;
 
         nsCSSParser parser;
 
         // XXX Get correct Base URI (need GetBaseURI on *prototype* element)
-        // TODO: If we implement Content Security Policy for chrome documents
-        // as has been discussed, the CSP should be checked here to see if
-        // inline styles are allowed to be applied.
         parser.ParseStyleAttribute(aValue, aDocumentURI, aDocumentURI,
                                    // This is basically duplicating what
                                    // nsINode::NodePrincipal() does
                                    mNodeInfo->NodeInfoManager()->
                                      DocumentPrincipal(),
                                    getter_AddRefs(rule));
         if (rule) {
             mAttributes[aPos].mValue.SetTo(rule, &aValue);
--- a/layout/style/nsDOMCSSAttrDeclaration.cpp
+++ b/layout/style/nsDOMCSSAttrDeclaration.cpp
@@ -149,21 +149,21 @@ nsDOMCSSAttributeDeclaration::GetCSSDecl
   return decl;
 }
 
 void
 nsDOMCSSAttributeDeclaration::GetCSSParsingEnvironment(CSSParsingEnvironment& aCSSParseEnv)
 {
   NS_ASSERTION(mElement, "Something is severely broken -- there should be an Element here!");
 
-  aCSSParseEnv.mDocument = mElement->OwnerDoc();
-  aCSSParseEnv.mSheetURI = aCSSParseEnv.mDocument->GetDocumentURI();
+  nsIDocument* doc = mElement->OwnerDoc();
+  aCSSParseEnv.mSheetURI = doc->GetDocumentURI();
   aCSSParseEnv.mBaseURI = mElement->GetBaseURI();
   aCSSParseEnv.mPrincipal = mElement->NodePrincipal();
-  aCSSParseEnv.mCSSLoader = aCSSParseEnv.mDocument->CSSLoader();
+  aCSSParseEnv.mCSSLoader = doc->CSSLoader();
 }
 
 NS_IMETHODIMP
 nsDOMCSSAttributeDeclaration::GetParentRule(nsIDOMCSSRule **aParent)
 {
   NS_ENSURE_ARG_POINTER(aParent);
 
   *aParent = nullptr;
--- a/layout/style/nsDOMCSSDeclaration.cpp
+++ b/layout/style/nsDOMCSSDeclaration.cpp
@@ -14,17 +14,16 @@
 #include "mozilla/css/Rule.h"
 #include "mozilla/css/Declaration.h"
 #include "nsCSSProps.h"
 #include "nsCOMPtr.h"
 #include "nsIURL.h"
 #include "nsReadableUtils.h"
 #include "nsIPrincipal.h"
 #include "mozAutoDocUpdate.h"
-#include "nsStyleUtil.h"
 
 using namespace mozilla;
 
 nsDOMCSSDeclaration::~nsDOMCSSDeclaration()
 {
 }
 
 NS_INTERFACE_TABLE_HEAD(nsDOMCSSDeclaration)
@@ -88,35 +87,28 @@ nsDOMCSSDeclaration::SetCssText(const ns
   }
 
   CSSParsingEnvironment env;
   GetCSSParsingEnvironment(env);
   if (!env.mPrincipal) {
     return NS_ERROR_NOT_AVAILABLE;
   }
 
-  nsresult result;
-  if (env.mDocument && !nsStyleUtil::CSPAllowsInlineStyle(
-                                               env.mDocument->NodePrincipal(),
-                                               env.mDocument->GetDocumentURI(),
-                                                         0, aCssText, &result))
-    return result;
-
   // For nsDOMCSSAttributeDeclaration, SetCSSDeclaration will lead to
   // Attribute setting code, which leads in turn to BeginUpdate.  We
   // need to start the update now so that the old rule doesn't get used
   // between when we mutate the declaration and when we set the new
   // rule (see stack in bug 209575).
   mozAutoDocConditionalContentUpdateBatch autoUpdate(DocToUpdate(), true);
 
   nsAutoPtr<css::Declaration> decl(new css::Declaration());
   decl->InitializeEmpty();
   nsCSSParser cssParser(env.mCSSLoader);
   bool changed;
-  result = cssParser.ParseDeclarations(aCssText, env.mSheetURI,
+  nsresult result = cssParser.ParseDeclarations(aCssText, env.mSheetURI,
                                                 env.mBaseURI,
                                                 env.mPrincipal, decl, &changed);
   if (NS_FAILED(result) || !changed) {
     return result;
   }
 
   return SetCSSDeclaration(decl.forget());
 }
@@ -232,22 +224,21 @@ nsDOMCSSDeclaration::GetCSSParsingEnviro
 {
   nsIStyleSheet* sheet = aRule ? aRule->GetStyleSheet() : nullptr;
   nsRefPtr<nsCSSStyleSheet> cssSheet(do_QueryObject(sheet));
   if (!cssSheet) {
     aCSSParseEnv.mPrincipal = nullptr;
     return;
   }
 
-  aCSSParseEnv.mDocument = sheet->GetOwningDocument();
+  nsIDocument* document = sheet->GetOwningDocument();
   aCSSParseEnv.mSheetURI = sheet->GetSheetURI();
   aCSSParseEnv.mBaseURI = sheet->GetBaseURI();
   aCSSParseEnv.mPrincipal = cssSheet->Principal();
-  aCSSParseEnv.mCSSLoader = aCSSParseEnv.mDocument ?
-    aCSSParseEnv.mDocument->CSSLoader() : nullptr;
+  aCSSParseEnv.mCSSLoader = document ? document->CSSLoader() : nullptr;
 }
 
 nsresult
 nsDOMCSSDeclaration::ParsePropertyValue(const nsCSSProperty aPropID,
                                         const nsAString& aPropValue,
                                         bool aIsImportant)
 {
   css::Declaration* olddecl = GetCSSDeclaration(true);
@@ -256,34 +247,27 @@ nsDOMCSSDeclaration::ParsePropertyValue(
   }
 
   CSSParsingEnvironment env;
   GetCSSParsingEnvironment(env);
   if (!env.mPrincipal) {
     return NS_ERROR_NOT_AVAILABLE;
   }
 
-  nsresult result;
-  if (env.mDocument && !nsStyleUtil::CSPAllowsInlineStyle(
-                                                env.mDocument->NodePrincipal(),
-                                               env.mDocument->GetDocumentURI(),
-                                                       0, aPropValue, &result))
-    return result;
-
   // For nsDOMCSSAttributeDeclaration, SetCSSDeclaration will lead to
   // Attribute setting code, which leads in turn to BeginUpdate.  We
   // need to start the update now so that the old rule doesn't get used
   // between when we mutate the declaration and when we set the new
   // rule (see stack in bug 209575).
   mozAutoDocConditionalContentUpdateBatch autoUpdate(DocToUpdate(), true);
   css::Declaration* decl = olddecl->EnsureMutable();
 
   nsCSSParser cssParser(env.mCSSLoader);
   bool changed;
-  result = cssParser.ParseProperty(aPropID, aPropValue, env.mSheetURI,
+  nsresult result = cssParser.ParseProperty(aPropID, aPropValue, env.mSheetURI,
                                             env.mBaseURI, env.mPrincipal, decl,
                                             &changed, aIsImportant);
   if (NS_FAILED(result) || !changed) {
     if (decl != olddecl) {
       delete decl;
     }
     return result;
   }
@@ -294,27 +278,16 @@ nsDOMCSSDeclaration::ParsePropertyValue(
 nsresult
 nsDOMCSSDeclaration::RemoveProperty(const nsCSSProperty aPropID)
 {
   css::Declaration* decl = GetCSSDeclaration(false);
   if (!decl) {
     return NS_OK; // no decl, so nothing to remove
   }
 
-  CSSParsingEnvironment env;
-  GetCSSParsingEnvironment(env);
-
-  nsresult result;
-  if (env.mDocument && !nsStyleUtil::CSPAllowsInlineStyle(
-                                                env.mDocument->NodePrincipal(),
-                                               env.mDocument->GetDocumentURI(),
-                 0, NS_ConvertUTF8toUTF16(nsCSSProps::GetStringValue(aPropID)),
-                                                         &result))
-    return result;
-
   // For nsDOMCSSAttributeDeclaration, SetCSSDeclaration will lead to
   // Attribute setting code, which leads in turn to BeginUpdate.  We
   // need to start the update now so that the old rule doesn't get used
   // between when we mutate the declaration and when we set the new
   // rule (see stack in bug 209575).
   mozAutoDocConditionalContentUpdateBatch autoUpdate(DocToUpdate(), true);
 
   decl = decl->EnsureMutable();
--- a/layout/style/nsDOMCSSDeclaration.h
+++ b/layout/style/nsDOMCSSDeclaration.h
@@ -109,28 +109,26 @@ protected:
   virtual nsresult SetCSSDeclaration(mozilla::css::Declaration* aDecl) = 0;
   // Document that we must call BeginUpdate/EndUpdate on around the
   // calls to SetCSSDeclaration and the style rule mutation that leads
   // to it.
   virtual nsIDocument* DocToUpdate() = 0;
 
   // Information neded to parse a declaration.  We need the mSheetURI
   // for error reporting, mBaseURI to resolve relative URIs,
-  // mPrincipal for subresource loads, mDocument for determining
-  // if there's a CSP that should block inline style, and mCSSLoader
-  // for determining whether we're in quirks mode.  mBaseURI needs to be a
-  // strong pointer because of xml:base possibly creating base URIs on the
+  // mPrincipal for subresource loads, and mCSSLoader for determining
+  // whether we're in quirks mode.  mBaseURI needs to be a strong
+  // pointer because of xml:base possibly creating base URIs on the
   // fly.  This is why we don't use CSSParsingEnvironment as a return
   // value, to avoid multiple-refcounting of mBaseURI.
   struct CSSParsingEnvironment {
     nsIURI* mSheetURI;
     nsCOMPtr<nsIURI> mBaseURI;
     nsIPrincipal* mPrincipal;
     mozilla::css::Loader* mCSSLoader;
-    nsIDocument* mDocument;
   };
   
   // On failure, mPrincipal should be set to null in aCSSParseEnv.
   // If mPrincipal is null, the other members may not be set to
   // anything meaningful.
   virtual void GetCSSParsingEnvironment(CSSParsingEnvironment& aCSSParseEnv) = 0;
 
   // An implementation for GetCSSParsingEnvironment for callers wrapping
--- a/layout/style/nsStyleAnimation.cpp
+++ b/layout/style/nsStyleAnimation.cpp
@@ -22,17 +22,16 @@
 #include "mozilla/FloatingPoint.h"
 #include "mozilla/Likely.h"
 #include "prlog.h"
 #include "gfxMatrix.h"
 #include "gfxQuaternion.h"
 #include "nsPrintfCString.h"
 #include <cstdlib> // for std::abs(int/long)
 #include <cmath> // for std::abs(float/double)
-#include "nsStyleUtil.h"
 
 using namespace mozilla;
 
 // HELPER METHODS
 // --------------
 /*
  * Given two units, this method returns a common unit that they can both be
  * converted into, if possible.  This is intended to facilitate
@@ -2230,21 +2229,16 @@ BuildStyleRule(nsCSSProperty aProperty,
   nsAutoPtr<css::Declaration> declaration(new css::Declaration());
   declaration->InitializeEmpty();
 
   bool changed; // ignored, but needed as outparam for ParseProperty
   nsIDocument* doc = aTargetElement->OwnerDoc();
   nsCOMPtr<nsIURI> baseURI = aTargetElement->GetBaseURI();
   nsCSSParser parser(doc->CSSLoader());
 
-  if (!nsStyleUtil::CSPAllowsInlineStyle(doc->NodePrincipal(),
-                                         doc->GetDocumentURI(),
-                                         0, aSpecifiedValue, nullptr))
-    return nullptr;
-
   nsCSSProperty propertyToCheck = nsCSSProps::IsShorthand(aProperty) ?
     nsCSSProps::SubpropertyEntryFor(aProperty)[0] : aProperty;
 
   // Get a parser, parse the property, and check for CSS parsing errors.
   // If any of these steps fails, we bail out and delete the declaration.
   if (NS_FAILED(parser.ParseProperty(aProperty, aSpecifiedValue,
                                      doc->GetDocumentURI(), baseURI,
                                      aTargetElement->NodePrincipal(),
--- a/layout/style/nsStyleUtil.cpp
+++ b/layout/style/nsStyleUtil.cpp
@@ -15,17 +15,16 @@
 #include "nsIContent.h"
 #include "nsINameSpaceManager.h"
 #include "nsIURI.h"
 #include "nsNetUtil.h"
 #include "nsReadableUtils.h"
 #include "nsTextFormatter.h"
 #include "nsCSSProps.h"
 #include "nsRuleNode.h"
-#include "nsIContentSecurityPolicy.h"
 
 using namespace mozilla;
 
 //------------------------------------------------------------------------------
 // Font Algorithm Code
 //------------------------------------------------------------------------------
 
 // Compare two language strings
@@ -309,61 +308,8 @@ nsStyleUtil::IsSignificantChild(nsIConte
     return true;
   }
 
   return aTextIsSignificant && isText && aChild->TextLength() != 0 &&
          (aWhitespaceIsSignificant ||
           !aChild->TextIsOnlyWhitespace());
 }
 
-/* static */ bool
-nsStyleUtil::CSPAllowsInlineStyle(nsIPrincipal* aPrincipal,
-                                  nsIURI* aSourceURI,
-                                  uint32_t aLineNumber,
-                                  const nsSubstring& aStyleText,
-                                  nsresult* aRv)
-{
-  nsresult rv;
-
-  if (aRv) {
-    *aRv = NS_OK;
-  }
-
-  nsCOMPtr<nsIContentSecurityPolicy> csp;
-  rv = aPrincipal->GetCsp(getter_AddRefs(csp));
-
-  if (NS_FAILED(rv) && aRv) {
-    *aRv = rv;
-    return false;
-  }
-
-  if (csp) {
-    bool inlineOK;
-    rv = csp->GetAllowsInlineStyle(&inlineOK);
-    if (NS_FAILED(rv) && aRv) {
-      *aRv = rv;
-      return false;
-    }
-
-    if (!inlineOK) {
-      // Inline styles are not allowed by CSP, so report the violation and
-      // punt the style load.
-      nsAutoCString asciiSpec;
-      aSourceURI->GetAsciiSpec(asciiSpec);
-      nsAutoString styleText(aStyleText);
-
-      // cap the length of the style sample at 40 chars.
-      if (styleText.Length() > 40) {
-        styleText.Truncate(40);
-        styleText.Append(NS_LITERAL_STRING("..."));
-      }
-
-      csp->LogViolationDetails(nsIContentSecurityPolicy::VIOLATION_TYPE_INLINE_STYLE,
-                              NS_ConvertUTF8toUTF16(asciiSpec),
-                              aStyleText,
-                              aLineNumber);
-      // The inline style should be blocked.
-      return false;
-    }
-  }
-  // No CSP or a CSP that allows inline styles.
-  return true;
-}
--- a/layout/style/nsStyleUtil.h
+++ b/layout/style/nsStyleUtil.h
@@ -73,28 +73,12 @@ public:
   static float ColorComponentToFloat(uint8_t aAlpha);
 
   /*
    * Does this child count as significant for selector matching?
    */
   static bool IsSignificantChild(nsIContent* aChild,
                                    bool aTextIsSignificant,
                                    bool aWhitespaceIsSignificant);
-  /*
-   *  Does this principal have a CSP that blocks the application of
-   *  inline styles ? Returns false if application of the style should
-   *  be blocked.
-   *
-   *  Note that the principal passed in here needs to be the principal
-   *  of the document, not of the style sheet. The document's principal
-   *  is where any Content Security Policy that should be used to
-   *  block or allow inline styles will be located.
-   */
-  static bool CSPAllowsInlineStyle(nsIPrincipal* aPrincipal,
-                                   nsIURI* aSourceURI,
-                                   uint32_t aLineNumber,
-                                   const nsSubstring& aStyleText,
-                                   nsresult* aRv);
-
 };
 
 
 #endif /* nsStyleUtil_h___ */