Bumping gaia.json for 2 gaia revision(s) a=gaia-bump
[gecko.git] / dom / events / SpeechRecognitionError.cpp
blob75e5c3f00ef54d560eca2e888038994d96b08a00
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"
8 namespace mozilla {
9 namespace dom {
11 SpeechRecognitionError::SpeechRecognitionError(
12 mozilla::dom::EventTarget* aOwner,
13 nsPresContext* aPresContext,
14 WidgetEvent* aEvent)
15 : Event(aOwner, aPresContext, aEvent)
16 , mError()
20 SpeechRecognitionError::~SpeechRecognitionError() {}
22 already_AddRefed<SpeechRecognitionError>
23 SpeechRecognitionError::Constructor(const GlobalObject& aGlobal,
24 const nsAString& aType,
25 const SpeechRecognitionErrorInit& aParam,
26 ErrorResult& aRv)
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);
33 return e.forget();
36 void
37 SpeechRecognitionError::InitSpeechRecognitionError(const nsAString& aType,
38 bool aCanBubble,
39 bool aCancelable,
40 SpeechRecognitionErrorCode aError,
41 const nsAString& aMessage,
42 ErrorResult& aRv)
44 aRv = Event::InitEvent(aType, aCanBubble, aCancelable);
45 NS_ENSURE_SUCCESS_VOID(aRv.ErrorCode());
47 mError = aError;
48 mMessage = aMessage;
49 return;
52 } // namespace dom
53 } // namespace mozilla