|
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 |
|
5 def test(mod, path, entity = None): |
|
6 import re |
|
7 # ignore anything but Firefox |
|
8 if mod not in ("netwerk", "dom", "toolkit", "security/manager", |
|
9 "browser", "browser/metro", "webapprt", |
|
10 "extensions/reporter", "extensions/spellcheck", |
|
11 "other-licenses/branding/firefox", |
|
12 "browser/branding/official", |
|
13 "services/sync"): |
|
14 return "ignore" |
|
15 if mod not in ("browser", "browser/metro", "extensions/spellcheck"): |
|
16 # we only have exceptions for browser, metro and extensions/spellcheck |
|
17 return "error" |
|
18 if not entity: |
|
19 # the only files to ignore are spell checkers and search |
|
20 if mod == "extensions/spellcheck": |
|
21 return "ignore" |
|
22 # browser |
|
23 return "ignore" if re.match(r"searchplugins\/.+\.xml", path) else "error" |
|
24 if mod == "extensions/spellcheck": |
|
25 # l10n ships en-US dictionary or something, do compare |
|
26 return "error" |
|
27 if path == "defines.inc": |
|
28 return "ignore" if entity == "MOZ_LANGPACK_CONTRIBUTORS" else "error" |
|
29 |
|
30 if mod == "browser" and path == "chrome/browser-region/region.properties": |
|
31 # only region.properties exceptions remain, compare all others |
|
32 return ("ignore" |
|
33 if (re.match(r"browser\.search\.order\.[1-9]", entity) or |
|
34 re.match(r"browser\.contentHandlers\.types\.[0-5]", entity) or |
|
35 re.match(r"gecko\.handlerService\.schemes\.", entity) or |
|
36 re.match(r"gecko\.handlerService\.defaultHandlersVersion", entity)) |
|
37 else "error") |
|
38 if mod == "browser/metro" and path == "chrome/region.properties": |
|
39 return ("ignore" |
|
40 if re.match(r"browser\.search\.order\.[1-9]", entity) |
|
41 else "error") |
|
42 return "error" |