Skip to content
This repository
Browse code

Added compatibility tests for Thunderbird 18 (Bug 850029)

  • Loading branch information...
commit 551b4f9017c827078050e9c63929330045e7084d 1 parent 318b2fb
wagnerand wagnerand authored
23 tests/compat/test_tb18.py
... ... @@ -0,0 +1,23 @@
  1 +from helper import CompatTestCase
  2 +from validator.compat import TB18_DEFINITION
  3 +
  4 +
  5 +class TestTB18Compat(CompatTestCase):
  6 + """Test that compatibility tests for Thunderbird 18 are properly executed."""
  7 +
  8 + VERSION = TB18_DEFINITION
  9 +
  10 + def test_js_patterns(self):
  11 + """Test that these js patterns are flagged in Thunderbird 18."""
  12 + def test_pattern(self, pattern):
  13 + self.setUp()
  14 + self.run_regex_for_compat("var x = %s();" % pattern)
  15 + self.assert_compat_error(type_="notice")
  16 +
  17 + yield test_pattern, self, "queryISupportsArray"
  18 +
  19 + def test_prplIAccount_noNewlines(self):
  20 + for method in self.run_xpcom_for_compat(
  21 + "prplIAccount", ["noNewlines"]):
  22 + self.assert_silent()
  23 + self.assert_compat_error(type_="notice")
2  validator/compat.py
@@ -63,3 +63,5 @@ def _build_definition(maj_version_num, firefox=True, fennec=True,
63 63 TB18_DEFINITION = _build_definition(18, firefox=False, fennec=False)
64 64 TB19_DEFINITION = _build_definition(19, firefox=False, fennec=False)
65 65 TB20_DEFINITION = _build_definition(20, firefox=False, fennec=False)
  66 +TB21_DEFINITION = _build_definition(21, firefox=False, fennec=False)
  67 +TB22_DEFINITION = _build_definition(22, firefox=False, fennec=False)
19 validator/testcases/javascript/entity_values.py
@@ -3,7 +3,7 @@
3 3 from validator.compat import (FX10_DEFINITION, FX14_DEFINITION,
4 4 FX16_DEFINITION, FX19_DEFINITION,
5 5 TB14_DEFINITION, TB15_DEFINITION,
6   - TB16_DEFINITION)
  6 + TB16_DEFINITION, TB18_DEFINITION)
7 7 from validator.constants import BUGZILLA_BUG
8 8
9 9
@@ -333,3 +333,20 @@ def nsIImportMail_ImportMailbox(traverser):
333 333 message="This attribute has been changed from `nsILocalFile` to "
334 334 "`nsIFile`",
335 335 bug=749930)
  336 +
  337 +# Thunderbird 18 IDL changes
  338 +@register_entity("prplIAccount.noNewlines")
  339 +def prplIAccount_noNewlines(traverser):
  340 + traverser.err.notice(
  341 + err_id=("testcases_javascript_entity_values",
  342 + "prplIAccount_noNewlines"),
  343 + notice="Altered `prplIAccount.noNewlines` method in use.",
  344 + description="This add-on uses the `prplIAccount.noNewlines` property "
  345 + "which has been removed in `%s`." % BUGZILLA_BUG % 799068,
  346 + filename=traverser.filename,
  347 + line=traverser.line,
  348 + column=traverser.position,
  349 + context=traverser.context,
  350 + for_appversions=TB18_DEFINITION,
  351 + compatibility_type="error",
  352 + tier=5)
3  validator/testcases/javascript/predefinedentities.py
@@ -347,6 +347,9 @@
347 347 {u"saveURI":
348 348 {"return":
349 349 call_definitions.webbrowserpersist_saveuri}}},
  350 + u"prplIAccount":
  351 + {"value":
  352 + {u"noNewlines": entity("prplIAccount.noNewlines")}}
350 353 }
351 354
352 355 INTERFACE_ENTITIES = {u"nsIXMLHttpRequest":
53 validator/testcases/regex.py
@@ -10,7 +10,7 @@
10 10 FX20_DEFINITION, TB7_DEFINITION, TB10_DEFINITION,
11 11 TB11_DEFINITION, TB12_DEFINITION, TB13_DEFINITION,
12 12 TB14_DEFINITION, TB15_DEFINITION, TB16_DEFINITION,
13   - TB17_DEFINITION)
  13 + TB17_DEFINITION, TB18_DEFINITION)
14 14 from validator.contextgenerator import ContextGenerator
15 15 from markup.csstester import UNPREFIXED_MESSAGE
16 16
@@ -1277,3 +1277,54 @@ def tests(self):
1277 1277 "been flagged as having changed, removed, or deprecated "
1278 1278 "in Thunderbird 17." % pattern,
1279 1279 compat_type="error", log_function=self.err.notice)
  1280 +
  1281 +@register_generator
  1282 +class Thunderbird18RegexTests(CompatRegexTestHelper):
  1283 + """Regex tests for the Thunderbird 18 update."""
  1284 +
  1285 + VERSION = TB18_DEFINITION
  1286 +
  1287 + def tests(self):
  1288 + """String and JS changes for Thunderbird add-ons"""
  1289 +
  1290 + # String changes for add-ons that use our localizations.
  1291 + patterns = {r"fullZoomEnlargeCmd\.label": 738194,
  1292 + r"fullZoomReduceCmd\.label": 738194,
  1293 + r"fullZoomResetCmd\.label": 738194,
  1294 + r"fullZoomToggleCmd\.label": 738194,
  1295 + r"identitiesListDesc\.label": 314806,
  1296 + r"connection\.error\.certError": 792046,
  1297 + r"command\.wallops": 799068,
  1298 + r"searchTermsInvalidMessage": 561762,
  1299 + r"alreadyDefaultClientTitle": 595723,
  1300 + r"alreadyDefault": 595723,
  1301 + r"directoryUsedByOtherAccount": 577775}
  1302 + for pattern, bug in patterns.items():
  1303 + yield self.get_test_bug(
  1304 + bug, pattern,
  1305 + "Removed, renamed, or changed labels in use.",
  1306 + "Some string matched the pattern `%s`, which has been "
  1307 + "flagged as having changed in Thunderbird 18." % pattern,
  1308 + compat_type="error")
  1309 +
  1310 + js_patterns = {r"initContactList": 775105,
  1311 + r"ircChannel\.prototype\.setMode": 799068,
  1312 + r"SetUpToolbarButtons": 785980,
  1313 + r"queryISupportsArray": 679696,
  1314 + r"gAttachmentNotifier\.EditAction": 792979,
  1315 + r"accountManagerContractID": 776705,
  1316 + r"updateMoveTargetMode": 725488,
  1317 + r"updatePurgeSpam": 725488,
  1318 + r"gServer": 577775}
  1319 +
  1320 + # Add restricting prefix for ( or word boundary to prevent substring matching.
  1321 + js_patterns.update(dict(("(\b|\()" + k, v) for k, v in js_patterns.items()))
  1322 +
  1323 + for pattern, bug in js_patterns.items():
  1324 + yield self.get_test_bug(
  1325 + bug, pattern,
  1326 + "Removed, renamed, or changed methods in use.",
  1327 + "A JavaScript function matched the pattern `%s`, which has "
  1328 + "been flagged as having changed, removed, or deprecated "
  1329 + "in Thunderbird 18." % pattern,
  1330 + compat_type="error", log_function=self.err.notice)

0 comments on commit 551b4f9

Please sign in to comment.
Something went wrong with that request. Please try again.