mirror of
https://github.com/bitwarden/browser
synced 2026-02-09 13:10:17 +00:00
Adds domain qualifier, some logs.
This commit is contained in:
@@ -199,6 +199,8 @@ export class AutofillOverlayContentService implements AutofillOverlayContentServ
|
||||
autofillFieldData: AutofillField,
|
||||
pageDetails: AutofillPageDetails,
|
||||
) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log("Field", formFieldElement, this.isIgnoredField(autofillFieldData, pageDetails));
|
||||
if (
|
||||
currentlyInSandboxedIframe() ||
|
||||
this.formFieldElements.has(formFieldElement) ||
|
||||
@@ -206,11 +208,13 @@ export class AutofillOverlayContentService implements AutofillOverlayContentServ
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
console.log("Field Was not ignored.");
|
||||
if (this.isHiddenField(formFieldElement, autofillFieldData)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
console.log("Field was not hidden.");
|
||||
await this.setupOverlayListenersOnQualifiedField(formFieldElement, autofillFieldData);
|
||||
}
|
||||
|
||||
@@ -1049,7 +1053,12 @@ export class AutofillOverlayContentService implements AutofillOverlayContentServ
|
||||
autofillFieldData: AutofillField,
|
||||
pageDetails: AutofillPageDetails,
|
||||
): { result: boolean; message: string } {
|
||||
const message = "isIgnoredField";
|
||||
const ns = "isIgnoredField";
|
||||
|
||||
const field = autofillFieldData;
|
||||
if (field.domainMatch && field.domainMatch.fieldType === AutofillFieldQualifier.password) {
|
||||
return { result: false, message: `${ns} Matched domain specific setting.` };
|
||||
}
|
||||
|
||||
const ignoredTypeResult = Array.from(this.ignoredFieldTypes).find(
|
||||
(v) => v === autofillFieldData.type,
|
||||
@@ -1057,7 +1066,7 @@ export class AutofillOverlayContentService implements AutofillOverlayContentServ
|
||||
if (ignoredTypeResult) {
|
||||
return {
|
||||
result: true,
|
||||
message: `${message} // field type is ignored type: ${ignoredTypeResult}`,
|
||||
message: `${ns} // field type is ignored type: ${ignoredTypeResult}`,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1065,7 +1074,7 @@ export class AutofillOverlayContentService implements AutofillOverlayContentServ
|
||||
this.inlineMenuFieldQualificationService.isFieldForLoginForm(autofillFieldData, pageDetails)
|
||||
) {
|
||||
void this.setQualifiedLoginFillType(autofillFieldData);
|
||||
return { result: false, message: `${message} // field is for login form` };
|
||||
return { result: false, message: `${ns} // field is for login form` };
|
||||
}
|
||||
|
||||
if (
|
||||
@@ -1078,7 +1087,7 @@ export class AutofillOverlayContentService implements AutofillOverlayContentServ
|
||||
autofillFieldData.inlineMenuFillType = CipherType.Card;
|
||||
return {
|
||||
result: false,
|
||||
message: `${message} // field is for credit card form & inline menu cards shown`,
|
||||
message: `${ns} // field is for credit card form & inline menu cards shown`,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1089,7 +1098,7 @@ export class AutofillOverlayContentService implements AutofillOverlayContentServ
|
||||
)
|
||||
) {
|
||||
this.setQualifiedAccountCreationFillType(autofillFieldData);
|
||||
return { result: false, message: `${message} // field is for account creation form` };
|
||||
return { result: false, message: `${ns} // field is for account creation form` };
|
||||
}
|
||||
|
||||
if (
|
||||
@@ -1102,13 +1111,13 @@ export class AutofillOverlayContentService implements AutofillOverlayContentServ
|
||||
autofillFieldData.inlineMenuFillType = CipherType.Identity;
|
||||
return {
|
||||
result: false,
|
||||
message: `${message} // field is for identity form & inline menu identities shown`,
|
||||
message: `${ns} // field is for identity form & inline menu identities shown`,
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
result: true,
|
||||
message: `${message} // field ignored by default — not in any unignorable condition`,
|
||||
message: `${ns} // field ignored by default — not in any unignorable condition`,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// @ts-strict-ignore
|
||||
import { Utils } from "@bitwarden/common/platform/misc/utils";
|
||||
|
||||
import { AutofillFieldQualifier } from "../enums/autofill-field.enums";
|
||||
import { AutofillFieldQualifier, AutofillFieldQualifierType } from "../enums/autofill-field.enums";
|
||||
import AutofillField, { DomainMatch } from "../models/autofill-field";
|
||||
import AutofillForm from "../models/autofill-form";
|
||||
import AutofillPageDetails from "../models/autofill-page-details";
|
||||
@@ -28,6 +28,17 @@ import {
|
||||
debounce,
|
||||
} from "../utils";
|
||||
|
||||
type XPathQualifier = {
|
||||
qualifierType: AutofillFieldQualifierType;
|
||||
fullxpath: string;
|
||||
xpath?: string;
|
||||
};
|
||||
|
||||
type DomainMatcher = {
|
||||
domain: string;
|
||||
xpathQualifiers: XPathQualifier[];
|
||||
};
|
||||
|
||||
import { AutofillOverlayContentService } from "./abstractions/autofill-overlay-content.service";
|
||||
import {
|
||||
AutofillFieldElements,
|
||||
@@ -436,7 +447,7 @@ export class CollectAutofillContentService implements CollectAutofillContentServ
|
||||
matchesXPathForDomain(element: ElementWithOpId<FormFieldElement>): DomainMatch {
|
||||
const url = this.getSafeDocumentUrl();
|
||||
const domain = Utils.getDomain(url);
|
||||
const matchers = [
|
||||
const matchers: DomainMatcher[] = [
|
||||
{
|
||||
domain: "hbomax.com",
|
||||
xpathQualifiers: [
|
||||
@@ -509,6 +520,19 @@ export class CollectAutofillContentService implements CollectAutofillContentServ
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
domain: "westelm.com",
|
||||
xpathQualifiers: [
|
||||
{
|
||||
qualifierType: AutofillFieldQualifier.identityEmail,
|
||||
fullxpath: "/html/body/div[1]/div/div/div/div/div[1]/div/form/div[1]/div/input",
|
||||
},
|
||||
{
|
||||
qualifierType: AutofillFieldQualifier.password,
|
||||
fullxpath: "/html/body/div[1]/div/div/div/div/div[1]/div/form/div[2]/div[1]/input[2]",
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
for (const matcher of matchers) {
|
||||
|
||||
Reference in New Issue
Block a user