1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_MediaError_h
8 #define mozilla_dom_MediaError_h
10 #include "mozilla/dom/HTMLMediaElement.h"
11 #include "nsWrapperCache.h"
12 #include "nsISupports.h"
13 #include "mozilla/Attributes.h"
15 namespace mozilla::dom
{
17 class MediaError final
: public nsISupports
, public nsWrapperCache
{
18 ~MediaError() = default;
21 MediaError(HTMLMediaElement
* aParent
, uint16_t aCode
,
22 const nsACString
& aMessage
= nsCString());
25 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
26 NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(MediaError
)
28 HTMLMediaElement
* GetParentObject() const { return mParent
; }
30 virtual JSObject
* WrapObject(JSContext
* aCx
,
31 JS::Handle
<JSObject
*> aGivenProto
) override
;
33 uint16_t Code() const { return mCode
; }
35 void GetMessage(nsAString
& aResult
) const;
38 RefPtr
<HTMLMediaElement
> mParent
;
43 const nsCString mMessage
;
46 } // namespace mozilla::dom
48 #endif // mozilla_dom_MediaError_h