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/. */
6 :
7 : #ifndef mozilla_dom_domerror_h__
8 : #define mozilla_dom_domerror_h__
9 :
10 : #include "nsIDOMDOMError.h"
11 :
12 : #include "nsCOMPtr.h"
13 : #include "nsStringGlue.h"
14 :
15 : namespace mozilla {
16 : namespace dom {
17 :
18 : class DOMError : public nsIDOMDOMError
19 : {
20 : nsString mName;
21 :
22 : public:
23 : NS_DECL_ISUPPORTS
24 : NS_DECL_NSIDOMDOMERROR
25 :
26 : static already_AddRefed<nsIDOMDOMError>
27 : CreateForDOMExceptionCode(PRUint16 aDOMExceptionCode);
28 :
29 : static already_AddRefed<nsIDOMDOMError>
30 0 : CreateWithName(const nsAString& aName)
31 : {
32 0 : nsCOMPtr<nsIDOMDOMError> error = new DOMError(aName);
33 0 : return error.forget();
34 : }
35 :
36 : protected:
37 0 : DOMError(const nsAString& aName)
38 0 : : mName(aName)
39 0 : { }
40 :
41 0 : virtual ~DOMError()
42 0 : { }
43 : };
44 :
45 : } // namespace dom
46 : } // namespace mozilla
47 :
48 : #endif // mozilla_dom_domerror_h__
|