-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[PM-5880] Refactor browser platform utils service to remove window
references
#7885
[PM-5880] Refactor browser platform utils service to remove window
references
#7885
Conversation
…gic between the BrowserPlatformUtils and offscreen document
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7885 +/- ##
==========================================
+ Coverage 25.15% 25.31% +0.15%
==========================================
Files 2252 2254 +2
Lines 65846 65894 +48
Branches 12414 12415 +1
==========================================
+ Hits 16566 16679 +113
+ Misses 47938 47870 -68
- Partials 1342 1345 +3 ☔ View full report in Codecov by Sentry. |
New Issues
Fixed Issues
|
…tils-service-to-remove-window-reference
…tils-service-to-remove-window-reference
…tils-service-to-remove-window-reference
…tils-service-to-remove-window-reference
…tils-service-to-remove-window-reference
…within the BrowserPlatformUtilsService
…tils-service-to-remove-window-reference
…tils-service-to-remove-window-reference
…tils-service-to-remove-window-reference
…tils-service-to-remove-window-reference
…tils-service-to-remove-window-reference
* | ||
* @param expectedVersion - The expected manifest version to check against. | ||
*/ | ||
static isManifestVersion(expectedVersion: 2 | 3) { |
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.
non-blocking naming nit (the nittiest) - don't bother if you don't need to make other changes, tho
static isManifestVersion(expectedVersion: 2 | 3) { | |
static isManifestVersion(expectedManifestVersion: 2 | 3) { |
* | ||
* @param expectedVersion - The expected manifest version to check against. | ||
*/ | ||
static isManifestVersion(expectedVersion: 2 | 3) { |
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.
non-blocking nit/question:
I'm guessing no, but Is there a scenario where either of these two values in the comparison are not 2 or 3 (say, undefined
)? Should we defend against that scenario?
Another way I'm thinking about it; any reason to replace BrowserApi.manifestVersion === 3
with this method other than (the slightly improved) conciseness?
…tils-service-to-remove-window-reference
…tils-service-to-remove-window-reference
…tils-service-to-remove-window-reference
…tils-service-to-remove-window-reference
…tils-service-to-remove-window-reference
…tils-service-to-remove-window-reference
…tils-service-to-remove-window-reference
Type of change
Objective
The goal for this ticket is to remove a direct dependency on the
window
object within theBrowserPlatformUtilsService
. To do this, we are refactoring the typing information within the service, adjusting how the service is instantiated to remove dependence on thewindow
object, and reworking the clipboard related methods to conditionally use thechrome.offscreen
API when we the extension is built using manifest v3.Code changes
window
object when handling a copy to clipboard actionwindow
object when handling a copy to clipboard actionwindow
object when handling a copy to clipboard actionwindow
object that directly affect theBrowserPlatformUtilsService
class.window
object when handling a copy to clipboard actionoffscreen
API to the manifestBrowserApi
class.isManifestVersion
method that simplifies checking for mv3, as well as methods for creating and closing offscreen documents as needed.ServiceWorkerGlobalScope
. This likely should be updated at some point, but scoping down the expected service worker scope to specific files, especially when they might switch between mv2 and mv3, has proven difficult.BrowserClipboardService
classBrowserPlatformUtilsService
class. The two public methodscopy
andread
first attempt to enact their behavior using the Clipboard API, and on failure will fallback to legacy methods. This allows us to have the same behavior within theBrowserPlatformUtilsService
class as well as the offscreen document.BrowserPlatformUtilsService
classwindow
objects throughout the script, and reworked the copy/read from clipboard functionality.