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 file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_domerror_h__
8 #define mozilla_dom_domerror_h__
10 #include "mozilla/Attributes.h"
11 #include "nsWrapperCache.h"
15 #define DOMERROR_IID \
17 0x220cb63f, 0xa37d, 0x4ba4, { \
18 0x8e, 0x31, 0xfc, 0xde, 0xec, 0x48, 0xe1, 0x66 \
22 class nsPIDOMWindowInner
;
32 class DOMError
: public nsISupports
, public nsWrapperCache
{
33 nsCOMPtr
<nsPIDOMWindowInner
> mWindow
;
41 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
42 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMError
)
44 NS_DECLARE_STATIC_IID_ACCESSOR(DOMERROR_IID
)
46 // aWindow can be null if this DOMError is not associated with a particular
49 explicit DOMError(nsPIDOMWindowInner
* aWindow
);
51 DOMError(nsPIDOMWindowInner
* aWindow
, nsresult aValue
);
53 DOMError(nsPIDOMWindowInner
* aWindow
, const nsAString
& aName
);
55 DOMError(nsPIDOMWindowInner
* aWindow
, const nsAString
& aName
,
56 const nsAString
& aMessage
);
58 nsPIDOMWindowInner
* GetParentObject() const { return mWindow
; }
60 virtual JSObject
* WrapObject(JSContext
* aCx
,
61 JS::Handle
<JSObject
*> aGivenProto
) override
;
63 static already_AddRefed
<DOMError
> Constructor(const GlobalObject
& global
,
64 const nsAString
& name
,
65 const nsAString
& message
,
68 void GetName(nsString
& aRetval
) const { aRetval
= mName
; }
70 void GetMessage(nsString
& aRetval
) const { aRetval
= mMessage
; }
73 NS_DEFINE_STATIC_IID_ACCESSOR(DOMError
, DOMERROR_IID
)
76 } // namespace mozilla
78 #endif // mozilla_dom_domerror_h__