[ 
https://issues.apache.org/jira/browse/MYFACES-4575?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17694494#comment-17694494
 ] 

Werner Punz edited comment on MYFACES-4575 at 2/28/23 11:50 AM:
----------------------------------------------------------------

The test will fail in any case, because in the Ajax case with the onload 
handler foo() is not called at all!

We have to solve this differently, either by not even shifting the code down to 
onload but executing it directly!

This also would resolve the ajax case!

 

 


was (Author: werpu):
please update the code, addOnLoad is not a standard jsf feature, we should 
replace it. I will have a look at the old code and provide an alternative which 
does not rely on internal apis!

 

> Uncaught TypeError: myfaces._impl is undefined
> ----------------------------------------------
>
>                 Key: MYFACES-4575
>                 URL: https://issues.apache.org/jira/browse/MYFACES-4575
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: General
>    Affects Versions: 4.0.0-RC5
>            Reporter: Volodymyr Siedlecki
>            Assignee: Werner Punz
>            Priority: Major
>
> Discovered via TCK: commandScript - spec613.xhtml 
> [https://github.com/jakartaee/faces/blob/7d3edf6fd066b340746040460b63a79cc26aff3e/tck/faces23/commandScript/src/main/webapp/spec613.xhtml]
>  
> [https://github.com/jakartaee/faces/blob/7d3edf6fd066b340746040460b63a79cc26aff3e/tck/faces23/commandScript/src/test/java/ee/jakarta/tck/faces/test/javaee8/commandScript/Spec613IT.java#L78]
>  
> JavaScript Error: 
> Uncaught TypeError: myfaces._impl is undefined 
> Generated HTML code: 
> {code:java}
> <html lang="en" xmlns="http://www.w3.org/1999/xhtml";>
>    <head>
>       <title>Spec613IT - commandScript</title>
>    </head>
>    <body>
>       <form id="j_id_7" name="j_id_7" method="post" 
> action="/commandScript/spec613.xhtml" 
> enctype="application/x-www-form-urlencoded">
>          <script 
> src="/commandScript/jakarta.faces.resource/faces.js.xhtml?ln=jakarta.faces"></script>
>          <span id="j_id_7:j_id_8">
>             <script>var foo = function(o){var o=(typeof 
> o==='object')&&o?o:{};myfaces.ab('j_id_7:j_id_8',null,'action','','result')};myfaces._impl.core._Runtime.addOnLoad(window,foo);</script>
>          </span>
>          <span id="j_id_7:j_id_9">
>             <script>var bar = function(o){var o=(typeof 
> o==='object')&&o?o:{};myfaces.ab('j_id_7:j_id_9',null,'action','','result')}</script>
>          </span>
>          <input type="hidden" name="j_id_7_SUBMIT" value="1" /><input 
> type="hidden" name="jakarta.faces.ViewState" 
> id="j_id__v_0:jakarta.faces.ViewState:1" 
> value="YTA0OTg5YWVkZTU2NDE2YTAwMDAwMDAx" autocomplete="off" />
>       </form>
>       <span id="result"></span>
>    </body>
> </html> {code}
> Old scripts had a _onload_ function, but I don't see anything like that in 
> the new scripts: 
>         this.addOnLoad = function(target, func) {
>             var oldonload = (target) ? target.onload : null;
>             target.onload = (!oldonload) ? func : function() {
>                 try {
>                     oldonload();
>                 } catch (e) {
>                     throw e;
>                 } finally {
>                     func();
>                 }
>             };
>         };



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to