Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-4498

TCK: Issue 4345 : Head Element Not Updated As Expected via Ajax Call

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 4.0.0-RC2
    • 2.3-next-M8, 4.0.0-RC3
    • None
    • None

    Description

      Test Code:
      https://github.com/jakartaee/faces/blob/4.0.1/tck/faces22/ajax/src/test/java/ee/jakarta/tck/faces/test/servlet30/ajax/Issue4345IT.java#L47

      https://github.com/jakartaee/faces/blob/4.0.1/tck/faces22/ajax/src/main/webapp/issue4345result.xhtml

      https://github.com/jakartaee/faces/blob/4.0.1/tck/faces22/ajax/src/test/java/ee/jakarta/tck/faces/test/servlet30/ajax/Issue4345IT.java#L47

      This test was created for ensure HTML is only escaped twice ([Issue 4345|https://github.com/eclipse-ee4j/mojarra/issues/4345). However, MyFaces is encountering two problems with this test.

      Firstly, here is the Ajax response and the updated HTML:

      <?xml version="1.0" encoding="UTF-8"?>
      <partial-response id="j_id__v_0">
         <changes>
            <update id="jakarta.faces.ViewRoot">
               <![CDATA[<!--
                  Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
                  
                  This program and the accompanying materials are made available under the
                  terms of the Eclipse Public License v. 2.0, which is available at
                  http://www.eclipse.org/legal/epl-2.0.
                  
                  This Source Code may also be made available under the following Secondary
                  Licenses when the conditions for such availability set forth in the
                  Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
                  version 2 with the GNU Classpath Exception, which is available at
                  https://www.gnu.org/software/classpath/license.html.
                  
                  SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
                  
                  --><!DOCTYPE html>
                  <html xmlns="http://www.w3.org/1999/xhtml"><head>
                      <!-- h:outputStylesheet does not support params in the URL, so generate a similar link manually. -->
                      <!--<h:outputStylesheet name="issue4345.css?firstParam=1&amp;secondParam=2" />-->
                      <link type="text/css" rel="stylesheet" href="/test-faces22-ajax/jakarta.faces.resource/issue4345.css.xhtml?firstParam=1&amp;secondParam=2" /><script type="text/javascript" src="/test-faces22-ajax/jakarta.faces.resource/issue4345.js.xhtml?firstParam=1&amp;secondParam=2"></script></head><body></body>
                  </html>]]>
            </update>
            <update id="j_id__v_0:jakarta.faces.ViewState:1">
               <![CDATA[ZmY2MjMxN2MxYTY3OTg1MTAwMDAwMDA0]]>
            </update>
         </changes>
      </partial-response> 

      The HTML is then set as :

      <html xmlns="http://www.w3.org/1999/xhtml">
         <head>
            <style rel="stylesheet" type="text/css">@import url('/test-faces22-ajax/jakarta.faces.resource/issue4345.css.xhtml?firstParam=1&secondParam=2');</style>
         </head>
         <body></body>
      </html>
       

      1) We change from a link (type/css ) to a style tag that imports the URL? Should that occur?  The JavaScript in issue4345result.xhtml specifically looks for a link element.

      2) The script tags are not appended to the head element, but I do see network requests for them. Additionally, the scripts do run (confirmed by the console: "issue4345.js loaded." ).

      This fails on both the RC2 scripts and the new TypeScript code.

       

      Attachments

        1. test-faces22-ajax.war
          2.87 MB
          Volodymyr Siedlecki

        Activity

          People

            werpu Werner Punz
            volosied Volodymyr Siedlecki
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: