1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-26 12:25:20 +01:00

[PM-8207] Inline menu unable to inject into body element when another script is attempting to force its element as the bottom-most element (#9610)

* [PM-8869] Autofill features broken on Safari

* [PM-8869] Autofill features broken on Safari

* [PM-5189] Working through subFrameRecalculation approach

* [PM-5189] Fixing an issue found within Safari

* [PM-8027] Reverting flag from a fallback flag to an enhancement feature flag

* [PM-8027] Fixing jest tests

* [PM-5189] Reworking how we handle updating ciphers within nested sub frames

* [PM-5189] Reworking how we handle updating ciphers within nested sub frames

* [PM-5189] Reworking how we handle updating ciphers within nested sub frames

* [PM-5189] Reworking how we handle updating ciphers within nested sub frames

* [PM-5189] Fixing issue found in Safari with how the inline menu is re-positioned

* [PM-5189] Fixing issue found in Safari with how the inline menu is re-positioned

* [PM-5189] Fixing issue found in Safari with how the inline menu is re-positioned

* [PM-5189] Fixing jest tests

* [PM-5189] Fixing jest tests

* [PM-5189] Refining how we handle fading in the inline menu elements

* [PM-5189] Refining how we handle fading in the inline menu elements

* [PM-5189] Refining how we handle fading in the inline menu elements

* [PM-5189] Reworking how we handle updating the inline menu position

* [PM-5189] Reworking how we handle updating the inline menu position

* [PM-5189] Reworking how we handle updating the inline menu position

* [PM-5189] Reworking how we handle updating the inline menu position

* [PM-5189] Reworking how we handle updating the inline menu position

* [PM-5189] Reworking how we handle updating the inline menu position

* [PM-5189] Reworking how we handle updating the inline menu position

* [PM-5189] Working through content script port improvement

* [PM-5189] Working through content script port improvement

* [PM-5189] Working through content script port improvement

* [PM-5189] Working through content script port improvement

* [PM-5189] Working through content script port improvement

* [PM-5189] Working through content script port improvement

* [PM-5189] Working through content script port improvement

* [PM-5189] Working through content script port improvement

* [PM-5189] Working through content script port improvement

* Revert "[PM-5189] Working through content script port improvement"

This reverts commit 857008413f.

* Revert "[PM-5189] Working through content script port improvement"

This reverts commit f219d71070.

* Revert "[PM-5189] Working through content script port improvement"

This reverts commit f389263b64.

* Revert "[PM-5189] Working through content script port improvement"

This reverts commit 8a48e576e1.

* Revert "[PM-5189] Working through content script port improvement"

This reverts commit e30a1ebc5d.

* Revert "[PM-5189] Working through content script port improvement"

This reverts commit da357f46b3.

* [PM-5189] Reverting content script port rework

* [PM-5189] Fixing jest tests for AutofillOverlayContentService

* [PM-5189] Adding documentation for the AutofillOverlayContentService

* [PM-5189] Working through jest tests for OverlayBackground and refining repositioning delays

* [PM-5189] Working through jest tests for OverlayBackground and refining repositioning delays

* [PM-5189] Throttling how often sub frame calculations can be triggered from the focus in listener

* [PM-5189] Finalizing jest tests for AutofillOverlayContentService

* [PM-5189] Finalizing jest tests for AutofillOverlayContentService

* [PM-5189] Finalizing jest tests for AutofillOverlayContentService

* [PM-5189] Removing custom debounce method that is unused

* [PM-5189] Removing custom debounce method that is unused

* [PM-8207] Implementing jest test for added functional element

* [PM-8207] Implementing jest test for added functional element

* [PM-8207] Implementing jest test for added functional element

* [PM-2857] Reworking how we handle invalidating cache when a tab chagne has occurred

* [PM-5189] Fixing issues found within code review behind how we position elements

* [PM-5189] Fixing issues found within code review behind how we position elements

* [PM-5189] Fixing issues found within code review behind how we position elements

* [PM-5189] Fixing issues found within code review behind how we position elements

* [PM-5189] Fixing issues found within code review behind how we position elements

* [PM-5189] Fixing issues found within code review behind how we position elements

* [PM-5189] Adding jest tests for OverlayBackground methods

* [PM-5189] Adding jest tests for OverlayContentService methods

* [PM-5189] Working through further issues on positioning of inline menu

* [PM-5189] Working through further issues on positioning of inline menu

* [PM-5189] Working through further issues on positioning of inline menu

* [PM-5189] Working through further issues on positioning of inline menu

* [PM-5189] Working through jest tests for OverlayBackground and refining repositioning delays

* [PM-5189] Working through jest tests for OverlayBackground and refining repositioning delays

* [PM-5189] Working through jest tests for OverlayBackground and refining repositioning delays

* [PM-5189] Working through jest tests for OverlayBackground and refining repositioning delays

* [PM-5189] Working through jest tests for OverlayBackground and refining repositioning delays

* [PM-5189] Fixing an issue found when switching between open windows

* [PM-5189] Fixing an issue found when switching between open windows

* [PM-5189] Removing throttle from resize listeners within the content script

* [PM-5189] Removing throttle from resize listeners within the content script

* [PM-5189] Fixing issue within Safari relating to repositioning elements from outer frame

* [PM-5189] Fixing issue within Safari relating to repositioning elements from outer frame

* [PM-5189] Fixing issue within Safari relating to repositioning elements from outer frame

* [PM-5189] Adding some documentation and adjust jest test for util method

* [PM-5189] Reverting naming structure for OverlayBackground method

* [PM-5189] Fixing a missed promise reference within OverlayBackground

* [PM-9267] Implement Feature Flag for Inline Menu Re-Architecture

* [PM-9267] Incorporating legacy OverlayBackground implementation

* [PM-9267] Incorporating legacy overlay content scripts

* [PM-9267] Incorporating legacy overlay content scripts

* [PM-9267] Incorporating legacy overlay content scripts

* [PM-9267] Incorporating legacy overlay content scripts

* [PM-9267] Finalizing feature flag implementation

* [PM-9267] Finalizing feature flag implementation

* [PM-9267] Finalizing feature flag implementation

* [PM-9267] Finalizing feature flag implementation

* [PM-9267] Finalizing feature flag implementation

* [PM-9267] Finalizing feature flag implementation

* [PM-9267] Finalizing feature flag implementation

* [PM-9267] Finalizing feature flag implementation

* [PM-5189] Removing throttle from resize listeners within the content script

* Revert "[PM-5189] Removing throttle from resize listeners within the content script"

This reverts commit 62cf0f8f24.

* [PM-5189] Re-adding throttle and reducing delay

* [PM-5189] Fixing an issue with onButton click settings not being respected when a reposition event occurs

* [PM-5189] Adding a missing test to OverlayBackground

* [PM-5189] Fixing an issue where we trigger a blur event when the inline menu is hovered, but the page takes focus away

* [PM-9267] Adjusting naming convention for page files

* [PM-9267] Adjusting naming convention for page files

* [PM-9342] Inline menu does not show on username field for a form that has a password field with an invalid autocomplete value

* [PM-9342] Incorporating logic to handle multiple autocomplete values within a captured set of page details

* [PM-9342] Incorporating logic to handle multiple autocomplete values within a captured set of page details

* [PM-9342] Changing logic for how we identify new password fields to reflect a more assertive qualification

* [PM-9342] Adding feedback from code review

* [PM-5189] Fixing an issue where the port key for an inline menu element could potentially be undefined if the window focus changes too quickly

* [PM-5189] Fixing an issue where we can potentially show the inline menu incorrectly after a user switches account

* [PM-5189] Fixing an issue where we can potentially show the inline menu incorrectly after a user switches account

* PM-4950 - Fix hint and verify delete components that had the data in the wrong place (#9877)

* PM-4661: Add passkey.username as item.username (#9756)

* Add incoming passkey.username as item.username

* Driveby fix, was sending wrong username

* added username to new-cipher too

* Guarded the if-block

* Update apps/browser/src/vault/popup/components/vault/add-edit.component.ts

Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>

* Fixed broken test

* fixed username on existing ciphers

---------

Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>

* PM-4878: Add passkey information to items when signing in (#9835)

* Added username to subtitle

* Added subName to cipher

* Moved subName to component

* Update apps/browser/src/vault/popup/components/fido2/fido2-cipher-row.component.ts

Co-authored-by: SmithThe4th <gsmith@bitwarden.com>

* Fixed double code and added comment

* Added changeDetection: ChangeDetectionStrategy.OnPush as per review

---------

Co-authored-by: SmithThe4th <gsmith@bitwarden.com>

* [AC-2791] Members page - finish component library refactors (#9727)

* Replace PlatformUtilsService with ToastService

* Remove unneeded templates

* Implement table filtering function

* Move member-only methods from base class to subclass

* Move utility functions inside new MemberTableDataSource

* Rename PeopleComponent to MembersComponent

* [deps] Platform: Update angular-cli monorepo to v16.2.14 (#9380)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* [PM-8789] Move desktop_native into subcrate (#9682)

* Move desktop_native into subcrate

* Add publish = false to crates

* [PM-6394] remove policy evaluator cache (#9807)

* [PM-9364] Copy for Aggregate auto-scaling invoices for Teams and Enterprise customers (#9875)

* Change the seat adjustment message

* Move changes from en_GB file to en file

* revert changes in en_GB file

* Add feature flag to the change

* use user verification as a part of key rotation (#9722)

* Add the ability for custom validation logic to be injected into `UserVerificationDialogComponent` (#8770)

* Introduce `verificationType`

* Update template to use `verificationType`

* Implement a path for `verificationType = 'custom'`

* Delete `clientSideOnlyVerification`

* Update `EnrollMasterPasswordResetComponent` to include a server-side hash check

* Better describe the custom scenerio through comments

* Add an example of the custom verficiation scenerio

* Move execution of verification function into try/catch

* Migrate existing uses of `clientSideOnlyVerification`

* Use generic type option instead of casting

* Change "given" to "determined" in a comment

* Restructure the `org-redirect` guard to be Angular 17+ compliant (#9552)

* Document the `org-redirect` guard in code

* Make assertions about the way the `org-redirect` guard should behave

* Restructure the `org-redirect` guard to be Angular 17+ compliant

* Convert data parameter to function parameter

* Convert a data parameter to a function parameter that was missed

* Pass redirect function to default organization route

* don't initialize kdf with validators, do it on first set (#9754)

* add testids for attachments (#9892)

* Bug fix - error toast in 2fa (#9623)

* Bug fix - error toast in 2fa

* Bug fix - Yubikey code obscured

* 2FA error fix

* [PM-5189] Fixing an issue where we can potentially show the inline menu incorrectly after a user switches account

* [PM-5189] Fixing an issue where we can potentially show the inline menu incorrectly after a user switches account

* [PM-5189] Fixing an issue where we can potentially show the inline menu incorrectly after a user switches account

* Restructure the `is-paid-org` guard to be Angular 17+ compliant (#9598)

* Document that `is-paid-org` guard in code

* Remove unused `MessagingService` dependency

* Make assertions about the way the is-paid-org guard should behave

* Restructure the `is-paid-org` guard to be Angular 17+ compliant

* Random commit to get the build job moving

* Undo previous commit

* Bumped client version(s) (#9895)

* [PM-9344] Clarify accepted user state (#9861)

* Prefer `Needs confirmation` to `Accepted` display status

This emphasizes that action is still required to complete setup.

* Remove unused message

* Bumped client version(s) (#9906)

* Revert "Bumped client version(s) (#9906)" (#9907)

This reverts commit 78c2829793.

* fix duo subscriptions and org vs individual duo setup (#9859)

* [PM-5024] Migrate tax-info component (#9872)

* Changes for the tax info migration

* Return for invalid formgroup

* Restructure the `org-permissions` guard to be Angular 17+ compliant (#9631)

* Document the `org-permissions` guard in code

* Restructure the `org-permissions` guard to be Angular 17+ compliant

* Update the `org-permissions` guard to use `ToastService`

* Simplify callback function sigantures

* Remove unused test object

* Fix updated route from merge

* Restructure the `provider-permissions` guard to be Angular 17+ compliant  (#9609)

* Document the `provider-permissions` guard in code

* Restructure the `provider-permissions` guard to be Angular 17+ compliant

* [deps] Platform: Update @types/argon2-browser to v1.18.4 (#8180)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Bumped client version(s) (#9914)

* [PM-7162] Cipher Form - Item Details (#9758)

* [PM-7162] Fix weird angular error regarding disabled component bit-select

* [PM-7162] Introduce CipherFormConfigService and related types

* [PM-7162] Introduce CipherFormService

* [PM-7162] Introduce the Item Details section component and the CipherFormContainer interface

* [PM-7162] Introduce the CipherForm component

* [PM-7162] Add strongly typed QueryParams to the add-edit-v2.component

* [PM-7162] Export CipherForm from Vault Lib

* [PM-7162] Use the CipherForm in Browser AddEditV2

* [PM-7162] Introduce CipherForm storybook

* [PM-7162] Remove VaultPopupListFilterService dependency from NewItemDropDownV2 component

* [PM-7162] Add support for content projection of attachment button

* [PM-7162] Fix typo

* [PM-7162] Cipher form service cleanup

* [PM-7162] Move readonly collection notice to bit-hint

* [PM-7162] Refactor CipherFormConfig type to enforce required properties with Typescript

* [PM-7162] Fix storybook after config changes

* [PM-7162] Use new add-edit component for clone route

* [deps]: Update @yao-pkg/pkg to ^5.12.0 (#9820)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Autosync the updated translations (#9922)

Co-authored-by: bitwarden-devops-bot <106330231+bitwarden-devops-bot@users.noreply.github.com>

* Autosync the updated translations (#9923)

Co-authored-by: bitwarden-devops-bot <106330231+bitwarden-devops-bot@users.noreply.github.com>

* Autosync the updated translations (#9924)

Co-authored-by: bitwarden-devops-bot <106330231+bitwarden-devops-bot@users.noreply.github.com>

* [AC-2830] Unable to create a free organization (#9917)

* Resolve the issue free org creation

* Check that the taxForm is touched

* [PM-7162] Fix broken getter when original cipher is null (#9927)

* [PM-8525] Edit Card (#9901)

* initial add of card details section

* add card number

* update card brand when the card number changes

* add year and month fields

* add security code field

* hide number and security code by default

* add `id` for all form fields

* update select options to match existing options

* make year input numerical

* only display card details for card ciphers

* use style to set input height

* handle numerical values for year

* update heading when a brand is available

* remove unused ref

* use cardview types for the form

* fix numerical input type

* disable card details when in partial-edit mode

* remove hardcoded height

* update types for formBuilder

* [PM-9440] Fix: handle undefined value in migration 66 (#9908)

* fix: handle undefined value in migration 66

* fix: the if-statement was typo

* Rename "encryptionAlgorithm" to "hashAlgorithmForEncryption" for clarity (#9891)

* [PM-7972] Account switching integration with "remember email" functionality (#9750)

* add account switching logic to login email service

* enforce boolean and fix desktop account switcher order

* [PM-9442] Add tests for undefined state values and proper emulation of ElectronStorageService in tests (#9910)

* fix: handle undefined value in migration 66

* fix: the if-statement was typo

* feat: duplicate error behavior in fake storage service

* feat: fix all migrations that were setting undefined values

* feat: add test for disabled fingrint in migration 66

* fix: default single user state saving undefined value to state

* revert: awaiting floating promise

gonna fix this in a separate PR

* Revert "feat: fix all migrations that were setting undefined values"

This reverts commit 034713256c.

* feat: automatically convert save to remove

* Revert "fix: default single user state saving undefined value to state"

This reverts commit 6c36da6ba5.

* [AC-2805] Consolidated Billing UI Updates (#9893)

* Add empty state for invoices

* Make cards on create client dialog tabbable

* Add space in $ / month per member

* Mute text, remove (Monthly) and right align menu on clients table

* Made used seats account for all users and fixed column sort for used/remaining

* Resize pricing cards

* Rename assignedSeats to occupiedSeats

* [PM-9460][deps] Tools: Update electron to v31 (#9921)

* [deps] Tools: Update electron to v31

* Bump version in electron-builder

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>

* [AC-1452] Restrict access to 'Organization Info' and 'Two-Step Login' settings pages with a permission check (#9483)

* Guard Organization Info route - Owners only

* Guard TwoFactor route - Owners only and Organization must be able to use 2FA

* Update guards to use function syntax

---------

Co-authored-by: Addison Beck <hello@addisonbeck.com>

* [PM-9437] Use CollectionAccessDetailsResponse type now that is always the type returned from the API (#9951)

* Add required env variables to desktop native build script (#9869)

* [AC-2676] Remove paging logic from GroupsComponent (#9705)

* remove infinite scroll, use virtual scroll instead
* use TableDataSource for search
* allow sorting by name
* replacing PlatformUtilsService.showToast with ToastService
* misc FIXMEs

* [PM-9441] Catch and log exceptions during migration (#9905)

* feat: catch and log exceptions during migration

* Revert "feat: catch and log exceptions during migration"

This reverts commit d68733b7e5.

* feat: use log service to log migration errors

* Autosync the updated translations (#9972)

Co-authored-by: bitwarden-devops-bot <106330231+bitwarden-devops-bot@users.noreply.github.com>

* Autosync the updated translations (#9973)

Co-authored-by: bitwarden-devops-bot <106330231+bitwarden-devops-bot@users.noreply.github.com>

* Updated codeowners for new design system team (#9913)

* Updated codeowners for new design system team.

* Moved Angular and Bootstrap dependencies

* Moved additional dependencies.

* Updated ownership

Co-authored-by: Will Martin <contact@willmartian.com>

---------

Co-authored-by: Will Martin <contact@willmartian.com>

* [SM-1016] Fix new access token dialog (#9918)

* swap to bit-dialog title & subtitle

* remove dialogRef.disableClose & use toastService

* Add shared two-factor-options component (#9767)

* Communicate the upcoming client vault privacy changes to MSPs (#9994)

* Add a banner notification to the provider portal

* Feature flag the banner

* Move banner copy to messages.json

* Allow for dismissing the banner

* Auth/PM-7321 - Registration with Email Verification - Registration Finish Component Implementation (#9653)

* PM-7321 - Temp add input password

* PM-7321 - update input password based on latest PR changes to test.

* PM-7321 - Progress on testing input password component + RegistrationFinishComponent checks

* PM-7321 - more progress on registration finish.

* PM-7321 - Wire up RegistrationFinishRequest model + AccountApiService abstraction + implementation changes for new method.

* PM-7321 - WIP Registration Finish - wiring up request building and API call on submit.

* PM-7321 - WIP registratin finish

* PM-7321 - WIP on creating registration-finish service + web override to add org invite handling

* PM-7321 - (1) Move web-registration-finish svc to web (2) Wire up exports (3) wire up RegistrationFinishComponent to call registration finish service

* PM-7321 - Get CLI building

* PM-7321 - Move all finish registration service and content to registration-finish feature folder.

* PM-7321 - Fix RegistrationFinishService config

* PM-7321 - RegistrationFinishComponent- handlePasswordFormSubmit - error handling WIP

* PM-7321 - InputPasswordComp - Update to accept masterPasswordPolicyOptions as input instead of retrieving it as parent components in different scenarios will need to retrieve the policies differently (e.g., orgInvite token in registration vs direct call via org id post SSO on set password)

* PM-7321 - Registration Finish - Add web specific logic for retrieving master password policies and passing them into the input password component.

* PM-7321 - Registration Start - Send email via query param to registration finish page so it can create masterKey

* PM-7321 - InputPassword comp - (1) Add loading input (2) Add email validation to submit logic.

* PM-7321 - Registration Finish - Add submitting state and pass into input password so that the rest of the registration process keeps the child form disabled.

* PM-7321 - Registration Finish - use validation service for error handling.

* PM-7321 - All register routes must be dynamic and change if the feature flag changes.

* PM-7321 - Test registration finish services.

* PM-7321 - RegisterRouteService - Add comment documenting why the service exists.

* PM-7321 - Add missing input password translations to browser & desktop

* PM-7321 - WebRegistrationFinishSvc - apply PR feedback

* [deps] Autofill: Update rimraf to v5.0.8 (#10008)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* [PM-9318] Fix username on protonpass import (#9889)

* Fix username field used for ProtonPass import

ProtonPass has changed their export format and userName is not itemEmail

* Import additional field itemUsername

---------

Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>

* [PM-8943] Update QRious script initialization in Authenticator two-factor provider (#9926)

* create onload() for qrious as well as error messaging if QR code cannot be displayed

* button and message updates and formpromise removal

* load QR script async

* rename and reorder methods

* Delete Unused Bits of StateService (#9858)

* Delete Unused Bits of StateService

* Fix Tests

* remove getBgService for auth request service (#10020)

* [PM-9267] Implement feature flag for inline menu re-architecture (#9845)

* [PM-9267] Implement Feature Flag for Inline Menu Re-Architecture

* [PM-9267] Incorporating legacy OverlayBackground implementation

* [PM-9267] Incorporating legacy overlay content scripts

* [PM-9267] Incorporating legacy overlay content scripts

* [PM-9267] Incorporating legacy overlay content scripts

* [PM-9267] Incorporating legacy overlay content scripts

* [PM-9267] Finalizing feature flag implementation

* [PM-9267] Finalizing feature flag implementation

* [PM-9267] Finalizing feature flag implementation

* [PM-9267] Finalizing feature flag implementation

* [PM-9267] Finalizing feature flag implementation

* [PM-9267] Finalizing feature flag implementation

* [PM-9267] Finalizing feature flag implementation

* [PM-9267] Finalizing feature flag implementation

* [PM-9267] Adjusting naming convention for page files

* [PM-9267] Adjusting naming convention for page files

* [PM-5189] Fixing an issue where we can potentially show the inline menu incorrectly after a user switches account

* PM-4950 - Fix hint and verify delete components that had the data in the wrong place (#9877)

* PM-4661: Add passkey.username as item.username (#9756)

* Add incoming passkey.username as item.username

* Driveby fix, was sending wrong username

* added username to new-cipher too

* Guarded the if-block

* Update apps/browser/src/vault/popup/components/vault/add-edit.component.ts

Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>

* Fixed broken test

* fixed username on existing ciphers

---------

Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>

* PM-4878: Add passkey information to items when signing in (#9835)

* Added username to subtitle

* Added subName to cipher

* Moved subName to component

* Update apps/browser/src/vault/popup/components/fido2/fido2-cipher-row.component.ts

Co-authored-by: SmithThe4th <gsmith@bitwarden.com>

* Fixed double code and added comment

* Added changeDetection: ChangeDetectionStrategy.OnPush as per review

---------

Co-authored-by: SmithThe4th <gsmith@bitwarden.com>

* [AC-2791] Members page - finish component library refactors (#9727)

* Replace PlatformUtilsService with ToastService

* Remove unneeded templates

* Implement table filtering function

* Move member-only methods from base class to subclass

* Move utility functions inside new MemberTableDataSource

* Rename PeopleComponent to MembersComponent

* [deps] Platform: Update angular-cli monorepo to v16.2.14 (#9380)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* [PM-8789] Move desktop_native into subcrate (#9682)

* Move desktop_native into subcrate

* Add publish = false to crates

* [PM-6394] remove policy evaluator cache (#9807)

* [PM-9364] Copy for Aggregate auto-scaling invoices for Teams and Enterprise customers (#9875)

* Change the seat adjustment message

* Move changes from en_GB file to en file

* revert changes in en_GB file

* Add feature flag to the change

* use user verification as a part of key rotation (#9722)

* Add the ability for custom validation logic to be injected into `UserVerificationDialogComponent` (#8770)

* Introduce `verificationType`

* Update template to use `verificationType`

* Implement a path for `verificationType = 'custom'`

* Delete `clientSideOnlyVerification`

* Update `EnrollMasterPasswordResetComponent` to include a server-side hash check

* Better describe the custom scenerio through comments

* Add an example of the custom verficiation scenerio

* Move execution of verification function into try/catch

* Migrate existing uses of `clientSideOnlyVerification`

* Use generic type option instead of casting

* Change "given" to "determined" in a comment

* Restructure the `org-redirect` guard to be Angular 17+ compliant (#9552)

* Document the `org-redirect` guard in code

* Make assertions about the way the `org-redirect` guard should behave

* Restructure the `org-redirect` guard to be Angular 17+ compliant

* Convert data parameter to function parameter

* Convert a data parameter to a function parameter that was missed

* Pass redirect function to default organization route

* don't initialize kdf with validators, do it on first set (#9754)

* add testids for attachments (#9892)

* Bug fix - error toast in 2fa (#9623)

* Bug fix - error toast in 2fa

* Bug fix - Yubikey code obscured

* 2FA error fix

* Restructure the `is-paid-org` guard to be Angular 17+ compliant (#9598)

* Document that `is-paid-org` guard in code

* Remove unused `MessagingService` dependency

* Make assertions about the way the is-paid-org guard should behave

* Restructure the `is-paid-org` guard to be Angular 17+ compliant

* Random commit to get the build job moving

* Undo previous commit

* Bumped client version(s) (#9895)

* [PM-9344] Clarify accepted user state (#9861)

* Prefer `Needs confirmation` to `Accepted` display status

This emphasizes that action is still required to complete setup.

* Remove unused message

* Bumped client version(s) (#9906)

* Revert "Bumped client version(s) (#9906)" (#9907)

This reverts commit 78c2829793.

* fix duo subscriptions and org vs individual duo setup (#9859)

* [PM-5024] Migrate tax-info component (#9872)

* Changes for the tax info migration

* Return for invalid formgroup

* Restructure the `org-permissions` guard to be Angular 17+ compliant (#9631)

* Document the `org-permissions` guard in code

* Restructure the `org-permissions` guard to be Angular 17+ compliant

* Update the `org-permissions` guard to use `ToastService`

* Simplify callback function sigantures

* Remove unused test object

* Fix updated route from merge

* Restructure the `provider-permissions` guard to be Angular 17+ compliant  (#9609)

* Document the `provider-permissions` guard in code

* Restructure the `provider-permissions` guard to be Angular 17+ compliant

* [deps] Platform: Update @types/argon2-browser to v1.18.4 (#8180)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Bumped client version(s) (#9914)

* [PM-7162] Cipher Form - Item Details (#9758)

* [PM-7162] Fix weird angular error regarding disabled component bit-select

* [PM-7162] Introduce CipherFormConfigService and related types

* [PM-7162] Introduce CipherFormService

* [PM-7162] Introduce the Item Details section component and the CipherFormContainer interface

* [PM-7162] Introduce the CipherForm component

* [PM-7162] Add strongly typed QueryParams to the add-edit-v2.component

* [PM-7162] Export CipherForm from Vault Lib

* [PM-7162] Use the CipherForm in Browser AddEditV2

* [PM-7162] Introduce CipherForm storybook

* [PM-7162] Remove VaultPopupListFilterService dependency from NewItemDropDownV2 component

* [PM-7162] Add support for content projection of attachment button

* [PM-7162] Fix typo

* [PM-7162] Cipher form service cleanup

* [PM-7162] Move readonly collection notice to bit-hint

* [PM-7162] Refactor CipherFormConfig type to enforce required properties with Typescript

* [PM-7162] Fix storybook after config changes

* [PM-7162] Use new add-edit component for clone route

* [deps]: Update @yao-pkg/pkg to ^5.12.0 (#9820)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Autosync the updated translations (#9922)

Co-authored-by: bitwarden-devops-bot <106330231+bitwarden-devops-bot@users.noreply.github.com>

* Autosync the updated translations (#9923)

Co-authored-by: bitwarden-devops-bot <106330231+bitwarden-devops-bot@users.noreply.github.com>

* Autosync the updated translations (#9924)

Co-authored-by: bitwarden-devops-bot <106330231+bitwarden-devops-bot@users.noreply.github.com>

* [AC-2830] Unable to create a free organization (#9917)

* Resolve the issue free org creation

* Check that the taxForm is touched

* [PM-7162] Fix broken getter when original cipher is null (#9927)

* [PM-8525] Edit Card (#9901)

* initial add of card details section

* add card number

* update card brand when the card number changes

* add year and month fields

* add security code field

* hide number and security code by default

* add `id` for all form fields

* update select options to match existing options

* make year input numerical

* only display card details for card ciphers

* use style to set input height

* handle numerical values for year

* update heading when a brand is available

* remove unused ref

* use cardview types for the form

* fix numerical input type

* disable card details when in partial-edit mode

* remove hardcoded height

* update types for formBuilder

* [PM-9440] Fix: handle undefined value in migration 66 (#9908)

* fix: handle undefined value in migration 66

* fix: the if-statement was typo

* Rename "encryptionAlgorithm" to "hashAlgorithmForEncryption" for clarity (#9891)

* [PM-7972] Account switching integration with "remember email" functionality (#9750)

* add account switching logic to login email service

* enforce boolean and fix desktop account switcher order

* [PM-9442] Add tests for undefined state values and proper emulation of ElectronStorageService in tests (#9910)

* fix: handle undefined value in migration 66

* fix: the if-statement was typo

* feat: duplicate error behavior in fake storage service

* feat: fix all migrations that were setting undefined values

* feat: add test for disabled fingrint in migration 66

* fix: default single user state saving undefined value to state

* revert: awaiting floating promise

gonna fix this in a separate PR

* Revert "feat: fix all migrations that were setting undefined values"

This reverts commit 034713256c.

* feat: automatically convert save to remove

* Revert "fix: default single user state saving undefined value to state"

This reverts commit 6c36da6ba5.

* [AC-2805] Consolidated Billing UI Updates (#9893)

* Add empty state for invoices

* Make cards on create client dialog tabbable

* Add space in $ / month per member

* Mute text, remove (Monthly) and right align menu on clients table

* Made used seats account for all users and fixed column sort for used/remaining

* Resize pricing cards

* Rename assignedSeats to occupiedSeats

* [PM-9460][deps] Tools: Update electron to v31 (#9921)

* [deps] Tools: Update electron to v31

* Bump version in electron-builder

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>

* [AC-1452] Restrict access to 'Organization Info' and 'Two-Step Login' settings pages with a permission check (#9483)

* Guard Organization Info route - Owners only

* Guard TwoFactor route - Owners only and Organization must be able to use 2FA

* Update guards to use function syntax

---------

Co-authored-by: Addison Beck <hello@addisonbeck.com>

* [PM-9437] Use CollectionAccessDetailsResponse type now that is always the type returned from the API (#9951)

* Add required env variables to desktop native build script (#9869)

* [AC-2676] Remove paging logic from GroupsComponent (#9705)

* remove infinite scroll, use virtual scroll instead
* use TableDataSource for search
* allow sorting by name
* replacing PlatformUtilsService.showToast with ToastService
* misc FIXMEs

* [PM-9441] Catch and log exceptions during migration (#9905)

* feat: catch and log exceptions during migration

* Revert "feat: catch and log exceptions during migration"

This reverts commit d68733b7e5.

* feat: use log service to log migration errors

* Autosync the updated translations (#9972)

Co-authored-by: bitwarden-devops-bot <106330231+bitwarden-devops-bot@users.noreply.github.com>

* Autosync the updated translations (#9973)

Co-authored-by: bitwarden-devops-bot <106330231+bitwarden-devops-bot@users.noreply.github.com>

* Updated codeowners for new design system team (#9913)

* Updated codeowners for new design system team.

* Moved Angular and Bootstrap dependencies

* Moved additional dependencies.

* Updated ownership

Co-authored-by: Will Martin <contact@willmartian.com>

---------

Co-authored-by: Will Martin <contact@willmartian.com>

* [SM-1016] Fix new access token dialog (#9918)

* swap to bit-dialog title & subtitle

* remove dialogRef.disableClose & use toastService

* Add shared two-factor-options component (#9767)

* Communicate the upcoming client vault privacy changes to MSPs (#9994)

* Add a banner notification to the provider portal

* Feature flag the banner

* Move banner copy to messages.json

* Allow for dismissing the banner

* Auth/PM-7321 - Registration with Email Verification - Registration Finish Component Implementation (#9653)

* PM-7321 - Temp add input password

* PM-7321 - update input password based on latest PR changes to test.

* PM-7321 - Progress on testing input password component + RegistrationFinishComponent checks

* PM-7321 - more progress on registration finish.

* PM-7321 - Wire up RegistrationFinishRequest model + AccountApiService abstraction + implementation changes for new method.

* PM-7321 - WIP Registration Finish - wiring up request building and API call on submit.

* PM-7321 - WIP registratin finish

* PM-7321 - WIP on creating registration-finish service + web override to add org invite handling

* PM-7321 - (1) Move web-registration-finish svc to web (2) Wire up exports (3) wire up RegistrationFinishComponent to call registration finish service

* PM-7321 - Get CLI building

* PM-7321 - Move all finish registration service and content to registration-finish feature folder.

* PM-7321 - Fix RegistrationFinishService config

* PM-7321 - RegistrationFinishComponent- handlePasswordFormSubmit - error handling WIP

* PM-7321 - InputPasswordComp - Update to accept masterPasswordPolicyOptions as input instead of retrieving it as parent components in different scenarios will need to retrieve the policies differently (e.g., orgInvite token in registration vs direct call via org id post SSO on set password)

* PM-7321 - Registration Finish - Add web specific logic for retrieving master password policies and passing them into the input password component.

* PM-7321 - Registration Start - Send email via query param to registration finish page so it can create masterKey

* PM-7321 - InputPassword comp - (1) Add loading input (2) Add email validation to submit logic.

* PM-7321 - Registration Finish - Add submitting state and pass into input password so that the rest of the registration process keeps the child form disabled.

* PM-7321 - Registration Finish - use validation service for error handling.

* PM-7321 - All register routes must be dynamic and change if the feature flag changes.

* PM-7321 - Test registration finish services.

* PM-7321 - RegisterRouteService - Add comment documenting why the service exists.

* PM-7321 - Add missing input password translations to browser & desktop

* PM-7321 - WebRegistrationFinishSvc - apply PR feedback

* [deps] Autofill: Update rimraf to v5.0.8 (#10008)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* [PM-9318] Fix username on protonpass import (#9889)

* Fix username field used for ProtonPass import

ProtonPass has changed their export format and userName is not itemEmail

* Import additional field itemUsername

---------

Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>

* [PM-8943] Update QRious script initialization in Authenticator two-factor provider (#9926)

* create onload() for qrious as well as error messaging if QR code cannot be displayed

* button and message updates and formpromise removal

* load QR script async

* rename and reorder methods

* Delete Unused Bits of StateService (#9858)

* Delete Unused Bits of StateService

* Fix Tests

* remove getBgService for auth request service (#10020)

---------

Co-authored-by: Jared Snider <116684653+JaredSnider-Bitwarden@users.noreply.github.com>
Co-authored-by: Anders Åberg <anders@andersaberg.com>
Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>
Co-authored-by: SmithThe4th <gsmith@bitwarden.com>
Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Daniel García <dani-garcia@users.noreply.github.com>
Co-authored-by:  Audrey  <ajensen@bitwarden.com>
Co-authored-by: cyprain-okeke <108260115+cyprain-okeke@users.noreply.github.com>
Co-authored-by: Jake Fink <jfink@bitwarden.com>
Co-authored-by: Addison Beck <github@addisonbeck.com>
Co-authored-by: Nick Krantz <125900171+nick-livefront@users.noreply.github.com>
Co-authored-by: vinith-kovan <156108204+vinith-kovan@users.noreply.github.com>
Co-authored-by: Bitwarden DevOps <106330231+bitwarden-devops-bot@users.noreply.github.com>
Co-authored-by: Matt Gibson <mgibson@bitwarden.com>
Co-authored-by: Opeyemi <Alaoopeyemi101@gmail.com>
Co-authored-by: Shane Melton <smelton@bitwarden.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Andreas Coroiu <acoroiu@bitwarden.com>
Co-authored-by: Bernd Schoolmann <mail@quexten.com>
Co-authored-by: Alex Morask <144709477+amorask-bitwarden@users.noreply.github.com>
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
Co-authored-by: Rui Tomé <108268980+r-tome@users.noreply.github.com>
Co-authored-by: Addison Beck <hello@addisonbeck.com>
Co-authored-by: Todd Martin <106564991+trmartin4@users.noreply.github.com>
Co-authored-by: Will Martin <contact@willmartian.com>
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
Co-authored-by: Daniel James Smith <2670567+djsmith85@users.noreply.github.com>
Co-authored-by: Ike <137194738+ike-kottlowski@users.noreply.github.com>

---------

Co-authored-by: Jared Snider <116684653+JaredSnider-Bitwarden@users.noreply.github.com>
Co-authored-by: Anders Åberg <anders@andersaberg.com>
Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>
Co-authored-by: SmithThe4th <gsmith@bitwarden.com>
Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Daniel García <dani-garcia@users.noreply.github.com>
Co-authored-by:  Audrey  <ajensen@bitwarden.com>
Co-authored-by: cyprain-okeke <108260115+cyprain-okeke@users.noreply.github.com>
Co-authored-by: Jake Fink <jfink@bitwarden.com>
Co-authored-by: Addison Beck <github@addisonbeck.com>
Co-authored-by: Nick Krantz <125900171+nick-livefront@users.noreply.github.com>
Co-authored-by: vinith-kovan <156108204+vinith-kovan@users.noreply.github.com>
Co-authored-by: Bitwarden DevOps <106330231+bitwarden-devops-bot@users.noreply.github.com>
Co-authored-by: Matt Gibson <mgibson@bitwarden.com>
Co-authored-by: Opeyemi <Alaoopeyemi101@gmail.com>
Co-authored-by: Shane Melton <smelton@bitwarden.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Andreas Coroiu <acoroiu@bitwarden.com>
Co-authored-by: Bernd Schoolmann <mail@quexten.com>
Co-authored-by: Alex Morask <144709477+amorask-bitwarden@users.noreply.github.com>
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
Co-authored-by: Rui Tomé <108268980+r-tome@users.noreply.github.com>
Co-authored-by: Addison Beck <hello@addisonbeck.com>
Co-authored-by: Todd Martin <106564991+trmartin4@users.noreply.github.com>
Co-authored-by: Will Martin <contact@willmartian.com>
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
Co-authored-by: Daniel James Smith <2670567+djsmith85@users.noreply.github.com>
Co-authored-by: Ike <137194738+ike-kottlowski@users.noreply.github.com>
This commit is contained in:
Cesar Gonzalez 2024-07-23 13:08:00 -05:00 committed by GitHub
parent 0e0c44b90b
commit 9c80ee6b86
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 226 additions and 13 deletions

View File

@ -38,6 +38,18 @@ export type FocusedFieldData = {
frameId?: number; frameId?: number;
}; };
export type InlineMenuElementPosition = {
top: number;
left: number;
width: number;
height: number;
};
export type InlineMenuPosition = {
button?: InlineMenuElementPosition;
list?: InlineMenuElementPosition;
};
export type OverlayAddNewItemMessage = { export type OverlayAddNewItemMessage = {
login?: { login?: {
uri?: string; uri?: string;
@ -120,6 +132,7 @@ export type OverlayBackgroundExtensionMessageHandlers = {
message, message,
sender, sender,
}: BackgroundOnMessageHandlerParams) => Promise<void>; }: BackgroundOnMessageHandlerParams) => Promise<void>;
getAutofillInlineMenuPosition: () => InlineMenuPosition;
updateAutofillInlineMenuElementIsVisibleStatus: ({ updateAutofillInlineMenuElementIsVisibleStatus: ({
message, message,
sender, sender,

View File

@ -319,7 +319,8 @@ describe("OverlayBackground", () => {
}); });
describe("removing pageDetails", () => { describe("removing pageDetails", () => {
it("removes the page details and port key for a specific tab from the pageDetailsForTab object", () => { it("removes the page details and port key for a specific tab from the pageDetailsForTab object", async () => {
await initOverlayElementPorts();
const tabId = 1; const tabId = 1;
sendMockExtensionMessage( sendMockExtensionMessage(
{ command: "collectPageDetailsResponse", details: createAutofillPageDetailsMock() }, { command: "collectPageDetailsResponse", details: createAutofillPageDetailsMock() },
@ -1402,6 +1403,25 @@ describe("OverlayBackground", () => {
}); });
}); });
describe("getAutofillInlineMenuPosition", () => {
it("returns the current inline menu position", async () => {
overlayBackground["inlineMenuPosition"] = {
button: { left: 1, top: 2, width: 3, height: 4 },
};
sendMockExtensionMessage(
{ command: "getAutofillInlineMenuPosition" },
mock<chrome.runtime.MessageSender>(),
sendResponse,
);
await flushPromises();
expect(sendResponse).toHaveBeenCalledWith({
button: { left: 1, top: 2, width: 3, height: 4 },
});
});
});
it("triggers a debounced reposition of the inline menu if the sender frame has a `null` sub frame offsets value", async () => { it("triggers a debounced reposition of the inline menu if the sender frame has a `null` sub frame offsets value", async () => {
jest.useFakeTimers(); jest.useFakeTimers();
const focusedFieldData = createFocusedFieldDataMock(); const focusedFieldData = createFocusedFieldDataMock();
@ -2095,6 +2115,22 @@ describe("OverlayBackground", () => {
styles: { height: "100px" }, styles: { height: "100px" },
}); });
}); });
it("updates the inline menu position property's list height value", () => {
overlayBackground["inlineMenuPosition"] = {
list: { height: 50, top: 1, left: 2, width: 3 },
};
sendPortMessage(listMessageConnectorSpy, {
command: "updateAutofillInlineMenuListHeight",
styles: { height: "100px" },
portKey,
});
expect(overlayBackground["inlineMenuPosition"]).toStrictEqual({
list: { height: 100, top: 1, left: 2, width: 3 },
});
});
}); });
}); });

View File

@ -52,6 +52,7 @@ import {
SubFrameOffsetData, SubFrameOffsetData,
SubFrameOffsetsForTab, SubFrameOffsetsForTab,
CloseInlineMenuMessage, CloseInlineMenuMessage,
InlineMenuPosition,
ToggleInlineMenuHiddenMessage, ToggleInlineMenuHiddenMessage,
} from "./abstractions/overlay.background"; } from "./abstractions/overlay.background";
@ -67,6 +68,7 @@ export class OverlayBackground implements OverlayBackgroundInterface {
private inlineMenuListPort: chrome.runtime.Port; private inlineMenuListPort: chrome.runtime.Port;
private inlineMenuCiphers: Map<string, CipherView> = new Map(); private inlineMenuCiphers: Map<string, CipherView> = new Map();
private inlineMenuPageTranslations: Record<string, string>; private inlineMenuPageTranslations: Record<string, string>;
private inlineMenuPosition: InlineMenuPosition = {};
private delayedCloseTimeout: number | NodeJS.Timeout; private delayedCloseTimeout: number | NodeJS.Timeout;
private startInlineMenuFadeInSubject = new Subject<void>(); private startInlineMenuFadeInSubject = new Subject<void>();
private cancelInlineMenuFadeInSubject = new Subject<boolean>(); private cancelInlineMenuFadeInSubject = new Subject<boolean>();
@ -99,6 +101,7 @@ export class OverlayBackground implements OverlayBackgroundInterface {
focusAutofillInlineMenuList: () => this.focusInlineMenuList(), focusAutofillInlineMenuList: () => this.focusInlineMenuList(),
updateAutofillInlineMenuPosition: ({ message, sender }) => updateAutofillInlineMenuPosition: ({ message, sender }) =>
this.updateInlineMenuPosition(message, sender), this.updateInlineMenuPosition(message, sender),
getAutofillInlineMenuPosition: () => this.getInlineMenuPosition(),
updateAutofillInlineMenuElementIsVisibleStatus: ({ message, sender }) => updateAutofillInlineMenuElementIsVisibleStatus: ({ message, sender }) =>
this.updateInlineMenuElementIsVisibleStatus(message, sender), this.updateInlineMenuElementIsVisibleStatus(message, sender),
checkIsAutofillInlineMenuButtonVisible: () => this.checkIsInlineMenuButtonVisible(), checkIsAutofillInlineMenuButtonVisible: () => this.checkIsInlineMenuButtonVisible(),
@ -751,6 +754,13 @@ export class OverlayBackground implements OverlayBackgroundInterface {
} }
} }
/**
* Returns the position of the currently open inline menu.
*/
private getInlineMenuPosition(): InlineMenuPosition {
return this.inlineMenuPosition;
}
/** /**
* Handles updating the opacity of both the inline menu button and list. * Handles updating the opacity of both the inline menu button and list.
* This is used to simultaneously fade in the inline menu elements. * This is used to simultaneously fade in the inline menu elements.
@ -807,11 +817,18 @@ export class OverlayBackground implements OverlayBackgroundInterface {
? subFrameLeftOffset + left + width - height - (fieldPaddingRight - elementOffset + 2) ? subFrameLeftOffset + left + width - height - (fieldPaddingRight - elementOffset + 2)
: subFrameLeftOffset + left + width - height + elementOffset / 2; : subFrameLeftOffset + left + width - height + elementOffset / 2;
this.inlineMenuPosition.button = {
top: Math.round(elementTopPosition),
left: Math.round(elementLeftPosition),
height: Math.round(elementHeight),
width: Math.round(elementHeight),
};
return { return {
top: `${Math.round(elementTopPosition)}px`, top: `${this.inlineMenuPosition.button.top}px`,
left: `${Math.round(elementLeftPosition)}px`, left: `${this.inlineMenuPosition.button.left}px`,
height: `${Math.round(elementHeight)}px`, height: `${this.inlineMenuPosition.button.height}px`,
width: `${Math.round(elementHeight)}px`, width: `${this.inlineMenuPosition.button.width}px`,
}; };
} }
@ -824,10 +841,18 @@ export class OverlayBackground implements OverlayBackgroundInterface {
const subFrameLeftOffset = subFrameOffsets?.left || 0; const subFrameLeftOffset = subFrameOffsets?.left || 0;
const { top, left, width, height } = this.focusedFieldData.focusedFieldRects; const { top, left, width, height } = this.focusedFieldData.focusedFieldRects;
this.inlineMenuPosition.list = {
top: Math.round(top + height + subFrameTopOffset),
left: Math.round(left + subFrameLeftOffset),
height: 0,
width: Math.round(width),
};
return { return {
width: `${Math.round(width)}px`, width: `${this.inlineMenuPosition.list.width}px`,
top: `${Math.round(top + height + subFrameTopOffset)}px`, top: `${this.inlineMenuPosition.list.top}px`,
left: `${Math.round(left + subFrameLeftOffset)}px`, left: `${this.inlineMenuPosition.list.left}px`,
}; };
} }
@ -1205,6 +1230,11 @@ export class OverlayBackground implements OverlayBackgroundInterface {
* @param message - Contains the dimensions of the inline menu list * @param message - Contains the dimensions of the inline menu list
*/ */
private updateInlineMenuListHeight(message: OverlayBackgroundExtensionMessage) { private updateInlineMenuListHeight(message: OverlayBackgroundExtensionMessage) {
const parsedHeight = parseInt(message.styles?.height);
if (this.inlineMenuPosition.list && parsedHeight > 0) {
this.inlineMenuPosition.list.height = parsedHeight;
}
this.inlineMenuListPort?.postMessage({ this.inlineMenuListPort?.postMessage({
command: "updateAutofillInlineMenuPosition", command: "updateAutofillInlineMenuPosition",
styles: message.styles, styles: message.styles,
@ -1532,11 +1562,13 @@ export class OverlayBackground implements OverlayBackgroundInterface {
if (port.name === AutofillOverlayPort.List) { if (port.name === AutofillOverlayPort.List) {
this.inlineMenuListPort = null; this.inlineMenuListPort = null;
this.isInlineMenuListVisible = false; this.isInlineMenuListVisible = false;
this.inlineMenuPosition.list = null;
} }
if (port.name === AutofillOverlayPort.Button) { if (port.name === AutofillOverlayPort.Button) {
this.inlineMenuButtonPort = null; this.inlineMenuButtonPort = null;
this.isInlineMenuButtonVisible = false; this.isInlineMenuButtonVisible = false;
this.inlineMenuPosition.button = null;
} }
}; };
} }

View File

@ -11,9 +11,12 @@ describe("AutofillInlineMenuContentService", () => {
let autofillInit: AutofillInit; let autofillInit: AutofillInit;
let sendExtensionMessageSpy: jest.SpyInstance; let sendExtensionMessageSpy: jest.SpyInstance;
let observeBodyMutationsSpy: jest.SpyInstance; let observeBodyMutationsSpy: jest.SpyInstance;
const waitForIdleCallback = () =>
new Promise((resolve) => globalThis.requestIdleCallback(resolve));
beforeEach(() => { beforeEach(() => {
globalThis.document.body.innerHTML = ""; globalThis.document.body.innerHTML = "";
globalThis.requestIdleCallback = jest.fn((cb, options) => setTimeout(cb, 100));
autofillInlineMenuContentService = new AutofillInlineMenuContentService(); autofillInlineMenuContentService = new AutofillInlineMenuContentService();
autofillInit = new AutofillInit(null, autofillInlineMenuContentService); autofillInit = new AutofillInit(null, autofillInlineMenuContentService);
autofillInit.init(); autofillInit.init();
@ -302,6 +305,7 @@ describe("AutofillInlineMenuContentService", () => {
autofillInlineMenuContentService["listElement"] = undefined; autofillInlineMenuContentService["listElement"] = undefined;
await autofillInlineMenuContentService["handleBodyElementMutationObserverUpdate"](); await autofillInlineMenuContentService["handleBodyElementMutationObserverUpdate"]();
await waitForIdleCallback();
expect(globalThis.document.body.insertBefore).not.toHaveBeenCalled(); expect(globalThis.document.body.insertBefore).not.toHaveBeenCalled();
}); });
@ -315,12 +319,23 @@ describe("AutofillInlineMenuContentService", () => {
.mockReturnValue(true); .mockReturnValue(true);
await autofillInlineMenuContentService["handleBodyElementMutationObserverUpdate"](); await autofillInlineMenuContentService["handleBodyElementMutationObserverUpdate"]();
await waitForIdleCallback();
expect(globalThis.document.body.insertBefore).not.toHaveBeenCalled();
});
it("skips re-arranging the DOM elements if the last child of the body is non-existent", async () => {
document.body.innerHTML = "";
await autofillInlineMenuContentService["handleBodyElementMutationObserverUpdate"]();
await waitForIdleCallback();
expect(globalThis.document.body.insertBefore).not.toHaveBeenCalled(); expect(globalThis.document.body.insertBefore).not.toHaveBeenCalled();
}); });
it("skips re-arranging the DOM elements if the last child of the body is the overlay list and the second to last child of the body is the overlay button", async () => { it("skips re-arranging the DOM elements if the last child of the body is the overlay list and the second to last child of the body is the overlay button", async () => {
await autofillInlineMenuContentService["handleBodyElementMutationObserverUpdate"](); await autofillInlineMenuContentService["handleBodyElementMutationObserverUpdate"]();
await waitForIdleCallback();
expect(globalThis.document.body.insertBefore).not.toHaveBeenCalled(); expect(globalThis.document.body.insertBefore).not.toHaveBeenCalled();
}); });
@ -330,6 +345,7 @@ describe("AutofillInlineMenuContentService", () => {
isInlineMenuListVisibleSpy.mockResolvedValue(false); isInlineMenuListVisibleSpy.mockResolvedValue(false);
await autofillInlineMenuContentService["handleBodyElementMutationObserverUpdate"](); await autofillInlineMenuContentService["handleBodyElementMutationObserverUpdate"]();
await waitForIdleCallback();
expect(globalThis.document.body.insertBefore).not.toHaveBeenCalled(); expect(globalThis.document.body.insertBefore).not.toHaveBeenCalled();
}); });
@ -339,6 +355,7 @@ describe("AutofillInlineMenuContentService", () => {
document.body.insertBefore(injectedElement, listElement); document.body.insertBefore(injectedElement, listElement);
await autofillInlineMenuContentService["handleBodyElementMutationObserverUpdate"](); await autofillInlineMenuContentService["handleBodyElementMutationObserverUpdate"]();
await waitForIdleCallback();
expect(globalThis.document.body.insertBefore).toHaveBeenCalledWith( expect(globalThis.document.body.insertBefore).toHaveBeenCalledWith(
buttonElement, buttonElement,
@ -350,6 +367,7 @@ describe("AutofillInlineMenuContentService", () => {
document.body.appendChild(buttonElement); document.body.appendChild(buttonElement);
await autofillInlineMenuContentService["handleBodyElementMutationObserverUpdate"](); await autofillInlineMenuContentService["handleBodyElementMutationObserverUpdate"]();
await waitForIdleCallback();
expect(globalThis.document.body.insertBefore).toHaveBeenCalledWith( expect(globalThis.document.body.insertBefore).toHaveBeenCalledWith(
buttonElement, buttonElement,
@ -362,12 +380,59 @@ describe("AutofillInlineMenuContentService", () => {
document.body.appendChild(injectedElement); document.body.appendChild(injectedElement);
await autofillInlineMenuContentService["handleBodyElementMutationObserverUpdate"](); await autofillInlineMenuContentService["handleBodyElementMutationObserverUpdate"]();
await waitForIdleCallback();
expect(globalThis.document.body.insertBefore).toHaveBeenCalledWith( expect(globalThis.document.body.insertBefore).toHaveBeenCalledWith(
injectedElement, injectedElement,
buttonElement, buttonElement,
); );
}); });
describe("handling an element that attempts to force itself as the last child", () => {
let persistentLastChild: HTMLElement;
beforeEach(() => {
persistentLastChild = document.createElement("div");
persistentLastChild.style.setProperty("z-index", "2147483647");
document.body.appendChild(persistentLastChild);
autofillInlineMenuContentService["lastElementOverrides"].set(persistentLastChild, 3);
});
it("sets the z-index of to a lower value", async () => {
await autofillInlineMenuContentService["handleBodyElementMutationObserverUpdate"]();
await waitForIdleCallback();
expect(persistentLastChild.style.getPropertyValue("z-index")).toBe("2147483646");
});
it("closes the inline menu if the persistent last child overlays the inline menu button", async () => {
sendExtensionMessageSpy.mockResolvedValue({
button: { top: 0, left: 0, width: 0, height: 0 },
});
globalThis.document.elementFromPoint = jest.fn(() => persistentLastChild);
await autofillInlineMenuContentService["handleBodyElementMutationObserverUpdate"]();
await waitForIdleCallback();
expect(sendExtensionMessageSpy).toHaveBeenCalledWith("autofillOverlayElementClosed", {
overlayElement: AutofillOverlayElement.Button,
});
});
it("closes the inline menu if the persistent last child overlays the inline menu list", async () => {
sendExtensionMessageSpy.mockResolvedValue({
list: { top: 0, left: 0, width: 0, height: 0 },
});
globalThis.document.elementFromPoint = jest.fn(() => persistentLastChild);
await autofillInlineMenuContentService["handleBodyElementMutationObserverUpdate"]();
await waitForIdleCallback();
expect(sendExtensionMessageSpy).toHaveBeenCalledWith("autofillOverlayElementClosed", {
overlayElement: AutofillOverlayElement.List,
});
});
});
}); });
describe("isTriggeringExcessiveMutationObserverIterations", () => { describe("isTriggeringExcessiveMutationObserverIterations", () => {

View File

@ -1,3 +1,7 @@
import {
InlineMenuElementPosition,
InlineMenuPosition,
} from "../../../background/abstractions/overlay.background";
import { AutofillExtensionMessage } from "../../../content/abstractions/autofill-init"; import { AutofillExtensionMessage } from "../../../content/abstractions/autofill-init";
import { import {
AutofillOverlayElement, AutofillOverlayElement,
@ -7,6 +11,7 @@ import {
sendExtensionMessage, sendExtensionMessage,
generateRandomCustomElementName, generateRandomCustomElementName,
setElementStyles, setElementStyles,
requestIdleCallbackPolyfill,
} from "../../../utils"; } from "../../../utils";
import { import {
InlineMenuExtensionMessageHandlers, InlineMenuExtensionMessageHandlers,
@ -28,6 +33,7 @@ export class AutofillInlineMenuContentService implements AutofillInlineMenuConte
private bodyElementMutationObserver: MutationObserver; private bodyElementMutationObserver: MutationObserver;
private mutationObserverIterations = 0; private mutationObserverIterations = 0;
private mutationObserverIterationsResetTimeout: number | NodeJS.Timeout; private mutationObserverIterationsResetTimeout: number | NodeJS.Timeout;
private lastElementOverrides: WeakMap<Element, number> = new WeakMap();
private readonly customElementDefaultStyles: Partial<CSSStyleDeclaration> = { private readonly customElementDefaultStyles: Partial<CSSStyleDeclaration> = {
all: "initial", all: "initial",
position: "fixed", position: "fixed",
@ -375,12 +381,35 @@ export class AutofillInlineMenuContentService implements AutofillInlineMenuConte
return; return;
} }
requestIdleCallbackPolyfill(this.processBodyElementMutation, { timeout: 500 });
};
/**
* Processes the mutation of the body element. Will trigger when an
* idle moment in the execution of the main thread is detected.
*/
private processBodyElementMutation = async () => {
const lastChild = globalThis.document.body.lastElementChild; const lastChild = globalThis.document.body.lastElementChild;
const secondToLastChild = lastChild?.previousElementSibling; const secondToLastChild = lastChild?.previousElementSibling;
const lastChildIsInlineMenuList = lastChild === this.listElement; const lastChildIsInlineMenuList = lastChild === this.listElement;
const lastChildIsInlineMenuButton = lastChild === this.buttonElement; const lastChildIsInlineMenuButton = lastChild === this.buttonElement;
const secondToLastChildIsInlineMenuButton = secondToLastChild === this.buttonElement; const secondToLastChildIsInlineMenuButton = secondToLastChild === this.buttonElement;
if (!lastChild) {
return;
}
const lastChildEncounterCount = this.lastElementOverrides.get(lastChild) || 0;
if (!lastChildIsInlineMenuList && !lastChildIsInlineMenuButton && lastChildEncounterCount < 3) {
this.lastElementOverrides.set(lastChild, lastChildEncounterCount + 1);
}
if (this.lastElementOverrides.get(lastChild) >= 3) {
await this.handlePersistentLastChildOverride(lastChild);
return;
}
if ( if (
!lastChild || !lastChild ||
(lastChildIsInlineMenuList && secondToLastChildIsInlineMenuButton) || (lastChildIsInlineMenuList && secondToLastChildIsInlineMenuButton) ||
@ -400,6 +429,46 @@ export class AutofillInlineMenuContentService implements AutofillInlineMenuConte
globalThis.document.body.insertBefore(lastChild, this.buttonElement); globalThis.document.body.insertBefore(lastChild, this.buttonElement);
}; };
/**
* Verifies if the last child of the body element is overlaying the inline menu elements.
* This is triggered when the last child of the body is being forced by some script to
* be an element other than the inline menu elements.
*
* @param lastChild - The last child of the body element.
*/
private async handlePersistentLastChildOverride(lastChild: Element) {
const lastChildZIndex = parseInt((lastChild as HTMLElement).style.zIndex);
if (lastChildZIndex >= 2147483647) {
(lastChild as HTMLElement).style.zIndex = "2147483646";
}
const inlineMenuPosition: InlineMenuPosition = await this.sendExtensionMessage(
"getAutofillInlineMenuPosition",
);
const { button, list } = inlineMenuPosition;
if (!!button && this.elementAtCenterOfInlineMenuPosition(button) === lastChild) {
this.closeInlineMenu();
return;
}
if (!!list && this.elementAtCenterOfInlineMenuPosition(list) === lastChild) {
this.closeInlineMenu();
}
}
/**
* Returns the element present at the center of the inline menu position.
*
* @param position - The position of the inline menu element.
*/
private elementAtCenterOfInlineMenuPosition(position: InlineMenuElementPosition): Element | null {
return globalThis.document.elementFromPoint(
position.left + position.width / 2,
position.top + position.height / 2,
);
}
/** /**
* Identifies if the mutation observer is triggering excessive iterations. * Identifies if the mutation observer is triggering excessive iterations.
* Will trigger a blur of the most recently focused field and remove the * Will trigger a blur of the most recently focused field and remove the

View File

@ -1,6 +1,4 @@
interface DomElementVisibilityService { export interface DomElementVisibilityService {
isFormFieldViewable: (element: HTMLElement) => Promise<boolean>; isFormFieldViewable: (element: HTMLElement) => Promise<boolean>;
isElementHiddenByCss: (element: HTMLElement) => boolean; isElementHiddenByCss: (element: HTMLElement) => boolean;
} }
export { DomElementVisibilityService };

View File

@ -1,9 +1,9 @@
import { AutofillInlineMenuContentService } from "../overlay/inline-menu/abstractions/autofill-inline-menu-content.service"; import { AutofillInlineMenuContentService } from "../overlay/inline-menu/abstractions/autofill-inline-menu-content.service";
import { FillableFormFieldElement, FormFieldElement } from "../types"; import { FillableFormFieldElement, FormFieldElement } from "../types";
import { DomElementVisibilityService as domElementVisibilityServiceInterface } from "./abstractions/dom-element-visibility.service"; import { DomElementVisibilityService as DomElementVisibilityServiceInterface } from "./abstractions/dom-element-visibility.service";
class DomElementVisibilityService implements domElementVisibilityServiceInterface { class DomElementVisibilityService implements DomElementVisibilityServiceInterface {
private cachedComputedStyle: CSSStyleDeclaration | null = null; private cachedComputedStyle: CSSStyleDeclaration | null = null;
constructor(private inlineMenuElements?: AutofillInlineMenuContentService) {} constructor(private inlineMenuElements?: AutofillInlineMenuContentService) {}