Bug 1191113 - Add localizable string for security csp in gcli (r=jwalker)
authorChristoph Kerschbaumer <mozilla@christophkerschbaumer.com>
Thu, 06 Aug 2015 11:20:58 -0700
changeset 288336 2170e194fe60ddff425857c59272c94661748d7a
parent 288335 46f635f60ee06ed202d0c2fe9cfa7303bbf06f7b
child 288337 f4610f8fd0be8a1d5b6c59f6aac5c26a3fb37ce9
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwalker
bugs1191113
milestone42.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 1191113 - Add localizable string for security csp in gcli (r=jwalker)
toolkit/devtools/gcli/commands/security.js
toolkit/locales/en-US/chrome/global/devtools/gclicommands.properties
--- a/toolkit/devtools/gcli/commands/security.js
+++ b/toolkit/devtools/gcli/commands/security.js
@@ -13,32 +13,32 @@
 const { Cc, Ci, Cu, CC } = require("chrome");
 const l10n = require("gcli/l10n");
 const CSP = Cc["@mozilla.org/cspcontext;1"].getService(Ci.nsIContentSecurityPolicy);
 
 const GOOD_IMG_SRC = "chrome://browser/content/gcli_sec_good.svg";
 const MOD_IMG_SRC = "chrome://browser/content/gcli_sec_moderate.svg";
 const BAD_IMG_SRC = "chrome://browser/content/gcli_sec_bad.svg";
 
-const CONTENT_SECURITY_POLICY = "Content-Security-Policy";
-const CONTENT_SECURITY_POLICY_REPORT_ONLY = "Content-Security-Policy-Report-Only";
 
 // special handling within policy
 const POLICY_REPORT_ONLY = "report-only"
 
 // special handling of directives
 const DIR_UPGRADE_INSECURE = "upgrade-insecure-requests";
 
 // special handling of sources
 const SRC_UNSAFE_INLINE = "'unsafe-inline'";
 const SRC_UNSAFE_EVAL = "'unsafe-eval'";
 
 const WILDCARD_MSG = l10n.lookup("securityCSPRemWildCard");
 const XSS_WARNING_MSG = l10n.lookup("securityCSPPotentialXSS");
-
+const NO_CSP_ON_PAGE_MSG = l10n.lookup("securityCSPNoCSPOnPage");
+const CONTENT_SECURITY_POLICY_MSG = l10n.lookup("securityCSPHeaderOnPage");
+const CONTENT_SECURITY_POLICY_REPORT_ONLY_MSG = l10n.lookup("securityCSPROHeaderOnPage");
 
 exports.items = [
   {
     // --- General Security information
     name: "security",
     description: l10n.lookup("securityDesc"),
     manual: l10n.lookup("securityManual")
   },
@@ -60,26 +60,26 @@ exports.items = [
       var policies = cspOBJ["csp-policies"];
 
       // loop over all the different policies
       for (var csp in policies) {
         var curPolicy = policies[csp];
 
         // loop over all the directive-values within that policy
         var outDirectives = [];
-        var outHeader = CONTENT_SECURITY_POLICY;
+        var outHeader = CONTENT_SECURITY_POLICY_MSG;
         for (var dir in curPolicy) {
           var curDir = curPolicy[dir];
 
           // when iterating properties within the obj we might also
           // encounter the 'report-only' flag, which is not a csp directive.
           if (dir === POLICY_REPORT_ONLY) {
             outHeader = curPolicy[POLICY_REPORT_ONLY] === true ?
-                          CONTENT_SECURITY_POLICY_REPORT_ONLY :
-                          CONTENT_SECURITY_POLICY;
+                          CONTENT_SECURITY_POLICY_REPORT_ONLY_MSG :
+                          CONTENT_SECURITY_POLICY_MSG;
             continue;
           }
 
           // loop over all the directive-sources within that directive
           var outSrcs = [];
 
           // special case handling for upgrade-insecure-requests
           // which does not have any srcs
@@ -135,27 +135,27 @@ exports.items = [
       var uri = context.environment.document.documentURI;
 
       if (cspInfo.length == 0) {
         return context.createView({
           html:
             "<table class='gcli-csp-detail' cellspacing='10' valign='top'>" +
             "  <tr>" +
             "    <td> <img src='chrome://browser/content/gcli_sec_bad.svg' width='20px' /> </td> " +
-            "    <td> Could not find any 'Content-Security-Policy' for <b>" + uri + "</b></td>" +
+            "    <td>" + NO_CSP_ON_PAGE_MSG + " <b>" + uri + "</b></td>" +
             "  </tr>" +
             "</table>"});
       }
 
       return context.createView({
         html:
           "<table class='gcli-csp-detail' cellspacing='10' valign='top'>" +
           // iterate all policies
           "  <tr foreach='csp in ${cspinfo}' >" +
-          "    <td> ${csp.header} for: <b>" + uri + "</b><br/><br/>" +
+          "    <td> ${csp.header} <b>" + uri + "</b><br/><br/>" +
           "      <table class='gcli-csp-dir-detail' valign='top'>" +
           // >> iterate all directives
           "        <tr foreach='dir in ${csp.directives}' >" +
           "          <td valign='top'> ${dir.dirValue} </td>" +
           "          <td valign='top'>" +
           "            <table class='gcli-csp-src-detail' valign='top'>" +
           // >> >> iterate all srs
           "              <tr foreach='src in ${dir.dirSrc}' >" +
--- a/toolkit/locales/en-US/chrome/global/devtools/gclicommands.properties
+++ b/toolkit/locales/en-US/chrome/global/devtools/gclicommands.properties
@@ -1578,16 +1578,20 @@ securityDesc=Display supported security 
 securityManual=Commands to list and get suggestions about security features for the current domain.
 securityListDesc=Display security features
 securityListManual=Display a list of all relevant security features of the current page.
 # CSP specific
 securityCSPDesc=Display CSP specific security features
 securityCSPManual=Display feedback about the CSP applied to the current page.
 securityCSPRemWildCard=Can you remove the wildcard(*)?
 securityCSPPotentialXSS=Potential XSS vulnerability!
+# LOCALIZATION NOTE: do not translate 'Content-Security-Policy'
+securityCSPNoCSPOnPage=Could not find Content-Security-Policy for
+securityCSPHeaderOnPage=Content-Security-Policy for
+securityCSPROHeaderOnPage=Content-Security-Policy-Report-Only for
 
 # LOCALIZATION NOTE (rulersDesc) A very short description of the
 # 'rulers' command. See rulersManual for a fuller description of what
 # it does. This string is designed to be shown in a menu alongside the
 # command name, which is why it should be as short as possible.
 rulersDesc=Toggle rulers for the page
 
 # LOCALIZATION NOTE (rulersManual) A fuller description of the 'rulers'