Closed olueiro closed 5 years ago
From https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/status
Before the request completes, the value of status is 0. Browsers also report a status of 0 in case of XMLHttpRequest errors.
This sounds like a bug in Phonegap.
Hmm
I've created a custom fengari(-web) version for PhoneGap with my modifications (xhr.status and error logging)
PS I've tested my package in local browser, Nox emulator and some mobile Android devices (no iOS :cry: ). In any tests, javascript WeakMap
is undefined, so I have added a WeakMap
polyfill.
You can close this issue. :smile:
I have added a
WeakMap
polyfill.
Weakmap
is impossible to polyfill correctly (hence why it remains a hard dependency).
Are you sure that your JS engine doesn't support Weakmap
? If so it is very old and should be updated.
I can to reproduce this on Nox App Player (latest version), running on Windows 10 machine. This sounds like a bug in Phonegap too. In my Android devices the JS engine supports WeakMap .
This Map shim emulates the Weakmap (window.WeakMap = window.Map;
) and has solved my issue.
window.WeakMap = window.Map;
that will end up leaking memory: the longer your page/app runs, the more memory it will use.
Hi https://github.com/fengari-lua/fengari-web/blob/a9fb130f6851206e8a57be902af061e980be5610/src/fengari-web.js#L188
Reference: https://stackoverflow.com/q/33471547