commit cb52be935989820f06e092f5bb415f1dc5da4a51
parent 90c194e6ac537b0fc4393abc9a7d778548242119
Author: Brendan Gregg <brendan.d.gregg@gmail.com>
Date: Sat, 27 Jun 2015 17:02:26 -0700
Merge pull request #53 from xmo-odoo/patch-1
Fix quoting in mouseover
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/flamegraph.pl b/flamegraph.pl
@@ -794,6 +794,7 @@ while (my ($id, $node) = each %Node) {
$escaped_func =~ s/&/&/g;
$escaped_func =~ s/</</g;
$escaped_func =~ s/>/>/g;
+ $escaped_func =~ s/"/"/g;
unless (defined $delta) {
$info = "$escaped_func ($samples_txt $countname, $pct%)";
} else {
@@ -805,8 +806,10 @@ while (my ($id, $node) = each %Node) {
}
my $nameattr = { %{ $nameattr{$func}||{} } }; # shallow clone
+ my $jsinfo = $info;
+ $jsinfo =~ s/'/\\'/g;
$nameattr->{class} ||= "func_g";
- $nameattr->{onmouseover} ||= "s('".$info."')";
+ $nameattr->{onmouseover} ||= "s('".$jsinfo."')";
$nameattr->{onmouseout} ||= "c()";
$nameattr->{onclick} ||= "zoom(this)";
$nameattr->{title} ||= $info;