1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=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"
14 #include "nsPIDOMWindow.h"
16 #define DOMERROR_IID \
17 { 0x220cb63f, 0xa37d, 0x4ba4, \
18 { 0x8e, 0x31, 0xfc, 0xde, 0xec, 0x48, 0xe1, 0x66 } }
28 class DOMError
: public nsISupports
,
31 nsCOMPtr
<nsPIDOMWindow
> mWindow
;
39 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
40 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMError
)
42 NS_DECLARE_STATIC_IID_ACCESSOR(DOMERROR_IID
)
44 // aWindow can be null if this DOMError is not associated with a particular
47 explicit DOMError(nsPIDOMWindow
* aWindow
);
49 DOMError(nsPIDOMWindow
* aWindow
, nsresult aValue
);
51 DOMError(nsPIDOMWindow
* aWindow
, const nsAString
& aName
);
53 DOMError(nsPIDOMWindow
* aWindow
, const nsAString
& aName
,
54 const nsAString
& aMessage
);
56 nsPIDOMWindow
* GetParentObject() const
62 WrapObject(JSContext
* aCx
) MOZ_OVERRIDE
;
64 static already_AddRefed
<DOMError
>
65 Constructor(const GlobalObject
& global
, const nsAString
& name
,
66 const nsAString
& message
, ErrorResult
& aRv
);
68 void GetName(nsString
& aRetval
) const
73 void GetMessage(nsString
& aRetval
) const
78 void Init(const nsAString
& aName
, const nsAString
& aMessage
)
85 NS_DEFINE_STATIC_IID_ACCESSOR(DOMError
, DOMERROR_IID
)
88 } // namespace mozilla
90 #endif // mozilla_dom_domerror_h__