2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2013-06-26 04:08:58 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#include "SpeechRecognitionError.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2013-10-02 07:46:04 +04:00
|
|
|
SpeechRecognitionError::SpeechRecognitionError(
|
|
|
|
mozilla::dom::EventTarget* aOwner,
|
|
|
|
nsPresContext* aPresContext,
|
|
|
|
WidgetEvent* aEvent)
|
2014-03-05 04:37:43 +04:00
|
|
|
: Event(aOwner, aPresContext, aEvent)
|
|
|
|
, mError()
|
|
|
|
{
|
|
|
|
}
|
2013-06-26 04:08:58 +04:00
|
|
|
|
|
|
|
SpeechRecognitionError::~SpeechRecognitionError() {}
|
|
|
|
|
|
|
|
already_AddRefed<SpeechRecognitionError>
|
|
|
|
SpeechRecognitionError::Constructor(const GlobalObject& aGlobal,
|
|
|
|
const nsAString& aType,
|
|
|
|
const SpeechRecognitionErrorInit& aParam,
|
|
|
|
ErrorResult& aRv)
|
|
|
|
{
|
2013-08-23 09:17:08 +04:00
|
|
|
nsCOMPtr<mozilla::dom::EventTarget> t = do_QueryInterface(aGlobal.GetAsSupports());
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<SpeechRecognitionError> e = new SpeechRecognitionError(t, nullptr, nullptr);
|
2013-06-26 04:08:58 +04:00
|
|
|
bool trusted = e->Init(t);
|
2015-11-13 03:09:42 +03:00
|
|
|
e->InitSpeechRecognitionError(aType, aParam.mBubbles, aParam.mCancelable, aParam.mError, aParam.mMessage);
|
2013-06-26 04:08:58 +04:00
|
|
|
e->SetTrusted(trusted);
|
2016-08-31 06:16:11 +03:00
|
|
|
e->SetComposed(aParam.mComposed);
|
2013-06-26 04:08:58 +04:00
|
|
|
return e.forget();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SpeechRecognitionError::InitSpeechRecognitionError(const nsAString& aType,
|
|
|
|
bool aCanBubble,
|
|
|
|
bool aCancelable,
|
|
|
|
SpeechRecognitionErrorCode aError,
|
2015-11-13 03:09:42 +03:00
|
|
|
const nsAString& aMessage)
|
2013-06-26 04:08:58 +04:00
|
|
|
{
|
2015-11-13 03:09:42 +03:00
|
|
|
Event::InitEvent(aType, aCanBubble, aCancelable);
|
2013-06-26 04:08:58 +04:00
|
|
|
mError = aError;
|
|
|
|
mMessage = aMessage;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|