dom/events/SpeechRecognitionError.cpp

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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