Thu, 15 Jan 2015 15:59:08 +0100
Implement a real Private Browsing Mode condition by changing the API/ABI;
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 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "ScriptedNotificationObserver.h"
8 #include "imgIScriptedNotificationObserver.h"
9 #include "nsCycleCollectionParticipant.h"
11 using namespace mozilla::image;
13 NS_IMPL_CYCLE_COLLECTION(ScriptedNotificationObserver, mInner)
15 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ScriptedNotificationObserver)
16 NS_INTERFACE_MAP_ENTRY(imgINotificationObserver)
17 NS_INTERFACE_MAP_ENTRY(nsISupports)
18 NS_INTERFACE_MAP_END
20 NS_IMPL_CYCLE_COLLECTING_ADDREF(ScriptedNotificationObserver)
21 NS_IMPL_CYCLE_COLLECTING_RELEASE(ScriptedNotificationObserver)
23 ScriptedNotificationObserver::ScriptedNotificationObserver(
24 imgIScriptedNotificationObserver* aInner)
25 : mInner(aInner)
26 {
27 }
29 NS_IMETHODIMP
30 ScriptedNotificationObserver::Notify(imgIRequest* aRequest,
31 int32_t aType,
32 const nsIntRect* /*aUnused*/)
33 {
34 if (aType == imgINotificationObserver::SIZE_AVAILABLE)
35 return mInner->SizeAvailable(aRequest);
36 if (aType == imgINotificationObserver::FRAME_UPDATE)
37 return mInner->FrameUpdate(aRequest);
38 if (aType == imgINotificationObserver::FRAME_COMPLETE)
39 return mInner->FrameComplete(aRequest);
40 if (aType == imgINotificationObserver::DECODE_COMPLETE)
41 return mInner->DecodeComplete(aRequest);
42 if (aType == imgINotificationObserver::LOAD_COMPLETE)
43 return mInner->LoadComplete(aRequest);
44 if (aType == imgINotificationObserver::DISCARD)
45 return mInner->Discard(aRequest);
46 if (aType == imgINotificationObserver::IS_ANIMATED)
47 return mInner->IsAnimated(aRequest);
48 return NS_OK;
49 }