Bug 1194856 - Load noscript.css and noframes.css from data: URLs in release builds. r=dbaron
authorCameron McCormack <cam@mcc.id.au>
Thu, 10 Sep 2015 13:24:12 +1000
changeset 294311 d05b4fbebba817e30ca6eefb73ca3c3b4bc2d70a
parent 294310 f98e6bf596316ff4b3534317c9c37e0ba5ad9596
child 294312 c1d187c685d1a00d8f0cd521fb34b250ccf7124b
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs1194856
milestone43.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 1194856 - Load noscript.css and noframes.css from data: URLs in release builds. r=dbaron
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)