Skip to content

Refactor - auto update credential provider script #26159

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,8 @@ export const AutofillFormFactory = {
}
return lazy.FormLikeFactory.createFromField(aField, { ignoreForm });
},

createFromDocumentRoot(aDocRoot) {
return lazy.FormLikeFactory.createFromDocumentRoot(aDocRoot);
},
};
47 changes: 0 additions & 47 deletions firefox-ios/Client/Assets/CC_Script/AutofillTelemetry.sys.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ class AutofillTelemetryBase {
EVENT_CATEGORY = null;
EVENT_OBJECT_FORM_INTERACTION = null;

HISTOGRAM_NUM_USES = null;
HISTOGRAM_PROFILE_NUM_USES = null;
HISTOGRAM_PROFILE_NUM_USES_KEY = null;

#initFormEventExtra(value) {
let extra = {};
for (const field of Object.values(this.SUPPORTED_FIELDS)) {
Expand Down Expand Up @@ -183,17 +179,6 @@ class AutofillTelemetryBase {
throw new Error("Not implemented.");
}

recordNumberOfUse(records) {
let histogram = Services.telemetry.getKeyedHistogramById(
this.HISTOGRAM_PROFILE_NUM_USES
);
histogram.clear();

for (let record of records) {
histogram.add(this.HISTOGRAM_PROFILE_NUM_USES_KEY, record.timesUsed);
}
}

recordIframeLayoutDetection(flowId, fieldDetails) {
const fieldsInMainFrame = [];
const fieldsInIframe = [];
Expand Down Expand Up @@ -238,9 +223,6 @@ export class AddressTelemetry extends AutofillTelemetryBase {
EVENT_OBJECT_FORM_INTERACTION = "AddressForm";
EVENT_OBJECT_FORM_INTERACTION_EXT = "AddressFormExt";

HISTOGRAM_PROFILE_NUM_USES = "AUTOFILL_PROFILE_NUM_USES";
HISTOGRAM_PROFILE_NUM_USES_KEY = "address";

// Fields that are recorded in `address_form` and `address_form_ext` telemetry
SUPPORTED_FIELDS = {
"street-address": "street_address",
Expand Down Expand Up @@ -316,10 +298,6 @@ class CreditCardTelemetry extends AutofillTelemetryBase {
EVENT_CATEGORY = "creditcard";
EVENT_OBJECT_FORM_INTERACTION = "CcFormV2";

HISTOGRAM_NUM_USES = "CREDITCARD_NUM_USES";
HISTOGRAM_PROFILE_NUM_USES = "AUTOFILL_PROFILE_NUM_USES";
HISTOGRAM_PROFILE_NUM_USES_KEY = "credit_card";

// Mapping of field name used in formautofill code to the field name
// used in the telemetry.
SUPPORTED_FIELDS = {
Expand Down Expand Up @@ -369,23 +347,6 @@ class CreditCardTelemetry extends AutofillTelemetryBase {
}
}

recordNumberOfUse(records) {
super.recordNumberOfUse(records);

if (!this.HISTOGRAM_NUM_USES) {
return;
}

let histogram = Services.telemetry.getHistogramById(
this.HISTOGRAM_NUM_USES
);
histogram.clear();

for (let record of records) {
histogram.add(record.timesUsed);
}
}

recordAutofillProfileCount(count) {
Glean.formautofillCreditcards.autofillProfilesCount.set(count);
}
Expand Down Expand Up @@ -463,14 +424,6 @@ export class AutofillTelemetry {
telemetry.recordAutofillProfileCount(count);
}

/**
* Utility functions for address/credit card number of use
*/
static recordNumberOfUse(type, records) {
const telemetry = this.#getTelemetryByType(type);
telemetry.recordNumberOfUse(records);
}

static recordFormSubmissionHeuristicCount(label) {
Glean.formautofill.formSubmissionHeuristic[label].add(1);
}
Expand Down
1 change: 1 addition & 0 deletions firefox-ios/Client/Assets/CC_Script/Constants.ios.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const IOS_DEFAULT_PREFERENCES = {
"extensions.formautofill.heuristics.captureOnPageNavigation": false,
"extensions.formautofill.heuristics.detectDynamicFormChanges": false,
"extensions.formautofill.heuristics.fillOnDynamicFormChanges": false,
"extensions.formautofill.heuristics.refillOnSiteClearingFields": false,
"extensions.formautofill.focusOnAutofill": false,
"extensions.formautofill.test.ignoreVisibilityCheck": false,
"extensions.formautofill.heuristics.autofillSameOriginWithTop": false,
Expand Down
20 changes: 20 additions & 0 deletions firefox-ios/Client/Assets/CC_Script/FormAutofill.sys.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ const AUTOFILL_FILL_ON_DYNAMIC_FORM_CHANGES_TIMEOUT_PREF =
"extensions.formautofill.heuristics.fillOnDynamicFormChanges.timeout";
const AUTOFILL_FILL_ON_DYNAMIC_FORM_CHANGES_PREF =
"extensions.formautofill.heuristics.fillOnDynamicFormChanges";
const AUTOFILL_REFILL_ON_SITE_CLEARING_VALUE_PREF =
"extensions.formautofill.heuristics.refillOnSiteClearingFields";
const AUTOFILL_REFILL_ON_SITE_CLEARING_VALUE_TIMEOUT_PREF =
"extensions.formautofill.heuristics.refillOnSiteClearingFields.timeout";

export const FormAutofill = {
ENABLED_AUTOFILL_ADDRESSES_PREF,
Expand All @@ -59,6 +63,8 @@ export const FormAutofill = {
AUTOFILL_ADDRESSES_AUTOCOMPLETE_OFF_PREF,
AUTOFILL_FILL_ON_DYNAMIC_FORM_CHANGES_PREF,
AUTOFILL_FILL_ON_DYNAMIC_FORM_CHANGES_TIMEOUT_PREF,
AUTOFILL_REFILL_ON_SITE_CLEARING_VALUE_PREF,
AUTOFILL_REFILL_ON_SITE_CLEARING_VALUE_TIMEOUT_PREF,

_region: null,

Expand Down Expand Up @@ -366,6 +372,20 @@ XPCOMUtils.defineLazyPreferenceGetter(
0
);

XPCOMUtils.defineLazyPreferenceGetter(
FormAutofill,
"refillOnSiteClearingFields",
"extensions.formautofill.heuristics.refillOnSiteClearingFields",
false
);

XPCOMUtils.defineLazyPreferenceGetter(
FormAutofill,
"refillOnSiteClearingFieldsTimeout",
"extensions.formautofill.heuristics.refillOnSiteClearingFields.timeout",
0
);

ChromeUtils.defineLazyGetter(FormAutofill, "countries", () =>
AddressMetaDataLoader.getCountries()
);
Loading