michael@0: # This Source Code Form is subject to the terms of the Mozilla Public michael@0: # License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: # file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: michael@0: def test(mod, path, entity = None): michael@0: import re michael@0: # ignore anything but Firefox michael@0: if mod not in ("netwerk", "dom", "toolkit", "security/manager", michael@0: "browser", "browser/metro", "webapprt", michael@0: "extensions/reporter", "extensions/spellcheck", michael@0: "other-licenses/branding/firefox", michael@0: "browser/branding/official", michael@0: "services/sync"): michael@0: return "ignore" michael@0: if mod not in ("browser", "browser/metro", "extensions/spellcheck"): michael@0: # we only have exceptions for browser, metro and extensions/spellcheck michael@0: return "error" michael@0: if not entity: michael@0: # the only files to ignore are spell checkers and search michael@0: if mod == "extensions/spellcheck": michael@0: return "ignore" michael@0: # browser michael@0: return "ignore" if re.match(r"searchplugins\/.+\.xml", path) else "error" michael@0: if mod == "extensions/spellcheck": michael@0: # l10n ships en-US dictionary or something, do compare michael@0: return "error" michael@0: if path == "defines.inc": michael@0: return "ignore" if entity == "MOZ_LANGPACK_CONTRIBUTORS" else "error" michael@0: michael@0: if mod == "browser" and path == "chrome/browser-region/region.properties": michael@0: # only region.properties exceptions remain, compare all others michael@0: return ("ignore" michael@0: if (re.match(r"browser\.search\.order\.[1-9]", entity) or michael@0: re.match(r"browser\.contentHandlers\.types\.[0-5]", entity) or michael@0: re.match(r"gecko\.handlerService\.schemes\.", entity) or michael@0: re.match(r"gecko\.handlerService\.defaultHandlersVersion", entity)) michael@0: else "error") michael@0: if mod == "browser/metro" and path == "chrome/region.properties": michael@0: return ("ignore" michael@0: if re.match(r"browser\.search\.order\.[1-9]", entity) michael@0: else "error") michael@0: return "error"