Skip to content

Conversation

@max-baz
Copy link
Member

@max-baz max-baz commented Apr 18, 2019

Chromium can hang indefinitely trying to inject a script to certain kinds of iframes, such as the one present on ox.credativ.com (#62 (comment)). The workaround is to wait at most 1 second, and then abort the injection.

Hopefully 1 sec is more than enough for normal cases and we won't mess with anybody's Browserpass, if we see user reports about "Error: Unable to inject script in the top frame", we must increase this timeout.

@erayd
Copy link
Collaborator

erayd commented Apr 18, 2019

When does this start counting from? If a page is slow to load, will it cause problems?

@max-baz
Copy link
Member Author

max-baz commented Apr 18, 2019

It starts counting since the moment you tell Browserpass to fill a form for you, I think in vast majority of cases the page is already loaded when users attempt to fill a form.

@max-baz
Copy link
Member Author

max-baz commented Apr 18, 2019

By the way, this is another review that is easier to review with whitespace diff off.

const MAX_WAIT = 1000;

return new Promise(async (resolve, reject) => {
setTimeout(reject, MAX_WAIT);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This looks problematic. On success, it will both reject and resolve, which is probably an error.

try {
await injectScript(settings, true);
injectedAllFrames = true;
} catch {}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you please put an explicit noop comment here. Error suppression with no action should have an explaining comment, both to clarify why, and to prevent one of us accidentally attempting to do something with the error later.

@max-baz max-baz merged commit f030e4c into browserpass:master Apr 19, 2019
fkneist pushed a commit to fkneist/browserpass-extension that referenced this pull request Feb 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants