diff --git a/tests/compat/test_tb19.py b/tests/compat/test_tb19.py new file mode 100644 index 000000000..ae75c16e4 --- /dev/null +++ b/tests/compat/test_tb19.py @@ -0,0 +1,27 @@ +from helper import CompatTestCase +from validator.compat import TB19_DEFINITION + + +class TestTB19Compat(CompatTestCase): + """Test that compatibility tests for Thunderbird 19 are properly executed.""" + + VERSION = TB19_DEFINITION + + def test_js_patterns(self): + """Test that these patterns are flagged in Thunderbird 19.""" + self.setUp() + self.run_regex_for_compat("var x = %s();" "enableEditableFields") + self.assert_compat_error(type_="notice") + + def test_nsIMsgCompFields_newshost(self): + for method in self.run_xpcom_for_compat( + "nsIMsgCompFields", ["newshost"]): + self.assert_silent() + self.assert_compat_error(type_="warning") + + def test_nsIMsgSearchAdapter_CurrentUrlDone(self): + for method in self.run_xpcom_for_compat( + "nsIMsgSearchAdapter", ["CurrentUrlDone"]): + self.assert_silent() + self.assert_compat_error(type_="warning") + diff --git a/tests/compat/test_tb20.py b/tests/compat/test_tb20.py new file mode 100644 index 000000000..51e6d4265 --- /dev/null +++ b/tests/compat/test_tb20.py @@ -0,0 +1,47 @@ +from helper import CompatTestCase +from validator.compat import TB20_DEFINITION + + +class TestTB20Compat(CompatTestCase): + """Test that compatibility tests for Thunderbird 20 are properly executed.""" + + VERSION = TB20_DEFINITION + + def test_js_patterns(self): + """Test that these patterns are flagged in Thunderbird 20.""" + self.setUp() + self.run_regex_for_compat("var x = %s();" "GetWindowByWindowType") + self.assert_compat_error(type_="notice") + + def test_nsIMsgAccount_identities(self): + for method in self.run_xpcom_for_compat( + "nsIMsgAccount", ["identities"]): + self.assert_silent() + self.assert_compat_error(type_="warning") + + def test_nsIMsgAccountManager(self): + for method in self.run_xpcom_for_compat( + "nsIMsgAccountManager", + ["allIdentities", "GetIdentitiesForServer", "accounts", + "GetServersForIdentity", "allServers"]): + self.assert_silent() + self.assert_compat_error(type_="warning") + + def test_nsIMsgFolder_getExpansionArray(self): + for method in self.run_xpcom_for_compat( + "nsIMsgFolder", ["getExpansionArray"]): + self.assert_silent() + self.assert_compat_error(type_="warning") + + def test_nsIMsgFilter(self): + for method in self.run_xpcom_for_compat( + "nsIMsgFilter", ["actionList", "getSortedActionList"]): + self.assert_silent() + self.assert_compat_error(type_="warning") + + def test_nsIMsgFilterService_applyFiltersToFolders(self): + for method in self.run_xpcom_for_compat( + "nsIMsgFilterService", ["applyFiltersToFolders"]): + self.assert_silent() + self.assert_compat_error(type_="warning") + diff --git a/validator/testcases/javascript/entity_values.py b/validator/testcases/javascript/entity_values.py index 7b63596ca..a7e1d361b 100644 --- a/validator/testcases/javascript/entity_values.py +++ b/validator/testcases/javascript/entity_values.py @@ -3,7 +3,8 @@ from validator.compat import (FX10_DEFINITION, FX14_DEFINITION, FX16_DEFINITION, FX19_DEFINITION, TB14_DEFINITION, TB15_DEFINITION, - TB16_DEFINITION, TB18_DEFINITION) + TB16_DEFINITION, TB18_DEFINITION, + TB19_DEFINITION, TB20_DEFINITION) from validator.constants import BUGZILLA_BUG @@ -34,7 +35,7 @@ def deprecated_entity(name, version, message, bug, status="deprecated", compat_type="error"): def wrap(traverser): traverser.err.warning( - err_id=("testcases_javascript_entity_values", name), + err_id=("js", "entities", name), warning="`%s` has been %s." % (name, status), description=[message, "See %s for more information." % BUGZILLA_BUG % bug], @@ -47,6 +48,15 @@ def wrap(traverser): tier=5) register_entity(name)(wrap) +def register_changed_entities(version_definition, entities, version_string): + for entity in entities: + deprecated_entity( + name=entity["name"], + version=version_definition, + message="The method or property `%s` has been `%s` in `%s`." + % (entity["name"], entity["status"], version_string), + bug=entity["bug"], + compat_type=entity["compat_type"]) DEP_IHF_MESSAGE = ("The `importHTMLFromFile` and `importHTMLFromURI` functions " "have been removed from the `nsIPlacesImportExportService` " @@ -350,3 +360,43 @@ def prplIAccount_noNewlines(traverser): for_appversions=TB18_DEFINITION, compatibility_type="error", tier=5) + +# Thunderbird 19 IDL changes +TB19_ENTITIES = [ + {"name":"nsIMsgCompFields.newshost", + "status": "changed", + "bug": 133605, + "compat_type": "error"}, + {"name": "nsIMsgSearchAdapter.CurrentUrlDone", + "status": "changed", + "bug": 801383, + "compat_type": "error"} +] +register_changed_entities(version_definition=TB19_DEFINITION, + entities=TB19_ENTITIES, version_string="Thunderbird 19") + +# Thunderbird 20 IDL changes +TB20_ENTITIES = [ + {"name": "nsIMsgAccount.identities", + "status": "changed", "bug": 820377, "compat_type": "error"}, + {"name": "nsIMsgAccountManager.allIdentities", + "status": "changed", "bug": 820377, "compat_type": "error"}, + {"name": "nsIMsgAccountManager.GetIdentitiesForServer", + "status": "changed", "bug": 820377, "compat_type": "error"}, + {"name": "nsIMsgAccountManager.accounts", + "status": "changed", "bug": 820377, "compat_type": "error"}, + {"name": "nsIMsgAccountManager.GetServersForIdentity", + "status": "changed", "bug": 820377, "compat_type": "error"}, + {"name": "nsIMsgAccountManager.allServers", + "status": "changed", "bug": 820377, "compat_type": "error"}, + {"name": "nsIMsgFolder.getExpansionArray", + "status": "removed", "bug": 821236, "compat_type": "error"}, + {"name": "nsIMsgFilter.getSortedActionList", + "status": "changed", "bug": 821253, "compat_type": "error"}, + {"name": "nsIMsgFilter.actionList", + "status": "removed", "bug": 821743, "compat_type": "error"}, + {"name": "nsIMsgFilterService.applyFiltersToFolders", + "status": "changed", "bug": 822131, "compat_type": "error"} +] +register_changed_entities(version_definition=TB20_DEFINITION, + entities=TB20_ENTITIES, version_string="Thunderbird 20") diff --git a/validator/testcases/javascript/predefinedentities.py b/validator/testcases/javascript/predefinedentities.py index 54188f20b..fe055f04d 100644 --- a/validator/testcases/javascript/predefinedentities.py +++ b/validator/testcases/javascript/predefinedentities.py @@ -142,8 +142,12 @@ entity("nsIMessenger.saveAttachmentToFolder")}}, u"nsIMsgAccountManager": {"value": - {u"folderUriForPath": - entity("nsIMsgAccountManager.folderUriForPath")}}, + {u"folderUriForPath": entity("nsIMsgAccountManager.folderUriForPath"), + u"allIdentities": entity("nsIMsgAccountManager.allIdentities"), + u"GetIdentitiesForServer": entity("nsIMsgAccountManager.GetIdentitiesForServer"), + u"accounts": entity("nsIMsgAccountManager.accounts"), + u"GetServersForIdentity": entity("nsIMsgAccountManager.GetServersForIdentity"), + u"allServers": entity("nsIMsgAccountManager.allServers")}}, u"nsIMsgLocalMailFolder": {"value": {u"addMessage": @@ -174,12 +178,14 @@ u"nsIMsgFilterService": {"value": {u"OpenFilterList": entity("nsIMsgFilterService.OpenFilterList"), - u"SaveFilterList": entity("nsIMsgFilterService.SaveFilterList")}}, + u"SaveFilterList": entity("nsIMsgFilterService.SaveFilterList"), + u"applyFiltersToFolders": entity("nsIMsgFilterService.applyFiltersToFolders")}}, u"nsIMsgFolder": {"value": {u"offlineStoreOutputStream": {"value": call_definitions.nsIMsgFolder_changed}, - u"filePath": entity("nsIMsgFolder.filePath")}}, + u"filePath": entity("nsIMsgFolder.filePath"), + u"getExpansionArray": entity("nsIMsgFolder.getExpansionArray")}}, u"nsIMsgIdentity": {"value": {u"signature": entity("nsIMsgIdentity.signature")}}, @@ -349,7 +355,20 @@ call_definitions.webbrowserpersist_saveuri}}}, u"prplIAccount": {"value": - {u"noNewlines": entity("prplIAccount.noNewlines")}} + {u"noNewlines": entity("prplIAccount.noNewlines")}}, + u"nsIMsgCompFields": + {"value": + {u"newshost": entity("nsIMsgCompFields.newshost")}}, + u"nsIMsgSearchAdapter": + {"value": + {u"CurrentUrlDone": entity("nsIMsgSearchAdapter.CurrentUrlDone")}}, + u"nsIMsgAccount": + {"value": + {u"identities": entity("nsIMsgAccount.identities")}}, + u"nsIMsgFilter": + {"value": + {u"getSortedActionList": entity("nsIMsgFilter.getSortedActionList"), + u"actionList": entity("nsIMsgFilter.actionList")}} } INTERFACE_ENTITIES = {u"nsIXMLHttpRequest": diff --git a/validator/testcases/regex.py b/validator/testcases/regex.py index 7e5f63b04..c60ae0813 100644 --- a/validator/testcases/regex.py +++ b/validator/testcases/regex.py @@ -10,7 +10,8 @@ FX20_DEFINITION, TB7_DEFINITION, TB10_DEFINITION, TB11_DEFINITION, TB12_DEFINITION, TB13_DEFINITION, TB14_DEFINITION, TB15_DEFINITION, TB16_DEFINITION, - TB17_DEFINITION, TB18_DEFINITION) + TB17_DEFINITION, TB18_DEFINITION, TB19_DEFINITION, + TB20_DEFINITION) from validator.contextgenerator import ContextGenerator from markup.csstester import UNPREFIXED_MESSAGE @@ -1328,3 +1329,113 @@ def tests(self): "been flagged as having changed, removed, or deprecated " "in Thunderbird 18." % pattern, compat_type="error", log_function=self.err.notice) + +@register_generator +class Thunderbird19RegexTests(CompatRegexTestHelper): + """Regex tests for the Thunderbird 19 update.""" + + VERSION = TB19_DEFINITION + + def tests(self): + """String and JS changes for Thunderbird add-ons""" + + # String changes for add-ons that use our localizations. + patterns = {r"contextDesc\.accesskey": 775665, + r"contextIncoming\.label": 775665, + r"contextBoth\.label": 775665, + r"contextPostPlugin\.label": 775665, + r"contextPostPluginBoth\.label": 775665, + r"checkNow\.label": 804001, + r"checkNow\.acesskey": 804001, + r"outputFormatMenu\.label": 339887, + r"deliveryFormatMenu\.accesskey": 339887, + r"12564": 801383, + r"mime_multipartSignedBlurb": 800877, + r"command\.mode": 812921, + r"message\.mode": 812921} + for pattern, bug in patterns.items(): + yield self.get_test_bug( + bug, pattern, + "Removed, renamed, or changed labels in use.", + "Some string matched the pattern `%s`, which has been " + "flagged as having changed in Thunderbird 19." % pattern, + compat_type="error") + + js_patterns = {r"toggleFilter": 783491, + r"gFilterContext": 775665, + r"determineFilterType": 775665, + r"KEY_ISP_DIRECTORY_LIST": 793599, + r"disableEditableFields": 271730, + r"enableEditableFields": 271730, + r"gSmtpHostNameIsIllegal": 80855, + r"hostnameIsIllegal": 80855, + r"gLastPurpleConvId": 812921} + + # Add restricting prefix for ( or word boundary to prevent substring matching. + js_patterns.update(dict(("(\b|\()" + k, v) for k, v in js_patterns.items())) + + for pattern, bug in js_patterns.items(): + yield self.get_test_bug( + bug, pattern, + "Removed, renamed, or changed methods in use.", + "A JavaScript function matched the pattern `%s`, which has " + "been flagged as having changed, removed, or deprecated " + "in Thunderbird 19." % pattern, + compat_type="error", log_function=self.err.notice) + +@register_generator +class Thunderbird20RegexTests(CompatRegexTestHelper): + """Regex tests for the Thunderbird 20 update.""" + + VERSION = TB20_DEFINITION + + def tests(self): + """String and JS changes for Thunderbird add-ons""" + + # String changes for add-ons that use our localizations. + patterns = {r"appmenuButton.tooltip": 812630, + r"decreaseFontSize.key": 813295, + r"decreaseFontSize.key2": 813295, + r"increaseFontSize.key": 813295, + r"increaseFontSize.key2": 813295, + r"serverNameEmpty": 327812, + r"confirmDeferAccount": 734034} + for pattern, bug in patterns.items(): + yield self.get_test_bug( + bug, pattern, + "Removed, renamed, or changed labels in use.", + "Some string matched the pattern `%s`, which has been " + "flagged as having changed in Thunderbird 20." % pattern, + compat_type="error") + + js_patterns = {r"gIdentity": 807101, + r"enabling": 807101, + r"cleanUpHostname": 327812, + r"gIOService": 794909, + r"gPromptService": 794909, + r"gIsOffline": 794909, + r"gIOService": 794909, + r"gPrefBranch": 795152, + r"GetWindowByWindowType": 795152, + r"specialTabs\.getApplicationUpgradeVersions": 795152, + r"specialTabs\.shouldShowTelemetryNotification": 795152, + r"specialTabs\.showTelemetryNotification": 795152, + r"specialTabs\.shouldShowAboutRightsNotification": 795152, + r"specialTabs\.showAboutRightsNotification": 795152, + r"FocusManager": 795152, + r"nsIWindowMediator": 795152, + r"nsIWindowWatcher": 795152, + r"gPrefs": 795152, + r"gAttachmentNotifier\.handleMutations": 823009} + + # Add restricting prefix for ( or word boundary to prevent substring matching. + js_patterns.update(dict(("(\b|\()" + k, v) for k, v in js_patterns.items())) + + for pattern, bug in js_patterns.items(): + yield self.get_test_bug( + bug, pattern, + "Removed, renamed, or changed methods in use.", + "A JavaScript function matched the pattern `%s`, which has " + "been flagged as having changed, removed, or deprecated " + "in Thunderbird 20." % pattern, + compat_type="error", log_function=self.err.notice)