[jira] [Created] (MYFACES-4672) Uncaught TypeError: G.hasKey is not a function

2024-06-21 Thread Volodymyr Siedlecki (Jira)
Volodymyr Siedlecki created MYFACES-4672:


 Summary: Uncaught TypeError: G.hasKey is not a function
 Key: MYFACES-4672
 URL: https://issues.apache.org/jira/browse/MYFACES-4672
 Project: MyFaces Core
  Issue Type: Bug
Affects Versions: 2.2.15
Reporter: Volodymyr Siedlecki


This affects 2.2 which I know is out of date, but I have a user of MyFaces 2.2 
who needs this bug fixed.

I ported MYFACES-4606 to 2.2 here: [https://github.com/apache/myfaces/pull/647]

4606 was applied to 2.3, so I applied the same fix to 2.2.  However, I didn't 
realize that _AjaxRequestLevel2 was removed from 2.3 in this PR: 
[https://github.com/apache/myfaces/pull/415/files]

_AjaxRequestLevel2 still exists in the 2.2 codebase. 

This mean that `if(targetBuf.hasKey(identifier))` was called from 
_AjaxRequestLevel2's getFormData which does not decorate the FormData to 
include the hasKey method – thus we get " G.hasKey is not a function". 

[https://github.com/volosied/myfaces/blob/d5d28a0e6cae3ea22e021c64ecf474d6352bf900/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequestLevel2.js#L32-L44]

This error is reproducible via multi-part form requests that use ajax. 

What is the proper fix here? I'll create a draft PR for what I think is 
correct. 

Thanks!



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


[jira] [Commented] (MYFACES-4672) Uncaught TypeError: G.hasKey is not a function

2024-06-21 Thread Volodymyr Siedlecki (Jira)


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

Volodymyr Siedlecki commented on MYFACES-4672:
--

https://github.com/apache/myfaces/pull/720

> Uncaught TypeError: G.hasKey is not a function
> --
>
> Key: MYFACES-4672
> URL: https://issues.apache.org/jira/browse/MYFACES-4672
> Project: MyFaces Core
>  Issue Type: Bug
>Affects Versions: 2.2.16
>Reporter: Volodymyr Siedlecki
>Assignee: Werner Punz
>Priority: Major
>
> This affects 2.2 which I know is out of date, but I have a user of MyFaces 
> 2.2 who needs this bug fixed.
> I ported MYFACES-4606 to 2.2 here: 
> [https://github.com/apache/myfaces/pull/647]
> 4606 was applied to 2.3, so I applied the same fix to 2.2.  However, I didn't 
> realize that _AjaxRequestLevel2 was removed from 2.3 in this PR: 
> [https://github.com/apache/myfaces/pull/415/files]
> _AjaxRequestLevel2 still exists in the 2.2 codebase. 
> This mean that `if(targetBuf.hasKey(identifier))` was called from 
> _AjaxRequestLevel2's getFormData which does not decorate the FormData to 
> include the hasKey method – thus we get " G.hasKey is not a function". 
> [https://github.com/volosied/myfaces/blob/d5d28a0e6cae3ea22e021c64ecf474d6352bf900/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequestLevel2.js#L32-L44]
> This error is reproducible via multi-part form requests that use ajax. 
> What is the proper fix here? I'll create a draft PR for what I think is 
> correct. 
> Thanks!



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


[jira] [Commented] (MYFACES-4672) Uncaught TypeError: G.hasKey is not a function

2024-06-21 Thread Werner Punz (Jira)


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

Werner Punz commented on MYFACES-4672:
--

I will look into it next week. As far as I remember, the old codebase built 
something similar as FormData to keep the code on the same level. I will look 
into it but wont make it before monday!

 

> Uncaught TypeError: G.hasKey is not a function
> --
>
> Key: MYFACES-4672
> URL: https://issues.apache.org/jira/browse/MYFACES-4672
> Project: MyFaces Core
>  Issue Type: Bug
>Affects Versions: 2.2.16
>Reporter: Volodymyr Siedlecki
>Assignee: Werner Punz
>Priority: Major
>
> This affects 2.2 which I know is out of date, but I have a user of MyFaces 
> 2.2 who needs this bug fixed.
> I ported MYFACES-4606 to 2.2 here: 
> [https://github.com/apache/myfaces/pull/647]
> 4606 was applied to 2.3, so I applied the same fix to 2.2.  However, I didn't 
> realize that _AjaxRequestLevel2 was removed from 2.3 in this PR: 
> [https://github.com/apache/myfaces/pull/415/files]
> _AjaxRequestLevel2 still exists in the 2.2 codebase. 
> This mean that `if(targetBuf.hasKey(identifier))` was called from 
> _AjaxRequestLevel2's getFormData which does not decorate the FormData to 
> include the hasKey method – thus we get " G.hasKey is not a function". 
> [https://github.com/volosied/myfaces/blob/d5d28a0e6cae3ea22e021c64ecf474d6352bf900/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequestLevel2.js#L32-L44]
> This error is reproducible via multi-part form requests that use ajax. 
> What is the proper fix here? I'll create a draft PR for what I think is 
> correct. 
> Thanks!



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


[jira] [Comment Edited] (MYFACES-4672) Uncaught TypeError: G.hasKey is not a function

2024-06-21 Thread Werner Punz (Jira)


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

Werner Punz edited comment on MYFACES-4672 at 6/21/24 8:14 PM:
---

I will look into it next week. As far as I remember, the old codebase built 
something similar as FormData to keep the code on the same level. I will look 
into it but wont make it before monday!

The proper fix very likely simply is to add the function!

 


was (Author: werpu):
I will look into it next week. As far as I remember, the old codebase built 
something similar as FormData to keep the code on the same level. I will look 
into it but wont make it before monday!

 

> Uncaught TypeError: G.hasKey is not a function
> --
>
> Key: MYFACES-4672
> URL: https://issues.apache.org/jira/browse/MYFACES-4672
> Project: MyFaces Core
>  Issue Type: Bug
>Affects Versions: 2.2.16
>Reporter: Volodymyr Siedlecki
>Assignee: Werner Punz
>Priority: Major
>
> This affects 2.2 which I know is out of date, but I have a user of MyFaces 
> 2.2 who needs this bug fixed.
> I ported MYFACES-4606 to 2.2 here: 
> [https://github.com/apache/myfaces/pull/647]
> 4606 was applied to 2.3, so I applied the same fix to 2.2.  However, I didn't 
> realize that _AjaxRequestLevel2 was removed from 2.3 in this PR: 
> [https://github.com/apache/myfaces/pull/415/files]
> _AjaxRequestLevel2 still exists in the 2.2 codebase. 
> This mean that `if(targetBuf.hasKey(identifier))` was called from 
> _AjaxRequestLevel2's getFormData which does not decorate the FormData to 
> include the hasKey method – thus we get " G.hasKey is not a function". 
> [https://github.com/volosied/myfaces/blob/d5d28a0e6cae3ea22e021c64ecf474d6352bf900/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequestLevel2.js#L32-L44]
> This error is reproducible via multi-part form requests that use ajax. 
> What is the proper fix here? I'll create a draft PR for what I think is 
> correct. 
> Thanks!



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


[jira] [Commented] (MYFACES-4672) Uncaught TypeError: G.hasKey is not a function

2024-06-21 Thread Volodymyr Siedlecki (Jira)


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

Volodymyr Siedlecki commented on MYFACES-4672:
--

Thanks! 

I did tried adding the function, but it caused other errors in their 
application.  The XHR did not contain the form data in the request – it was 
formatted differently. 

When I decorated the form data object, the request had: 
{color:#1d1c1d}j_id_a:j_id_d=[object File] j_id_a_SUBMIT=1 
javax.faces.ViewState=etXhe99OOEwGmJMwtxyC6OvI0hBYMSNfhRFQFlnPdIp07mF2KWgN0fDLNVqbkvHTdDOAWQ==
 javax.faces.behavior.event=change javax.faces.partial.event=change 
javax.faces.source=j_id_a:j_id_d javax.faces.partial.ajax=true 
javax.faces.partial.execute=j_id_a:j_id_d j_id_a=j_id_a{color}

It should look more like this: 
{color:#cc}-10818876671980492753015449693{color}
{color:#cc}Content-Disposition: form-data{color}{color:#6a9955}; 
name="j_id_a:j_id_d"; filename="1.txt"{color}
{color:#cc}Content-Type: text/plain{color}
{color:#cc}1{color}
{color:#cc}-10818876671980492753015449693{color}
{color:#cc}Content-Disposition: form-data{color}{color:#6a9955}; 
name="j_id_a_SUBMIT"{color}
{color:#cc}1

{color}

> Uncaught TypeError: G.hasKey is not a function
> --
>
> Key: MYFACES-4672
> URL: https://issues.apache.org/jira/browse/MYFACES-4672
> Project: MyFaces Core
>  Issue Type: Bug
>Affects Versions: 2.2.16
>Reporter: Volodymyr Siedlecki
>Assignee: Werner Punz
>Priority: Major
>
> This affects 2.2 which I know is out of date, but I have a user of MyFaces 
> 2.2 who needs this bug fixed.
> I ported MYFACES-4606 to 2.2 here: 
> [https://github.com/apache/myfaces/pull/647]
> 4606 was applied to 2.3, so I applied the same fix to 2.2.  However, I didn't 
> realize that _AjaxRequestLevel2 was removed from 2.3 in this PR: 
> [https://github.com/apache/myfaces/pull/415/files]
> _AjaxRequestLevel2 still exists in the 2.2 codebase. 
> This mean that `if(targetBuf.hasKey(identifier))` was called from 
> _AjaxRequestLevel2's getFormData which does not decorate the FormData to 
> include the hasKey method – thus we get " G.hasKey is not a function". 
> [https://github.com/volosied/myfaces/blob/d5d28a0e6cae3ea22e021c64ecf474d6352bf900/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequestLevel2.js#L32-L44]
> This error is reproducible via multi-part form requests that use ajax. 
> What is the proper fix here? I'll create a draft PR for what I think is 
> correct. 
> Thanks!



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


[jira] [Commented] (MYFACES-4672) Uncaught TypeError: G.hasKey is not a function

2024-06-21 Thread Volodymyr Siedlecki (Jira)


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

Volodymyr Siedlecki commented on MYFACES-4672:
--

For better reference this is the original fix I used which caused the form data 
problems: 

{{_MF_CLS(_PFX_XHR + "_MultipartAjaxRequestLevel2", 
myfaces._impl.xhrCore._AjaxRequest, \{
  getFormData: function() {
var A;
if (this._context._mfInternal.xhrOp === "multipartQueuedPost") {
  A = 
this._Lang.createFormDataDecorator(jsf.getViewState(this._sourceForm));
  this._AJAXUTIL.appendIssuingItem(this._source, A);
} else \{
  A = this._Lang.createFormDataDecorator(jsf.getViewState(new Array()))
  this._AJAXUTIL.encodeSubmittableFields(A, this._sourceForm, null);
  this._AJAXUTIL.appendIssuingItem(this._source, A);
}
return A;
  },}}

> Uncaught TypeError: G.hasKey is not a function
> --
>
> Key: MYFACES-4672
> URL: https://issues.apache.org/jira/browse/MYFACES-4672
> Project: MyFaces Core
>  Issue Type: Bug
>Affects Versions: 2.2.16
>Reporter: Volodymyr Siedlecki
>Assignee: Werner Punz
>Priority: Major
>
> This affects 2.2 which I know is out of date, but I have a user of MyFaces 
> 2.2 who needs this bug fixed.
> I ported MYFACES-4606 to 2.2 here: 
> [https://github.com/apache/myfaces/pull/647]
> 4606 was applied to 2.3, so I applied the same fix to 2.2.  However, I didn't 
> realize that _AjaxRequestLevel2 was removed from 2.3 in this PR: 
> [https://github.com/apache/myfaces/pull/415/files]
> _AjaxRequestLevel2 still exists in the 2.2 codebase. 
> This mean that `if(targetBuf.hasKey(identifier))` was called from 
> _AjaxRequestLevel2's getFormData which does not decorate the FormData to 
> include the hasKey method – thus we get " G.hasKey is not a function". 
> [https://github.com/volosied/myfaces/blob/d5d28a0e6cae3ea22e021c64ecf474d6352bf900/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequestLevel2.js#L32-L44]
> This error is reproducible via multi-part form requests that use ajax. 
> What is the proper fix here? I'll create a draft PR for what I think is 
> correct. 
> Thanks!



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


[jira] [Commented] (MYFACES-4671) PushImpl.ts Socket#onerror attempting to use undefined variable

2024-06-21 Thread Werner Punz (Jira)


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

Werner Punz commented on MYFACES-4671:
--

Btw the code can be written a little bit more tersely:
 
let message = JSON.parse(event?.data ?? null);
 
Typescript has an Elvis operator, so no need for explicity undefined checks 
anymore!

I will prepare a new version of the upstream codebase then we can easily get 
the new code into all branches!

 

> PushImpl.ts Socket#onerror attempting to use undefined variable
> ---
>
> Key: MYFACES-4671
> URL: https://issues.apache.org/jira/browse/MYFACES-4671
> Project: MyFaces Core
>  Issue Type: Bug
>Affects Versions: 4.0.2, 4.1.0-RC2
> Environment: OS: Windows 11
> Java version 17.0.7
>Reporter: Thomas Smith
>Assignee: Werner Punz
>Priority: Minor
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> While running some OpenLiberty FAT tests, specifically 
> io.openliberty.org.apache.myfaces.4.0_fat/WebSocketTests, we discovered a 
> small bug where JSON.parse(event.data) was running where event.data was 
> undefined.
> Here is the line it occurs: 
> [https://github.com/apache/myfaces/blob/dae36dde5cc42208d034dda23107ad79f68ecc3a/api/src/client/typescript/faces/impl/PushImpl.ts#L156]
> Volodymyr created a GitHub issue describing the issue here: [Faces 4.0 Fix 
> WebSocketTests so that "onerror listener" occurs -  Issue #27598 -  
> OpenLiberty/open-liberty 
> (github.com)|https://github.com/OpenLiberty/open-liberty/issues/27598]
> Proposed Solution: Change
> {code:java}
>  JSON.parse(event.data) {code}
> to
> {code:java}
> JSON.parse(event.data === undefined ? null : event.data){code}



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


[jira] [Commented] (MYFACES-4671) PushImpl.ts Socket#onerror attempting to use undefined variable

2024-06-21 Thread Werner Punz (Jira)


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

Werner Punz commented on MYFACES-4671:
--

I added the fix now to all 3 affected branches via the upstream project.

Also The fix is now the one with the Elvis operator usage!

 

> PushImpl.ts Socket#onerror attempting to use undefined variable
> ---
>
> Key: MYFACES-4671
> URL: https://issues.apache.org/jira/browse/MYFACES-4671
> Project: MyFaces Core
>  Issue Type: Bug
>Affects Versions: 4.0.2, 4.1.0-RC2
> Environment: OS: Windows 11
> Java version 17.0.7
>Reporter: Thomas Smith
>Assignee: Werner Punz
>Priority: Minor
> Fix For: 5.0.0, 4.0.3, 4.1.0-RC3
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> While running some OpenLiberty FAT tests, specifically 
> io.openliberty.org.apache.myfaces.4.0_fat/WebSocketTests, we discovered a 
> small bug where JSON.parse(event.data) was running where event.data was 
> undefined.
> Here is the line it occurs: 
> [https://github.com/apache/myfaces/blob/dae36dde5cc42208d034dda23107ad79f68ecc3a/api/src/client/typescript/faces/impl/PushImpl.ts#L156]
> Volodymyr created a GitHub issue describing the issue here: [Faces 4.0 Fix 
> WebSocketTests so that "onerror listener" occurs -  Issue #27598 -  
> OpenLiberty/open-liberty 
> (github.com)|https://github.com/OpenLiberty/open-liberty/issues/27598]
> Proposed Solution: Change
> {code:java}
>  JSON.parse(event.data) {code}
> to
> {code:java}
> JSON.parse(event.data === undefined ? null : event.data){code}



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


[jira] [Resolved] (MYFACES-4671) PushImpl.ts Socket#onerror attempting to use undefined variable

2024-06-21 Thread Werner Punz (Jira)


 [ 
https://issues.apache.org/jira/browse/MYFACES-4671?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Werner Punz resolved MYFACES-4671.
--
Resolution: Fixed

> PushImpl.ts Socket#onerror attempting to use undefined variable
> ---
>
> Key: MYFACES-4671
> URL: https://issues.apache.org/jira/browse/MYFACES-4671
> Project: MyFaces Core
>  Issue Type: Bug
>Affects Versions: 4.0.2, 4.1.0-RC2
> Environment: OS: Windows 11
> Java version 17.0.7
>Reporter: Thomas Smith
>Assignee: Werner Punz
>Priority: Minor
> Fix For: 5.0.0, 4.0.3, 4.1.0-RC3
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> While running some OpenLiberty FAT tests, specifically 
> io.openliberty.org.apache.myfaces.4.0_fat/WebSocketTests, we discovered a 
> small bug where JSON.parse(event.data) was running where event.data was 
> undefined.
> Here is the line it occurs: 
> [https://github.com/apache/myfaces/blob/dae36dde5cc42208d034dda23107ad79f68ecc3a/api/src/client/typescript/faces/impl/PushImpl.ts#L156]
> Volodymyr created a GitHub issue describing the issue here: [Faces 4.0 Fix 
> WebSocketTests so that "onerror listener" occurs -  Issue #27598 -  
> OpenLiberty/open-liberty 
> (github.com)|https://github.com/OpenLiberty/open-liberty/issues/27598]
> Proposed Solution: Change
> {code:java}
>  JSON.parse(event.data) {code}
> to
> {code:java}
> JSON.parse(event.data === undefined ? null : event.data){code}



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


[jira] [Commented] (MYFACES-4672) Uncaught TypeError: G.hasKey is not a function

2024-06-21 Thread Werner Punz (Jira)


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

Werner Punz commented on MYFACES-4672:
--

I am a little bit puzzled why you get the g.hasKey is not a function. There is 
decoration code which explicitly adds the hasKey 
/**
* creates a neutral form data wrapper over an existing form Data element
* the wrapper delegates following methods, append
* and adds makeFinal as finalizing method which returns the final
* send representation of the element
*
* @param formData an array
*/
createFormDataDecorator:function (formData)
 
That one creates formData shims and all of them have the hasKey, I will look 
into this!
Btw. Multiform reverts in old browsers to an iframe transport!
 

> Uncaught TypeError: G.hasKey is not a function
> --
>
> Key: MYFACES-4672
> URL: https://issues.apache.org/jira/browse/MYFACES-4672
> Project: MyFaces Core
>  Issue Type: Bug
>Affects Versions: 2.2.16
>Reporter: Volodymyr Siedlecki
>Assignee: Werner Punz
>Priority: Major
>
> This affects 2.2 which I know is out of date, but I have a user of MyFaces 
> 2.2 who needs this bug fixed.
> I ported MYFACES-4606 to 2.2 here: 
> [https://github.com/apache/myfaces/pull/647]
> 4606 was applied to 2.3, so I applied the same fix to 2.2.  However, I didn't 
> realize that _AjaxRequestLevel2 was removed from 2.3 in this PR: 
> [https://github.com/apache/myfaces/pull/415/files]
> _AjaxRequestLevel2 still exists in the 2.2 codebase. 
> This mean that `if(targetBuf.hasKey(identifier))` was called from 
> _AjaxRequestLevel2's getFormData which does not decorate the FormData to 
> include the hasKey method – thus we get " G.hasKey is not a function". 
> [https://github.com/volosied/myfaces/blob/d5d28a0e6cae3ea22e021c64ecf474d6352bf900/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequestLevel2.js#L32-L44]
> This error is reproducible via multi-part form requests that use ajax. 
> What is the proper fix here? I'll create a draft PR for what I think is 
> correct. 
> Thanks!



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


[jira] [Comment Edited] (MYFACES-4672) Uncaught TypeError: G.hasKey is not a function

2024-06-21 Thread Werner Punz (Jira)


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

Werner Punz edited comment on MYFACES-4672 at 6/21/24 8:53 PM:
---

I am a little bit puzzled why you get the g.hasKey is not a function. There is 
decoration code which explicitly adds the hasKey 
/**
 * creates a neutral form data wrapper over an existing form Data element
 * the wrapper delegates following methods, append
 * and adds makeFinal as finalizing method which returns the final
 * send representation of the element
*
 * @param formData an array
*/
createFormDataDecorator:function (formData)
 
That one creates formData shims and all of them have the hasKey, I will look 
into this!
Btw. Multipart reverts in old browsers to an iframe transport if xhr level 2 
cannot be provided


was (Author: werpu):
I am a little bit puzzled why you get the g.hasKey is not a function. There is 
decoration code which explicitly adds the hasKey 
/**
 * creates a neutral form data wrapper over an existing form Data element
 * the wrapper delegates following methods, append
 * and adds makeFinal as finalizing method which returns the final
 * send representation of the element
*
 * @param formData an array
*/
createFormDataDecorator:function (formData)
 
That one creates formData shims and all of them have the hasKey, I will look 
into this!
Btw. Multipart reverts in old browsers to an iframe transport if xhr level 2 
cannot be provided!
 * 
 

> Uncaught TypeError: G.hasKey is not a function
> --
>
> Key: MYFACES-4672
> URL: https://issues.apache.org/jira/browse/MYFACES-4672
> Project: MyFaces Core
>  Issue Type: Bug
>Affects Versions: 2.2.16
>Reporter: Volodymyr Siedlecki
>Assignee: Werner Punz
>Priority: Major
>
> This affects 2.2 which I know is out of date, but I have a user of MyFaces 
> 2.2 who needs this bug fixed.
> I ported MYFACES-4606 to 2.2 here: 
> [https://github.com/apache/myfaces/pull/647]
> 4606 was applied to 2.3, so I applied the same fix to 2.2.  However, I didn't 
> realize that _AjaxRequestLevel2 was removed from 2.3 in this PR: 
> [https://github.com/apache/myfaces/pull/415/files]
> _AjaxRequestLevel2 still exists in the 2.2 codebase. 
> This mean that `if(targetBuf.hasKey(identifier))` was called from 
> _AjaxRequestLevel2's getFormData which does not decorate the FormData to 
> include the hasKey method – thus we get " G.hasKey is not a function". 
> [https://github.com/volosied/myfaces/blob/d5d28a0e6cae3ea22e021c64ecf474d6352bf900/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequestLevel2.js#L32-L44]
> This error is reproducible via multi-part form requests that use ajax. 
> What is the proper fix here? I'll create a draft PR for what I think is 
> correct. 
> Thanks!



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


[jira] [Comment Edited] (MYFACES-4672) Uncaught TypeError: G.hasKey is not a function

2024-06-21 Thread Werner Punz (Jira)


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

Werner Punz edited comment on MYFACES-4672 at 6/21/24 8:53 PM:
---

I am a little bit puzzled why you get the g.hasKey is not a function. There is 
decoration code which explicitly adds the hasKey 
/**
 * creates a neutral form data wrapper over an existing form Data element
 * the wrapper delegates following methods, append
 * and adds makeFinal as finalizing method which returns the final
 * send representation of the element
*
 * @param formData an array
*/
createFormDataDecorator:function (formData)
 
That one creates formData shims and all of them have the hasKey, I will look 
into this!
Btw. Multipart reverts in old browsers to an iframe transport if xhr level 2 
cannot be provided!
 * 
 


was (Author: werpu):
I am a little bit puzzled why you get the g.hasKey is not a function. There is 
decoration code which explicitly adds the hasKey 
/**
* creates a neutral form data wrapper over an existing form Data element
* the wrapper delegates following methods, append
* and adds makeFinal as finalizing method which returns the final
* send representation of the element
*
* @param formData an array
*/
createFormDataDecorator:function (formData)
 
That one creates formData shims and all of them have the hasKey, I will look 
into this!
Btw. Multiform reverts in old browsers to an iframe transport!
 

> Uncaught TypeError: G.hasKey is not a function
> --
>
> Key: MYFACES-4672
> URL: https://issues.apache.org/jira/browse/MYFACES-4672
> Project: MyFaces Core
>  Issue Type: Bug
>Affects Versions: 2.2.16
>Reporter: Volodymyr Siedlecki
>Assignee: Werner Punz
>Priority: Major
>
> This affects 2.2 which I know is out of date, but I have a user of MyFaces 
> 2.2 who needs this bug fixed.
> I ported MYFACES-4606 to 2.2 here: 
> [https://github.com/apache/myfaces/pull/647]
> 4606 was applied to 2.3, so I applied the same fix to 2.2.  However, I didn't 
> realize that _AjaxRequestLevel2 was removed from 2.3 in this PR: 
> [https://github.com/apache/myfaces/pull/415/files]
> _AjaxRequestLevel2 still exists in the 2.2 codebase. 
> This mean that `if(targetBuf.hasKey(identifier))` was called from 
> _AjaxRequestLevel2's getFormData which does not decorate the FormData to 
> include the hasKey method – thus we get " G.hasKey is not a function". 
> [https://github.com/volosied/myfaces/blob/d5d28a0e6cae3ea22e021c64ecf474d6352bf900/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequestLevel2.js#L32-L44]
> This error is reproducible via multi-part form requests that use ajax. 
> What is the proper fix here? I'll create a draft PR for what I think is 
> correct. 
> Thanks!



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


[jira] [Comment Edited] (MYFACES-4672) Uncaught TypeError: G.hasKey is not a function

2024-06-21 Thread Werner Punz (Jira)


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

Werner Punz edited comment on MYFACES-4672 at 6/21/24 8:53 PM:
---

I am a little bit puzzled why you get the g.hasKey is not a function. There is 
decoration code which explicitly adds the hasKey 
/**
 * creates a neutral form data wrapper over an existing form Data element
 * the wrapper delegates following methods, append
 * and adds makeFinal as finalizing method which returns the final
 * send representation of the element
*
 * @param formData an array
*/
createFormDataDecorator:function (formData)
 


was (Author: werpu):
I am a little bit puzzled why you get the g.hasKey is not a function. There is 
decoration code which explicitly adds the hasKey 
/**
 * creates a neutral form data wrapper over an existing form Data element
 * the wrapper delegates following methods, append
 * and adds makeFinal as finalizing method which returns the final
 * send representation of the element
*
 * @param formData an array
*/
createFormDataDecorator:function (formData)
 
That one creates formData shims and all of them have the hasKey, I will look 
into this!
Btw. Multipart reverts in old browsers to an iframe transport if xhr level 2 
cannot be provided

> Uncaught TypeError: G.hasKey is not a function
> --
>
> Key: MYFACES-4672
> URL: https://issues.apache.org/jira/browse/MYFACES-4672
> Project: MyFaces Core
>  Issue Type: Bug
>Affects Versions: 2.2.16
>Reporter: Volodymyr Siedlecki
>Assignee: Werner Punz
>Priority: Major
>
> This affects 2.2 which I know is out of date, but I have a user of MyFaces 
> 2.2 who needs this bug fixed.
> I ported MYFACES-4606 to 2.2 here: 
> [https://github.com/apache/myfaces/pull/647]
> 4606 was applied to 2.3, so I applied the same fix to 2.2.  However, I didn't 
> realize that _AjaxRequestLevel2 was removed from 2.3 in this PR: 
> [https://github.com/apache/myfaces/pull/415/files]
> _AjaxRequestLevel2 still exists in the 2.2 codebase. 
> This mean that `if(targetBuf.hasKey(identifier))` was called from 
> _AjaxRequestLevel2's getFormData which does not decorate the FormData to 
> include the hasKey method – thus we get " G.hasKey is not a function". 
> [https://github.com/volosied/myfaces/blob/d5d28a0e6cae3ea22e021c64ecf474d6352bf900/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequestLevel2.js#L32-L44]
> This error is reproducible via multi-part form requests that use ajax. 
> What is the proper fix here? I'll create a draft PR for what I think is 
> correct. 
> Thanks!



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


[jira] [Comment Edited] (MYFACES-4672) Uncaught TypeError: G.hasKey is not a function

2024-06-21 Thread Werner Punz (Jira)


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

Werner Punz edited comment on MYFACES-4672 at 6/21/24 8:55 PM:
---

Ok the issue is very likely in the XHRRequestLevel2 code

 if (this._context._mfInternal.xhrOp === "multipartQueuedPost") {
ret = new FormData(this._sourceForm);


FormData does not have the getKey Function, we simply have to add a getKey 
function on the FormData class!

 


was (Author: werpu):
I am a little bit puzzled why you get the g.hasKey is not a function. There is 
decoration code which explicitly adds the hasKey 
/**
 * creates a neutral form data wrapper over an existing form Data element
 * the wrapper delegates following methods, append
 * and adds makeFinal as finalizing method which returns the final
 * send representation of the element
*
 * @param formData an array
*/
createFormDataDecorator:function (formData)
 

> Uncaught TypeError: G.hasKey is not a function
> --
>
> Key: MYFACES-4672
> URL: https://issues.apache.org/jira/browse/MYFACES-4672
> Project: MyFaces Core
>  Issue Type: Bug
>Affects Versions: 2.2.16
>Reporter: Volodymyr Siedlecki
>Assignee: Werner Punz
>Priority: Major
>
> This affects 2.2 which I know is out of date, but I have a user of MyFaces 
> 2.2 who needs this bug fixed.
> I ported MYFACES-4606 to 2.2 here: 
> [https://github.com/apache/myfaces/pull/647]
> 4606 was applied to 2.3, so I applied the same fix to 2.2.  However, I didn't 
> realize that _AjaxRequestLevel2 was removed from 2.3 in this PR: 
> [https://github.com/apache/myfaces/pull/415/files]
> _AjaxRequestLevel2 still exists in the 2.2 codebase. 
> This mean that `if(targetBuf.hasKey(identifier))` was called from 
> _AjaxRequestLevel2's getFormData which does not decorate the FormData to 
> include the hasKey method – thus we get " G.hasKey is not a function". 
> [https://github.com/volosied/myfaces/blob/d5d28a0e6cae3ea22e021c64ecf474d6352bf900/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequestLevel2.js#L32-L44]
> This error is reproducible via multi-part form requests that use ajax. 
> What is the proper fix here? I'll create a draft PR for what I think is 
> correct. 
> Thanks!



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


[jira] [Comment Edited] (MYFACES-4672) Uncaught TypeError: G.hasKey is not a function

2024-06-21 Thread Werner Punz (Jira)


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

Werner Punz edited comment on MYFACES-4672 at 6/21/24 8:55 PM:
---

Ok the issue is very likely in the XHRRequestLevel2 code

 if (this._context._mfInternal.xhrOp === "multipartQueuedPost") {
ret = new FormData(this._sourceForm);


FormData does not have the getKey Function, we simply have to add a hasKey 
function on the FormData class!

 


was (Author: werpu):
Ok the issue is very likely in the XHRRequestLevel2 code

 if (this._context._mfInternal.xhrOp === "multipartQueuedPost") {
ret = new FormData(this._sourceForm);


FormData does not have the getKey Function, we simply have to add a getKey 
function on the FormData class!

 

> Uncaught TypeError: G.hasKey is not a function
> --
>
> Key: MYFACES-4672
> URL: https://issues.apache.org/jira/browse/MYFACES-4672
> Project: MyFaces Core
>  Issue Type: Bug
>Affects Versions: 2.2.16
>Reporter: Volodymyr Siedlecki
>Assignee: Werner Punz
>Priority: Major
>
> This affects 2.2 which I know is out of date, but I have a user of MyFaces 
> 2.2 who needs this bug fixed.
> I ported MYFACES-4606 to 2.2 here: 
> [https://github.com/apache/myfaces/pull/647]
> 4606 was applied to 2.3, so I applied the same fix to 2.2.  However, I didn't 
> realize that _AjaxRequestLevel2 was removed from 2.3 in this PR: 
> [https://github.com/apache/myfaces/pull/415/files]
> _AjaxRequestLevel2 still exists in the 2.2 codebase. 
> This mean that `if(targetBuf.hasKey(identifier))` was called from 
> _AjaxRequestLevel2's getFormData which does not decorate the FormData to 
> include the hasKey method – thus we get " G.hasKey is not a function". 
> [https://github.com/volosied/myfaces/blob/d5d28a0e6cae3ea22e021c64ecf474d6352bf900/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequestLevel2.js#L32-L44]
> This error is reproducible via multi-part form requests that use ajax. 
> What is the proper fix here? I'll create a draft PR for what I think is 
> correct. 
> Thanks!



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


[jira] [Comment Edited] (MYFACES-4672) Uncaught TypeError: G.hasKey is not a function

2024-06-21 Thread Werner Punz (Jira)


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

Werner Punz edited comment on MYFACES-4672 at 6/21/24 8:56 PM:
---

Ok the issue is very likely in the XHRRequestLevel2 code

 if (this._context._mfInternal.xhrOp === "multipartQueuedPost") {
ret = new FormData(this._sourceForm);


FormData does not have the getKey Function, we simply have to add a hasKey 
function on the FormData class! This affects only the xhrLevel2 class, not the 
newer ones and very likely also not the iframe transport itself!


 


was (Author: werpu):
Ok the issue is very likely in the XHRRequestLevel2 code

 if (this._context._mfInternal.xhrOp === "multipartQueuedPost") {
ret = new FormData(this._sourceForm);


FormData does not have the getKey Function, we simply have to add a hasKey 
function on the FormData class!

 

> Uncaught TypeError: G.hasKey is not a function
> --
>
> Key: MYFACES-4672
> URL: https://issues.apache.org/jira/browse/MYFACES-4672
> Project: MyFaces Core
>  Issue Type: Bug
>Affects Versions: 2.2.16
>Reporter: Volodymyr Siedlecki
>Assignee: Werner Punz
>Priority: Major
>
> This affects 2.2 which I know is out of date, but I have a user of MyFaces 
> 2.2 who needs this bug fixed.
> I ported MYFACES-4606 to 2.2 here: 
> [https://github.com/apache/myfaces/pull/647]
> 4606 was applied to 2.3, so I applied the same fix to 2.2.  However, I didn't 
> realize that _AjaxRequestLevel2 was removed from 2.3 in this PR: 
> [https://github.com/apache/myfaces/pull/415/files]
> _AjaxRequestLevel2 still exists in the 2.2 codebase. 
> This mean that `if(targetBuf.hasKey(identifier))` was called from 
> _AjaxRequestLevel2's getFormData which does not decorate the FormData to 
> include the hasKey method – thus we get " G.hasKey is not a function". 
> [https://github.com/volosied/myfaces/blob/d5d28a0e6cae3ea22e021c64ecf474d6352bf900/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequestLevel2.js#L32-L44]
> This error is reproducible via multi-part form requests that use ajax. 
> What is the proper fix here? I'll create a draft PR for what I think is 
> correct. 
> Thanks!



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


[jira] [Comment Edited] (MYFACES-4672) Uncaught TypeError: G.hasKey is not a function

2024-06-21 Thread Werner Punz (Jira)


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

Werner Punz edited comment on MYFACES-4672 at 6/21/24 9:06 PM:
---

Ok the issue is very likely in the XHRRequestLevel2 code

 if (this._context._mfInternal.xhrOp === "multipartQueuedPost") {
ret = new FormData(this._sourceForm);


FormData does not have the hasKey Function but the has function (seems this was 
not fully fixed when I coded this and they renamed it), we simply can identify 
the code parts which have problems with the hasKey and use has instead as 
fallback, so if one or the other is present we use either!

 


was (Author: werpu):
Ok the issue is very likely in the XHRRequestLevel2 code

 if (this._context._mfInternal.xhrOp === "multipartQueuedPost") {
ret = new FormData(this._sourceForm);


FormData does not have the getKey Function, we simply have to add a hasKey 
function on the FormData class! This affects only the xhrLevel2 class, not the 
newer ones and very likely also not the iframe transport itself!


 

> Uncaught TypeError: G.hasKey is not a function
> --
>
> Key: MYFACES-4672
> URL: https://issues.apache.org/jira/browse/MYFACES-4672
> Project: MyFaces Core
>  Issue Type: Bug
>Affects Versions: 2.2.16
>Reporter: Volodymyr Siedlecki
>Assignee: Werner Punz
>Priority: Major
>
> This affects 2.2 which I know is out of date, but I have a user of MyFaces 
> 2.2 who needs this bug fixed.
> I ported MYFACES-4606 to 2.2 here: 
> [https://github.com/apache/myfaces/pull/647]
> 4606 was applied to 2.3, so I applied the same fix to 2.2.  However, I didn't 
> realize that _AjaxRequestLevel2 was removed from 2.3 in this PR: 
> [https://github.com/apache/myfaces/pull/415/files]
> _AjaxRequestLevel2 still exists in the 2.2 codebase. 
> This mean that `if(targetBuf.hasKey(identifier))` was called from 
> _AjaxRequestLevel2's getFormData which does not decorate the FormData to 
> include the hasKey method – thus we get " G.hasKey is not a function". 
> [https://github.com/volosied/myfaces/blob/d5d28a0e6cae3ea22e021c64ecf474d6352bf900/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequestLevel2.js#L32-L44]
> This error is reproducible via multi-part form requests that use ajax. 
> What is the proper fix here? I'll create a draft PR for what I think is 
> correct. 
> Thanks!



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


[jira] [Comment Edited] (MYFACES-4672) Uncaught TypeError: G.hasKey is not a function

2024-06-21 Thread Werner Punz (Jira)


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

Werner Punz edited comment on MYFACES-4672 at 6/21/24 9:07 PM:
---

Ok the issue is very likely in the XHRRequestLevel2 code

 if (this._context._mfInternal.xhrOp === "multipartQueuedPost") {
ret = new FormData(this._sourceForm);


FormData does not have the hasKey Function but the has function (seems this was 
not fully fixed when I coded this and they renamed it), we simply can identify 
the code parts which have problems with the hasKey and use has instead as 
fallback, so if one or the other is present we use either!

The reason why your patch fails is that createFormDataDecorator does not really 
work with a real xhr level2 object! This was a fallback to work with iframe 
transports but to keep the calls the same on the upper code levels! 
So we need to fix this on the code parts which rely on the hasKey function 
being present to also check for has!
This is a problem which probably the entire old codebase has!



 


was (Author: werpu):
Ok the issue is very likely in the XHRRequestLevel2 code

 if (this._context._mfInternal.xhrOp === "multipartQueuedPost") {
ret = new FormData(this._sourceForm);


FormData does not have the hasKey Function but the has function (seems this was 
not fully fixed when I coded this and they renamed it), we simply can identify 
the code parts which have problems with the hasKey and use has instead as 
fallback, so if one or the other is present we use either!

 

> Uncaught TypeError: G.hasKey is not a function
> --
>
> Key: MYFACES-4672
> URL: https://issues.apache.org/jira/browse/MYFACES-4672
> Project: MyFaces Core
>  Issue Type: Bug
>Affects Versions: 2.2.16
>Reporter: Volodymyr Siedlecki
>Assignee: Werner Punz
>Priority: Major
>
> This affects 2.2 which I know is out of date, but I have a user of MyFaces 
> 2.2 who needs this bug fixed.
> I ported MYFACES-4606 to 2.2 here: 
> [https://github.com/apache/myfaces/pull/647]
> 4606 was applied to 2.3, so I applied the same fix to 2.2.  However, I didn't 
> realize that _AjaxRequestLevel2 was removed from 2.3 in this PR: 
> [https://github.com/apache/myfaces/pull/415/files]
> _AjaxRequestLevel2 still exists in the 2.2 codebase. 
> This mean that `if(targetBuf.hasKey(identifier))` was called from 
> _AjaxRequestLevel2's getFormData which does not decorate the FormData to 
> include the hasKey method – thus we get " G.hasKey is not a function". 
> [https://github.com/volosied/myfaces/blob/d5d28a0e6cae3ea22e021c64ecf474d6352bf900/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequestLevel2.js#L32-L44]
> This error is reproducible via multi-part form requests that use ajax. 
> What is the proper fix here? I'll create a draft PR for what I think is 
> correct. 
> Thanks!



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


[jira] [Comment Edited] (MYFACES-4672) Uncaught TypeError: G.hasKey is not a function

2024-06-21 Thread Werner Punz (Jira)


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

Werner Punz edited comment on MYFACES-4672 at 6/21/24 9:08 PM:
---

Ok the issue is very likely in the XHRRequestLevel2 code

 if (this._context._mfInternal.xhrOp === "multipartQueuedPost") {
ret = new FormData(this._sourceForm);


FormData does not have the hasKey Function but the has function (seems this was 
not fully specced out, when I coded this and they renamed it), we simply can 
identify the code parts which have problems with the hasKey and use has instead 
as fallback, so if one or the other is present we use either!

The reason why your patch fails is that createFormDataDecorator does not really 
work with a real xhr level2 object! This was a fallback to work with iframe 
transports but to keep the calls the same on the upper code levels! 
So we need to fix this on the code parts which rely on the hasKey function 
being present to also check for has!
This is a problem which probably the entire old codebase has!



 


was (Author: werpu):
Ok the issue is very likely in the XHRRequestLevel2 code

 if (this._context._mfInternal.xhrOp === "multipartQueuedPost") {
ret = new FormData(this._sourceForm);


FormData does not have the hasKey Function but the has function (seems this was 
not fully fixed when I coded this and they renamed it), we simply can identify 
the code parts which have problems with the hasKey and use has instead as 
fallback, so if one or the other is present we use either!

The reason why your patch fails is that createFormDataDecorator does not really 
work with a real xhr level2 object! This was a fallback to work with iframe 
transports but to keep the calls the same on the upper code levels! 
So we need to fix this on the code parts which rely on the hasKey function 
being present to also check for has!
This is a problem which probably the entire old codebase has!



 

> Uncaught TypeError: G.hasKey is not a function
> --
>
> Key: MYFACES-4672
> URL: https://issues.apache.org/jira/browse/MYFACES-4672
> Project: MyFaces Core
>  Issue Type: Bug
>Affects Versions: 2.2.16
>Reporter: Volodymyr Siedlecki
>Assignee: Werner Punz
>Priority: Major
>
> This affects 2.2 which I know is out of date, but I have a user of MyFaces 
> 2.2 who needs this bug fixed.
> I ported MYFACES-4606 to 2.2 here: 
> [https://github.com/apache/myfaces/pull/647]
> 4606 was applied to 2.3, so I applied the same fix to 2.2.  However, I didn't 
> realize that _AjaxRequestLevel2 was removed from 2.3 in this PR: 
> [https://github.com/apache/myfaces/pull/415/files]
> _AjaxRequestLevel2 still exists in the 2.2 codebase. 
> This mean that `if(targetBuf.hasKey(identifier))` was called from 
> _AjaxRequestLevel2's getFormData which does not decorate the FormData to 
> include the hasKey method – thus we get " G.hasKey is not a function". 
> [https://github.com/volosied/myfaces/blob/d5d28a0e6cae3ea22e021c64ecf474d6352bf900/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequestLevel2.js#L32-L44]
> This error is reproducible via multi-part form requests that use ajax. 
> What is the proper fix here? I'll create a draft PR for what I think is 
> correct. 
> Thanks!



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


[jira] [Comment Edited] (MYFACES-4672) Uncaught TypeError: G.hasKey is not a function

2024-06-21 Thread Werner Punz (Jira)


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

Werner Punz edited comment on MYFACES-4672 at 6/21/24 9:08 PM:
---

Ok the issue is very likely in the XHRRequestLevel2 code

 if (this._context._mfInternal.xhrOp === "multipartQueuedPost") {
ret = new FormData(this._sourceForm);


FormData does not have the hasKey Function but the has function (seems this was 
not fully specced out, when I coded this given that xhr2 was in beta at best 
then, and they renamed it), we simply can identify the code parts which have 
problems with the hasKey and use has instead as fallback, so if one or the 
other is present we use either!

The reason why your patch fails is that createFormDataDecorator does not really 
work with a real xhr level2 object! This was a fallback to work with iframe 
transports but to keep the calls the same on the upper code levels! 
So we need to fix this on the code parts which rely on the hasKey function 
being present to also check for has!
This is a problem which probably the entire old codebase has!



 


was (Author: werpu):
Ok the issue is very likely in the XHRRequestLevel2 code

 if (this._context._mfInternal.xhrOp === "multipartQueuedPost") {
ret = new FormData(this._sourceForm);


FormData does not have the hasKey Function but the has function (seems this was 
not fully specced out, when I coded this and they renamed it), we simply can 
identify the code parts which have problems with the hasKey and use has instead 
as fallback, so if one or the other is present we use either!

The reason why your patch fails is that createFormDataDecorator does not really 
work with a real xhr level2 object! This was a fallback to work with iframe 
transports but to keep the calls the same on the upper code levels! 
So we need to fix this on the code parts which rely on the hasKey function 
being present to also check for has!
This is a problem which probably the entire old codebase has!



 

> Uncaught TypeError: G.hasKey is not a function
> --
>
> Key: MYFACES-4672
> URL: https://issues.apache.org/jira/browse/MYFACES-4672
> Project: MyFaces Core
>  Issue Type: Bug
>Affects Versions: 2.2.16
>Reporter: Volodymyr Siedlecki
>Assignee: Werner Punz
>Priority: Major
>
> This affects 2.2 which I know is out of date, but I have a user of MyFaces 
> 2.2 who needs this bug fixed.
> I ported MYFACES-4606 to 2.2 here: 
> [https://github.com/apache/myfaces/pull/647]
> 4606 was applied to 2.3, so I applied the same fix to 2.2.  However, I didn't 
> realize that _AjaxRequestLevel2 was removed from 2.3 in this PR: 
> [https://github.com/apache/myfaces/pull/415/files]
> _AjaxRequestLevel2 still exists in the 2.2 codebase. 
> This mean that `if(targetBuf.hasKey(identifier))` was called from 
> _AjaxRequestLevel2's getFormData which does not decorate the FormData to 
> include the hasKey method – thus we get " G.hasKey is not a function". 
> [https://github.com/volosied/myfaces/blob/d5d28a0e6cae3ea22e021c64ecf474d6352bf900/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequestLevel2.js#L32-L44]
> This error is reproducible via multi-part form requests that use ajax. 
> What is the proper fix here? I'll create a draft PR for what I think is 
> correct. 
> Thanks!



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


[jira] [Comment Edited] (MYFACES-4672) Uncaught TypeError: G.hasKey is not a function

2024-06-21 Thread Werner Punz (Jira)


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

Werner Punz edited comment on MYFACES-4672 at 6/21/24 9:09 PM:
---

Ok the issue is very likely in the XHRRequestLevel2 code

 if (this._context._mfInternal.xhrOp === "multipartQueuedPost") {
ret = new FormData(this._sourceForm);


FormData does not have the hasKey Function but the has function (seems this was 
not fully specced out, when I coded this given that xhr2 was in beta at best 
then, and they renamed it), we simply can identify the code parts which have 
problems with the hasKey and use has instead as fallback, so if one or the 
other is present we use either!

The reason why your patch fails is that createFormDataDecorator does not really 
work with a real xhr level2 object! This was a fallback to work with iframe 
transports but to keep the calls the same on the upper code levels! 
So we need to fix this on the code parts which rely on the hasKey function 
being present to also check for has!
This is a problem which probably the entire old codebase has!


As reference: 
https://developer.mozilla.org/en-US/docs/Web/API/FormData/has?retiredLocale=de

 


was (Author: werpu):
Ok the issue is very likely in the XHRRequestLevel2 code

 if (this._context._mfInternal.xhrOp === "multipartQueuedPost") {
ret = new FormData(this._sourceForm);


FormData does not have the hasKey Function but the has function (seems this was 
not fully specced out, when I coded this given that xhr2 was in beta at best 
then, and they renamed it), we simply can identify the code parts which have 
problems with the hasKey and use has instead as fallback, so if one or the 
other is present we use either!

The reason why your patch fails is that createFormDataDecorator does not really 
work with a real xhr level2 object! This was a fallback to work with iframe 
transports but to keep the calls the same on the upper code levels! 
So we need to fix this on the code parts which rely on the hasKey function 
being present to also check for has!
This is a problem which probably the entire old codebase has!



 

> Uncaught TypeError: G.hasKey is not a function
> --
>
> Key: MYFACES-4672
> URL: https://issues.apache.org/jira/browse/MYFACES-4672
> Project: MyFaces Core
>  Issue Type: Bug
>Affects Versions: 2.2.16
>Reporter: Volodymyr Siedlecki
>Assignee: Werner Punz
>Priority: Major
>
> This affects 2.2 which I know is out of date, but I have a user of MyFaces 
> 2.2 who needs this bug fixed.
> I ported MYFACES-4606 to 2.2 here: 
> [https://github.com/apache/myfaces/pull/647]
> 4606 was applied to 2.3, so I applied the same fix to 2.2.  However, I didn't 
> realize that _AjaxRequestLevel2 was removed from 2.3 in this PR: 
> [https://github.com/apache/myfaces/pull/415/files]
> _AjaxRequestLevel2 still exists in the 2.2 codebase. 
> This mean that `if(targetBuf.hasKey(identifier))` was called from 
> _AjaxRequestLevel2's getFormData which does not decorate the FormData to 
> include the hasKey method – thus we get " G.hasKey is not a function". 
> [https://github.com/volosied/myfaces/blob/d5d28a0e6cae3ea22e021c64ecf474d6352bf900/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequestLevel2.js#L32-L44]
> This error is reproducible via multi-part form requests that use ajax. 
> What is the proper fix here? I'll create a draft PR for what I think is 
> correct. 
> Thanks!



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


[jira] [Commented] (MYFACES-4672) Uncaught TypeError: G.hasKey is not a function

2024-06-21 Thread Volodymyr Siedlecki (Jira)


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

Volodymyr Siedlecki commented on MYFACES-4672:
--

Are you saying we should use use " if(targetBuf.has(identifier)) {" instead? 


[https://github.com/Apache/myfaces/blob/d5d28a0e6cae3ea22e021c64ecf474d6352bf900/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxUtils.js#L63]
 


I'll leave it to you as this is out of my area at this point.  Thank you again 
for all your help here :)

> Uncaught TypeError: G.hasKey is not a function
> --
>
> Key: MYFACES-4672
> URL: https://issues.apache.org/jira/browse/MYFACES-4672
> Project: MyFaces Core
>  Issue Type: Bug
>Affects Versions: 2.2.16
>Reporter: Volodymyr Siedlecki
>Assignee: Werner Punz
>Priority: Major
>
> This affects 2.2 which I know is out of date, but I have a user of MyFaces 
> 2.2 who needs this bug fixed.
> I ported MYFACES-4606 to 2.2 here: 
> [https://github.com/apache/myfaces/pull/647]
> 4606 was applied to 2.3, so I applied the same fix to 2.2.  However, I didn't 
> realize that _AjaxRequestLevel2 was removed from 2.3 in this PR: 
> [https://github.com/apache/myfaces/pull/415/files]
> _AjaxRequestLevel2 still exists in the 2.2 codebase. 
> This mean that `if(targetBuf.hasKey(identifier))` was called from 
> _AjaxRequestLevel2's getFormData which does not decorate the FormData to 
> include the hasKey method – thus we get " G.hasKey is not a function". 
> [https://github.com/volosied/myfaces/blob/d5d28a0e6cae3ea22e021c64ecf474d6352bf900/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequestLevel2.js#L32-L44]
> This error is reproducible via multi-part form requests that use ajax. 
> What is the proper fix here? I'll create a draft PR for what I think is 
> correct. 
> Thanks!



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


[jira] [Commented] (MYFACES-4672) Uncaught TypeError: G.hasKey is not a function

2024-06-21 Thread Werner Punz (Jira)


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

Werner Punz commented on MYFACES-4672:
--

I am thinking about the following follliwing, I do not want to change the code 
big time
if((targetBuf.has && targetBuf.has(identifier)) || (targetBuf.hasKey && 
targetBuf.hasKey(identifier))) 

you basically do a check first which type of targetBuf you have by checking the 
whether it has a has or hasKey and then proceed forward!
Give this a shot!
I will be able to provide a fix monday, but not earlier, sorry about that! But 
you can give it a try that way. 

> Uncaught TypeError: G.hasKey is not a function
> --
>
> Key: MYFACES-4672
> URL: https://issues.apache.org/jira/browse/MYFACES-4672
> Project: MyFaces Core
>  Issue Type: Bug
>Affects Versions: 2.2.16
>Reporter: Volodymyr Siedlecki
>Assignee: Werner Punz
>Priority: Major
>
> This affects 2.2 which I know is out of date, but I have a user of MyFaces 
> 2.2 who needs this bug fixed.
> I ported MYFACES-4606 to 2.2 here: 
> [https://github.com/apache/myfaces/pull/647]
> 4606 was applied to 2.3, so I applied the same fix to 2.2.  However, I didn't 
> realize that _AjaxRequestLevel2 was removed from 2.3 in this PR: 
> [https://github.com/apache/myfaces/pull/415/files]
> _AjaxRequestLevel2 still exists in the 2.2 codebase. 
> This mean that `if(targetBuf.hasKey(identifier))` was called from 
> _AjaxRequestLevel2's getFormData which does not decorate the FormData to 
> include the hasKey method – thus we get " G.hasKey is not a function". 
> [https://github.com/volosied/myfaces/blob/d5d28a0e6cae3ea22e021c64ecf474d6352bf900/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequestLevel2.js#L32-L44]
> This error is reproducible via multi-part form requests that use ajax. 
> What is the proper fix here? I'll create a draft PR for what I think is 
> correct. 
> Thanks!



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