michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "SpeechRecognitionError.h" michael@0: michael@0: namespace mozilla { michael@0: namespace dom { michael@0: michael@0: SpeechRecognitionError::SpeechRecognitionError( michael@0: mozilla::dom::EventTarget* aOwner, michael@0: nsPresContext* aPresContext, michael@0: WidgetEvent* aEvent) michael@0: : Event(aOwner, aPresContext, aEvent) michael@0: , mError() michael@0: { michael@0: } michael@0: michael@0: SpeechRecognitionError::~SpeechRecognitionError() {} michael@0: michael@0: already_AddRefed michael@0: SpeechRecognitionError::Constructor(const GlobalObject& aGlobal, michael@0: const nsAString& aType, michael@0: const SpeechRecognitionErrorInit& aParam, michael@0: ErrorResult& aRv) michael@0: { michael@0: nsCOMPtr t = do_QueryInterface(aGlobal.GetAsSupports()); michael@0: nsRefPtr e = new SpeechRecognitionError(t, nullptr, nullptr); michael@0: bool trusted = e->Init(t); michael@0: e->InitSpeechRecognitionError(aType, aParam.mBubbles, aParam.mCancelable, aParam.mError, aParam.mMessage, aRv); michael@0: e->SetTrusted(trusted); michael@0: return e.forget(); michael@0: } michael@0: michael@0: void michael@0: SpeechRecognitionError::InitSpeechRecognitionError(const nsAString& aType, michael@0: bool aCanBubble, michael@0: bool aCancelable, michael@0: SpeechRecognitionErrorCode aError, michael@0: const nsAString& aMessage, michael@0: ErrorResult& aRv) michael@0: { michael@0: aRv = Event::InitEvent(aType, aCanBubble, aCancelable); michael@0: NS_ENSURE_SUCCESS_VOID(aRv.ErrorCode()); michael@0: michael@0: mError = aError; michael@0: mMessage = aMessage; michael@0: return; michael@0: } michael@0: michael@0: } // namespace dom michael@0: } // namespace mozilla