fix desktop using mv3 and remove ENABLE_MV3#263
Conversation
fea4f57 to
73fc6d1
Compare
73fc6d1 to
2398174
Compare
There was a problem hiding this comment.
Is this all necessary? Can we not just add both the action and browserAction versions to the array?
There was a problem hiding this comment.
Should we be using cfg().desktop.mv3 and code fencing to avoid dealing with the envs directly?
There was a problem hiding this comment.
Sure, but just to confirm do you mean code fencing just the import cfg from './desktop/utils/config'; or the whole if as well?
There was a problem hiding this comment.
Good point, probably not worth it here as you'd have to break up the condition and it'd get ugly.
b1fae9a to
d818604
Compare
9fbcc40 to
20aabb3
Compare
There was a problem hiding this comment.
We can remove configOverride if it's no longer being used.
There was a problem hiding this comment.
Is there a way to fully get rid ENABLE_MV3 env variable?
For example by calling both the MV3 and the non-MV3 method in the extension?
browser.action.setBadgeText({ text: label });
browser.browserAction.setBadgeText({ text: label });
There was a problem hiding this comment.
It's possible if I use fencing.
///: BEGIN:EXCLUDE_IN(desktopapp)
browser.action.setBadgeText({ text: label });
browser.action.setBadgeBackgroundColor({ color: '#037DD6' });
///: END:EXCLUDE_IN
It will result in errors like Cannot find browser method - browserAction.setBadgeBackgroundColor.
d346c77 to
293fdb9
Compare
336413d to
d0e4408
Compare
There was a problem hiding this comment.
This isn't actually doing anything as in the desktop app (which is always MV2), we would never hit the desktopextension code fence as it has its own desktopapp build type. And in the extension itself, we can detect isManifestV3 correctly and use the alternate condition.
On reflection, the cleanest fix for this issue is to update browser-proxy in the common package which receives browser commands from the app and runs them against the real browser. Here we can use isManifestV3 as we're in the extension, and update getBrowserMethod to just update all browserAction functions to use action if we're in MV3.
There was a problem hiding this comment.
Thanks @matthewwalsh0, applied the fix on browser-proxy to replace browserAction with action when the extension is in MV3.
cedf96e to
376b8c8
Compare
376b8c8 to
62c3a43
Compare
Overview
ENABLE_MV3was removed frommv3.utils.json the desktop app side. Now It only has two places whereENABLE_MV3will need to be until MV3 is fully merged.Changes
Desktop
node-browser.tsand inbackground.jsto properly proxybrowserActionbecause it has been replaced byactionin MV3Extension
ENABLE_MV3frommv3.utils.jsCommon
browser-proxyto replacebrowserActionwithactionwhen the extension is in MV3Issues
Resolves #159