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 | /* vim:set ts=2 sw=2 et tw=78: */ |
michael@0 | 3 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | #include "mozilla/dom/TextTrackRegion.h" |
michael@0 | 8 | #include "mozilla/dom/VTTRegionBinding.h" |
michael@0 | 9 | |
michael@0 | 10 | namespace mozilla { |
michael@0 | 11 | namespace dom { |
michael@0 | 12 | |
michael@0 | 13 | NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(TextTrackRegion, mParent) |
michael@0 | 14 | NS_IMPL_CYCLE_COLLECTING_ADDREF(TextTrackRegion) |
michael@0 | 15 | NS_IMPL_CYCLE_COLLECTING_RELEASE(TextTrackRegion) |
michael@0 | 16 | NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TextTrackRegion) |
michael@0 | 17 | NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY |
michael@0 | 18 | NS_INTERFACE_MAP_ENTRY(nsISupports) |
michael@0 | 19 | NS_INTERFACE_MAP_END |
michael@0 | 20 | |
michael@0 | 21 | JSObject* |
michael@0 | 22 | TextTrackRegion::WrapObject(JSContext* aCx) |
michael@0 | 23 | { |
michael@0 | 24 | return VTTRegionBinding::Wrap(aCx, this); |
michael@0 | 25 | } |
michael@0 | 26 | |
michael@0 | 27 | already_AddRefed<TextTrackRegion> |
michael@0 | 28 | TextTrackRegion::Constructor(const GlobalObject& aGlobal, ErrorResult& aRv) |
michael@0 | 29 | { |
michael@0 | 30 | nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aGlobal.GetAsSupports()); |
michael@0 | 31 | if (!window) { |
michael@0 | 32 | aRv.Throw(NS_ERROR_FAILURE); |
michael@0 | 33 | return nullptr; |
michael@0 | 34 | } |
michael@0 | 35 | |
michael@0 | 36 | nsRefPtr<TextTrackRegion> region = new TextTrackRegion(aGlobal.GetAsSupports()); |
michael@0 | 37 | return region.forget(); |
michael@0 | 38 | } |
michael@0 | 39 | |
michael@0 | 40 | TextTrackRegion::TextTrackRegion(nsISupports* aGlobal) |
michael@0 | 41 | : mParent(aGlobal) |
michael@0 | 42 | , mWidth(100) |
michael@0 | 43 | , mLines(3) |
michael@0 | 44 | , mRegionAnchorX(0) |
michael@0 | 45 | , mRegionAnchorY(100) |
michael@0 | 46 | , mViewportAnchorX(0) |
michael@0 | 47 | , mViewportAnchorY(100) |
michael@0 | 48 | { |
michael@0 | 49 | SetIsDOMBinding(); |
michael@0 | 50 | } |
michael@0 | 51 | |
michael@0 | 52 | void |
michael@0 | 53 | TextTrackRegion::CopyValues(TextTrackRegion& aRegion) |
michael@0 | 54 | { |
michael@0 | 55 | mWidth = aRegion.Width(); |
michael@0 | 56 | mLines = aRegion.Lines(); |
michael@0 | 57 | mRegionAnchorX = aRegion.RegionAnchorX(); |
michael@0 | 58 | mRegionAnchorY = aRegion.RegionAnchorY(); |
michael@0 | 59 | mViewportAnchorX = aRegion.ViewportAnchorX(); |
michael@0 | 60 | mViewportAnchorY = aRegion.ViewportAnchorY(); |
michael@0 | 61 | mScroll = aRegion.Scroll(); |
michael@0 | 62 | } |
michael@0 | 63 | |
michael@0 | 64 | } //namespace dom |
michael@0 | 65 | } //namespace mozilla |
michael@0 | 66 |