hgtemplates: port 4.1 template changes to gitweb_mozilla (bug 1333616); r?glob draft
authorGregory Szorc <gps@mozilla.com>
Mon, 03 Apr 2017 16:31:44 -0700
changeset 10652 fc3237220096ac25b45372dc4fcd163de4caaed4
parent 10651 7d6a4df4a64373d0b648ee151c7b63c6edeeb719
push id1601
push userbmo:gps@mozilla.com
push dateMon, 03 Apr 2017 23:52:01 +0000
reviewersglob
bugs1333616
hgtemplates: port 4.1 template changes to gitweb_mozilla (bug 1333616); r?glob gitweb_mozilla is our fork of the gitweb style. Every release, we have to port changes to the gitweb style to gitweb_mozilla. The changes in this release weren't too bad. process_dates() was factored into mercurial.js, so we can delete it. In order to support CSP, all <script> instances now have some template boilerplate to automatically emit a CSP nonce. The only non-obvious change was pushlog.tmpl had a <script> that needed to be taught about a nonce. MozReview-Commit-ID: Cwl4dWEY0Ji
hgtemplates/gitweb_mozilla/footer.tmpl
hgtemplates/gitweb_mozilla/graph.tmpl
hgtemplates/gitweb_mozilla/index.tmpl
hgtemplates/gitweb_mozilla/pushlog.tmpl
hgtemplates/gitweb_mozilla/shortlog.tmpl
--- a/hgtemplates/gitweb_mozilla/footer.tmpl
+++ b/hgtemplates/gitweb_mozilla/footer.tmpl
@@ -1,9 +1,8 @@
-<script type="text/javascript">process_dates()</script>
 <div class="page_footer">
 <div class="page_footer_text">{repo|escape}</div>
 <div class="page_footer_text" style="padding-left: 10px">Deployed from <a href="https://hg.mozilla.org/hgcustom/version-control-tools/rev/VCTNODE">VCTNODE</a> at DEPLOYDATE.</div>
 <div class="rss_logo">
 <a href="{url|urlescape}rss-log">RSS</a>
 <a href="{url|urlescape}atom-log">Atom</a>
 </div>
 <br />
--- a/hgtemplates/gitweb_mozilla/graph.tmpl
+++ b/hgtemplates/gitweb_mozilla/graph.tmpl
@@ -41,17 +41,17 @@ graph |
 <noscript>The revision graph only works with JavaScript-enabled browsers.</noscript>
 
 <div id="wrapper">
 <ul id="nodebgs"></ul>
 <canvas id="graph" width="{canvaswidth}" height="{canvasheight}"></canvas>
 <ul id="graphnodes"></ul>
 </div>
 
-<script>
+<script{if(nonce, ' nonce="{nonce}"')}>
 <!-- hide script content
 
 var data = {jsdata|json};
 var graph = new Graph();
 graph.scale({bg_height});
 
 graph.vertex = function(x, y, color, parity, cur) \{
 	
@@ -104,17 +104,17 @@ graph.render(data);
 </script>
 
 <div class="page_nav">
 <a href="{url|urlescape}graph/{symrev}{lessvars%urlparameter}">less</a>
 <a href="{url|urlescape}graph/{symrev}{morevars%urlparameter}">more</a>
 | {changenav%navgraph}
 </div>
 
-<script type="text/javascript">
+<script type="text/javascript"{if(nonce, ' nonce="{nonce}"')}>
     ajaxScrollInit(
             '{url|urlescape}graph/{rev}?revcount=%next%&style={style}',
             {revcount}+60,
             function (htmlText, previousVal) \{ return previousVal + 60; },
             '#wrapper',
             '<div class="%class%" style="text-align: center;">%text%</div>',
             'graph'
     );
--- a/hgtemplates/gitweb_mozilla/index.tmpl
+++ b/hgtemplates/gitweb_mozilla/index.tmpl
@@ -148,11 +148,10 @@
     <tr>
         <td><a href="/www">www</a></td>
         <td>Code related to various mozilla websites</td>
     </tr>
 </table>
 <div class="page_footer">
 {motd}
 </div>
-<script type="text/javascript">process_dates()</script>
 </body>
 </html>
--- a/hgtemplates/gitweb_mozilla/pushlog.tmpl
+++ b/hgtemplates/gitweb_mozilla/pushlog.tmpl
@@ -3,17 +3,17 @@
 <link rel="alternate" type="application/atom+xml"
    href="{url|urlescape}pushlog" title="Atom feed for {repo|escape} pushlog"/>
 <style type="text/css">
 #localize, .expand \{
   font-size: x-small;
 }
 </style>
 <script type="text/javascript" src="{staticurl}jquery-1.2.6.min.js"></script>
-<script type="text/javascript">// <![CDATA[
+<script type="text/javascript"{if(nonce, ' nonce="{nonce}"')}>// <![CDATA[
 $(document).ready(function () \{
   // add click handler to the localize dates link
   $('#localize').show().click(function () \{
      $(this).hide();
      $('.date').each(function (i) \{
        $(this).text(new Date($(this).text()).toLocaleString());
      });
      return false;
--- a/hgtemplates/gitweb_mozilla/shortlog.tmpl
+++ b/hgtemplates/gitweb_mozilla/shortlog.tmpl
@@ -36,17 +36,17 @@ shortlog |
 <table class="shortlogtable" cellspacing="0">
 {entries%shortlogentry}
 </table>
 
 <div class="page_nav">
 {changenav%navshort}
 </div>
 
-<script type="text/javascript">
+<script type="text/javascript"{if(nonce, ' nonce="{nonce}"')}>
     ajaxScrollInit(
             '{url|urlescape}shortlog/%next%{sessionvars%urlparameter}',
             '{nextentry%"{node}"}', <!-- NEXTHASH
             function (htmlText, previousVal) \{
                 var m = htmlText.match(/'(\w+)', <!-- NEXTHASH/);
                 return m ? m[1] : null;
             },
             '.shortlogtable > tbody:nth-of-type(1)',