Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File, FileReader, Blob, ArrayBuffer are replacing Javascript native code instead of extending it. #572

Open
LucasBourgeois opened this issue Jun 26, 2023 · 0 comments

Comments

@LucasBourgeois
Copy link

Bug Report

Problem

Many of this plugin classes are overriding Javascript native classes instead of implements them properly

What is expected to happen?

Plugin Blob, File, ArrayBuffer, FileReader classes should not replace Javascript native code and extend native JS API's

What does actually happen?

For exemple, if i do a const file = new File([], 'yoyo'), I can't use Blob() functions like file.arrayBuffer() as File isn't extending Blob interface.
Also, file.name is an array containing a Blob item.

It cause unexpected behavior between browser web native Javascript File implementation and phone device cordova one.
In addition, we must add trash code to handle this.

Information

https://developer.mozilla.org/en-US/docs/Web/API/Blob
https://developer.mozilla.org/en-US/docs/Web/API/File
https://developer.mozilla.org/fr/docs/Web/API/FileReader

Command or Code

Just init a new File() or an new ArrayBuffer() and compare them with browser result, they are not as Javascript define them.

Environment, Platform, Device

Cordova-android 11, Android 13 device, Chrome.

Version information

    "cordova-plugin-file": "^6.0.2",

Checklist

  • [ X] I searched for existing GitHub issues
  • [X ] I updated all Cordova tooling to most recent version
  • [ X] I included all the necessary information above
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant