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

fix: extension does not get injected on page load #1486

Conversation

tien
Copy link
Contributor

@tien tien commented Dec 4, 2024

Resolves #1475

@tien
Copy link
Contributor Author

tien commented Dec 4, 2024

});

inject();
redirectIfPhishing();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The promise needs to be handled:

inject();
redirectIfPhishing().catch((e) => console.warn(`Unable to determine if the site is in the phishing list: ${(e as Error).message}`));

could work?

Copy link
Member

@TarikGul TarikGul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to be linted: yarn lint, and the promise needs to be handled.

@tien tien force-pushed the fix/extension-does-not-get-injected-on-page-load branch from 437f430 to a74fe93 Compare December 4, 2024 04:45
@tien tien requested a review from TarikGul December 4, 2024 04:45
@TarikGul
Copy link
Member

TarikGul commented Dec 4, 2024

I just need to look into this more, I am not sure of the side affects - like what is the consequences of injecting before a redirect is established? It would nullify the return value (boolean) of the redirect

@tien
Copy link
Contributor Author

tien commented Dec 4, 2024

I don't think it matter if a redirect happens. Because the user will no longer be on that page anyway.

@Tbaut
Copy link
Contributor

Tbaut commented Dec 4, 2024

This looks ok to me, as redirecting would still be quick enough for users not to have time to interact with the website, but in 99.9% of the cases, when there's no redirect, it will save the time it takes to call the phishing api which was delaying the injection.

@TarikGul
Copy link
Member

TarikGul commented Dec 4, 2024

Yea did some looking into the actual call stack happening, and I don't think there is any residual issues happening! Going to add this to the release that I cut today

@TarikGul TarikGul merged commit a4292d8 into polkadot-js:master Dec 4, 2024
4 checks passed
@polkadot-js-bot
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@polkadot-js polkadot-js locked as resolved and limited conversation to collaborators Dec 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Injection happen after page load
4 participants