[
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 12:26 PM:
----------------------------------------------------------------
I wonder if the test will fail in any case. I remember it running it through
RC4 which is the old codebase, and it also failed. Will investigate!
I do not think readding the onload might suffice here, I can give it a try
though.
A corner case of an ajax case refreshing the command script comes to my mind
where doing an addOnLoad definitely will fail, because the onload handler
simply is not called anymore!
a direct exeution of the foo script might be better!
I will readd something similar as onload to the myfaces namespace!
But it will use a document ready check and domcontent loaded, and also will
take the ajax refresh case into consideration!
was (Author: werpu):
I wonder if the test will fail in any case. I remember it running it through
RC4 which is the old codebase, and it also failed. Will investigate!
I do not think readding the onload might suffice here, I can give it a try
though.
A corner case of an ajax case refreshing the command script comes to my mind
where doing an addOnLoad definitely will fail, because the onload handler
simply is not called anymore!
a direct exeution of the foo script might be better!
I will readd something similar as onload to the myfaces namespace!
But it will use a document ready check and domcontent loaded!
> 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)