Files
palemoon27/dom/base/DOMException.h
T
roytam1 34074a23ec import changes from `dev' branch of rmottola/Arctic-Fox:
- missing of Bug 1130096 - Convert embedding/components/windowwatcher/ to Gecko style (883cc280e)
- Bug 1114299 - Pass window features up from the content process via nsCString. r=smaug (017de6dc8)
- Bug 1114299 - Be more strict about which window chromeFlags we compute from content. r=smaug (71e9f4959)
- Bug 1159034 - Only fake no-alpha for the backbuffer. - r=kamidphish (2bc4bcf14)
- Bug 1184786 - Fix LastColorAttachment(). r=jgilber (b320f23de)
- Bug 1184786 - Fix ReadBuffer parameter validation. r=jgilber (7c6fac544)
-  Bug 1151736 - More information to pick up with crash reports. r=jgilbert (cd26cb6cb)
- Bug 1151736 - Lose context on OOM instead of crashing. r=jgilbert (904e2d98a)
- Bug 1176153. Have binding code grab the array buffer view type for ArrayBufferView arguments, so consumers don't have to manually use JSAPI to do it. Use the new setup in WebGL code. r=smau (3a93669ee)
- Bug 1182347 - Implement OriginAttributesPattern. r=sicking,f=allstars.chh (10eb6487c)
- Bug 922212 - Add console.dirxml. r=bgrins, r=mrbkap (85ebd7e39)
- Bug 1176341 - De-holder nsIXPConnect::CreateSandbox. r=baku,gabor (d27b571d5)
- Bug 1156005 - Mark the nsIAtom members of NodeInfo::NodeInfoInner as MOZ_NON_OWNING_REF; r=baku (3c17318c4)
- Bug 1156006 - Mark NodeInfo::mDocument as MOZ_NON_OWNING_REF; r=baku (67ad08801)
- Bug 1169129 - Make DOMException::Create(nsresult, nsCString) accept nsACString. r=bholley (22e2f4e5e)
- Bug 1156099 - Mark the atom members of NodeInfo as nsCOMPtr's; r=baku (83dca3dde)
- Bug 1176757 - Throw a DataCloneError when attempting to invoke 'cloneNode' on a 'ShadowRoot' and associated mochitest. r=wchen (decac1493)
- Bug 1169044 - Patch 6 - Update web-platform-tests expected data. r=jgraham (def441a11)
- Bug 1169044 - Patch 7 - Set mObserver in URLSearchParams. a=bustage. (80bd7a589)
- Bug 1181259 Remove stray debugging printf from Cache API. r=froydnj (8b030de0a)
- Bug 1173439 P1 Store URLs as UTF8 strings in Cache instead of UTF16. r=ehsan (ad3120be5)
- Bug 1180765 - Bump the caches.sqlite version numbers because of the field that was added in bug 1169044; r=jdm (c40b57eab)
- Bug 1173439 P2 Parse Response URL query as a separate field. r=ehsan (3b5c9641b)
- Bug 1173439 P3 Use url query field for database matching and Request creation. r=ehsan (18969bd6c)
- Bug 1173439 P4 Remove Request url field from Cache API database. r=ehsan (00e45614d)
- Bug 1173439 P5 Cache should index on a hash instead of the url itself. r=ehsan (eafb8d1a1)
- Bug 1177916 - URLSearchParams::GetParentObject should not return nullptr, r=smaug (c44513ab6)
- Bug 1177916 - URL should be a nsWrapperCache object, r=smaug (67c3f7221)
- Bug 1121773 - Conditionally include SiteSpecificUserAgent files on mobile/android. (37db816f1)
2022-01-10 09:23:54 +08:00

178 lines
4.3 KiB
C++

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=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_DOMException_h__
#define mozilla_dom_DOMException_h__
// We intentionally shadow non-virtual methods, but gcc gets confused.
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Woverloaded-virtual"
#endif
#include <stdint.h>
#include "jspubtd.h"
#include "js/GCAPI.h"
#include "nsCOMPtr.h"
#include "nsCycleCollectionParticipant.h"
#include "nsID.h"
#include "nsIDOMDOMException.h"
#include "nsWrapperCache.h"
#include "xpcexception.h"
#include "nsString.h"
#include "mozilla/dom/BindingDeclarations.h"
class nsIStackFrame;
class nsString;
nsresult
NS_GetNameAndMessageForDOMNSResult(nsresult aNSResult, nsACString& aName,
nsACString& aMessage,
uint16_t* aCode = nullptr);
namespace mozilla {
class ErrorResult;
namespace dom {
class GlobalObject;
#define MOZILLA_EXCEPTION_IID \
{ 0x55eda557, 0xeba0, 0x4fe3, \
{ 0xae, 0x2e, 0xf3, 0x94, 0x49, 0x23, 0x62, 0xd6 } }
class Exception : public nsIXPCException,
public nsWrapperCache
{
public:
NS_DECLARE_STATIC_IID_ACCESSOR(MOZILLA_EXCEPTION_IID)
NS_DEFINE_STATIC_CID_ACCESSOR(NS_XPCEXCEPTION_CID)
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Exception)
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_NSIEXCEPTION
NS_DECL_NSIXPCEXCEPTION
// Cruft used by XPConnect for exceptions originating in JS implemented
// components.
bool StealJSVal(JS::Value* aVp);
void StowJSVal(JS::Value& aVp);
// WebIDL API
virtual JSObject* WrapObject(JSContext* cx, JS::Handle<JSObject*> aGivenProto)
override;
nsISupports* GetParentObject() const { return nullptr; }
void GetMessageMoz(nsString& retval);
uint32_t Result() const;
void GetName(nsString& retval);
// The XPCOM GetFilename does the right thing. It might throw, but we want to
// return an empty filename in that case anyway, instead of throwing.
uint32_t LineNumber() const;
uint32_t ColumnNumber() const;
already_AddRefed<nsIStackFrame> GetLocation() const;
already_AddRefed<nsISupports> GetData() const;
void GetStack(nsAString& aStack, ErrorResult& aRv) const;
void Stringify(nsString& retval);
// XPCOM factory ctor.
Exception();
Exception(const nsACString& aMessage,
nsresult aResult,
const nsACString& aName,
nsIStackFrame *aLocation,
nsISupports *aData);
protected:
virtual ~Exception();
nsCString mMessage;
nsresult mResult;
nsCString mName;
nsCOMPtr<nsIStackFrame> mLocation;
nsCOMPtr<nsISupports> mData;
nsString mFilename;
int mLineNumber;
bool mInitialized;
bool mHoldingJSVal;
JS::Heap<JS::Value> mThrownJSVal;
private:
static bool sEverMadeOneFromFactory;
};
NS_DEFINE_STATIC_IID_ACCESSOR(Exception, MOZILLA_EXCEPTION_IID)
class DOMException : public Exception,
public nsIDOMDOMException
{
public:
DOMException(nsresult aRv, const nsACString& aMessage,
const nsACString& aName, uint16_t aCode);
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIDOMDOMEXCEPTION
// nsIException overrides
NS_IMETHOD ToString(nsACString& aReturn) override;
// nsWrapperCache overrides
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
override;
static already_AddRefed<DOMException>
Constructor(GlobalObject& /* unused */,
const nsAString& aMessage,
const Optional<nsAString>& aName,
ErrorResult& aError);
uint16_t Code() const {
return mCode;
}
// Intentionally shadow the nsXPCException version.
void GetMessageMoz(nsString& retval);
void GetName(nsString& retval);
static already_AddRefed<DOMException>
Create(nsresult aRv);
static already_AddRefed<DOMException>
Create(nsresult aRv, const nsACString& aMessage);
protected:
virtual ~DOMException() {}
nsCString mName;
nsCString mMessage;
uint16_t mCode;
};
} // namespace dom
} // namespace mozilla
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
#endif