filter.py 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. # This Source Code Form is subject to the terms of the Mozilla Public
  2. # License, v. 2.0. If a copy of the MPL was not distributed with this
  3. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
  4. def test(mod, path, entity = None):
  5. import re
  6. # ignore anything but Firefox
  7. if mod not in ("netwerk", "dom", "toolkit", "security/manager",
  8. "browser", "browser/metro", "webapprt",
  9. "extensions/reporter", "extensions/spellcheck",
  10. "other-licenses/branding/firefox",
  11. "browser/branding/official",
  12. "services/sync"):
  13. return False
  14. if mod != "browser" and mod != "extensions/spellcheck":
  15. # we only have exceptions for browser and extensions/spellcheck
  16. return True
  17. if not entity:
  18. if mod == "extensions/spellcheck":
  19. return False
  20. # browser
  21. return not (re.match(r"searchplugins\/.+\.xml", path) or
  22. re.match(r"chrome\/help\/images\/[A-Za-z-_]+\.png", path))
  23. if mod == "extensions/spellcheck":
  24. # l10n ships en-US dictionary or something, do compare
  25. return True
  26. if path == "defines.inc":
  27. return entity != "MOZ_LANGPACK_CONTRIBUTORS"
  28. if path != "chrome/browser-region/region.properties":
  29. # only region.properties exceptions remain, compare all others
  30. return True
  31. return not (re.match(r"browser\.search\.order\.[1-9]", entity) or
  32. re.match(r"browser\.contentHandlers\.types\.[0-5]", entity) or
  33. re.match(r"goanna\.handlerService\.schemes\.", entity) or
  34. re.match(r"goanna\.handlerService\.defaultHandlersVersion", entity))