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
971 stars 415 forks source link

Remove persistent background pages (basically eol in Chrome) #310

Closed jacogr closed 2 months ago

jacogr commented 4 years ago

Specifically https://github.com/polkadot-js/extension/blob/master/packages/extension/manifest.json#L11

This puts the extension down the road to get ready for a move to V3 manifests (persistent not supported, background pages are service workers)

There is an impact on initialization, so will see what the overhead turns out to be. (Specifically wasm-crypto)

This also means that the in-memory state needs to be moved to actual storage as applicable.

The checklist -

https://developer.chrome.com/docs/extensions/mv3/mv3-migration-checklist/

jak-pan commented 3 years ago

Ah so this is why in chrome canary the extension breaks after using it for a while. Stable is now at version 89 where it works. Canary is at 91 so there's probably still some time.

jacogr commented 3 years ago

Umpf. There is a still a lot of work to do on this front... not ready for v3 as of yet :(

Will try and see what is the absolute minimum.

jak-pan commented 3 years ago

It looks like almost all of the extension is working even without the wasm and with the error present. It's just the popup window account screen that doesn't work. Even account creation from the popup is ok. Isn't there just some easy fix for now, that would at least partly make it seem not broken? I mean it's usable...

jacogr commented 3 years ago

I saw the UI issue on canary, it is the css calc as height: calc(100vh - 2px) here that is broken and causing the layout issue -

image

It really looks like a Canary bug. Setting it to height: 100vh works - but you cannot quite do it each and every time you open it...

EDT: And adding it as part of a style tag does seem to work... as part of inline styles it doesn't.

jak-pan commented 3 years ago

Ah sorry. I thought that it has to do something with the error in the console.

Maybe OT but: I rememeber exactly this problem happening several years back, when working on an extension. It had to do with the window starting as zero size and resizing to content, but it didn't always fire repaints correctly, so we needed to hack it, by introducing resize after load. I thought I'm crazy by telling this but I still found this is an issue from time to time until today! https://stackoverflow.com/questions/8840580/force-dom-redraw-refresh-on-chrome-mac

jacogr commented 3 years ago

:) Just spend some time reading a number of interesting workarounds - and then got to stuff like „October 2020 - the above hacks stopped working, here are some new ones“

zeedgold commented 3 years ago

This is very interesting

zeedgold commented 3 years ago

This is very interesting

Nick-1979 commented 2 years ago

Are there any plans to work on this serious issue in the near future?

jacogr commented 2 years ago

The extension won't be removed from the stores, but will comply with the requirements.

Nick-1979 commented 2 years ago

When do you estimate it will be available in V3?

jacogr commented 1 year ago

Have a working local version that I've been using and sorting through issues (of which there were "some", not even mentioning dual FF & Chrome support), but there also seems some breathing room atm - https://news.ycombinator.com/item?id=33925735 (mid Dec 2022) as well as https://developer.chrome.com/blog/more-mv2-transition/ (early Dec 2022). Keeping an eye since it may just be enough tracking the FF rollouts of support.

TL;DR Some breathing room is nice since FF + Chrome compat is "slightly" nightmarish...

Kocik commented 1 year ago

@jacogr We're developing a fork of the extension, focused on Aleph Zero network. I'd like to propose a collaboration, where we test your v3 support and contribute by taking over or working together on the remaining issues.

To deploy it on the Chrome Web Store, we must migrate to v3 since new v2 extensions are no longer accepted, so this way, we could get a head start on the migration, and you would get help on testing and finalize the whole thing. Then we would merge the final solution to our solution. Let me know what you think.

PS You can look at our repo here.

poka-IT commented 9 months ago

I implement manifest v3 changes with service_worker on this commit of our fork: https://git.duniter.org/clients/duniter-connect/-/commit/6a2278eac0ea5e779270ff09d6742ef7360a75e9

Inspired by this commit, many thanks to @Kocik.

It works very good on Chrome and have been accepted on chrome store. Just a little issue with popup width and popup which doesn't close after extrinsic signature confirmation (stay open on extension home).

On firefox, I still have an issue with permission: We have to manually accept the extension to communicate with web page, for each ones, I don't know why yet.

polkadot-js-bot commented 2 months ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue if you think you have a related problem or query.