Tue, 06 Jan 2015 21:39:09 +0100
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.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 /* atom list for CSS anonymous boxes */
8 #include "mozilla/ArrayUtils.h"
10 #include "nsCSSAnonBoxes.h"
11 #include "nsAtomListUtils.h"
12 #include "nsStaticAtom.h"
14 using namespace mozilla;
16 // define storage for all atoms
17 #define CSS_ANON_BOX(_name, _value) \
18 nsICSSAnonBoxPseudo* nsCSSAnonBoxes::_name;
19 #include "nsCSSAnonBoxList.h"
20 #undef CSS_ANON_BOX
22 #define CSS_ANON_BOX(name_, value_) \
23 NS_STATIC_ATOM_BUFFER(name_##_buffer, value_)
24 #include "nsCSSAnonBoxList.h"
25 #undef CSS_ANON_BOX
27 static const nsStaticAtom CSSAnonBoxes_info[] = {
28 #define CSS_ANON_BOX(name_, value_) \
29 NS_STATIC_ATOM(name_##_buffer, (nsIAtom**)&nsCSSAnonBoxes::name_),
30 #include "nsCSSAnonBoxList.h"
31 #undef CSS_ANON_BOX
32 };
34 void nsCSSAnonBoxes::AddRefAtoms()
35 {
36 NS_RegisterStaticAtoms(CSSAnonBoxes_info);
37 }
39 bool nsCSSAnonBoxes::IsAnonBox(nsIAtom *aAtom)
40 {
41 return nsAtomListUtils::IsMember(aAtom, CSSAnonBoxes_info,
42 ArrayLength(CSSAnonBoxes_info));
43 }
45 #ifdef MOZ_XUL
46 /* static */ bool
47 nsCSSAnonBoxes::IsTreePseudoElement(nsIAtom* aPseudo)
48 {
49 return StringBeginsWith(nsDependentAtomString(aPseudo),
50 NS_LITERAL_STRING(":-moz-tree-"));
51 }
52 #endif