Bug 1453989 - Apply Meta CSP to Content Privileged about:checkerboard. r=ckerschb,Gijs
authorvinoth <cegvinoth@gmail.com>
Sat, 21 Apr 2018 02:16:30 +0300
changeset 468474 2398baa3198845ea904fcdee1f009dc11d0090bb
parent 468469 dd0e54d786743974a50a338059bcd68a09b6d5b2
child 468475 c007f07170a5b3b377f45ab63c6c508ab0ebb58f
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersckerschb, Gijs
bugs1453989
milestone61.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 1453989 - Apply Meta CSP to Content Privileged about:checkerboard. r=ckerschb,Gijs Reviewers: ckerschb, Gijs Reviewed By: ckerschb, Gijs Subscribers: Gijs, ckerschb Bug #: 1453989 Differential Revision: https://phabricator.services.mozilla.com/D944
modules/libpref/init/all.js
toolkit/components/aboutcheckerboard/content/aboutCheckerboard.css
toolkit/components/aboutcheckerboard/content/aboutCheckerboard.js
toolkit/components/aboutcheckerboard/content/aboutCheckerboard.xhtml
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -2454,17 +2454,17 @@ pref("security.directory",              
 pref("security.dialog_enable_delay", 1000);
 pref("security.notification_enable_delay", 500);
 
 pref("security.csp.enable", true);
 pref("security.csp.experimentalEnabled", false);
 pref("security.csp.enableStrictDynamic", true);
 
 #if defined(DEBUG) && !defined(ANDROID)
-pref("csp.content_privileged_about_uris_without_csp", "blank,cache,certerror,checkerboard,credits,home,logo,neterror,newtab,printpreview,srcdoc,studies");
+pref("csp.content_privileged_about_uris_without_csp", "blank,cache,certerror,credits,home,logo,neterror,newtab,printpreview,srcdoc,studies");
 #endif
 
 #ifdef NIGHTLY_BUILD
 pref("security.csp.enable_violation_events", true);
 #else
 pref("security.csp.enable_violation_events", false);
 #endif
 
--- a/toolkit/components/aboutcheckerboard/content/aboutCheckerboard.css
+++ b/toolkit/components/aboutcheckerboard/content/aboutCheckerboard.css
@@ -42,8 +42,16 @@ iframe {
     width: 100%;
     border: solid 1px black;
     margin-top: 0;
 }
 
 #trace {
     width: 100%;
 }
+
+#enabled {
+  color: red;
+}
+
+#enabled.enabled {
+  color: green;
+}
--- a/toolkit/components/aboutcheckerboard/content/aboutCheckerboard.js
+++ b/toolkit/components/aboutcheckerboard/content/aboutCheckerboard.js
@@ -21,23 +21,23 @@ function onLoad() {
     let bullet = document.createElement("li");
     bullet.appendChild(link);
     document.getElementById(reports[i].reason).appendChild(bullet);
   }
 }
 
 function updateEnabled() {
   let enabled = document.getElementById("enabled");
-  if (service.isRecordingEnabled()) {
+  let isEnabled = service.isRecordingEnabled();
+  if (isEnabled) {
     enabled.textContent = "enabled";
-    enabled.style.color = "green";
   } else {
     enabled.textContent = "disabled";
-    enabled.style.color = "red";
   }
+  enabled.classList.toggle("enabled", isEnabled);
 }
 
 function toggleEnabled() {
   service.setRecordingEnabled(!service.isRecordingEnabled());
   updateEnabled();
 }
 
 function flushReports() {
@@ -269,8 +269,28 @@ function togglePlay() {
 
 function stopPlay() {
     if (playing) {
         togglePlay();
     }
     currentFrame = 0;
     renderFrame();
 }
+
+document.getElementById("pauseButton").addEventListener("click", togglePlay);
+document.getElementById("stopButton").addEventListener("click", stopPlay);
+document.getElementById("enableToggleButton").addEventListener("click", toggleEnabled);
+document.getElementById("flushReportsButton").addEventListener("click", flushReports);
+document.getElementById("excludePageFromZoom").addEventListener("click", loadData);
+document.getElementById("stepForwardButton").addEventListener("click", function() {
+  step(false);
+});
+document.getElementById("forwardButton").addEventListener("click", function() {
+  reset(false);
+});
+document.getElementById("rewindButton").addEventListener("click", function() {
+  reset(true);
+});
+document.getElementById("stepBackButton").addEventListener("click", function() {
+  step(true);
+});
+window.addEventListener("load", onLoad);
+
--- a/toolkit/components/aboutcheckerboard/content/aboutCheckerboard.xhtml
+++ b/toolkit/components/aboutcheckerboard/content/aboutCheckerboard.xhtml
@@ -1,55 +1,56 @@
 <?xml version="1.0"?>
 
 <!-- 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/. -->
 
 <html xmlns="http://www.w3.org/1999/xhtml">
  <head>
+  <meta http-equiv="Content-Security-Policy" content="default-src chrome:" />
   <meta name="viewport" content="width=device-width"/>
   <link rel="stylesheet" href="chrome://global/content/aboutCheckerboard.css" type="text/css"/>
-  <script type="text/javascript" src="chrome://global/content/aboutCheckerboard.js"></script>
  </head>
 
- <body onload="onLoad()">
-  <p>Checkerboard recording is <span id="enabled" style="color: red">undetermined</span>.
-     <button onclick="toggleEnabled()">Toggle it!</button>.</p>
+ <body>
+  <p>Checkerboard recording is <span id="enabled">undetermined</span>.
+     <button id="enableToggleButton">Toggle it!</button>.</p>
   <p>If there are active reports in progress, you can stop and flush them by clicking here:
-     <button onclick="flushReports()">Flush active reports</button></p>
+     <button id="flushReportsButton">Flush active reports</button></p>
   <table class="listing" cellspacing="0">
    <tr>
     <th>Most severe checkerboarding reports</th>
     <th>Most recent checkerboarding reports</th>
    </tr>
    <tr>
     <td><ul id="severe"></ul></td>
     <td><ul id="recent"></ul></td>
    </tr>
   </table>
 
   <hr/>
 
   <div id="player">
    <div id="controls">
-    <button onclick="reset(true)">&#171;</button><!-- rewind button -->
-    <button onclick="step(true)">&lt;</button><!-- step back button -->
-    <button onclick="togglePlay()">|| &#9654;</button><!-- pause button -->
-    <button onclick="stopPlay()">&#9744;</button><!-- stop button -->
-    <button onclick="step(false)">&gt;</button><!-- step forward button -->
-    <button onclick="reset(false)">&#187;</button><!-- forward button -->
+    <button id="rewindButton">&#171;</button><!-- rewind button -->
+    <button id="stepBackButton">&lt;</button><!-- step back button -->
+    <button id="pauseButton">|| &#9654;</button><!-- pause button -->
+    <button id="stopButton">&#9744;</button><!-- stop button -->
+    <button id="stepForwardButton">&gt;</button><!-- step forward button -->
+    <button id="forwardButton">&#187;</button><!-- forward button -->
    </div>
    <canvas id="canvas" width="800" height="600">Canvas not supported!</canvas>
    <pre id="active">(Details for currently visible replay frame)</pre>
   </div>
 
   <hr/>
 
   <div id="raw">
    Raw log:<br/>
    <textarea id="trace" rows="10"></textarea>
    <div>
-    <input type="checkbox" id="excludePageFromZoom" onclick="loadData()"/><label for="excludePageFromZoom">Exclude page coordinates from zoom calculations</label><br/>
+    <input type="checkbox" id="excludePageFromZoom"/><label for="excludePageFromZoom">Exclude page coordinates from zoom calculations</label><br/>
    </div>
   </div>
  </body>
+ <script type="text/javascript" src="chrome://global/content/aboutCheckerboard.js"></script>
 </html>