зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1750466 - Stop adding default mailto: handlers in Thunderbird. r=mkaply
Differential Revision: https://phabricator.services.mozilla.com/D136291
This commit is contained in:
Родитель
8dd4b286bd
Коммит
dc79c103b5
|
@ -158,6 +158,11 @@ HandlerService.prototype = {
|
|||
// don't care what's already in the file, we just want to do the
|
||||
// equivalent of appending into the database. So let's just go do that:
|
||||
for (let scheme of Object.keys(localeHandlers.schemes)) {
|
||||
if (scheme == "mailto" && AppConstants.MOZ_APP_NAME == "thunderbird") {
|
||||
// Thunderbird IS a mailto handler, it doesn't need handlers added.
|
||||
continue;
|
||||
}
|
||||
|
||||
let existingSchemeInfo = this._store.data.schemes[scheme];
|
||||
if (!existingSchemeInfo) {
|
||||
// Haven't seen this scheme before. Default to asking which app the
|
||||
|
|
|
@ -155,7 +155,11 @@ function run_test() {
|
|||
// OS default exists, injected default exists, explicit warning pref: false
|
||||
prefSvc.setBoolPref(kExternalWarningPrefPrefix + "mailto", false);
|
||||
protoInfo = protoSvc.getProtocolHandlerInfo("mailto");
|
||||
if (AppConstants.MOZ_APP_NAME == "thunderbird") {
|
||||
Assert.equal(0, protoInfo.possibleApplicationHandlers.length);
|
||||
} else {
|
||||
Assert.equal(1, protoInfo.possibleApplicationHandlers.length);
|
||||
}
|
||||
|
||||
// Win7+ or Linux's GIO might not have a default mailto: handler
|
||||
if (noMailto) {
|
||||
|
@ -167,6 +171,9 @@ function run_test() {
|
|||
// OS default exists, injected default exists, explicit warning pref: true
|
||||
prefSvc.setBoolPref(kExternalWarningPrefPrefix + "mailto", true);
|
||||
protoInfo = protoSvc.getProtocolHandlerInfo("mailto");
|
||||
if (AppConstants.MOZ_APP_NAME == "thunderbird") {
|
||||
Assert.equal(0, protoInfo.possibleApplicationHandlers.length);
|
||||
} else {
|
||||
Assert.equal(1, protoInfo.possibleApplicationHandlers.length);
|
||||
// Win7+ or Linux's GIO may have no default mailto: handler, so we'd ask
|
||||
// anyway. Otherwise, the default handlers will not have stored preferred
|
||||
|
@ -176,7 +183,7 @@ function run_test() {
|
|||
Assert.ok(protoInfo.alwaysAskBeforeHandling);
|
||||
// As soon as anyone actually stores updated defaults into the profile
|
||||
// database, that default will stop tracking the warning pref.
|
||||
|
||||
}
|
||||
// Now set the value stored in RDF to true, and the pref to false, to make
|
||||
// sure we still get the right value. (Basically, same thing as above but
|
||||
// with the values reversed.)
|
||||
|
@ -184,8 +191,12 @@ function run_test() {
|
|||
protoInfo.alwaysAskBeforeHandling = true;
|
||||
handlerSvc.store(protoInfo);
|
||||
protoInfo = protoSvc.getProtocolHandlerInfo("mailto");
|
||||
if (AppConstants.MOZ_APP_NAME == "thunderbird") {
|
||||
Assert.equal(0, protoInfo.possibleApplicationHandlers.length);
|
||||
} else {
|
||||
Assert.equal(1, protoInfo.possibleApplicationHandlers.length);
|
||||
Assert.ok(protoInfo.alwaysAskBeforeHandling);
|
||||
}
|
||||
|
||||
//* *************************************************************************//
|
||||
// Test Round-Trip Data Integrity
|
||||
|
|
|
@ -595,7 +595,9 @@ function assertAllHandlerInfosMatchDefaultHandlers() {
|
|||
/**
|
||||
* Tests the default protocol handlers imported from the locale-specific data.
|
||||
*/
|
||||
add_task(async function test_default_protocol_handlers() {
|
||||
add_task(
|
||||
{ skip_if: () => AppConstants.MOZ_APP_NAME == "thunderbird" },
|
||||
async function test_default_protocol_handlers() {
|
||||
if (
|
||||
!Services.prefs.getPrefType("gecko.handlerService.defaultHandlersVersion")
|
||||
) {
|
||||
|
@ -607,13 +609,16 @@ add_task(async function test_default_protocol_handlers() {
|
|||
await deleteHandlerStore();
|
||||
|
||||
await assertAllHandlerInfosMatchDefaultHandlers();
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* Tests that the default protocol handlers are not imported again from the
|
||||
* locale-specific data if they already exist.
|
||||
*/
|
||||
add_task(async function test_default_protocol_handlers_no_duplicates() {
|
||||
add_task(
|
||||
{ skip_if: () => AppConstants.MOZ_APP_NAME == "thunderbird" },
|
||||
async function test_default_protocol_handlers_no_duplicates() {
|
||||
if (
|
||||
!Services.prefs.getPrefType("gecko.handlerService.defaultHandlersVersion")
|
||||
) {
|
||||
|
@ -631,7 +636,8 @@ add_task(async function test_default_protocol_handlers_no_duplicates() {
|
|||
|
||||
// There should be no duplicate handlers in the protocols.
|
||||
assertAllHandlerInfosMatchDefaultHandlers();
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* Ensures forward compatibility by checking that the "store" method preserves
|
||||
|
|
Загрузка…
Ссылка в новой задаче