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 | #ifndef mozilla_MutationEvent_h__ |
michael@0 | 7 | #define mozilla_MutationEvent_h__ |
michael@0 | 8 | |
michael@0 | 9 | #include "mozilla/BasicEvents.h" |
michael@0 | 10 | #include "nsCOMPtr.h" |
michael@0 | 11 | #include "nsIAtom.h" |
michael@0 | 12 | #include "nsIDOMNode.h" |
michael@0 | 13 | |
michael@0 | 14 | namespace mozilla { |
michael@0 | 15 | |
michael@0 | 16 | class InternalMutationEvent : public WidgetEvent |
michael@0 | 17 | { |
michael@0 | 18 | public: |
michael@0 | 19 | virtual InternalMutationEvent* AsMutationEvent() MOZ_OVERRIDE { return this; } |
michael@0 | 20 | |
michael@0 | 21 | InternalMutationEvent(bool aIsTrusted, uint32_t aMessage) : |
michael@0 | 22 | WidgetEvent(aIsTrusted, aMessage, NS_MUTATION_EVENT), |
michael@0 | 23 | mAttrChange(0) |
michael@0 | 24 | { |
michael@0 | 25 | mFlags.mCancelable = false; |
michael@0 | 26 | } |
michael@0 | 27 | |
michael@0 | 28 | virtual WidgetEvent* Duplicate() const MOZ_OVERRIDE |
michael@0 | 29 | { |
michael@0 | 30 | MOZ_ASSERT(eventStructType == NS_MUTATION_EVENT, |
michael@0 | 31 | "Duplicate() must be overridden by sub class"); |
michael@0 | 32 | InternalMutationEvent* result = new InternalMutationEvent(false, message); |
michael@0 | 33 | result->AssignMutationEventData(*this, true); |
michael@0 | 34 | result->mFlags = mFlags; |
michael@0 | 35 | return result; |
michael@0 | 36 | } |
michael@0 | 37 | |
michael@0 | 38 | nsCOMPtr<nsIDOMNode> mRelatedNode; |
michael@0 | 39 | nsCOMPtr<nsIAtom> mAttrName; |
michael@0 | 40 | nsCOMPtr<nsIAtom> mPrevAttrValue; |
michael@0 | 41 | nsCOMPtr<nsIAtom> mNewAttrValue; |
michael@0 | 42 | unsigned short mAttrChange; |
michael@0 | 43 | |
michael@0 | 44 | void AssignMutationEventData(const InternalMutationEvent& aEvent, |
michael@0 | 45 | bool aCopyTargets) |
michael@0 | 46 | { |
michael@0 | 47 | AssignEventData(aEvent, aCopyTargets); |
michael@0 | 48 | |
michael@0 | 49 | mRelatedNode = aEvent.mRelatedNode; |
michael@0 | 50 | mAttrName = aEvent.mAttrName; |
michael@0 | 51 | mPrevAttrValue = aEvent.mPrevAttrValue; |
michael@0 | 52 | mNewAttrValue = aEvent.mNewAttrValue; |
michael@0 | 53 | mAttrChange = aEvent.mAttrChange; |
michael@0 | 54 | } |
michael@0 | 55 | }; |
michael@0 | 56 | |
michael@0 | 57 | // Bits are actually checked to optimize mutation event firing. |
michael@0 | 58 | // That's why I don't number from 0x00. The first event should |
michael@0 | 59 | // always be 0x01. |
michael@0 | 60 | #define NS_EVENT_BITS_MUTATION_SUBTREEMODIFIED 0x01 |
michael@0 | 61 | #define NS_EVENT_BITS_MUTATION_NODEINSERTED 0x02 |
michael@0 | 62 | #define NS_EVENT_BITS_MUTATION_NODEREMOVED 0x04 |
michael@0 | 63 | #define NS_EVENT_BITS_MUTATION_NODEREMOVEDFROMDOCUMENT 0x08 |
michael@0 | 64 | #define NS_EVENT_BITS_MUTATION_NODEINSERTEDINTODOCUMENT 0x10 |
michael@0 | 65 | #define NS_EVENT_BITS_MUTATION_ATTRMODIFIED 0x20 |
michael@0 | 66 | #define NS_EVENT_BITS_MUTATION_CHARACTERDATAMODIFIED 0x40 |
michael@0 | 67 | |
michael@0 | 68 | } // namespace mozilla |
michael@0 | 69 | |
michael@0 | 70 | #endif // mozilla_MutationEvent_h__ |