-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Remove the action queue mechanism #21068
Description
Context
For our purposes at MetaMask, one of the most significant differences between manifest v3 and v2 extension implementations was that the background process runs on a service worker that restarts every 5 minutes. However, we recently learned that Chrome dropped that requirement, which means the mv3-specific code still needs to persist in the service worker state, but the implementation can be simplified from what we have previously implemented.
To remove the action queue functionality, we can essentially un-deprecate callBackgroundMethod and simplify it as well as submitRequestToBackground.
We can also simply call background.<bckgMethod>, but since these methods use callbacks, it's still useful to keep a wrapper function around the background methods that promisifies them.
Reference MR which added action queue previously:
#15337
Approach
- un-deprecate
callBackgroundMethodin and simplify the implementation by removing v3 retrying queue related work, and only keep
background?.[method](...args, callback);
- simplify
submitRequestToBackgroundmethod and simplify as the implementation by removing v3 retrying queue related work, and only keep
return promisifiedBackground?.[method](
...(args ?? []),
) as unknown as Promise<R>;
- delete other unused helper function
- removed the usage of
submitRequestToBackground
Acceptance Criteria
- Clean up action queue related mv3 implementations
- Clean up
submitRequestToBackgroundandcallBackgroundMethod - Success build MV3