dom/events/SpeechRecognitionError.cpp

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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()
    17 {
    18 }
    20 SpeechRecognitionError::~SpeechRecognitionError() {}
    22 already_AddRefed<SpeechRecognitionError>
    23 SpeechRecognitionError::Constructor(const GlobalObject& aGlobal,
    24                                     const nsAString& aType,
    25                                     const SpeechRecognitionErrorInit& aParam,
    26                                     ErrorResult& aRv)
    27 {
    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();
    34 }
    36 void
    37 SpeechRecognitionError::InitSpeechRecognitionError(const nsAString& aType,
    38                                                    bool aCanBubble,
    39                                                    bool aCancelable,
    40                                                    SpeechRecognitionErrorCode aError,
    41                                                    const nsAString& aMessage,
    42                                                    ErrorResult& aRv)
    43 {
    44   aRv = Event::InitEvent(aType, aCanBubble, aCancelable);
    45   NS_ENSURE_SUCCESS_VOID(aRv.ErrorCode());
    47   mError = aError;
    48   mMessage = aMessage;
    49   return;
    50 }
    52 } // namespace dom
    53 } // namespace mozilla

mercurial