DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Mercurial (cf424d6d4bb6)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
Index: Bugzilla/Template.pm
===================================================================
RCS file: /cvsroot/mozilla/webtools/bugzilla/Bugzilla/Template.pm,v
retrieving revision 1.99.2.3
diff -5 -p -u -r1.99.2.3 Template.pm
--- Bugzilla/Template.pm	26 Sep 2009 23:37:22 -0000	1.99.2.3
+++ Bugzilla/Template.pm	26 Oct 2009 19:00:15 -0000
@@ -495,10 +495,22 @@ sub create {
                 $var =~ s/\@/\\x40/g; # anti-spam for email addresses
                 $var =~ s/</\\x3c/g;
                 return $var;
             },
             
+            # Sadly, different to the above. See http://www.json.org/ 
+            # for details.
+            json => sub {
+                my ($var) = @_;
+                $var =~ s/([\\\"\/])/\\$1/g;
+                $var =~ s/\n/\\n/g;
+                $var =~ s/\r/\\r/g;
+                $var =~ s/\f/\\f/g;
+                $var =~ s/\t/\\t/g;
+                return $var;
+            },
+            
             # Converts data to base64
             base64 => sub {
                 my ($data) = @_;
                 return encode_base64($data);
             },