From 8df04ff073d0fa70f692935c5dcddc0e23cb0117 Mon Sep 17 00:00:00 2001 From: Razvan Maries Date: Tue, 11 Aug 2020 07:57:38 +0300 Subject: [PATCH] Backed out changeset 558dce220fdd (bug 1654388) for perma failures on test_usage_prefs.html. CLOSED TREE --- .../formautofill/FormAutofillStorage.jsm | 41 ------- .../test/mochitest/formautofill_common.js | 20 ---- .../test_address_level_1_submission.html | 2 - .../test_basic_autocomplete_form.html | 2 - .../components/passwordmgr/storage-json.js | 17 +-- .../passwordmgr/test/mochitest/mochitest.ini | 3 - .../test/mochitest/test_usage_prefs.html | 111 ------------------ 7 files changed, 1 insertion(+), 195 deletions(-) delete mode 100644 toolkit/components/passwordmgr/test/mochitest/test_usage_prefs.html diff --git a/browser/extensions/formautofill/FormAutofillStorage.jsm b/browser/extensions/formautofill/FormAutofillStorage.jsm index c21749f68b7a..1d153f2752e1 100644 --- a/browser/extensions/formautofill/FormAutofillStorage.jsm +++ b/browser/extensions/formautofill/FormAutofillStorage.jsm @@ -307,7 +307,6 @@ class AutofillRecords { if (dataHasChanges) { this._store.saveSoon(); } - this._onDataLoaded(); }); } @@ -544,8 +543,6 @@ class AutofillRecords { * * @param {string} guid * Indicates which record to be notified. - * @returns {Object} - * Record corresponding to the guid that was used */ notifyUsed(guid) { this.log.debug("notifyUsed:", guid); @@ -571,7 +568,6 @@ class AutofillRecords { "formautofill-storage-changed", "notifyUsed" ); - return recordFound; } updateUseCountTelemetry() {} @@ -1443,9 +1439,6 @@ class AutofillRecords { // An interface to be inherited. async mergeIfPossible(guid, record, strict) {} - - // Called once initalization has completed - _onDataLoaded() {} } class Addresses extends AutofillRecords { @@ -1457,15 +1450,6 @@ class Addresses extends AutofillRecords { VALID_ADDRESS_COMPUTED_FIELDS, ADDRESS_SCHEMA_VERSION ); - Services.obs.addObserver(this, "formautofill-storage-changed"); - } - - observe(subject, topic, data) { - switch (topic) { - case "formautofill-storage-changed": - this._recordEntryPresent(); - break; - } } _recordReadProcessor(address) { @@ -1772,31 +1756,6 @@ class Addresses extends AutofillRecords { await this.update(guid, addressToMerge, true); return true; } - - _onDataLoaded() { - this._recordEntryPresent(); - } - - // Record in prefs whether the user has any address entries stored. - // This information is not uploaded as telemetry, and is used to target - // user surveys. See Bug 1654388 for details. - _recordEntryPresent() { - const records = this._data.filter(entry => !entry.deleted); - this.log.debug("Address records:", records); - Services.prefs.setBoolPref( - "extensions.formautofill.addresses.usage.hasEntry", - !!records.length - ); - } - - notifyUsed(guid) { - const record = super.notifyUsed(guid); - Services.prefs.setIntPref( - "extensions.formautofill.addresses.usage.lastUsed", - Math.floor(record.timeLastUsed / 1000) - ); - return record; - } } class CreditCards extends AutofillRecords { diff --git a/browser/extensions/formautofill/test/mochitest/formautofill_common.js b/browser/extensions/formautofill/test/mochitest/formautofill_common.js index 28c6ff3ccf43..d6635325bd36 100644 --- a/browser/extensions/formautofill/test/mochitest/formautofill_common.js +++ b/browser/extensions/formautofill/test/mochitest/formautofill_common.js @@ -439,24 +439,4 @@ function formAutoFillCommonSetup() { ); } -function checkUsagePrefs(hasEntry, lastUsed) { - lastUsed = Math.floor(lastUsed); - is( - SpecialPowers.getBoolPref( - "extensions.formautofill.addresses.usage.hasEntry", - false - ), - hasEntry, - "hasEntry usage pref is " + hasEntry - ); - const lastUsedPref = SpecialPowers.getIntPref( - "extensions.formautofill.addresses.usage.lastUsed", - 0 - ); - ok( - lastUsed - lastUsedPref < 10, - `lastUsed usage pref (${lastUsedPref}) is within 10 seconds of ${lastUsed}` - ); -} - formAutoFillCommonSetup(); diff --git a/browser/extensions/formautofill/test/mochitest/test_address_level_1_submission.html b/browser/extensions/formautofill/test/mochitest/test_address_level_1_submission.html index cb361f9cc27d..0c16b91d3a66 100644 --- a/browser/extensions/formautofill/test/mochitest/test_address_level_1_submission.html +++ b/browser/extensions/formautofill/test/mochitest/test_address_level_1_submission.html @@ -75,8 +75,6 @@ add_task(async function test_form_will_submit_without_sub_keys() { let matching = await checkAddresses(TEST_ADDRESSES); ok(matching, "Address saved as expected"); - checkUsagePrefs(true, Date.now()/1000); - await loadPromise; isnot(window.submit_frame.location.href, "about:blank", "Check form submitted"); }); diff --git a/browser/extensions/formautofill/test/mochitest/test_basic_autocomplete_form.html b/browser/extensions/formautofill/test/mochitest/test_basic_autocomplete_form.html index ef7589bc2f25..a642b2abca3b 100644 --- a/browser/extensions/formautofill/test/mochitest/test_basic_autocomplete_form.html +++ b/browser/extensions/formautofill/test/mochitest/test_basic_autocomplete_form.html @@ -74,9 +74,7 @@ add_task(async function all_saved_fields_less_than_threshold() { // Form with both history and address storage. add_task(async function check_menu_when_both_existed() { - checkUsagePrefs(false, 0); await setupAddressStorage(); - checkUsagePrefs(true, 0); await setInput("#organization", ""); await notExpectPopup(); diff --git a/toolkit/components/passwordmgr/storage-json.js b/toolkit/components/passwordmgr/storage-json.js index 07b28e21b42c..8a7fba89da45 100644 --- a/toolkit/components/passwordmgr/storage-json.js +++ b/toolkit/components/passwordmgr/storage-json.js @@ -105,7 +105,6 @@ class LoginManagerStorage_json { // Load the data asynchronously. this.log("Opening database at", this._store.path); await this._store.load(); - this._recordEntryPresent(); })().catch(Cu.reportError); } catch (e) { this.log("Initialization failed:", e); @@ -267,7 +266,6 @@ class LoginManagerStorage_json { // Send a notification that a login was added. LoginHelper.notifyStorageChanged("addLogin", loginClone); - this._recordEntryPresent(); return loginClone; } @@ -286,7 +284,6 @@ class LoginManagerStorage_json { } LoginHelper.notifyStorageChanged("removeLogin", storedLogin); - this._recordEntryPresent(); } modifyLogin(oldLogin, newLoginData) { @@ -352,11 +349,9 @@ class LoginManagerStorage_json { let propBag = Cc["@mozilla.org/hash-property-bag;1"].createInstance( Ci.nsIWritablePropertyBag ); - let now = Date.now(); - propBag.setProperty("timeLastUsed", now); + propBag.setProperty("timeLastUsed", Date.now()); propBag.setProperty("timesUsedIncrement", 1); this.modifyLogin(login, propBag); - Services.prefs.setIntPref("signon.usage.lastUsed", Math.floor(now / 1000)); } async recordBreachAlertDismissal(loginGUID) { @@ -833,16 +828,6 @@ class LoginManagerStorage_json { return result; } - - // Record in prefs whether the user has any password entries stored. - // This information is not uploaded as telemetry, and is used to target - // user surveys. See Bug 1654388 for details. - _recordEntryPresent() { - Services.prefs.setBoolPref( - "signon.usage.hasEntry", - !!this._store.data.logins.length - ); - } } XPCOMUtils.defineLazyGetter(LoginManagerStorage_json.prototype, "log", () => { diff --git a/toolkit/components/passwordmgr/test/mochitest/mochitest.ini b/toolkit/components/passwordmgr/test/mochitest/mochitest.ini index c8eb70061eaf..e081cba0f50f 100644 --- a/toolkit/components/passwordmgr/test/mochitest/mochitest.ini +++ b/toolkit/components/passwordmgr/test/mochitest/mochitest.ini @@ -236,9 +236,6 @@ skip-if = e10s || os == "linux" || toolkit == 'android' # Tests desktop prompts support-files = subtst_prefilled_form.html skip-if = (xorigin && fission) # Hangs -[test_usage_prefs.html] -scheme = https -skip-if = (xorigin && fission) # Hangs [test_username_focus.html] skip-if = toolkit == 'android' # android:autocomplete. || (xorigin && fission) # Hangs diff --git a/toolkit/components/passwordmgr/test/mochitest/test_usage_prefs.html b/toolkit/components/passwordmgr/test/mochitest/test_usage_prefs.html deleted file mode 100644 index fb07df61c463..000000000000 --- a/toolkit/components/passwordmgr/test/mochitest/test_usage_prefs.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - - Test usage prefs - - - - - -Login Manager test: usage prefs collection - - - -

- - - -

-
-
-