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

Issue 9349043: html-emitter screws up document structure (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years ago by felix8a
Modified:
13 years ago
Reviewers:
kpreid2
CC:
google-caja-discuss_googlegroups.com
Base URL:
http://google-caja.googlecode.com/svn/trunk/
Visibility:
Public.

Description

This fixes issue 1589 https://code.google.com/p/google-caja/issues/detail?id=1589 Input like this: <html> <head> <script>;</script></head> <body>foo</body> </html> will cause the cajoler to emit html like this: <caja-v-html> <caja-v-head> <span id="id_2___"></span></caja-v-head> <caja-v-body>foo</caja-v-body> </caja-v-html> which is fine. But when html-emitter is done, the result looks like this: <caja-v-html> <caja-v-head><caja-v-body></caja-v-body></caja-v-head> <caja-v-body>foo</caja-v-body> </caja-v-html> So what's happening: When we call htmlEmitter.finish(), insertionPoint is at the caja-v-head, everything after that is detached, and insertionMode is afterHead (rather than inHead). finish() calls notifyEOF() before reattaching the detached nodes. notifyEOF() calls afterHead.endOfFile(), which adds an empty body at the insertionPoint, so it goes inside the head instead of after. And then finish() reattaches the detached nodes, so we end up with two caja-v-body nodes. This fixes that.

Patch Set 1 #

Total comments: 7

Patch Set 2 : html-emitter screws up document structure #

Patch Set 3 : html-emitter screws up document structure #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+120 lines, -29 lines) Patch
M build.xml View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M src/com/google/caja/plugin/html-emitter.js View 1 2 4 chunks +67 lines, -29 lines 0 comments Download
M tests/com/google/caja/plugin/HtmlCompiledPluginTest.java View 1 2 3 chunks +17 lines, -0 lines 0 comments Download
M tests/com/google/caja/plugin/es53-test-domado-global.js View 1 2 1 chunk +30 lines, -0 lines 1 comment Download
M tests/com/google/caja/plugin/html-emitter-test.html View 1 2 1 chunk +5 lines, -0 lines 0 comments Download

Messages

Total messages: 15
felix8a
13 years ago (2013-05-10 23:25:29 UTC) #1
kpreid2
https://codereview.appspot.com/9349043/diff/1/src/com/google/caja/plugin/html-emitter.js File src/com/google/caja/plugin/html-emitter.js (right): https://codereview.appspot.com/9349043/diff/1/src/com/google/caja/plugin/html-emitter.js#newcode310 src/com/google/caja/plugin/html-emitter.js:310: insertionPoint = hasChild(base, 'html') || base; I believe that ...
13 years ago (2013-05-10 23:38:33 UTC) #2
felix8a
This fixes issue 1589 https://code.google.com/p/google-caja/issues/detail?id=1589 Input like this: <html> <head> <script>;</script></head> <body>foo</body> </html> will cause ...
13 years ago (2013-05-11 00:56:58 UTC) #3
felix8a
https://codereview.appspot.com/9349043/diff/1/src/com/google/caja/plugin/html-emitter.js File src/com/google/caja/plugin/html-emitter.js (right): https://codereview.appspot.com/9349043/diff/1/src/com/google/caja/plugin/html-emitter.js#newcode310 src/com/google/caja/plugin/html-emitter.js:310: insertionPoint = hasChild(base, 'html') || base; On 2013/05/10 23:38:33, ...
13 years ago (2013-05-11 00:57:11 UTC) #4
kpreid2
On 2013/05/11 00:57:11, felix8a wrote: > https://codereview.appspot.com/9349043/diff/1/src/com/google/caja/plugin/html-emitter.js > File src/com/google/caja/plugin/html-emitter.js (right): > > https://codereview.appspot.com/9349043/diff/1/src/com/google/caja/plugin/html-emitter.js#newcode310 > ...
13 years ago (2013-05-11 01:07:55 UTC) #5
kpreid2
(Resubmitting inline comment accidentally entered as generic reply) https://codereview.appspot.com/9349043/diff/1/tests/com/google/caja/plugin/es53-test-html-emitter.js File tests/com/google/caja/plugin/es53-test-html-emitter.js (right): https://codereview.appspot.com/9349043/diff/1/tests/com/google/caja/plugin/es53-test-html-emitter.js#newcode16 tests/com/google/caja/plugin/es53-test-html-emitter.js:16: * ...
13 years ago (2013-05-11 01:09:11 UTC) #6
felix8a
On 2013/05/11 01:09:11, kpreid2 wrote: > (Resubmitting inline comment accidentally entered as generic reply) > ...
13 years ago (2013-05-11 01:21:23 UTC) #7
kpreid2
https://codereview.appspot.com/9349043/diff/1/tests/com/google/caja/plugin/es53-test-html-emitter.js File tests/com/google/caja/plugin/es53-test-html-emitter.js (right): https://codereview.appspot.com/9349043/diff/1/tests/com/google/caja/plugin/es53-test-html-emitter.js#newcode16 tests/com/google/caja/plugin/es53-test-html-emitter.js:16: * @fileoverview End-to-end html-emitter tests. See also On 2013/05/11 ...
13 years ago (2013-05-11 01:39:20 UTC) #8
felix8a
On 2013/05/11 01:39:20, kpreid2 wrote: > I consider it more important to group tests for ...
13 years ago (2013-05-13 15:37:05 UTC) #9
felix8a
On 2013/05/13 15:37:05, felix8a wrote: > On 2013/05/11 01:39:20, kpreid2 wrote: > > I consider ...
13 years ago (2013-05-13 15:41:43 UTC) #10
kpreid2
On 2013/05/13 15:41:43, felix8a wrote: > Basically, this is a unit test for html-emitter, but ...
13 years ago (2013-05-13 18:52:00 UTC) #11
felix8a
This fixes issue 1589 https://code.google.com/p/google-caja/issues/detail?id=1589 Input like this: <html> <head> <script>;</script></head> <body>foo</body> </html> will cause ...
13 years ago (2013-05-15 20:30:34 UTC) #12
felix8a
new snapshot for the new world order
13 years ago (2013-05-15 20:30:56 UTC) #13
kpreid2
LGTM https://codereview.appspot.com/9349043/diff/15001/tests/com/google/caja/plugin/es53-test-domado-global.js File tests/com/google/caja/plugin/es53-test-domado-global.js (right): https://codereview.appspot.com/9349043/diff/15001/tests/com/google/caja/plugin/es53-test-domado-global.js#newcode260 tests/com/google/caja/plugin/es53-test-domado-global.js:260: if (!inES5Mode) should be jsunitRegisterIf
13 years ago (2013-05-15 20:33:59 UTC) #14
felix8a
13 years ago (2013-05-15 21:46:20 UTC) #15
@r5409
Sign in to reply to this message.

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