author Garrett Robinson <>
Wed, 04 Jun 2014 15:24:38 -0700
changeset 186716 bf40eebc65434dd7030506fb1dd6f1e64f34418f
parent 146552 7dd0ddad04601d33a36d1ccc9d7740abcc642952
child 187185 1fcd38e5b8553af4d232767a3bf83a4fb4fa6c62
permissions -rwxr-xr-x
Bug 988616 - Split CSP tests for CSP (1.0) and X-CSP, and update build system files r=sstamm r=ckerschb

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at

def test(mod, path, entity = None):
  import re
  # ignore anything but Firefox
  if mod not in ("netwerk", "dom", "toolkit", "security/manager",
                 "browser", "browser/metro", "webapprt",
                 "extensions/reporter", "extensions/spellcheck",
    return "ignore"
  if mod not in ("browser", "browser/metro", "extensions/spellcheck"):
    # we only have exceptions for browser, metro and extensions/spellcheck
    return "error"
  if not entity:
    # the only files to ignore are spell checkers and search
    if mod == "extensions/spellcheck":
      return "ignore"
    # browser
    return "ignore" if re.match(r"searchplugins\/.+\.xml", path) else "error"
  if mod == "extensions/spellcheck":
    # l10n ships en-US dictionary or something, do compare
    return "error"
  if path == "":
    return "ignore" if entity == "MOZ_LANGPACK_CONTRIBUTORS" else "error"

  if mod == "browser" and path == "chrome/browser-region/":
    # only exceptions remain, compare all others
    return ("ignore"
            if (re.match(r"browser\.search\.order\.[1-9]", entity) or
                re.match(r"browser\.contentHandlers\.types\.[0-5]", entity) or
                re.match(r"gecko\.handlerService\.schemes\.", entity) or
                re.match(r"gecko\.handlerService\.defaultHandlersVersion", entity))
            else "error")
  if mod == "browser/metro" and path == "chrome/":
      return ("ignore"
              if re.match(r"browser\.search\.order\.[1-9]", entity)
              else "error")
  return "error"