diff --git a/uriloader/exthandler/HandlerService.js b/uriloader/exthandler/HandlerService.js index c7263d7aa9da..54ce5eecc4ce 100644 --- a/uriloader/exthandler/HandlerService.js +++ b/uriloader/exthandler/HandlerService.js @@ -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 diff --git a/uriloader/exthandler/tests/unit/test_handlerService.js b/uriloader/exthandler/tests/unit/test_handlerService.js index c6450219ed72..4edb4900563b 100644 --- a/uriloader/exthandler/tests/unit/test_handlerService.js +++ b/uriloader/exthandler/tests/unit/test_handlerService.js @@ -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"); - Assert.equal(1, protoInfo.possibleApplicationHandlers.length); + 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,16 +171,19 @@ function run_test() { // OS default exists, injected default exists, explicit warning pref: true prefSvc.setBoolPref(kExternalWarningPrefPrefix + "mailto", true); protoInfo = protoSvc.getProtocolHandlerInfo("mailto"); - 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 - // actions etc., so re-requesting them after the warning pref has changed - // will use the updated pref value. So both when we have and do not have - // a default mailto: handler, we'll ask: - Assert.ok(protoInfo.alwaysAskBeforeHandling); - // As soon as anyone actually stores updated defaults into the profile - // database, that default will stop tracking the warning pref. - + 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 + // actions etc., so re-requesting them after the warning pref has changed + // will use the updated pref value. So both when we have and do not have + // a default mailto: handler, we'll ask: + 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"); - Assert.equal(1, protoInfo.possibleApplicationHandlers.length); - Assert.ok(protoInfo.alwaysAskBeforeHandling); + 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 diff --git a/uriloader/exthandler/tests/unit/test_handlerService_store.js b/uriloader/exthandler/tests/unit/test_handlerService_store.js index f9d6e8d90d43..d3f4e2818d00 100644 --- a/uriloader/exthandler/tests/unit/test_handlerService_store.js +++ b/uriloader/exthandler/tests/unit/test_handlerService_store.js @@ -595,43 +595,49 @@ function assertAllHandlerInfosMatchDefaultHandlers() { /** * Tests the default protocol handlers imported from the locale-specific data. */ -add_task(async function test_default_protocol_handlers() { - if ( - !Services.prefs.getPrefType("gecko.handlerService.defaultHandlersVersion") - ) { - info("This platform or locale does not have default handlers."); - return; +add_task( + { skip_if: () => AppConstants.MOZ_APP_NAME == "thunderbird" }, + async function test_default_protocol_handlers() { + if ( + !Services.prefs.getPrefType("gecko.handlerService.defaultHandlersVersion") + ) { + info("This platform or locale does not have default handlers."); + return; + } + + // This will inject the default protocol handlers for the current locale. + await deleteHandlerStore(); + + await assertAllHandlerInfosMatchDefaultHandlers(); } - - // This will inject the default protocol handlers for the current locale. - 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() { - if ( - !Services.prefs.getPrefType("gecko.handlerService.defaultHandlersVersion") - ) { - info("This platform or locale does not have default handlers."); - return; +add_task( + { skip_if: () => AppConstants.MOZ_APP_NAME == "thunderbird" }, + async function test_default_protocol_handlers_no_duplicates() { + if ( + !Services.prefs.getPrefType("gecko.handlerService.defaultHandlersVersion") + ) { + info("This platform or locale does not have default handlers."); + return; + } + + // This will inject the default protocol handlers for the current locale. + await deleteHandlerStore(); + + // Clear the preference to force injecting again. + Services.prefs.clearUserPref("gecko.handlerService.defaultHandlersVersion"); + + await unloadHandlerStore(); + + // There should be no duplicate handlers in the protocols. + assertAllHandlerInfosMatchDefaultHandlers(); } - - // This will inject the default protocol handlers for the current locale. - await deleteHandlerStore(); - - // Clear the preference to force injecting again. - Services.prefs.clearUserPref("gecko.handlerService.defaultHandlersVersion"); - - await unloadHandlerStore(); - - // There should be no duplicate handlers in the protocols. - assertAllHandlerInfosMatchDefaultHandlers(); -}); +); /** * Ensures forward compatibility by checking that the "store" method preserves