Bumping manifests a=b2g-bump
[gecko.git] / dom / base / DOMError.h
blobca02d06ba03f79612b07b178080ad1dc18a117bf
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"
12 #include "nsCOMPtr.h"
13 #include "nsString.h"
14 #include "nsPIDOMWindow.h"
16 #define DOMERROR_IID \
17 { 0x220cb63f, 0xa37d, 0x4ba4, \
18 { 0x8e, 0x31, 0xfc, 0xde, 0xec, 0x48, 0xe1, 0x66 } }
20 namespace mozilla {
22 class ErrorResult;
24 namespace dom {
26 class GlobalObject;
28 class DOMError : public nsISupports,
29 public nsWrapperCache
31 nsCOMPtr<nsPIDOMWindow> mWindow;
32 nsString mName;
33 nsString mMessage;
35 protected:
36 virtual ~DOMError();
38 public:
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
45 // window.
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
58 return mWindow;
61 virtual JSObject*
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
70 aRetval = mName;
73 void GetMessage(nsString& aRetval) const
75 aRetval = mMessage;
78 void Init(const nsAString& aName, const nsAString& aMessage)
80 mName = aName;
81 mMessage = aMessage;
85 NS_DEFINE_STATIC_IID_ACCESSOR(DOMError, DOMERROR_IID)
87 } // namespace dom
88 } // namespace mozilla
90 #endif // mozilla_dom_domerror_h__