polkadot-js / extension

Simple browser extension for managing Polkadot and Substrate network accounts in a browser. Allows the signing of extrinsics using these accounts. Also provides a simple interface for compliant extensions for dapps.
Apache License 2.0
972 stars 417 forks source link

Support Safari14 #377

Open athei opened 4 years ago

athei commented 4 years ago

The upcoming Safari14 will support web extensions. It may be worthwhile to look into whether we can support this browser with the current code. Safari14 will not support all API available in Firefox and Chrome in its first release. So some modification might be necessary. Safari web extensions need to be packaged as an app but there is a conversion tool for existing projects in the Xcode12 beta that just creates a bare minimum wrapper app that can be used to distribute the extension through the app store (the only way to distribute web extensions AFAIK).

carumusan commented 4 years ago
image

I got this to work using the built in web extension converter in macOS 11, Safari 14 and the Xcode 12 toolkit. After yarn installing and building you can run

xcrun safari-web-extension-converter .

in the build directory. The only api not supported by safari is background.persistence == true. Would be cool to have this officially supported as I use Safari most of the time.

jacogr commented 4 years ago

Really cool. Also on Mac, so I will definitely tale a look at some point - feel free to contribute additional/fixes to support this in the meantime, I always love contributions. (Especially if you are actually using it...)

remon-nashid commented 4 years ago

The only api not supported by safari is background.persistence == true. Would be cool to have this officially supported as I use Safari most of the time.

I wonder, why does the extension use persistence at the first place?

Tbaut commented 3 years ago

I wonder, why does the extension use persistence at the first place?

The background script in the extension is constantly listening to messages coming from a Dapps (signing and others...).

athei commented 3 years ago

I am not well-versed (not all all to be honest) in extension development but the documentation reads as if persistent is not required for that.

The registration of listeners is persistent even without persistent. When such a message from a Dapp arrives the background script would be loaded and unloaded when the processing is finished.

jacogr commented 3 years ago

With significant overhead, yes. So there are very valid reasons why this extension (like other well known extensions in other blockchains) use persistence.

However since there is manifest 3 on the horizon and this approach is deprecated, it is due for removal, please see https://github.com/polkadot-js/extension/issues/310, as logged

athei commented 3 years ago

Thanks for the explanation. It certainly feels sluggish on Safari (clicking the toolbar icon).

AurevoirXavier commented 2 years ago

Any progress on this?

Really looking forward to this.

david9991 commented 7 months ago
image

I got this to work using the built in web extension converter in macOS 11, Safari 14 and the Xcode 12 toolkit. After yarn installing and building you can run

xcrun safari-web-extension-converter .

in the build directory. The only api not supported by safari is background.persistence == true. Would be cool to have this officially supported as I use Safari most of the time.

By ITP policy, the indexedDB and localStorage will be cleared every 7days. Even with ITP disabled, the data will be deleted after each Safari upgrade.

Screenshot 2024-02-18 at 09 42 24