[jira] [Comment Edited] (MYFACES-4378) onloadScript not rendering with non ajax command button if jstl type tag c:if is present on the page

2024-05-08 Thread Werner Punz (Jira)


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

Werner Punz edited comment on MYFACES-4378 at 5/8/24 2:45 PM:
--

Does not really matter, see my updated comment, the question is what the 
resource id field itself is which gets updated, if it is a script  tag then it 
automatically gets evaled, but then the eval section is pointless, on the other 
hand if you have the eval section you wont need the embedded script doing the 
same.

This is a "garbage" response!

Btw forgot, the modern eval method for scripts is to append them to the head 
and clear them out again, that way the browser safely can do the eval!

All 3 implementations of the scripts nowadays use this method for evaling js!

Might play into this, but this is just a sidenote!
{code:java}
// code placeholder
globalEval(code: string, nonce ?: string): DomQuery {
const head = document.getElementsByTagName("head")?.[0]
?? document.documentElement.getElementsByTagName("head")?.[0];
const script = document.createElement("script");
if (nonce) {
if ('undefined' != typeof script?.nonce) {
script.nonce = nonce;
} else {
script.setAttribute("nonce", nonce);
}
}
script.type = "text/javascript";
script.innerHTML = code;
let newScriptElement = head.appendChild(script);
head.removeChild(newScriptElement);
return this;
} {code}
What happens here is at the moment the script is appended it gets evaled by the 
browser engine, and once evaled it is removed...

 

 


was (Author: werpu):
Does not really matter, see my updated comment, the question is what the 
resource id field itself is which gets updated, if it is a script  tag then it 
automatically gets evaled, but then the eval section is pointless, on the other 
hand if you have the eval section you wont need the embedded script doing the 
same.

This is a "garbage" response!

Btw forgot, the modern eval method for scripts is to append them to the head 
and clear them out again, that way the browser safely can do the eval!

All 3 implementations of the scripts nowadays use this method for evaling js!

Might play into this, but this is just a sidenote!

 

> onloadScript not rendering with non ajax command button if jstl type tag c:if 
> is present on the page
> 
>
> Key: MYFACES-4378
> URL: https://issues.apache.org/jira/browse/MYFACES-4378
> Project: MyFaces Core
>  Issue Type: Bug
>Affects Versions: 2.3.10, 2.3-next-M8, 4.0.2, 4.1.0-RC1
>Reporter: Thomas Andraschko
>Assignee: Thomas Andraschko
>Priority: Minor
> Attachments: pf-11780.zip, test.7z
>
>
> See https://github.com/omnifaces/omnifaces/issues/366



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


[jira] [Comment Edited] (MYFACES-4378) onloadScript not rendering with non ajax command button if jstl type tag c:if is present on the page

2024-05-08 Thread Werner Punz (Jira)


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

Werner Punz edited comment on MYFACES-4378 at 5/8/24 2:43 PM:
--

Does not really matter, see my updated comment, the question is what the 
resource id field itself is which gets updated, if it is a script  tag then it 
automatically gets evaled, but then the eval section is pointless, on the other 
hand if you have the eval section you wont need the embedded script doing the 
same.

This is a "garbage" response!

Btw forgot, the modern eval method for scripts is to append them to the head 
and clear them out again, that way the browser safely can do the eval!

All 3 implementations of the scripts nowadays use this method for evaling js!

Might play into this, but this is just a sidenote!

 


was (Author: werpu):
Does not really matter, see my updated comment, the question is what the 
resource id field itself is which gets updated, if it is a script  tag then it 
automatically gets evaled, but then the eval section is pointless, on the other 
hand if you have the eval section you wont need the embedded script doing the 
same.

This is a "garbage" response!

 

> onloadScript not rendering with non ajax command button if jstl type tag c:if 
> is present on the page
> 
>
> Key: MYFACES-4378
> URL: https://issues.apache.org/jira/browse/MYFACES-4378
> Project: MyFaces Core
>  Issue Type: Bug
>Affects Versions: 2.3.10, 2.3-next-M8, 4.0.2, 4.1.0-RC1
>Reporter: Thomas Andraschko
>Assignee: Thomas Andraschko
>Priority: Minor
> Attachments: pf-11780.zip, test.7z
>
>
> See https://github.com/omnifaces/omnifaces/issues/366



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


[jira] [Comment Edited] (MYFACES-4378) onloadScript not rendering with non ajax command button if jstl type tag c:if is present on the page

2024-05-08 Thread Werner Punz (Jira)


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

Werner Punz edited comment on MYFACES-4378 at 5/8/24 2:39 PM:
--

I just checked our scripts, there is no dedicated handling of a 
javax.faces.Resource field...

If there is one, it would only get executed/evaled automatically if it is of 
type script type="text/javascript"

in this case the eval would not be needed, in the second case if there is an 
eval, then a script type="text/javascript" id="javax.faces.Resource" is 
pointless and you would get a double eval, but the culprit here is a renderer 
sending such a response!

the namespace javax.faces.Resource normally is for resource requests not render 
areas, but using it is not a spec violation to my knowledge, any id on a script 
would have produced the same result!

 


was (Author: werpu):
yes the resource part is definitely wrong here... not sure why this is done 
both ways.. eval suffices to get the script executed, resource is for appending 
new resources (aka script links, css links etc...) not adding putting scripts 
as CDATA blocks...

Eval is clearly stated being for script blocks which needs separate evaluation!

I nevertheless will check our resource section what it does just in case to 
make sure that we do not get double includes in...

Either way, it is either or not both... you will get a double execution this 
way!

 

> onloadScript not rendering with non ajax command button if jstl type tag c:if 
> is present on the page
> 
>
> Key: MYFACES-4378
> URL: https://issues.apache.org/jira/browse/MYFACES-4378
> Project: MyFaces Core
>  Issue Type: Bug
>Affects Versions: 2.3.10, 2.3-next-M8, 4.0.2, 4.1.0-RC1
>Reporter: Thomas Andraschko
>Assignee: Thomas Andraschko
>Priority: Minor
> Attachments: pf-11780.zip, test.7z
>
>
> See https://github.com/omnifaces/omnifaces/issues/366



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


[jira] [Comment Edited] (MYFACES-4378) onloadScript not rendering with non ajax command button if jstl type tag c:if is present on the page

2024-05-08 Thread Werner Punz (Jira)


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

Werner Punz edited comment on MYFACES-4378 at 5/8/24 2:32 PM:
--

yes the resource part is definitely wrong here... not sure why this is done 
both ways.. eval suffices to get the script executed, resource is for appending 
new resources (aka script links, css links etc...) not adding putting scripts 
as CDATA blocks...

Eval is clearly stated being for script blocks which needs separate evaluation!

I nevertheless will check our resource section what it does just in case to 
make sure that we do not get double includes in...

Either way, it is either or not both... you will get a double execution this 
way!

 


was (Author: werpu):
yes the resource part is definitely wrong here... not sure why this is done 
both ways.. eval suffices to get the script executed, resource is for appending 
new resources (aka script links, css links etc...) not adding putting scripts 
as CDATA blocks...

Eval is clearly stated being for script blocks which needs separate evaluation!

I nevertheless will check our resource section what it does just in case to 
make sure that we do not get double includes in...

 

> onloadScript not rendering with non ajax command button if jstl type tag c:if 
> is present on the page
> 
>
> Key: MYFACES-4378
> URL: https://issues.apache.org/jira/browse/MYFACES-4378
> Project: MyFaces Core
>  Issue Type: Task
>Affects Versions: 2.3.10, 2.3-next-M8, 4.0.2, 4.1.0-RC1
>Reporter: Thomas Andraschko
>Assignee: Thomas Andraschko
>Priority: Minor
> Attachments: pf-11780.zip, test.7z
>
>
> See https://github.com/omnifaces/omnifaces/issues/366



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


[jira] [Comment Edited] (MYFACES-4378) onloadScript not rendering with non ajax command button if jstl type tag c:if is present on the page

2024-05-05 Thread Werner Punz (Jira)


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

Werner Punz edited comment on MYFACES-4378 at 5/5/24 2:33 PM:
--

Well, I dont think the new typescript based myfaces code is affected by this 
issue, we do as far as I remember a proper head cleanup to avoid exactly this 
situation!

But given that primefaces overrides the implementation and provides its own 
ajax implementation the culprit here is primefaces itself. 

Caveat, if I have understood the issue correctly! 

 


was (Author: werpu):
Well, I dont think the new myfaces code is affected by this issue, we do as far 
as I remember a proper head cleanup to avoid exactly this situation!

But given that primefaces overrides the implementation and provides its own 
ajax implementation the culprit here is primefaces itself. 

Caveat, if I have understood the issue correctly! 

 

> onloadScript not rendering with non ajax command button if jstl type tag c:if 
> is present on the page
> 
>
> Key: MYFACES-4378
> URL: https://issues.apache.org/jira/browse/MYFACES-4378
> Project: MyFaces Core
>  Issue Type: Task
>Affects Versions: 2.3.10, 2.3-next-M8, 4.0.2, 4.1.0-RC1
>Reporter: Thomas Andraschko
>Assignee: Thomas Andraschko
>Priority: Minor
> Attachments: pf-11780.zip, test.7z
>
>
> See https://github.com/omnifaces/omnifaces/issues/366



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


[jira] [Comment Edited] (MYFACES-4378) onloadScript not rendering with non ajax command button if jstl type tag c:if is present on the page

2024-05-05 Thread Werner Punz (Jira)


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

Werner Punz edited comment on MYFACES-4378 at 5/5/24 2:32 PM:
--

Well, I dont think the new myfaces code is affected by this issue, we do as far 
as I remember a proper head cleanup to avoid exactly this situation!

But given that primefaces overrides the implementation and provides its own 
ajax implementation the culprit here is primefaces itself. 

Caveat, if I have understood the issue correctly! 

 


was (Author: werpu):
Well, I dont think the new myfaces code is affected by this issue, we do as far 
as I remember a proper head cleanup to avoid exactly this situation!

But given that primefaces overrides the implementation and prov ides its own 
ajax implementation the culprit here is primefaces itself. 

Caveat, if I have understood the issue correctly!

 

> onloadScript not rendering with non ajax command button if jstl type tag c:if 
> is present on the page
> 
>
> Key: MYFACES-4378
> URL: https://issues.apache.org/jira/browse/MYFACES-4378
> Project: MyFaces Core
>  Issue Type: Task
>Affects Versions: 2.3.10, 2.3-next-M8, 4.0.2, 4.1.0-RC1
>Reporter: Thomas Andraschko
>Assignee: Thomas Andraschko
>Priority: Minor
> Attachments: pf-11780.zip, test.7z
>
>
> See https://github.com/omnifaces/omnifaces/issues/366



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


[jira] [Comment Edited] (MYFACES-4378) onloadScript not rendering with non ajax command button if jstl type tag c:if is present on the page

2024-05-05 Thread Melloware (Jira)


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

Melloware edited comment on MYFACES-4378 at 5/5/24 1:48 PM:


Reopened with simple reproducer provided: 
[https://github.com/omnifaces/omnifaces/issues/804]

Reported in PrimeFaces: [https://github.com/primefaces/primefaces/issues/11780]

 

Because PrimeFaces constantly appends to the `head` this will eventually cause 
the browser to fill up the head making the DOM slower and slower if you are on 
a page with AJAX constantly.
{code:java}
else if (id === PrimeFaces.ajax.RESOURCE) {
$('head').append(content);
} {code}
 

That was discovered in this issue: 
[https://github.com/primefaces/primefaces/issues/11714]

[~werpu] you may be interested in this as well...

 

 

 

 


was (Author: melloware):
Reopened with simple reproducer provided: 
[https://github.com/omnifaces/omnifaces/issues/804]

Reported in PrimeFaces: [https://github.com/primefaces/primefaces/issues/11780]

 

Because PrimeFaces constantly appends to the `head` this will eventually cause 
the browser to fill up the head making the DOM slower and slower if you are on 
a page with AJAX constantly.
{code:java}
else if (id === PrimeFaces.ajax.RESOURCE) {
$('head').append(content);
} {code}
 

That was discovered in this issue: 
[https://github.com/primefaces/primefaces/issues/11714]

 

 

 

 

 

> onloadScript not rendering with non ajax command button if jstl type tag c:if 
> is present on the page
> 
>
> Key: MYFACES-4378
> URL: https://issues.apache.org/jira/browse/MYFACES-4378
> Project: MyFaces Core
>  Issue Type: Task
>Affects Versions: 2.3.10, 2.3-next-M8, 4.0.2, 4.1.0-RC1
>Reporter: Thomas Andraschko
>Assignee: Thomas Andraschko
>Priority: Minor
> Attachments: pf-11780.zip, test.7z
>
>
> See https://github.com/omnifaces/omnifaces/issues/366



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


[jira] [Comment Edited] (MYFACES-4378) onloadScript not rendering with non ajax command button if jstl type tag c:if is present on the page

2021-01-19 Thread Thomas Andraschko (Jira)


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

Thomas Andraschko edited comment on MYFACES-4378 at 1/19/21, 1:18 PM:
--

added unittest in master 
(https://github.com/apache/myfaces/commit/0b641610962fe5829bb95fba65f38a5a798de2fe)
 and even the reproducer sample with jetty works fine (mvn clean package 
jetty:run-exploded -Pmyfaces23)


was (Author: tandraschko):
added unittest and even the reproducer sample with jetty works fine (mvn clean 
package jetty:run-exploded -Pmyfaces23)

> onloadScript not rendering with non ajax command button if jstl type tag c:if 
> is present on the page
> 
>
> Key: MYFACES-4378
> URL: https://issues.apache.org/jira/browse/MYFACES-4378
> Project: MyFaces Core
>  Issue Type: Task
>Affects Versions: 2.3.7, 2.3-next-M4, 3.0.0, 4.0.0-RC1
>Reporter: Thomas Andraschko
>Assignee: Thomas Andraschko
>Priority: Minor
> Attachments: test.7z
>
>
> See https://github.com/omnifaces/omnifaces/issues/366



--
This message was sent by Atlassian Jira
(v8.3.4#803005)