Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
50a6d3b4
Commit
50a6d3b4
authored
Oct 08, 2012
by
Frédéric Buclin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 795650: Cache the HTML::Scrubber object for improved performance
r=glob a=LpSolit
parent
a6ff444d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
8 deletions
+11
-8
Util.pm
Bugzilla/Util.pm
+11
-8
No files found.
Bugzilla/Util.pm
View file @
50a6d3b4
...
...
@@ -96,6 +96,9 @@ sub html_quote {
sub
html_light_quote
{
my
(
$text
)
=
@_
;
# admin/table.html.tmpl calls |FILTER html_light| many times.
# There is no need to recreate the HTML::Scrubber object again and again.
my
$scrubber
=
Bugzilla
->
process_cache
->
{
html_scrubber
};
# List of allowed HTML elements having no attributes.
my
@allow
=
qw(b strong em i u p br abbr acronym ins del cite code var
...
...
@@ -117,7 +120,7 @@ sub html_light_quote {
$text
=~
s
#$chr($safe)$chr#<$1>#go;
return
$text
;
}
els
e
{
els
if
(
!
$scrubber
)
{
# We can be less restrictive. We can accept elements with attributes.
push
(
@allow
,
qw(a blockquote q span)
);
...
...
@@ -161,14 +164,14 @@ sub html_light_quote {
},
);
my
$scrubber
=
HTML::
Scrubber
->
new
(
default
=>
\
@default
,
allow
=>
\
@allow
,
rules
=>
\
@rules
,
comment
=>
0
,
process
=>
0
);
return
$scrubber
->
scrub
(
$text
);
Bugzilla
->
process_cache
->
{
html_scrubber
}
=
$scrubber
=
HTML::
Scrubber
->
new
(
default
=>
\
@default
,
allow
=>
\
@allow
,
rules
=>
\
@rules
,
comment
=>
0
,
process
=>
0
);
}
return
$scrubber
->
scrub
(
$text
);
}
sub
email_filter
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment