author | Narcis Beleuzu <nbeleuzu@mozilla.com> |
Thu, 21 Nov 2019 03:22:06 +0200 | |
changeset 503130 | 141a109d768ea9f8208538e759d1c3cf4b7e2395 |
parent 503129 | 5caface7b2afcb648443a82ca9f4146b9da1d672 |
child 503131 | a4f6e5d0f3308339e566b116f5aee6faf2be1853 |
push id | 101135 |
push user | nbeleuzu@mozilla.com |
push date | Thu, 21 Nov 2019 01:23:00 +0000 |
treeherder | autoland@141a109d768e [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
bugs | 1595656 |
milestone | 72.0a1 |
backs out | 061c92c4b95c161ed9baedbb84aa27e2b0a99028 ef8d5090979a392b69500f0a43402d42a2fea529 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/browser/components/extensions/parent/ext-browsingData.js +++ b/browser/components/extensions/parent/ext-browsingData.js @@ -1,29 +1,45 @@ /* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */ /* vim: set sts=2 sw=2 et tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ "use strict"; -var { XPCOMUtils } = ChromeUtils.import( - "resource://gre/modules/XPCOMUtils.jsm" +var { PlacesUtils } = ChromeUtils.import( + "resource://gre/modules/PlacesUtils.jsm" ); -XPCOMUtils.defineLazyModuleGetters(this, { - LoginHelper: "resource://gre/modules/LoginHelper.jsm", - PlacesUtils: "resource://gre/modules/PlacesUtils.jsm", - Preferences: "resource://gre/modules/Preferences.jsm", - Sanitizer: "resource:///modules/Sanitizer.jsm", - Services: "resource://gre/modules/Services.jsm", - setTimeout: "resource://gre/modules/Timer.jsm", - ServiceWorkerCleanUp: "resource://gre/modules/ServiceWorkerCleanUp.jsm", -}); +ChromeUtils.defineModuleGetter( + this, + "Preferences", + "resource://gre/modules/Preferences.jsm" +); +ChromeUtils.defineModuleGetter( + this, + "Sanitizer", + "resource:///modules/Sanitizer.jsm" +); +ChromeUtils.defineModuleGetter( + this, + "Services", + "resource://gre/modules/Services.jsm" +); +ChromeUtils.defineModuleGetter( + this, + "setTimeout", + "resource://gre/modules/Timer.jsm" +); +ChromeUtils.defineModuleGetter( + this, + "ServiceWorkerCleanUp", + "resource://gre/modules/ServiceWorkerCleanUp.jsm" +); XPCOMUtils.defineLazyServiceGetter( this, "quotaManagerService", "@mozilla.org/dom/quota-manager-service;1", "nsIQuotaManagerService" ); @@ -210,27 +226,34 @@ const clearLocalStorage = async function }); }); return Promise.all(promises); } }; const clearPasswords = async function(options) { + let loginManager = Services.logins; let yieldCounter = 0; - // Iterate through the logins and delete any updated after our cutoff. - for (let login of await LoginHelper.getAllUserFacingLogins()) { - login.QueryInterface(Ci.nsILoginMetaInfo); - if (!options.since || login.timePasswordChanged >= options.since) { - Services.logins.removeLogin(login); - if (++yieldCounter % YIELD_PERIOD == 0) { - await new Promise(resolve => setTimeout(resolve, 0)); // Don't block the main thread too long. + if (options.since) { + // Iterate through the logins and delete any updated after our cutoff. + let logins = loginManager.getAllLogins(); + for (let login of logins) { + login.QueryInterface(Ci.nsILoginMetaInfo); + if (login.timePasswordChanged >= options.since) { + loginManager.removeLogin(login); + if (++yieldCounter % YIELD_PERIOD == 0) { + await new Promise(resolve => setTimeout(resolve, 0)); // Don't block the main thread too long. + } } } + } else { + // Remove everything. + loginManager.removeAllLogins(); } }; const clearPluginData = options => { return Sanitizer.items.pluginData.clear(makeRange(options)); }; const doRemoval = (options, dataToRemove, extension) => {
--- a/browser/components/extensions/test/xpcshell/test_ext_browsingData_passwords.js +++ b/browser/components/extensions/test/xpcshell/test_ext_browsingData_passwords.js @@ -7,44 +7,52 @@ XPCOMUtils.defineLazyServiceGetter( "loginManager", "@mozilla.org/login-manager;1", "nsILoginManager" ); const REFERENCE_DATE = Date.now(); const LOGIN_USERNAME = "username"; const LOGIN_PASSWORD = "password"; +const LOGIN_USERNAME_FIELD = "username_field"; +const LOGIN_PASSWORD_FIELD = "password_field"; const OLD_HOST = "http://mozilla.org"; const NEW_HOST = "http://mozilla.com"; -const FXA_HOST = "chrome://FirefoxAccounts"; function checkLoginExists(host, shouldExist) { let logins = loginManager.findLogins(host, "", null); equal( logins.length, shouldExist ? 1 : 0, `Login was ${shouldExist ? "" : "not "} found.` ); } function addLogin(host, timestamp) { checkLoginExists(host, false); let login = Cc["@mozilla.org/login-manager/loginInfo;1"].createInstance( Ci.nsILoginInfo ); - login.init(host, "", null, LOGIN_USERNAME, LOGIN_PASSWORD); + login.init( + host, + "", + null, + LOGIN_USERNAME, + LOGIN_PASSWORD, + LOGIN_USERNAME_FIELD, + LOGIN_PASSWORD_FIELD + ); login.QueryInterface(Ci.nsILoginMetaInfo); login.timePasswordChanged = timestamp; loginManager.addLogin(login); checkLoginExists(host, true); } async function setupPasswords() { loginManager.removeAllLogins(); - addLogin(FXA_HOST, REFERENCE_DATE); addLogin(NEW_HOST, REFERENCE_DATE); addLogin(OLD_HOST, REFERENCE_DATE - 10000); } add_task(async function testPasswords() { function background() { browser.test.onMessage.addListener(async (msg, options) => { if (msg == "removeHistory") { @@ -66,35 +74,32 @@ add_task(async function testPasswords() async function testRemovalMethod(method) { // Clear passwords with no since value. await setupPasswords(); extension.sendMessage(method, {}); await extension.awaitMessage("passwordsRemoved"); checkLoginExists(OLD_HOST, false); checkLoginExists(NEW_HOST, false); - checkLoginExists(FXA_HOST, true); // Clear passwords with recent since value. await setupPasswords(); extension.sendMessage(method, { since: REFERENCE_DATE - 1000 }); await extension.awaitMessage("passwordsRemoved"); checkLoginExists(OLD_HOST, true); checkLoginExists(NEW_HOST, false); - checkLoginExists(FXA_HOST, true); // Clear passwords with old since value. await setupPasswords(); extension.sendMessage(method, { since: REFERENCE_DATE - 20000 }); await extension.awaitMessage("passwordsRemoved"); checkLoginExists(OLD_HOST, false); checkLoginExists(NEW_HOST, false); - checkLoginExists(FXA_HOST, true); } await extension.startup(); await testRemovalMethod("removePasswords"); await testRemovalMethod("remove"); await extension.unload();
--- a/toolkit/components/passwordmgr/LoginHelper.jsm +++ b/toolkit/components/passwordmgr/LoginHelper.jsm @@ -1100,17 +1100,17 @@ this.LoginHelper = { Services.obs.notifyObservers( dataObject, "passwordmgr-storage-changed", changeType ); }, isUserFacingLogin(login) { - return login.origin != "chrome://FirefoxAccounts"; // FXA_PWDMGR_HOST + return !login.origin.startsWith("chrome://"); }, async getAllUserFacingLogins() { try { let logins = await Services.logins.getAllLoginsAsync(); return logins.filter(this.isUserFacingLogin); } catch (e) { if (e.result == Cr.NS_ERROR_ABORT) {