2012-01-24 10:13:41 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2015-05-03 19:32:37 +00:00
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-01-24 10:13:41 +00:00
|
|
|
/* 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"
|
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 } }
|
|
|
|
|
2016-01-30 17:05:36 +00:00
|
|
|
class nsPIDOMWindowInner;
|
|
|
|
|
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
|
|
|
{
|
2016-01-30 17:05:36 +00:00
|
|
|
nsCOMPtr<nsPIDOMWindowInner> 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.
|
|
|
|
|
2016-01-30 17:05:36 +00:00
|
|
|
explicit DOMError(nsPIDOMWindowInner* aWindow);
|
2013-06-30 12:21:31 +00:00
|
|
|
|
2016-01-30 17:05:36 +00:00
|
|
|
DOMError(nsPIDOMWindowInner* aWindow, nsresult aValue);
|
2012-01-24 10:13:41 +00:00
|
|
|
|
2016-01-30 17:05:36 +00:00
|
|
|
DOMError(nsPIDOMWindowInner* aWindow, const nsAString& aName);
|
2012-04-11 21:55:21 +00:00
|
|
|
|
2016-01-30 17:05:36 +00:00
|
|
|
DOMError(nsPIDOMWindowInner* aWindow, const nsAString& aName,
|
2013-05-18 17:52:06 +00:00
|
|
|
const nsAString& aMessage);
|
|
|
|
|
2016-01-30 17:05:36 +00:00
|
|
|
nsPIDOMWindowInner* 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*
|
2015-03-21 16:28:04 +00:00
|
|
|
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) 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__
|