diff tests/test-hgweb-commands.t @ 17421:3eb85477c0d9 stable

hgweb: avoid bad $$ processing in graph (issue3601) JavaScript .replace always magically processed $$ $& $' $` in replacement strings and thus displayed subject lines incorrectly in the graph view. Instead of regexps and .replace we now just create the strings the right way in the first place.
author Mads Kiilerich <mads@kiilerich.com>
date Wed, 29 Aug 2012 02:09:43 +0200
parents 7ac5800dbc8f
children d5a3bda6e170 ffe3630cb243
line wrap: on
line diff
--- a/tests/test-hgweb-commands.t	Wed Aug 29 13:16:56 2012 -0500
+++ b/tests/test-hgweb-commands.t	Wed Aug 29 02:09:43 2012 +0200
@@ -980,11 +980,6 @@
   var graph = new Graph();
   graph.scale(39);
   
-  var revlink = '<li style="_STYLE"><span class="desc">';
-  revlink += '<a class="list" href="/rev/_NODEID?style=gitweb" title="_NODEID"><b>_DESC</b></a>';
-  revlink += '</span> _TAGS';
-  revlink += '<span class="info">_DATE, by _USER</span></li>';
-  
   graph.vertex = function(x, y, color, parity, cur) {
   	
   	this.ctx.beginPath();
@@ -995,13 +990,6 @@
   	var bg = '<li class="bg parity' + parity + '"></li>';
   	var left = (this.columns + 1) * this.bg_height;
   	var nstyle = 'padding-left: ' + left + 'px;';
-  	var item = revlink.replace(/_STYLE/, nstyle);
-  	item = item.replace(/_PARITY/, 'parity' + parity);
-  	item = item.replace(/_NODEID/, cur[0]);
-  	item = item.replace(/_NODEID/, cur[0]);
-  	item = item.replace(/_DESC/, cur[3]);
-  	item = item.replace(/_USER/, cur[4]);
-  	item = item.replace(/_DATE/, cur[5]);
   	
   	var tagspan = '';
   	if (cur[7].length || cur[8].length || (cur[6][0] != 'default' || cur[6][1])) {
@@ -1028,7 +1016,11 @@
   		tagspan += '</span>';
   	}
   	
-  	item = item.replace(/_TAGS/, tagspan);
+  	var item = '<li style="' + nstyle + '"><span class="desc">';
+  	item += '<a class="list" href="/rev/' + cur[0] + '?style=gitweb" title="' + cur[0] + '"><b>' + cur[3] + '</b></a>';
+  	item += '</span> ' + tagspan + '';
+  	item += '<span class="info">' + cur[5] + ', by ' + cur[4] + '</span></li>';
+  
   	return [bg, item];
   	
   }