-
Notifications
You must be signed in to change notification settings - Fork 48
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
#1509 Migrate to Manifest V3 #5607
Conversation
@ioanmo226 here is my current changes for manifest v3 migration, you can continue working on this code, feel free to ask questions:
Per updated Google timeline - in June 2024 they'll start disabling manifest v2 extensions in pre-release versions of Chrome, so by that time we should have finished and tested migration to manifest v3. If some functionality can't be fully migrated to manifest v3 - we can simplify it for now and work on full functionality later. Google regularly adds new features to manifest v3, maybe some new feature will be helpful for us and make implementation easier. P.S. Also Firefox has a different implementation for manifest v3 - https://extensionworkshop.com/documentation/develop/manifest-v3-migration-guide/. They continue support background pages, but they are non-persistent in manifest v3, need to adapt code for them too. |
@sosnovsky Thank you for your detailed response and code update. I have now finished checking your code and manfest v3 update guide. Could you list TODO list (to update to v3) you had in mind? It would help me complete task faster. PS: I lost 2FA code for my previuos github account and submitted recovery action. Might be recovered in 1-2 days. |
For now we should start with these issues, as implementing them will make possible to run UI tests which will show broken functionality, and then it'll be easier to understand what needs to be fixed:
Initially I thought it'll be possible to create manifest v2 and v3 builds from the same codebase, then we could merge manifest v3 changes to |
Thank you for your answer. Let me implement above |
@sosnovsky Could you please check if Also Secure compose button is not even inserted on first load in my side. |
It probably doesn't work, as I've tested only already configured extension and didn't go through setup process.
Yes, it's my latest changes, probably one of my last changes broke compose button insert even on the first load :) |
Got it. Thank you for your answer/ |
Feel free to message me if you'll have any questions about manifest v3 migration, as it's quite complicated issue and probably second opinion will be useful for making some implementation decisions. |
Which second option do you mean?
|
I meant |
Aha, I see |
@sosnovsky This one is one is now fixed.
However I have implemented this solution in the latest commit. I welcome your feedback and am open to any suggestions you may have. Additionally, please inform me if you consent to adding the
PS: I thought there was logic in
|
Yes, we'll need to use By the way, when working on manifest v3 update I found tool for testing extension update - https://github.com/GoogleChromeLabs/extension-update-testing-tool. It'll show how update to the new version will look for users, so you can check if any additional permission alerts will be shown (we should try to migrate without such additional alerts, as some users can decline them and then some functionality will be broken))
I commented initial logic and temporary replaced it with |
Got it. Thank you for your detailed comment |
extension/chrome/elements/compose-modules/compose-draft-module.ts
Outdated
Show resolved
Hide resolved
It seems flowcrypt-browser/scripts/build.sh Line 124 in 2bbe516
|
I agree but not sure if it can be easily fixed with just regex replace or something like that. |
@sosnovsky I tried to bundle background.js with webpack but I'm stuck at this. :-( Could you take a look at this issue? Would be much appreciated. |
For sure, I'll check it later today or tomorrow |
@sosnovsky Have you checked? |
Yes, I'm checking it - tried to build without webpack and noticed that |
Yeah, you're right, after removing this comment |
@sosnovsky I tried to build forge mjs file from forge repository with rollup bundler. |
For me it doesn't work - Does it work for you? |
OHhh. yep |
@ioanmo226 did you try to use offscreen document for fixing |
Haven't tried yet. But I heard using offscreen object for referencing variable is not good idea and should not be used. |
private static get forgeCustom(): typeof forge { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-expect-error | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return | ||
return forge.default ? forge.default : forge; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sosnovsky How about now? What do you think about solution?
When I import like above import * as forge
then i have to call forge.default.asn1
instead of forge.asn1
. Therefore I added above logic.
Maybe there could be simple solution for this.
Let me know your suggestion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to find simpler solution, but wasn't able to implement something workable. Your solution works well, let's use it - maybe we'll find some way to replace it with simpler one in the future, but for now it should be ok.
I noticed that many tests are failing because of XMLHttpRequest is not defined
error (as it's not available in service worker, only fetch
should be used there), maybe we can move ajaxGmailAttachmentGetChunk
to content script?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I'm currently fixing test re-auth after updating chrome extension
test (It fails because OAuth2.js coudln't get window object because it was running from background). Fixing it to pass requried screen dimensions to service worker and pass it to OAuth2.
Let me have a look at ajaxGmailAttachmentGetChunk
after current one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a question. Why don't we just use fetch
in ajaxGmailAttachmentGetChunk
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also I think we couldn't move ajaxGmailAttachmentGetChunk
to content script because of below reason?
// content script CORS not allowed anymore, have to drag it through background page |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found reason and it's because when message is returned from ajaxGmailGetChunk
, with the createObjectUrl
usage removed object
is returned instead of Buf
.
This is a temp fix and it fixed issue.
4262aee
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found reason and it's because when message is returned from ajaxGmailGetChunk
, with the createObjectUrl
usage removed object
is returned instead of Buf
.
This is a temp fix and it fixed issue.
4262aee
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also FYI created new PR as we also have to test live test with new branch name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found reason and it's because when message is returned from
ajaxGmailGetChunk
, with thecreateObjectUrl
usage removedobject
is returned instead ofBuf
. This is a temp fix and it fixed issue. 4262aee
Ok, let's just add // todo: it's a temporary fix, should be removed
comment, so we won't forget about it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay
This PR migrates extension code to Manifest V3
close #1509
Tests (delete all except exactly one):
To be filled by reviewers
I have reviewed that this PR... (tick whichever items you personally focused on during this review):