Skip to content

issue #2158 pgp back to bg script - #2554

Merged
tomholub merged 21 commits into
masterfrom
issue-2158-move-the-rest-of-pgp-listeners-from-background-script
Feb 20, 2020
Merged

issue #2158 pgp back to bg script#2554
tomholub merged 21 commits into
masterfrom
issue-2158-move-the-rest-of-pgp-listeners-from-background-script

Conversation

@limonte

Copy link
Copy Markdown

Closes#2158

tomholub
tomholub previously approved these changes Feb 13, 2020

@tomholubtomholub left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Code looks good

@tomholub

Copy link
Copy Markdown
Collaborator

I'd also look at removing all parentTabId from https://github.com/FlowCrypt/flowcrypt-browser/blob/master/test/tests.json so that they don't cause confusion

Comment threadtest/tests.json
"ゾし逸現飲"
],
"params": "?frameId=none&message=-----BEGIN%20PGP%20MESSAGE-----%0A%0AhQIMA0taL%2FzmLZUBAQ%2F%2BJgpmkgscJEB9uAiFT6TbeZsBqD%2FrRDInab9OevrRBWOZ%0AwQ7UxS4OkM8M1joflEgtP1ZjNkCCuOG5RXR3JZFkUeQbvtMc4mpx%2BOOjYbwHwNNE%0A05wbcIHn380axNPWMYqe8%2FiCK9wFWhMDwtpDfJ0PzLKAhnjFhymMWjmXB2avejaS%0AiaKQRelmUiNt5Tk6FAu8UnOAbr7%2BuLvFBzzjyELL3pGzDBLkawhUT2QZ2nqrC1Ns%0AJ8HEXnl0TBI5T9rlK5i6YQi2i26SWk8QkM0ov5OWVK1qISf15VHeP5uLXch3MfHu%0AEfQEubo378Jbka9QMo1%2FE%2F8ublGQReMpsvbrWto9HqfPSXUGe3hUQcIRi3nKuQBx%0AnbMWonnNE7UEhBFytLL2w%2BMmBDlkePa7zDngOjQwLpYNVvrxJnCjk6Skcrn%2Bx20D%0AYkGziEubqhquMRLxJht4UTLuRSLI8j1NtIRZ5Q9Bi%2B1krSJz527cbq%2FIFBU%2BEmNV%0AfCcR1nYbF5%2FhyTwB7aZQyxCVlRWKlYfwv4%2B7q9c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FdIwHanjKSNr8O6aXXd0e%0AwrFjc71tUTNGF0suNi%2B74ol0rlS1seQNiijulEW53ngK8z5brNSd1N56H%2FwcYx81%0AqSyeqnGYHphNbpwhBTqHkURBlwygxI2%2BCuMSR96j49ko9AZZHYl6DBAqHLKYWHGi%0AvqvpG%2F%2B%2BFFy0AMSxjs%2F%2FCe5lTS3y3skfneaZ9sgH7o%2BUXCJ7Op%2BmtLdHGjn6%0A%3DGAOS%0A-----END%20PGP%20MESSAGE-----&hasPassword=___cu_false___&msgId=16f66f1da9d50d05&senderEmail=michael%20<censored%40email.com>&isOutgoing=___cu_false___&acctEmail=flowcrypt.compatibility%40gmail.com&parentTabId=0"
"params": "?frameId=none&message=-----BEGIN%20PGP%20MESSAGE-----%0A%0AhQIMA0taL%2FzmLZUBAQ%2F%2BJgpmkgscJEB9uAiFT6TbeZsBqD%2FrRDInab9OevrRBWOZ%0AwQ7UxS4OkM8M1joflEgtP1ZjNkCCuOG5RXR3JZFkUeQbvtMc4mpx%2BOOjYbwHwNNE%0A05wbcIHn380axNPWMYqe8%2FiCK9wFWhMDwtpDfJ0PzLKAhnjFhymMWjmXB2avejaS%0AiaKQRelmUiNt5Tk6FAu8UnOAbr7%2BuLvFBzzjyELL3pGzDBLkawhUT2QZ2nqrC1Ns%0AJ8HEXnl0TBI5T9rlK5i6YQi2i26SWk8QkM0ov5OWVK1qISf15VHeP5uLXch3MfHu%0AEfQEubo378Jbka9QMo1%2FE%2F8ublGQReMpsvbrWto9HqfPSXUGe3hUQcIRi3nKuQBx%0AnbMWonnNE7UEhBFytLL2w%2BMmBDlkePa7zDngOjQwLpYNVvrxJnCjk6Skcrn%2Bx20D%0AYkGziEubqhquMRLxJht4UTLuRSLI8j1NtIRZ5Q9Bi%2B1krSJz527cbq%2FIFBU%2BEmNV%0AfCcR1nYbF5%2FhyTwB7aZQyxCVlRWKlYfwv4%2B7q9cj5wCBuLCY7ZKucEbzodehRcEt%0A4C8Txg2KkD7%2F8%2BTt60Kcqj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QNiijulEW53ngK8z5brNSd1N56H%2FwcYx81%0AqSyeqnGYHphNbpwhBTqHkURBlwygxI2%2BCuMSR96j49ko9AZZHYl6DBAqHLKYWHGi%0AvqvpG%2F%2B%2BFFy0AMSxjs%2F%2FCe5lTS3y3skfneaZ9sgH7o%2BUXCJ7Op%2BmtLdHGjn6%0A%3DGAOS%0A-----END%20PGP%20MESSAGE-----&hasPassword=___cu_false___&msgId=16f66f1da9d50d05&senderEmail=michael%20<censored%40email.com>&isOutgoing=___cu_false___&acctEmail=flowcrypt.compatibility%40gmail.com"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

There's still a bunch more in this file (every one had a partentTabId - I think without it the frame would show an error). They may be all sorts of strings, I'd remove them all:

image

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done 👍

@limonte
limonteforce-pushed the issue-2158-move-the-rest-of-pgp-listeners-from-background-script branch from 5ac065b to b5e65bcCompareFebruary 19, 2020 13:44
@tomholub

Copy link
Copy Markdown
Collaborator

GitHub is telling me there's a comment but don't see any, just want to make sure I didn't miss any question :)

image

@limonte

Copy link
Copy Markdown
Author

GitHub is telling me there's a comment but don't see any, just want to make sure I didn't miss any question :)

image

GitHub will notify about both new commits and new comments in a PR. To ensure there are no unanswered conversations, I'll ping you on conversations waiting for your attention after 24h of inactivity. Would that work for you?

@limonte

limonte commented Feb 19, 2020

Copy link
Copy Markdown
Author

@tomholub I stuck on Error: BrowserMsg.sendAwait(pgpMsgDecrypt) returned(null) with lastError: (no lastError) in this case:

/ci_pgp_host_page.htm?account_email=flowcrypt.compatibility%40gmail.com&frame_id=frame_yVMKFLRDiY&message=&has_password=___cu_false___&message_id=1622eaa286f90737&sender_email=human%40flowcrypt.com&is_outgoing=___cu_false___

Looks like const decrypted = await prepared.message.decrypt(privateKeys, passwords, undefined, false); just throwing an undefined exception and I can't figure out why. Could you help me with this one?

@tomholub

Copy link
Copy Markdown
Collaborator

GitHub is telling me there's a comment but don't see any, just want to make sure I didn't miss any question :)
image

GitHub will notify about both new commits and new comments in a PR. To ensure there are no unanswered conversations, I'll ping you on conversations waiting for your attention after 24h of inactivity. Would that work for you?

Definitely

@tomholub

tomholub commented Feb 19, 2020

Copy link
Copy Markdown
Collaborator

/ci_pgp_host_page.htm?account_email=flowcrypt.compatibility%40gmail.com&frame_id=frame_yVMKFLRDiY&message=&has_password=cu_false&message_id=1622eaa286f90737&sender_email=human%40flowcrypt.com&is_outgoing=cu_false

I'm able to reproduce, and will have a look at this tomorrow.

chrome-extension://nhlmpmiobabndkmnhocbgomijbcmiikg/chrome/dev/ci_pgp_host_page.htm?account_email=flowcrypt.compatibility%40gmail.com&frame_id=frame_yVMKFLRDiY&message=&has_password=___cu_false___&message_id=1622eaa286f90737&sender_email=human%40flowcrypt.com&is_outgoing=___cu_false___

@tomholub

Copy link
Copy Markdown
Collaborator

The source of the issue is that the browser keeps sending the messages to both background and the parent tab, but I'm not yet sure how to fix it, tomorrow I'll figure something out.

@limonte

limonte commented Feb 20, 2020

Copy link
Copy Markdown
Author

The source of the issue is that the browser keeps sending the messages to both background and the parent tab, but I'm not yet sure how to fix it, tomorrow I'll figure something out.

Not sure if it's related or not, but with changes from this PR I'm facing another issue in Firefox only:

Message is either badly formatted or not compatible with FlowCrypt.
TypeError: openpgp is undefined

when trying to open any encrypted mail from myself. The issue is happening only in Firefox.

@tomholub

Copy link
Copy Markdown
Collaborator

Fixed, but only on Chrome. I'll take a look at Firefox

@tomholub

Copy link
Copy Markdown
Collaborator

The source of the issue is that the browser keeps sending the messages to both background and the parent tab, but I'm not yet sure how to fix it, tomorrow I'll figure something out.

Not sure if it's related or not, but with changes from this PR I'm facing another issue in Firefox only:

Message is either badly formatted or not compatible with FlowCrypt.
TypeError: openpgp is undefined

when trying to open any encrypted mail from myself. The issue is happening only in Firefox.

Indeed, on Firefox, openpgp.js seems to be undefined in content script. I don't know why, will try a few more things.

@limonte

limonte commented Feb 20, 2020

Copy link
Copy Markdown
Author

oops, pushed the commit to the wrong branch, sorry! The commit is reverted.

This reverts commit d80eb4c.
@tomholub

Copy link
Copy Markdown
Collaborator

I seem to be running into a wall, OpenPGP.js really cannot be loaded in Firefox content script. That's indeed quite a twist to this set of PRs. I may need to raise this with the OpenPGP.js team.

@tomholub

tomholub commented Feb 20, 2020

Copy link
Copy Markdown
Collaborator

I'll keep all of the changes that were refactored in these PRs (so that it's easier to switch later) but will start sending the requests back to bg script as before.. until the Firefox situation is understood and resolved.

Sorry that there were so many dragons in this issue, it was completely unexpected.

I'll wrap this up.

  • start sending pgp request back to backend
  • add bg pgp handlers
  • comment non-bg pgp handlers
  • create an issue to make a repro for OpenPGP.js team to debug Firefox [waiting for v5] OpenPGP.js does not work on Firefox content script #2560
  • remove openpgp.js from content scripts? (else some functionality may remain broken on FF)
  • add back PgpMsg.Type call from content script

@tomholubtomholub self-assigned this Feb 20, 2020
tomholub
tomholub previously approved these changes Feb 20, 2020

@tomholubtomholub left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Code ok, need to test FF

tomholub
tomholub previously approved these changes Feb 20, 2020

@tomholubtomholub left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

fixed + tested ff

@tomholubtomholub changed the title Move the rest of pgp* listeners from background scriptissue #2158 pgp back to bg scriptFeb 20, 2020
@tomholub
tomholub merged commit 686fcbf into masterFeb 20, 2020
@limonte
limonte deleted the issue-2158-move-the-rest-of-pgp-listeners-from-background-script branch February 20, 2020 12:03
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

prep work for manifest V3 - move pgp functionality from background script to content script

2 participants

@limonte@tomholub