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

U64 does not work in Safari #2716

Closed
Firaenix opened this issue Nov 4, 2021 · 11 comments
Closed

U64 does not work in Safari #2716

Firaenix opened this issue Nov 4, 2021 · 11 comments
Labels

Comments

@Firaenix
Copy link

Firaenix commented Nov 4, 2021

Describe the Bug

Safari 14 does not support BigUint64Array as mentioned in #2441 (comment)

Steps to Reproduce

Run any wasm code/test that exposes u64 in safari.

https://github.com/Firaenix/wasm-bindgen-BigUint64Array-repro

Expected Behavior

Should run in Safari (iOS and macOS) as in any other environment.

Actual Behavior

Console error that causes the code not to run.

@Firaenix Firaenix added the bug label Nov 4, 2021
@memoryruins
Copy link

Safari 15, released in September, added support for BigInt64Array and BigUint64Array on macOS and iOS. It might take a few more months before a majority of users have upgraded.

@Firaenix
Copy link
Author

Firaenix commented Nov 5, 2021

I don't think that's a satisfying solution, especially when the documentation claims that it should work on Safari.
If we are already providing what is essentially a polyfill for u64, it shouldnt just be good enough to say that we should just wait for users to upgrade.

I'm working on a PR that should hopefully solve this issue for all BigInt supporting browsers

@memoryruins
Copy link

To be clear, I wasn't offering a solution previously, only describing the current state of Safari support. An improved polyfill that handles Safari 14 would be great.

@Firaenix
Copy link
Author

Firaenix commented Nov 5, 2021

All good, I misinterpreted in that case, sorry for that

@Firaenix
Copy link
Author

I have a branch on my fork which works in Safari and all other browsers that support BigInt:
https://github.com/bsvwasm/wasm-bindgen/tree/universal-ui64-patch

@Firaenix
Copy link
Author

#2727

@dovahcrow
Copy link

does #3037 fixed this issue?

@Liamolucko
Copy link
Collaborator

does #3037 fixed this issue?

Yes.

@senolem
Copy link

senolem commented Jan 19, 2023

Hello, bf109de was supposed to fix this issue, but release 0.2.83 still fails upon using BigInt64Array on Safari iOS 14.8. This has been tested through Ruffle and the issue started when they updated to 0.2.83 (ruffle-rs/ruffle@1954f61). Any ideas?
EDIT : nosamu on Ruffle's Discord suggested that only BigUInt was fixed, but not BigInt.
(the log from Ruffle specify "Can't find variable: BigInt64Array")

Liamolucko added a commit to Liamolucko/wasm-bindgen that referenced this issue Jan 21, 2023
This stops load-time errors in versions of Safari before 15 if the `BigInt64Array` or `BigUint64Array` memory views are included but never used.

Pointed out in rustwasm#2716 (comment).
@Liamolucko
Copy link
Collaborator

#3037 fixed the problem for passing i64s and u64s directly, but it turns out that returning Option<i64> or Option<u64> still ends up using BigInt64Array for other reasons.

Right now (since #2886), that BigInt64Array gets initialised immediately, which means that trying to run something that might use it in Safari 14 will fail instantly. I've opened #3253 to change it back to only being initialised on first use, so that things can still work in Safari 14 as long as they never reach the code that uses the BigInt64Array. I think that should be enough to get Ruffle working.

@senolem
Copy link

senolem commented Jan 21, 2023

Thanks for your detailed answer :) Unfortunately I cannot test right now because I have no idea how to compile Ruffle from source, even less how to use a specific branch rather than the release they're using. I'll update you ASAP (so whenever the PR is commited and they update their dependencies)

alexcrichton pushed a commit that referenced this issue Jan 24, 2023
* Lazily initialize memory views

This stops load-time errors in versions of Safari before 15 if the `BigInt64Array` or `BigUint64Array` memory views are included but never used.

Pointed out in #2716 (comment).

* Update reference tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants