1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include "SpeechRecognitionError.h"
11 SpeechRecognitionError::SpeechRecognitionError(
12 mozilla::dom::EventTarget
* aOwner
,
13 nsPresContext
* aPresContext
,
15 : Event(aOwner
, aPresContext
, aEvent
)
20 SpeechRecognitionError::~SpeechRecognitionError() {}
22 already_AddRefed
<SpeechRecognitionError
>
23 SpeechRecognitionError::Constructor(const GlobalObject
& aGlobal
,
24 const nsAString
& aType
,
25 const SpeechRecognitionErrorInit
& aParam
,
28 nsCOMPtr
<mozilla::dom::EventTarget
> t
= do_QueryInterface(aGlobal
.GetAsSupports());
29 nsRefPtr
<SpeechRecognitionError
> e
= new SpeechRecognitionError(t
, nullptr, nullptr);
30 bool trusted
= e
->Init(t
);
31 e
->InitSpeechRecognitionError(aType
, aParam
.mBubbles
, aParam
.mCancelable
, aParam
.mError
, aParam
.mMessage
, aRv
);
32 e
->SetTrusted(trusted
);
37 SpeechRecognitionError::InitSpeechRecognitionError(const nsAString
& aType
,
40 SpeechRecognitionErrorCode aError
,
41 const nsAString
& aMessage
,
44 aRv
= Event::InitEvent(aType
, aCanBubble
, aCancelable
);
45 NS_ENSURE_SUCCESS_VOID(aRv
.ErrorCode());
53 } // namespace mozilla