Sat, 03 Jan 2015 20:18:00 +0100
Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.
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/.
5 # Taken from Paver's paver.options module.
7 class Bunch(dict):
8 """A dictionary that provides attribute-style access."""
10 def __repr__(self):
11 keys = self.keys()
12 keys.sort()
13 args = ', '.join(['%s=%r' % (key, self[key]) for key in keys])
14 return '%s(%s)' % (self.__class__.__name__, args)
16 def __getitem__(self, key):
17 item = dict.__getitem__(self, key)
18 if callable(item):
19 return item()
20 return item
22 def __getattr__(self, name):
23 try:
24 return self[name]
25 except KeyError:
26 raise AttributeError(name)
28 __setattr__ = dict.__setitem__
30 def __delattr__(self, name):
31 try:
32 del self[name]
33 except KeyError:
34 raise AttributeError(name)