208be8dfbf
* This commit implements the following main changes: - Query elements by using a TreeWalker instead of `document.querySelector[All]`. The reason for this is that `querySelector[All]` doesn't traverse into elements with ShadowRoot. - Recursively traverse into elements with `openOrClosedShadowRoot` or `Element.shadowRoot` (depending on browser support) inside TreeWalker loop. - Use new query logic everywhere inside `autofill.js`. This also means we need to use filter functions to find elements with specific nodeNames and/or attributes instead of CSS selector strings. - Add two new `instanceof Element` checks to prevent `Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'." errors`. This change is fully backward compatible. If `openOrClosedShadowRoot` is not available it will always return undefined and we will never traverse into ShadowRoots just as the behavior was before this change. * refactor: outsource recursive logic to accumulatingQueryDocAll We don't want the `els` argument on the `queryDocAll` function because it's never used from outside the function itself. Thus the recursive logic is moved to `accumulatingQueryDocAll`. Now `queryDocAll` creates an empty array and passes it to `accumulatingQueryDocAll` which recursively walks the document and all ShadowRoots and pushes all found nodes directly to the referenced array. The decision to use a directly mutated array instead of `Array.concat(els)` or `Array.push(...els)` is for performance reasons. Pushing to the referenced array was 74% faster than using `Array.push` with spread operator and even 90% faster than using `Array.concat`. Co-authored-by: Chad Miller <64046472+chadm-sq@users.noreply.github.com> * refactor: extract input field relevance check into own function Addresses CodeScene analysis violation "Bumpy Road Ahead" where conditional logic is checked for a nesting of 2 or deeper. * refactor: use proper element attribute handling - use el.type attribute instead of el.attribute.type on input elements. This makes sure we also get 'text' when type attribute is not explicitly specified - use el.htmlFor attribute instead of el.attribute.for on label elements - use `hasAttribute` and `getAttribute` methods instead of `attributes[]` which is discouraged by https://quirksmode.org/dom/core/#attributes - improve readability of `isRelevantInputField` --------- Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Chad Miller <64046472+chadm-sq@users.noreply.github.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> |
||
---|---|---|
.github | ||
.husky | ||
.storybook | ||
.vscode | ||
apps | ||
bitwarden_license | ||
libs | ||
.editorconfig | ||
.eslintignore | ||
.eslintrc.json | ||
.git-blame-ignore-revs | ||
.gitattributes | ||
.gitignore | ||
.nvmrc | ||
.prettierignore | ||
.prettierrc.json | ||
angular.json | ||
clients.code-workspace | ||
CONTRIBUTING.md | ||
jest.config.js | ||
LICENSE_BITWARDEN.txt | ||
LICENSE_GPL.txt | ||
LICENSE.txt | ||
package-lock.json | ||
package.json | ||
README.md | ||
SECURITY.md | ||
tailwind.config.js | ||
tsconfig.eslint.json | ||
tsconfig.json |
Bitwarden Client Applications
This repository houses all Bitwarden client applications except the Mobile application.
Please refer to the Clients section of the Contributing Documentation for build instructions, recommended tooling, code style tips, and lots of other great information to get you started.
Related projects:
- bitwarden/server: The core infrastructure backend (API, database, Docker, etc).
- bitwarden/mobile: The mobile app vault (iOS and Android).
- bitwarden/directory-connector: A tool for syncing a directory (AD, LDAP, Azure, G Suite, Okta) to an organization.
We're Hiring!
Interested in contributing in a big way? Consider joining our team! We're hiring for many positions. Please take a look at our Careers page to see what opportunities are currently open as well as what it's like to work at Bitwarden.
Contribute
Code contributions are welcome! Please commit any pull requests against the master
branch. Learn more about how to contribute by reading the Contributing Guidelines. Check out the Contributing Documentation for how to get started with your first contribution.
Security audits and feedback are welcome. Please open an issue or email us privately if the report is sensitive in nature. You can read our security policy in the SECURITY.md
file.