Open TarikGul opened 1 month ago
So far the extension is working fine in chrome with the exception of the following errors:
Error: Invalid url chrome://extensions/?errors=fnpncejekijbiiemffncneiiilejbmbj, expected to start with http: or https: or ipfs: or ipns:
Instead of causing breaking changes to extension-base
by enforcing async at the top level of State, I am going to just use the callback method for storage.local
Edit: Ahh but this might not work since there is no more persistent background.
edit: There was a stray change in the current state to avoid a TypeError: chrome.extension.getURL is not a function
in packages/extension-base/src/background/handlers/State.ts
- const NOTIFICATION_URL = chrome.extension.getURL('notification.html');
+ const NOTIFICATION_URL = chrome.runtime.getURL('notification.html');
I had a quick look on Firefox, changing the manifest to make it happy with what I found here which I'm sure you know
"background": {
"scripts": ["background.js"]
},
edit2: In Firefox the extension is then loaded correctly, I could add an account, but no script is injected on pages, so Dapps don't detect the extensions.
On chrome/brave, the next error I encountered in background.js
was
ReferenceError: localStorage is not defined
@Tbaut Yea the I was able to fix the localStorage error but then reverted my changes because I would like to change the design of the implementation, but yea the localStorage issue will be fixed soon :)
Is it expected that this PR will be merged in the near future? We have a downstream dependency for our Polymesh Wallet which requires this in order to move to manifest V3. @Tbaut
Is it expected that this PR will be merged in the near future? We have a downstream dependency for our Polymesh Wallet which requires this in order to move to manifest V3. @Tbaut
Yes this is absolutely a priority! My goal is to get it done this week.
Hello there, I tried this branch and documented my tests:
tg-manifest-v3
, did yarn && yarn build
refresh the extension in chrome
BTW just to be 100% sure this is indeed loading the extension I wantwith v3, I bumped the version in packages/extension/package.json
before building, and made sure the new version is displayed in chrome.Note that this includes connecting to some websites, and changing the connected accounts.
Somewhat unexpected for normal users
In summary, it's looking amazing :clap:
closes: https://github.com/polkadot-js/extension/issues/1316 closes: https://github.com/polkadot-js/extension/issues/310
Summary (BREAKING CHANGES)
The following PR gives support for manifest V3. Below will help document the exact changes that have taken place in this PR and how it affects the interface given to users.
@polkadot/extension-base
The following covers exported items from
@polkadot/extension-base
.class Extension
Extension.accountsForget
: This is now asynchronous, and has a return type ofPromise<boolean>
instead ofboolean
.Extension.authorizeUpdate
: This is now asynchronous, and has a return type ofPromise<void>
instead ofvoid
.Extension.metadataApprove
: This is now asynchronous, and has a return type ofPromise<boolean>
instead ofboolean
.Extension.removeAuthorization
: This is now asynchronous, and has a return type ofPromise<ResponseAuthorizeList>
instead ofResponseAuthorizeList
.class State
new State(providers)
has now changed. This is becauseextractMetadata
within the constructor has to be asynchronous now. So we instead have the logic from the constructor and placed it within a init function to initialize state. Example below:State.saveCurrentAuthList
: This is now asynchronous, and has a return type ofPromise<void>
instead ofvoid
.State.saveDefaultAuthAccounts
: This is now asynchronous, and has a return type ofPromise<void>
instead ofvoid
.State.updateDefaultAuthAccounts
: This is now asynchronous, and has a return type ofPromise<void>
instead ofvoid
.State.removeAuthorization
: This is now asynchronous, and has a return type ofPromise<AuthUrls>
instead ofAuthUrls
.State.updateAuthorizedAccounts
: This is now asynchronous, and has a return type ofPromise<void>
instead ofvoid
.State.saveMetadata
: This is now asynchronous, and has a return type ofPromise<void>
instead ofvoid
.Checklist
web_accessible_resources
offscreen
permission. See update_permissions, and keep-features for more info. I believe this is actually not necessary given the specific constraints.XMLHttpRequest
await chrome.alarms.create
tabs.executeScript()
tabs.insertCSS()
ortabs.removeCSS()