Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(78)

Issue 109100: Refactor TemplateCompiler to make it easier to reuse the attribute sanitizer (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
16 years, 9 months ago by MikeSamuel
Modified:
16 years, 9 months ago
Reviewers:
metaweta
CC:
google-caja-discuss_googlegroups.com
Base URL:
http://google-caja.googlecode.com/svn/trunk/
Visibility:
Public.

Description

To make it easier to reuse the HTML attribute sanitizer, I moved all the code in TemplateCompiler that dealt with attribute values into a separate class: HtmlAttributeRewriter. I created HtmlAttributeRewriter by doing (svn cp ...) so you should be able to see the diffs between the two files which should be more instructive than reading HtmlAttributeRewriter line by line. I also reorganized the code that generates expressions from strings and dynamic bits, since that's critical to generating code from templates. See JsConcatenator. Also simplified CssRewriter -- it requires a PluginEnvironment but nothing else from PluginMeta. Submitted @3667

Patch Set 1 #

Total comments: 2

Patch Set 2 : Refactor TemplateCompiler to make it easier to reuse the attribute sanitizer #

Unified diffs Side-by-side diffs Delta from patch set Stats (+795 lines, -806 lines) Patch
M src/com/google/caja/plugin/CssRewriter.java View 1 3 chunks +6 lines, -8 lines 0 comments Download
M src/com/google/caja/plugin/html-sanitizer.js View 1 1 chunk +1 line, -1 line 0 comments Download
M src/com/google/caja/plugin/stages/ValidateCssStage.java View 1 1 chunk +1 line, -1 line 0 comments Download
A + src/com/google/caja/plugin/templates/HtmlAttributeRewriter.java View 12 chunks +124 lines, -281 lines 0 comments Download
A src/com/google/caja/plugin/templates/JsConcatenator.java View 1 chunk +376 lines, -0 lines 0 comments Download
M src/com/google/caja/plugin/templates/QuasiUtil.java View 1 2 chunks +0 lines, -24 lines 0 comments Download
M src/com/google/caja/plugin/templates/SafeCssMaker.java View 1 1 chunk +5 lines, -7 lines 0 comments Download
M src/com/google/caja/plugin/templates/TemplateCompiler.java View 1 9 chunks +9 lines, -336 lines 0 comments Download
M src/com/google/caja/render/SourceSnippetRenderer.java View 1 5 chunks +6 lines, -15 lines 0 comments Download
M tests/com/google/caja/AllTests.java View 1 4 chunks +86 lines, -82 lines 0 comments Download
M tests/com/google/caja/plugin/CssRewriterTest.java View 1 2 chunks +32 lines, -34 lines 0 comments Download
A tests/com/google/caja/plugin/templates/JsConcatenatorTest.java View 1 1 chunk +119 lines, -0 lines 0 comments Download
M tests/com/google/caja/plugin/templates/TemplateCompilerTest.java View 1 6 chunks +30 lines, -17 lines 0 comments Download

Messages

Total messages: 3
MikeSamuel
16 years, 9 months ago (2009-08-27 02:42:58 UTC) #1
metaweta
LGTM http://codereview.appspot.com/109100/diff/1/4 File tests/com/google/caja/plugin/templates/JsConcatenatorTest.java (right): http://codereview.appspot.com/109100/diff/1/4#newcode85 Line 85: "new Date(year, month, day)"); Maybe also test ...
16 years, 9 months ago (2009-08-27 20:48:53 UTC) #2
MikeSamuel
16 years, 9 months ago (2009-08-27 20:54:27 UTC) #3
http://codereview.appspot.com/109100/diff/1/4
File tests/com/google/caja/plugin/templates/JsConcatenatorTest.java (right):

http://codereview.appspot.com/109100/diff/1/4#newcode85
Line 85: "new Date(year, month, day)");
On 2009/08/27 20:48:53, metaweta wrote:
> Maybe also test "+ new Date", which returns a number.

Done.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b