зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 558dce220fdd (bug 1654388) for perma failures on test_usage_prefs.html. CLOSED TREE
This commit is contained in:
Родитель
ffcff8cdcf
Коммит
8df04ff073
|
@ -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 {
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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");
|
||||
});
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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", () => {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,111 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test usage prefs</title>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="pwmgr_common.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
Login Manager test: usage prefs collection
|
||||
|
||||
<script>
|
||||
|
||||
function addLogin() {
|
||||
runInParent(() => {
|
||||
const { Services } =
|
||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
let login = Cc["@mozilla.org/login-manager/loginInfo;1"].
|
||||
createInstance(Ci.nsILoginInfo);
|
||||
login.init("https://example.com", "https://example.com", null,
|
||||
"testuser", "testpass", "uname", "pword");
|
||||
Services.logins.addLogin(login);
|
||||
});
|
||||
}
|
||||
|
||||
async function checkUsagePrefs(hasEntry, lastUsed) {
|
||||
lastUsed = Math.floor(lastUsed);
|
||||
|
||||
let parentPrefs = runInParent(() => {
|
||||
addMessageListener("getPrefValues", () => {
|
||||
let prefValues = {};
|
||||
prefValues.hasEntry = Services.prefs.getBoolPref(
|
||||
"signon.usage.hasEntry",
|
||||
false
|
||||
);
|
||||
prefValues.lastUsed = Services.prefs.getIntPref(
|
||||
"signon.usage.lastUsed",
|
||||
0
|
||||
);
|
||||
sendAsyncMessage("prefValues", prefValues);
|
||||
});
|
||||
});
|
||||
|
||||
parentPrefs.sendAsyncMessage("getPrefValues");
|
||||
let prefValues = await new Promise((resolve) => {
|
||||
parentPrefs.addMessageListener("prefValues", (values) => {
|
||||
parentPrefs.removeMessageListener("prefValues");
|
||||
resolve(values);
|
||||
});
|
||||
})
|
||||
|
||||
info(JSON.stringify(prefValues));
|
||||
|
||||
is(
|
||||
prefValues.hasEntry,
|
||||
hasEntry,
|
||||
"hasEntry usage pref is " + hasEntry
|
||||
);
|
||||
ok(
|
||||
lastUsed - prefValues.lastUsed < 10,
|
||||
`lastUsed usage pref (${prefValues.lastUsed}) is within 10 seconds of ${lastUsed}`
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
runChecksAfterCommonInit(startTest);
|
||||
|
||||
/** Test for Login Manager: form fill, multiple forms. **/
|
||||
|
||||
async function startTest() {
|
||||
runInParent(() => {
|
||||
Services.prefs.clearUserPref("signon.usage.hasEntry");
|
||||
Services.prefs.clearUserPref("signon.usage.lastUsed");
|
||||
});
|
||||
|
||||
await checkUsagePrefs(false, 0);
|
||||
addLogin();
|
||||
await checkUsagePrefs(true, 0);
|
||||
|
||||
await setFormAndWaitForFieldFilled(`
|
||||
<form id="form1" action="/">
|
||||
<p>This is form 1.</p>
|
||||
<input type="text" name="uname">
|
||||
<input type="password" name="pword">
|
||||
|
||||
<button type="submit" name="submit">Submit</button>
|
||||
<button type="reset"> Reset </button>
|
||||
</form>`, {fieldSelector: `input[name="uname"]`, fieldValue: "testuser"});
|
||||
|
||||
is($_(1, "uname").value, "testuser", "Checking for filled username");
|
||||
is($_(1, "pword").value, "testpass", "Checking for filled password");
|
||||
$_(1, "submit").click();
|
||||
|
||||
await checkUsagePrefs(true, Date.now()/1000);
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
</script>
|
||||
|
||||
<p id="display"></p>
|
||||
|
||||
<div id="content" style="display: none">
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<pre id="test"></pre>
|
||||
</body>
|
||||
</html>
|
||||
|
Загрузка…
Ссылка в новой задаче