mirror of
https://github.com/keepassxreboot/keepassxc-browser.git
synced 2026-03-11 08:54:43 +00:00
Merge pull request #2430 from keepassxreboot/fix/add_shadow_dom_exceptions
Add exceptions for Shadow DOM input query
This commit is contained in:
commit
60355e8e1c
2 changed files with 11 additions and 1 deletions
|
|
@ -101,6 +101,16 @@ kpxcSites.exceptionFound = function(identifier, field) {
|
|||
return false;
|
||||
};
|
||||
|
||||
// Forbids using Shadow DOM query with some sites unless a login dialog has been identified
|
||||
kpxcSites.isShadowDomQueryAllowed = function(nodeName) {
|
||||
if (document.location.href?.startsWith('https://www.reddit.com')
|
||||
&& nodeName !== 'BODY'
|
||||
&& !document.querySelector('auth-flow-manager[step-name=login]')) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* Handles a few exceptions for certain sites where 2FA field is not regognized properly.
|
||||
* @param {object} field Input field Element
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ kpxcObserverHelper.getInputs = function(target, ignoreVisibility = false) {
|
|||
inputFields.push(target);
|
||||
}
|
||||
|
||||
if (kpxc.improvedFieldDetectionEnabledForPage) {
|
||||
if (kpxc.improvedFieldDetectionEnabledForPage && kpxcSites.isShadowDomQueryAllowed(target?.nodeName)) {
|
||||
const inputFieldsFromShadowDOM = kpxcObserverHelper.findInputsFromShadowDOM(target);
|
||||
if (inputFieldsFromShadowDOM.length > 0) {
|
||||
logDebug('Input fields from Shadow DOM found:', inputFieldsFromShadowDOM);
|
||||
|
|
|
|||
Loading…
Reference in a new issue