mobile/locales/filter.py

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

michael@0 1 # This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 # License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
michael@0 4
michael@0 5 """This routine controls which localizable files and entries are
michael@0 6 reported and l10n-merged.
michael@0 7 This needs to stay in sync with the copy in mobile/android/locales.
michael@0 8 """
michael@0 9
michael@0 10 def test(mod, path, entity = None):
michael@0 11 import re
michael@0 12 # ignore anything but mobile, which is our local repo checkout name
michael@0 13 if mod not in ("netwerk", "dom", "toolkit", "security/manager",
michael@0 14 "services/sync", "mobile",
michael@0 15 "mobile/android/base", "mobile/android"):
michael@0 16 return "ignore"
michael@0 17
michael@0 18 if mod not in ("mobile", "mobile/android"):
michael@0 19 # we only have exceptions for mobile*
michael@0 20 return "error"
michael@0 21 if mod == "mobile/android":
michael@0 22 if not entity:
michael@0 23 if (re.match(r"mobile-l10n.js", path) or
michael@0 24 re.match(r"defines.inc", path)):
michael@0 25 return "ignore"
michael@0 26 if path == "defines.inc":
michael@0 27 if entity == "MOZ_LANGPACK_CONTRIBUTORS":
michael@0 28 return "ignore"
michael@0 29 return "error"
michael@0 30
michael@0 31 # we're in mod == "mobile"
michael@0 32 if re.match(r"searchplugins\/.+\.xml", path):
michael@0 33 return "ignore"
michael@0 34 if path == "chrome/region.properties":
michael@0 35 # only region.properties exceptions remain
michael@0 36 if (re.match(r"browser\.search\.order\.[1-9]", entity) or
michael@0 37 re.match(r"browser\.contentHandlers\.types\.[0-5]", entity) or
michael@0 38 re.match(r"gecko\.handlerService\.schemes\.", entity) or
michael@0 39 re.match(r"gecko\.handlerService\.defaultHandlersVersion", entity)):
michael@0 40 return "ignore"
michael@0 41
michael@0 42 return "error"

mercurial