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

Issue 126062: Modify Safe HTML Maker to optionally emit HTML as part of the JS. (Closed)

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

Description

1. Modify SafeHtmlMaker to optionally emit its HTML as part of the JS, as calls on the HTML emitter. This makes it possible to cajole some HTML to pure JS. This change envisions the following scenarios: a. Cajoling HTML->HTML is mainly for containers that compose their HTML pages server-side and wish to optimize startup latency. b. Cajoling HTML->JS is mainly for containers that dynamically embed plugins and wish to use the simplicity of the module system, or the cross site capability of <script> loading. 2. Updated the cajoling service (and some upstream components) to allow a new Caja module format -- one that provides a JSONP-style callback function. So in addition to the classic: ___.loadModule({...}); we can now emit: customCallback(___.prepareModule({...})); where "customCallback" is something the client asked for. As an immediate use for this, a future change will take advantage of this in the <script> module loader, so that the <script> module loader will no longer be so fragile when container pages change the default module handler.

Patch Set 1 #

Patch Set 2 : Modify Safe HTML Maker to optionally emit HTML as part of the JS. #

Patch Set 3 : Modify Safe HTML Maker to optionally emit HTML as part of the JS. #

Patch Set 4 : Modify Safe HTML Maker to optionally emit HTML as part of the JS. #

Patch Set 5 : Optionally emit HTML as part of the JS and provide JSONP-style callbacks. #

Patch Set 6 : Optionally emit HTML as part of the JS and provide JSONP-style callbacks. #

Patch Set 7 : Optionally emit HTML as part of the JS and provide JSONP-style callbacks. #

Total comments: 50

Patch Set 8 : Optionally emit HTML as part of the JS and provide JSONP-style callbacks. #

Patch Set 9 : Optionally emit HTML as part of the JS and provide JSONP-style callbacks. #

Patch Set 10 : Optionally emit HTML as part of the JS and provide JSONP-style callbacks. #

Total comments: 11

Patch Set 11 : Optionally emit HTML as part of the JS and provide JSONP-style callbacks. #

Patch Set 12 : Optionally emit HTML as part of the JS and provide JSONP-style callbacks. #

Total comments: 14

Patch Set 13 : Optionally emit HTML as part of the JS and provide JSONP-style callbacks. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+954 lines, -335 lines) Patch
M src/com/google/caja/parser/js/CajoledModule.java View 5 6 7 8 9 10 11 5 chunks +130 lines, -11 lines 0 comments Download
M src/com/google/caja/plugin/PluginMeta.java View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +9 lines, -0 lines 0 comments Download
M src/com/google/caja/plugin/html-emitter.js View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +15 lines, -0 lines 0 comments Download
M src/com/google/caja/plugin/stages/CompileHtmlStage.java View 12 3 chunks +31 lines, -1 line 0 comments Download
A src/com/google/caja/service/CajaArguments.java View 4 5 6 7 1 chunk +103 lines, -0 lines 0 comments Download
M src/com/google/caja/service/CajolingService.java View 3 4 5 6 7 8 9 10 11 6 chunks +62 lines, -43 lines 0 comments Download
M src/com/google/caja/service/ContentHandler.java View 3 4 5 6 7 8 9 10 11 2 chunks +17 lines, -6 lines 0 comments Download
A src/com/google/caja/service/ContentHandlerArgs.java View 1 chunk +49 lines, -0 lines 0 comments Download
M src/com/google/caja/service/GadgetHandler.java View 3 4 5 6 7 8 9 10 11 1 chunk +9 lines, -3 lines 0 comments Download
M src/com/google/caja/service/HtmlHandler.java View 3 4 5 6 7 8 9 10 11 7 chunks +93 lines, -33 lines 0 comments Download
M src/com/google/caja/service/ImageHandler.java View 3 4 5 6 7 8 9 10 11 1 chunk +9 lines, -3 lines 0 comments Download
M src/com/google/caja/service/InnocentHandler.java View 3 4 5 6 7 8 9 10 11 1 chunk +9 lines, -3 lines 0 comments Download
A src/com/google/caja/service/InvalidArgumentsException.java View 1 chunk +64 lines, -0 lines 0 comments Download
M src/com/google/caja/service/JsHandler.java View 3 4 5 6 7 8 9 10 11 5 chunks +46 lines, -13 lines 0 comments Download
M src/com/google/caja/service/LooseContentTypeCheck.java View 5 6 7 8 9 10 11 2 chunks +7 lines, -2 lines 0 comments Download
M tests/com/google/caja/parser/quasiliteral/ModuleFormatTest.java View 5 6 7 8 9 10 11 3 chunks +103 lines, -1 line 0 comments Download
M tests/com/google/caja/parser/quasiliteral/testModule.co.js View 10 11 2 chunks +2 lines, -2 lines 0 comments Download
M tests/com/google/caja/plugin/html-emitter-test.html View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +15 lines, -2 lines 0 comments Download
A + tests/com/google/caja/plugin/stages/CompileHtmlStageTest.java View 2 chunks +38 lines, -199 lines 0 comments Download
M tests/com/google/caja/plugin/stages/PipelineStageTestCase.java View 1 chunk +1 line, -1 line 0 comments Download
M tests/com/google/caja/service/HtmlHandlerTest.java View 3 4 5 6 7 8 9 10 11 3 chunks +101 lines, -5 lines 0 comments Download
M tests/com/google/caja/service/JsHandlerTest.java View 3 4 5 6 7 8 9 10 11 1 chunk +23 lines, -4 lines 0 comments Download
M tests/com/google/caja/service/ServiceTestCase.java View 3 4 5 6 7 8 9 10 11 2 chunks +18 lines, -3 lines 0 comments Download

Messages

Total messages: 22
ihab.awad
16 years, 8 months ago (2009-10-07 00:11:09 UTC) #1
ihab.awad
Adding jasvir as reviewer.
16 years, 8 months ago (2009-10-07 00:12:22 UTC) #2
ihab.awad
Ready for review. My intention is for mikesamuel to focus on the SafeHtmlMaker (and related) ...
16 years, 8 months ago (2009-10-07 22:19:15 UTC) #3
metaweta
LGTM http://codereview.appspot.com/126062/diff/2028/3041 File src/com/google/caja/plugin/templates/SafeHtmlMaker.java (right): http://codereview.appspot.com/126062/diff/2028/3041#newcode60 Line 60: * The {@link #make()} method of this ...
16 years, 8 months ago (2009-10-08 23:26:00 UTC) #4
MikeSamuel
http://codereview.appspot.com/126062/diff/2028/3038 File src/com/google/caja/parser/js/CajoledModule.java (right): http://codereview.appspot.com/126062/diff/2028/3038#newcode48 Line 48: (Expression) QuasiBuilder.substV("___.loadModule"); = should start the line. Please ...
16 years, 8 months ago (2009-10-09 02:31:44 UTC) #5
ihab.awad
16 years, 8 months ago (2009-10-13 22:20:56 UTC) #6
ihab.awad
New snapshot uploaded. http://codereview.appspot.com/126062/diff/2028/3038 File src/com/google/caja/parser/js/CajoledModule.java (right): http://codereview.appspot.com/126062/diff/2028/3038#newcode48 Line 48: (Expression) QuasiBuilder.substV("___.loadModule"); On 2009/10/09 02:31:44, ...
16 years, 8 months ago (2009-10-13 22:21:17 UTC) #7
MikeSamuel
http://codereview.appspot.com/126062/diff/2028/3034 File tests/com/google/caja/plugin/templates/TemplateCompilerTest.java (right): http://codereview.appspot.com/126062/diff/2028/3034#newcode342 Line 342: htmlFragment(fromString("<span/>")), On 2009/10/13 22:21:17, ihab.awad wrote: > On ...
16 years, 8 months ago (2009-10-15 19:31:59 UTC) #8
ihab.awad
Done & re-snapshotted. What else? http://codereview.appspot.com/126062/diff/2028/3034 File tests/com/google/caja/plugin/templates/TemplateCompilerTest.java (right): http://codereview.appspot.com/126062/diff/2028/3034#newcode342 Line 342: htmlFragment(fromString("<span/>")), On 2009/10/15 ...
16 years, 7 months ago (2009-10-16 16:23:41 UTC) #9
metaweta
LGTM http://codereview.appspot.com/126062/diff/4001/3092 File src/com/google/caja/service/ContentHandler.java (right): http://codereview.appspot.com/126062/diff/4001/3092#newcode56 Line 56: * @param checker Used to check wheter ...
16 years, 7 months ago (2009-10-19 20:05:19 UTC) #10
MikeSamuel
http://codereview.appspot.com/126062/diff/4001/3089 File src/com/google/caja/plugin/templates/SafeHtmlMaker.java (right): http://codereview.appspot.com/126062/diff/4001/3089#newcode135 Line 135: * has only a few, shallowly nested {@code ...
16 years, 7 months ago (2009-10-19 22:36:04 UTC) #11
MikeSamuel
http://codereview.appspot.com/126062/diff/4001/3088 File src/com/google/caja/plugin/html-emitter.js (right): http://codereview.appspot.com/126062/diff/4001/3088#newcode75 Line 75: base.innerHTML = htmlString; As discussed, I'm fine with ...
16 years, 7 months ago (2009-10-19 22:42:55 UTC) #12
ihab.awad
16 years, 7 months ago (2009-10-22 21:26:02 UTC) #13
ihab.awad
mikesamuel, note my question about your suggested refactoring. http://codereview.appspot.com/126062/diff/4001/3088 File src/com/google/caja/plugin/html-emitter.js (right): http://codereview.appspot.com/126062/diff/4001/3088#newcode75 Line 75: ...
16 years, 7 months ago (2009-10-22 21:26:22 UTC) #14
MikeSamuel
http://codereview.appspot.com/126062/diff/4001/3089 File src/com/google/caja/plugin/templates/SafeHtmlMaker.java (right): http://codereview.appspot.com/126062/diff/4001/3089#newcode364 Line 364: emitStatement(EMIT_STATIC_HTML_PLACEHOLDER); Why is it more complicated than: Index: ...
16 years, 7 months ago (2009-10-22 21:33:48 UTC) #15
ihab.awad
16 years, 7 months ago (2009-10-27 21:08:46 UTC) #16
ihab.awad
New snapshot.
16 years, 7 months ago (2009-10-27 21:09:16 UTC) #17
MikeSamuel
http://codereview.appspot.com/126062/diff/9001/10012 File src/com/google/caja/plugin/stages/CompileHtmlStage.java (right): http://codereview.appspot.com/126062/diff/9001/10012#newcode117 Line 117: "html", renderDomAsJsStringLiteral(node))); LGTM http://codereview.appspot.com/126062/diff/9001/10012#newcode127 Line 127: }); There ...
16 years, 7 months ago (2009-10-27 22:02:35 UTC) #18
ihab.awad
16 years, 7 months ago (2009-10-27 22:24:41 UTC) #19
ihab.awad
http://codereview.appspot.com/126062/diff/9001/10012 File src/com/google/caja/plugin/stages/CompileHtmlStage.java (right): http://codereview.appspot.com/126062/diff/9001/10012#newcode127 Line 127: }); On 2009/10/27 22:02:35, MikeSamuel wrote: > There ...
16 years, 7 months ago (2009-10-27 22:24:47 UTC) #20
MikeSamuel
LGTM
16 years, 7 months ago (2009-10-27 22:28:40 UTC) #21
ihab.awad
16 years, 7 months ago (2009-10-27 22:40:12 UTC) #22
@3828
Sign in to reply to this message.

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