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