1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 * A factory to generate AutofillForm objects that represent a set of autofillable fields
7 * which aren't necessarily marked up with a <form> element.
12 ChromeUtils.defineESModuleGetters(lazy, {
13 FormLikeFactory: "resource://gre/modules/FormLikeFactory.sys.mjs",
16 export const AutofillFormFactory = {
17 findRootForField(element) {
20 const bc = element.ownerGlobal.browsingContext;
21 ignoreForm = bc != bc.top;
25 return lazy.FormLikeFactory.findRootForField(element, { ignoreForm });
28 createFromForm(aForm) {
29 return lazy.FormLikeFactory.createFromForm(aForm);
32 createFromField(aField) {
35 const bc = aField.ownerGlobal.browsingContext;
36 ignoreForm = bc != bc.top;
40 return lazy.FormLikeFactory.createFromField(aField, { ignoreForm });