go/src/html/template
Samuel Tan a005a8d1b4 html/template: use the same escaper across multiple template executions
The escaper contains information about which templates have already been
visited and escaped. This information is necessary to prevent templates
that have already been escaped from being over-escaped. However, since we
currently create a new escaper each time we execute a template, this
information does not persist across multiple template executions.

Fix this by saving an escaper in each template name space which is shared by
all templates in that name space.

While there, fix error message formatting for an escaping unit test.

Fixes #20842

Change-Id: Ie392c3e7ce0e0a9947bdf56c99e926e7c7db76e4
Reviewed-on: https://go-review.googlesource.com/47256
Reviewed-by: Mike Samuel <mikesamuel@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-07-14 18:19:04 +00:00
..
attr.go html/template: ignore case when handling type attribute in script element 2017-04-20 18:53:09 +00:00
clone_test.go html/template: fix multiple Clones of redefined template 2016-11-15 04:30:20 +00:00
content.go
content_test.go
context.go
css.go
css_test.go
doc.go html/template: allow safe usage of predefined escapers in pipelines 2017-05-05 18:56:31 +00:00
error.go html/template: allow safe usage of predefined escapers in pipelines 2017-05-05 18:56:31 +00:00
escape.go html/template: use the same escaper across multiple template executions 2017-07-14 18:19:04 +00:00
escape_test.go html/template: use the same escaper across multiple template executions 2017-07-14 18:19:04 +00:00
example_test.go
examplefiles_test.go
html.go
html_test.go
js.go html/template: ensure that MIME type handling is case insensitive 2017-04-20 18:11:25 +00:00
js_test.go html/template: lock in application/json as valid JS test 2016-12-04 03:59:31 +00:00
template.go html/template: use the same escaper across multiple template executions 2017-07-14 18:19:04 +00:00
template_test.go
transition.go html/template: use bytes.ContainsAny 2017-04-25 23:36:25 +00:00
transition_test.go
url.go html/template: typo fix 2016-11-14 21:28:31 +00:00
url_test.go