| Summary: | [content model] DOMException when refreshing | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [WebTools] WTP Source Editing | Reporter: | Steffen Pingel <steffen.pingel> | ||||||||||
| Component: | wst.xml | Assignee: | Rakesh <rakes123> | ||||||||||
| Status: | RESOLVED FIXED | QA Contact: | Nitin Dahyabhai <thatnitind> | ||||||||||
| Severity: | normal | ||||||||||||
| Priority: | P3 | CC: | nsand.dev | ||||||||||
| Version: | 3.2 | Flags: | nsand.dev:
review+
|
||||||||||
| Target Milestone: | 3.2.2 | ||||||||||||
| Hardware: | PC | ||||||||||||
| OS: | Linux | ||||||||||||
| Whiteboard: | |||||||||||||
| Attachments: |
|
||||||||||||
|
Description
Steffen Pingel
Created attachment 172010 [details]
sample file: /vote/src/main/webapp/WEB-INF/layouts/default.jspx
Created attachment 172588 [details]
Patch
We should not scan CDATA when we are in ST_BLOCK_TAG_SCAN state in JSPTokenizer.I have used JFlex to create JSPTokernizer.java ,but had to do some changes manually.
Hi, Rakesh. I don't think we really need to tweak the JSPTokenizer for the solution (though it does work, but you'll notice that the CDATA tag is no longer syntax highlighted). I think the solution will actually be within the ElementImpl#insertBefore method if we could tweak the if() statement to not only exclude TEXT_NODE nodes, but also CDATA_SECTION_NODE nodes. Also, I think we could use some unit tests for this. Thanks! Created attachment 173193 [details]
Patch
I have added a check and a test file in jsp.core . This exception will occur only in jsp files whenever CDATA is first child of script or style.For example it occurs in <script><![CDATA[]]></script> but not in
<script>
<![CDATA[]]></script>
Please let me know if i need to make changes in test.I added test in jsp.core since it looks like a change related to jsp , although change is actually made in xml.core.
Patch looks good, Rakesh.
Only thing I would change is to make the unit test part of HTML core's suite. There are a set under o.e.wst.html.core.tests.parser. Just extend the ModelTest base class, and you can call createHTMLModel() to get your HTML model for edit. Add your nodes, and do a catch(DOMException) { fail("Did not permit CDATA section in script element."); }
Then make sure to add it to the ModelParserTests test suite.
Thanks.
Created attachment 173272 [details]
patch
TestCase changed
Released. Thanks, Rakesh. |