2012-01-24 14:13:41 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2015-05-03 22:32:37 +03:00
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-01-24 14:13:41 +04: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 21:52:06 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
|
|
|
#include "nsWrapperCache.h"
|
2013-08-15 22:17:48 +04:00
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsString.h"
|
2012-01-24 14:13:41 +04:00
|
|
|
|
2014-05-20 00:37:58 +04:00
|
|
|
#define DOMERROR_IID \
|
2018-11-30 13:46:48 +03:00
|
|
|
{ \
|
2014-05-20 00:37:58 +04:00
|
|
|
0x220cb63f, 0xa37d, 0x4ba4, { \
|
|
|
|
0x8e, 0x31, 0xfc, 0xde, 0xec, 0x48, 0xe1, 0x66 \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
2016-01-30 20:05:36 +03:00
|
|
|
class nsPIDOMWindowInner;
|
|
|
|
|
2012-01-24 14:13:41 +04:00
|
|
|
namespace mozilla {
|
2013-08-05 21:51:49 +04:00
|
|
|
|
|
|
|
class ErrorResult;
|
|
|
|
|
2012-01-24 14:13:41 +04:00
|
|
|
namespace dom {
|
|
|
|
|
2013-05-18 21:52:06 +04:00
|
|
|
class GlobalObject;
|
|
|
|
|
|
|
|
class DOMError : public nsISupports, public nsWrapperCache {
|
2016-01-30 20:05:36 +03:00
|
|
|
nsCOMPtr<nsPIDOMWindowInner> mWindow;
|
2012-01-24 14:13:41 +04:00
|
|
|
nsString mName;
|
2013-05-18 21:52:06 +04:00
|
|
|
nsString mMessage;
|
2012-01-24 14:13:41 +04:00
|
|
|
|
2014-06-23 23:56:07 +04:00
|
|
|
protected:
|
|
|
|
virtual ~DOMError();
|
|
|
|
|
2012-01-24 14:13:41 +04:00
|
|
|
public:
|
2013-05-18 21:52:06 +04:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMError)
|
|
|
|
|
2014-05-20 00:37:58 +04:00
|
|
|
NS_DECLARE_STATIC_IID_ACCESSOR(DOMERROR_IID)
|
|
|
|
|
2013-05-18 21:52:06 +04:00
|
|
|
// aWindow can be null if this DOMError is not associated with a particular
|
|
|
|
// window.
|
|
|
|
|
2016-01-30 20:05:36 +03:00
|
|
|
explicit DOMError(nsPIDOMWindowInner* aWindow);
|
2013-06-30 16:21:31 +04:00
|
|
|
|
2016-01-30 20:05:36 +03:00
|
|
|
DOMError(nsPIDOMWindowInner* aWindow, nsresult aValue);
|
2012-01-24 14:13:41 +04:00
|
|
|
|
2016-01-30 20:05:36 +03:00
|
|
|
DOMError(nsPIDOMWindowInner* aWindow, const nsAString& aName);
|
2012-04-12 01:55:21 +04:00
|
|
|
|
2016-01-30 20:05:36 +03:00
|
|
|
DOMError(nsPIDOMWindowInner* aWindow, const nsAString& aName,
|
2013-05-18 21:52:06 +04:00
|
|
|
const nsAString& aMessage);
|
|
|
|
|
2016-01-30 20:05:36 +03:00
|
|
|
nsPIDOMWindowInner* GetParentObject() const { return mWindow; }
|
2012-01-24 14:13:41 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual JSObject* WrapObject(JSContext* aCx,
|
|
|
|
JS::Handle<JSObject*> aGivenProto) override;
|
2013-05-18 21:52:06 +04:00
|
|
|
|
|
|
|
static already_AddRefed<DOMError> Constructor(const GlobalObject& global,
|
|
|
|
const nsAString& name,
|
|
|
|
const nsAString& message,
|
|
|
|
ErrorResult& aRv);
|
2012-01-24 14:13:41 +04:00
|
|
|
|
2013-05-18 21:52:06 +04:00
|
|
|
void GetName(nsString& aRetval) const { aRetval = mName; }
|
|
|
|
|
|
|
|
void GetMessage(nsString& aRetval) const { aRetval = mMessage; }
|
2012-01-24 14:13:41 +04:00
|
|
|
};
|
|
|
|
|
2014-05-20 00:37:58 +04:00
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(DOMError, DOMERROR_IID)
|
|
|
|
|
2012-01-24 14:13:41 +04:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_dom_domerror_h__
|