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 /* vim:set ts=2 sw=2 sts=2 et cindent: */
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 "SpeechRecognitionAlternative.h"
9 #include "mozilla/dom/SpeechRecognitionAlternativeBinding.h"
11 #include "SpeechRecognition.h"
13 namespace mozilla {
14 namespace dom {
16 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(SpeechRecognitionAlternative, mParent)
17 NS_IMPL_CYCLE_COLLECTING_ADDREF(SpeechRecognitionAlternative)
18 NS_IMPL_CYCLE_COLLECTING_RELEASE(SpeechRecognitionAlternative)
19 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(SpeechRecognitionAlternative)
20 NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
21 NS_INTERFACE_MAP_ENTRY(nsISupports)
22 NS_INTERFACE_MAP_END
24 SpeechRecognitionAlternative::SpeechRecognitionAlternative(SpeechRecognition* aParent)
25 : mTranscript(NS_LITERAL_STRING(""))
26 , mConfidence(0)
27 , mParent(aParent)
28 {
29 SetIsDOMBinding();
30 }
32 SpeechRecognitionAlternative::~SpeechRecognitionAlternative()
33 {
34 }
36 JSObject*
37 SpeechRecognitionAlternative::WrapObject(JSContext* aCx)
38 {
39 return SpeechRecognitionAlternativeBinding::Wrap(aCx, this);
40 }
42 nsISupports*
43 SpeechRecognitionAlternative::GetParentObject() const
44 {
45 return static_cast<DOMEventTargetHelper*>(mParent.get());
46 }
48 void
49 SpeechRecognitionAlternative::GetTranscript(nsString& aRetVal) const
50 {
51 aRetVal = mTranscript;
52 }
54 float
55 SpeechRecognitionAlternative::Confidence() const
56 {
57 return mConfidence;
58 }
59 } // namespace dom
60 } // namespace mozilla