2012-01-24 10:13:41 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_dom_domerror_h__
|
|
|
|
#define mozilla_dom_domerror_h__
|
|
|
|
|
2013-05-18 17:52:06 +00:00
|
|
|
#include "mozilla/Attributes.h"
|
|
|
|
#include "nsWrapperCache.h"
|
2013-08-15 18:17:48 +00:00
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsString.h"
|
2013-08-23 05:17:11 +00:00
|
|
|
#include "nsPIDOMWindow.h"
|
2012-01-24 10:13:41 +00:00
|
|
|
|
2014-05-19 20:37:58 +00:00
|
|
|
#define DOMERROR_IID \
|
|
|
|
{ 0x220cb63f, 0xa37d, 0x4ba4, \
|
|
|
|
{ 0x8e, 0x31, 0xfc, 0xde, 0xec, 0x48, 0xe1, 0x66 } }
|
|
|
|
|
2012-01-24 10:13:41 +00:00
|
|
|
namespace mozilla {
|
2013-08-05 17:51:49 +00:00
|
|
|
|
|
|
|
class ErrorResult;
|
|
|
|
|
2012-01-24 10:13:41 +00:00
|
|
|
namespace dom {
|
|
|
|
|
2013-05-18 17:52:06 +00:00
|
|
|
class GlobalObject;
|
|
|
|
|
|
|
|
class DOMError : public nsISupports,
|
|
|
|
public nsWrapperCache
|
2012-01-24 10:13:41 +00:00
|
|
|
{
|
2013-05-18 17:52:06 +00:00
|
|
|
nsCOMPtr<nsPIDOMWindow> mWindow;
|
2012-01-24 10:13:41 +00:00
|
|
|
nsString mName;
|
2013-05-18 17:52:06 +00:00
|
|
|
nsString mMessage;
|
2012-01-24 10:13:41 +00:00
|
|
|
|
2014-06-23 19:56:07 +00:00
|
|
|
protected:
|
|
|
|
virtual ~DOMError();
|
|
|
|
|
2012-01-24 10:13:41 +00:00
|
|
|
public:
|
2013-05-18 17:52:06 +00:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMError)
|
|
|
|
|
2014-05-19 20:37:58 +00:00
|
|
|
NS_DECLARE_STATIC_IID_ACCESSOR(DOMERROR_IID)
|
|
|
|
|
2013-05-18 17:52:06 +00:00
|
|
|
// aWindow can be null if this DOMError is not associated with a particular
|
|
|
|
// window.
|
|
|
|
|
2014-08-05 13:19:51 +00:00
|
|
|
explicit DOMError(nsPIDOMWindow* aWindow);
|
2013-06-30 12:21:31 +00:00
|
|
|
|
2013-05-18 17:52:06 +00:00
|
|
|
DOMError(nsPIDOMWindow* aWindow, nsresult aValue);
|
2012-01-24 10:13:41 +00:00
|
|
|
|
2013-05-18 17:52:06 +00:00
|
|
|
DOMError(nsPIDOMWindow* aWindow, const nsAString& aName);
|
2012-04-11 21:55:21 +00:00
|
|
|
|
2013-05-18 17:52:06 +00:00
|
|
|
DOMError(nsPIDOMWindow* aWindow, const nsAString& aName,
|
|
|
|
const nsAString& aMessage);
|
|
|
|
|
|
|
|
nsPIDOMWindow* GetParentObject() const
|
2012-01-24 10:13:41 +00:00
|
|
|
{
|
2013-05-18 17:52:06 +00:00
|
|
|
return mWindow;
|
2012-01-24 10:13:41 +00:00
|
|
|
}
|
|
|
|
|
2013-05-18 17:52:06 +00:00
|
|
|
virtual JSObject*
|
2014-04-08 22:27:18 +00:00
|
|
|
WrapObject(JSContext* aCx) MOZ_OVERRIDE;
|
2013-05-18 17:52:06 +00:00
|
|
|
|
|
|
|
static already_AddRefed<DOMError>
|
|
|
|
Constructor(const GlobalObject& global, const nsAString& name,
|
|
|
|
const nsAString& message, ErrorResult& aRv);
|
2012-01-24 10:13:41 +00:00
|
|
|
|
2013-05-18 17:52:06 +00:00
|
|
|
void GetName(nsString& aRetval) const
|
|
|
|
{
|
|
|
|
aRetval = mName;
|
|
|
|
}
|
|
|
|
|
|
|
|
void GetMessage(nsString& aRetval) const
|
|
|
|
{
|
|
|
|
aRetval = mMessage;
|
|
|
|
}
|
2012-01-24 10:13:41 +00:00
|
|
|
};
|
|
|
|
|
2014-05-19 20:37:58 +00:00
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(DOMError, DOMERROR_IID)
|
|
|
|
|
2012-01-24 10:13:41 +00:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_dom_domerror_h__
|