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

wallet Dapp Connection dialog fails silently with some privacy settings #45

Open
dckc opened this issue Dec 1, 2022 · 5 comments
Open
Labels
vaults_triage DO NOT USE

Comments

@dckc
Copy link
Member

dckc commented Dec 1, 2022

A community member reports:

I am on a chromebook, and when I go to PSM it does not prompt me to connect the dApp to the wallet

image

Failed to read 'localStorage' from 'Window': Access denied for this document

lockdown.umd.js:6614 
logError @ lockdown.umd.js:6614
logSubErrors @ lockdown.umd.js:6535
error @ lockdown.umd.js:6633
(anonymous) @ lockdown.umd.js:6919
error (async)
tameConsole @ lockdown.umd.js:6916
repairIntrinsics @ lockdown.umd.js:9082
lockdown @ lockdown.umd.js:9191
(anonymous) @ lockdown.js:16
(anonymous) @ bridge-dapp.jsx:205
(anonymous) @ bridge-dapp.jsx:205
index.86a34759.js:24 got metrics {anchorPoolBalance: {…}, feePoolBalance: {…}, mintedPoolBalance: {…}, totalAnchorProvided: {…}, totalMintedProvided: {…}}

cc @FredRadford @samsiegart @turadg

@dckc
Copy link
Member Author

dckc commented Dec 1, 2022

stackoverflow disucssion suggests this is due to unusual privacy settings.

In any case, I'd like us to do better than a silent failure.

In some cases we seem to be careful about lack of access to localStorage:

if (window?.localStorage) {

but in others, maybe not so much?

localStorage,

@lherfel
Copy link

lherfel commented Dec 1, 2022

third party cookies blocked, do not track, clear cookies on shutdown ( I intermittently wipe all cookies manually like google youtube etc that get left on about once a month)
Actually on this chromebook, I do not think I have done anything more

@samsiegart
Copy link
Contributor

samsiegart commented Dec 1, 2022

This is the relevant code

const Bridge = () => {
useEffect(() => {
const tryConnect = async () => {
if ('requestStorageAccess' in document) {
if (await document.hasStorageAccess()) {
return connectDapp();
} else {
sendCookiesDisabledError();
}
} else if ('localStorage' in window) {
return connectDapp();
} else {
sendCookiesDisabledError();
}
};
void tryConnect();
}, []);
return <></>;
};

I guess the check for 'localstorage' in window is returning true, but it's throwing a security error when trying to read it? It's difficult to tell because these behaviors are not well documented by browsers, it can vary by environment. Maybe we just need to wrap the whole thing in a try-catch.

@turadg
Copy link
Member

turadg commented Dec 1, 2022

Since the security settings make the PSM connection to Wallet impossible, I agree the issue here is about feedback.

At the least, I think we should have a global error handler that reports exceptions to the user. Could be a simple toast.

Do we also have a check specific to localStorage? IMO a user this app upon seeing an error message about localStorage would look into their browser settings.

@lherfel
Copy link

lherfel commented Dec 3, 2022

I allowed all cookies, and the transfer worked just now.

The two window system is unique to do a swap in my experience.

Look forward to the Agoric system buildout : )

@dckc dckc changed the title wallet Dapp Connection dialog for PSM missing wallet Dapp Connection dialog for PSM missing with some privacy settings Dec 3, 2022
@dckc dckc changed the title wallet Dapp Connection dialog for PSM missing with some privacy settings wallet Dapp Connection dialog missing with some privacy settings Dec 3, 2022
@dckc dckc changed the title wallet Dapp Connection dialog missing with some privacy settings wallet Dapp Connection dialog fails silently with some privacy settings Dec 3, 2022
@otoole-brendan otoole-brendan added the vaults_triage DO NOT USE label Feb 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
vaults_triage DO NOT USE
Projects
None yet
Development

No branches or pull requests

5 participants