Skip to content

Commit

Permalink
Refactor - auto update credential provider script (#22104)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
github-actions[bot] committed Sep 20, 2024
1 parent 9c25d21 commit 3d6b345
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
14 changes: 6 additions & 8 deletions firefox-ios/Client/Assets/CC_Script/FormLikeFactory.sys.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -37,24 +37,22 @@ export let FormLikeFactory = {
},

/**
* Create a FormLike object from an HTMLHtmlElement that is the root of the document
* Create a FormLike object from an element that is the root of the document
*
* Currently all <input> not in a <form> are one LoginForm but this
* shouldn't be relied upon as the heuristics may change to detect multiple
* "forms" (e.g. registration and login) on one page with a <form>.
*
* @param {HTMLHtmlElement} aDocumentRoot
* @param {HTMLElement} aDocumentRoot
* @param {Object} aOptions
* @param {boolean} [aOptions.ignoreForm = false]
* True to always use owner document as the `form`
* @return {FormLike}
* @throws Error if aDocumentRoot isn't an HTMLHtmlElement
* @return {formLike}
* @throws Error if aDocumentRoot is null
*/
createFromDocumentRoot(aDocumentRoot, aOptions = {}) {
if (!HTMLHtmlElement.isInstance(aDocumentRoot)) {
throw new Error(
"createFromDocumentRoot: aDocumentRoot must be an HTMLHtmlElement"
);
if (!aDocumentRoot) {
throw new Error("createFromDocumentRoot: aDocumentRoot is null");
}

let formLike = {
Expand Down
7 changes: 5 additions & 2 deletions firefox-ios/Client/Assets/CC_Script/HeuristicsRegExp.sys.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@ export const HeuristicsRegExp = {
RULES: {
email: undefined,
tel: undefined,
organization: undefined,
"street-address": undefined,
"address-line1": undefined,
"address-line2": undefined,
"address-line3": undefined,
"address-level2": undefined,
"address-level1": undefined,
"postal-code": undefined,
// Note: We place the `organization` field after the `address` fields, to
// ensure that all address-related fields that might contain organization
// info are matched as address fields first.
organization: undefined,
country: undefined,
// Note: We place the `cc-name` field for Credit Card first, because
// it is more specific than the `name` field below and we want to check
Expand Down Expand Up @@ -46,7 +49,7 @@ export const HeuristicsRegExp = {
"address-line1": "addrline1|address_1|addl1",
"address-line2": "addrline2|address_2|addl2",
"address-line3": "addrline3|address_3|addl3",
"address-level1": "land", // de-DE
"country": "land", // de-DE
"postal-code": "^PLZ(\\b|\\*)", // de-DE
"additional-name": "apellido.?materno|lastlastname",
"cc-name":
Expand Down
6 changes: 3 additions & 3 deletions firefox-ios/Client/Assets/CC_Script/LoginFormFactory.sys.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ export const LoginFormFactory = {
},

/**
* Create a LoginForm object from the HTMLHtmlElement that is the root of the document
* Create a LoginForm object from an elememt that is the root of the document
*
* Currently all <input> not in a <form> are one LoginForm but this
* shouldn't be relied upon as the heuristics may change to detect multiple
* "forms" (e.g. registration and login) on one page with a <form>.
*
* @param {HTMLHtmlElement} aDocumentRoot
* @param {HTMLElement} aDocumentRoot
* @return {LoginForm}
* @throws Error if aDocumentRoot isn't an HTMLHtmlElement
* @throws Error if aDocumentRoot is null
*/
createFromDocumentRoot(aDocumentRoot) {
const formLike = lazy.FormLikeFactory.createFromDocumentRoot(aDocumentRoot);
Expand Down

0 comments on commit 3d6b345

Please sign in to comment.