Bug 1194856 - Load noscript.css and noframes.css from data: URLs in release builds. r=dbaron a=ritu
authorCameron McCormack <cam@mcc.id.au>
Thu, 10 Sep 2015 13:24:12 +1000
changeset 282207 dd173dae22f14f92adfb87ae6ca2ff7235301f14
parent 282206 7e65fa0cf0c937d54ad6cbe7d4cae42a95a3d950
child 282208 360c43a9bb74d1aa5596c692584d8c1a439f6838
push id5056
push userkwierso@gmail.com
push dateThu, 10 Sep 2015 18:24:25 +0000
treeherdermozilla-beta@dd173dae22f1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron, ritu
bugs1194856
milestone41.0
Bug 1194856 - Load noscript.css and noframes.css from data: URLs in release builds. r=dbaron a=ritu
layout/style/noframes.css
layout/style/noscript.css
layout/style/nsLayoutStylesheetCache.cpp
--- a/layout/style/noframes.css
+++ b/layout/style/noframes.css
@@ -1,13 +1,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* This sheet is added to the style set for documents with frames disabled */
 
+/* Until bug 1194856 is fixed, if you update this file you should also update
+   the data: URL in nsLayoutStylesheetCache::NoFramesSheet(). */
+
 noframes {
   display: block;
 }
 
 frame, frameset, iframe {
   display: none !important;
 }
--- a/layout/style/noscript.css
+++ b/layout/style/noscript.css
@@ -1,9 +1,12 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* This sheet is added to the style set for documents with script disabled */
 
+/* Until bug 1194856 is fixed, if you update this file you should also update
+   the data: URL in nsLayoutStylesheetCache::NoScriptSheet(). */
+
 noscript {
   display: none !important;
 }
--- a/layout/style/nsLayoutStylesheetCache.cpp
+++ b/layout/style/nsLayoutStylesheetCache.cpp
@@ -193,30 +193,43 @@ nsLayoutStylesheetCache::CounterStylesSh
 }
 
 CSSStyleSheet*
 nsLayoutStylesheetCache::NoScriptSheet()
 {
   EnsureGlobal();
 
   if (!gStyleCache->mNoScriptSheet) {
-    LoadSheetURL("resource://gre-resources/noscript.css",
+    // If you update the data: URL, also update noscript.css  (See bug 1194856.)
+    LoadSheetURL(
+#ifdef RELEASE_BUILD
+                 "data:text/css,noscript { display%3A none !important%3B }",
+#else
+                 "resource://gre-resources/noscript.css",
+#endif
                  gStyleCache->mNoScriptSheet, true);
   }
 
   return gStyleCache->mNoScriptSheet;
 }
 
 CSSStyleSheet*
 nsLayoutStylesheetCache::NoFramesSheet()
 {
   EnsureGlobal();
 
   if (!gStyleCache->mNoFramesSheet) {
-    LoadSheetURL("resource://gre-resources/noframes.css",
+    // If you update the data: URL, also update noframes.css  (See bug 1194856.)
+    LoadSheetURL(
+#ifdef RELEASE_BUILD
+                 "data:text/css,noframes { display%3A block%3B } "
+                 "frame%2C frameset%2C iframe { display%3A none !important%3B }",
+#else
+                 "resource://gre-resources/noframes.css",
+#endif
                  gStyleCache->mNoFramesSheet, true);
   }
 
   return gStyleCache->mNoFramesSheet;
 }
 
 /* static */ CSSStyleSheet*
 nsLayoutStylesheetCache::ChromePreferenceSheet(nsPresContext* aPresContext)