Mokku icon indicating copy to clipboard operation
Mokku copied to clipboard

FormData class is redefined

Open xorxsan opened this issue 3 years ago • 2 comments

Hi,

when Mokku is enabled, the FormData class gets redefined as this:

> const formData = new FormData(<a form with values>)
> formData
g {fd: FormData, form: form.standard-form, append: ƒ}
append: ƒ ()
fd: FormData {}
form: form.standard-form
entries: (...)
get entries: ƒ ()
__proto__: Object

And doing any operations on that variable like formData.get("") throws an exception:

TypeError: formData.get is not a function

Tried it in Chrome Version 89.0.4389.90 (Official Build) (64-bit)

xorxsan avatar Mar 26 '21 11:03 xorxsan

Hi @xorxsan, thanks for reporting, will look into it.

mukuljainx avatar Mar 27 '21 09:03 mukuljainx

Hi @xorxsan just an update, this is not very straightforward as I am using a library xhook that does that, I am exploring new ways to mock which takes page injection out of context, no injection - no unexpected modification like this, if it works then well and good, if not I will try to inject getter and setters to current form data class.

mukuljainx avatar May 26 '21 16:05 mukuljainx

Hi @xorxsan, Can you check this again, I checked with 2.0.0(1), not happening anymore. Feel free to reopen.

mukuljainx avatar Aug 27 '23 12:08 mukuljainx