Bug 1229664. Drop the concept of inner exceptions from Exception/DOMException. r=bholley

This commit is contained in:
Boris Zbarsky 2015-12-02 13:52:59 -05:00
parent 11ce2e743d
commit 6f0cb4f884
5 changed files with 5 additions and 53 deletions

View File

@ -177,7 +177,6 @@ NS_IMPL_CYCLE_COLLECTION_CLASS(Exception)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Exception)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mLocation)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mInner)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
@ -188,7 +187,6 @@ NS_IMPL_CYCLE_COLLECTION_TRACE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(Exception)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mLocation)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mInner)
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
tmp->mThrownJSVal.setNull();
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
@ -248,7 +246,7 @@ Exception::Exception(const nsACString& aMessage,
}
}
Initialize(aMessage, aResult, aName, location, aData, nullptr);
Initialize(aMessage, aResult, aName, location, aData);
}
Exception::Exception()
@ -399,17 +397,6 @@ Exception::GetData(nsISupports** aData)
return NS_OK;
}
NS_IMETHODIMP
Exception::GetInner(nsIException** aException)
{
NS_ENSURE_ARG_POINTER(aException);
NS_ENSURE_TRUE(mInitialized, NS_ERROR_NOT_INITIALIZED);
nsCOMPtr<nsIException> inner = mInner;
inner.forget(aException);
return NS_OK;
}
NS_IMETHODIMP
Exception::ToString(nsACString& _retval)
{
@ -454,7 +441,7 @@ Exception::ToString(nsACString& _retval)
NS_IMETHODIMP
Exception::Initialize(const nsACString& aMessage, nsresult aResult,
const nsACString& aName, nsIStackFrame *aLocation,
nsISupports *aData, nsIException *aInner)
nsISupports *aData)
{
NS_ENSURE_FALSE(mInitialized, NS_ERROR_ALREADY_INITIALIZED);
@ -474,7 +461,6 @@ Exception::Initialize(const nsACString& aMessage, nsresult aResult,
}
mData = aData;
mInner = aInner;
mInitialized = true;
return NS_OK;
@ -543,13 +529,6 @@ Exception::GetLocation() const
return location.forget();
}
already_AddRefed<nsISupports>
Exception::GetInner() const
{
nsCOMPtr<nsIException> inner = mInner;
return inner.forget();
}
already_AddRefed<nsISupports>
Exception::GetData() const
{
@ -623,25 +602,6 @@ DOMException::ToString(nsACString& aReturn)
nsAutoCString location;
if (mInner) {
nsString filename;
mInner->GetFilename(filename);
if (!filename.IsEmpty()) {
uint32_t line_nr = 0;
mInner->GetLineNumber(&line_nr);
char *temp = PR_smprintf("%s Line: %d",
NS_ConvertUTF16toUTF8(filename).get(),
line_nr);
if (temp) {
location.Assign(temp);
PR_smprintf_free(temp);
}
}
}
if (location.IsEmpty()) {
location = defaultLocation;
}

View File

@ -84,8 +84,6 @@ public:
already_AddRefed<nsIStackFrame> GetLocation() const;
already_AddRefed<nsISupports> GetInner() const;
already_AddRefed<nsISupports> GetData() const;
void GetStack(nsAString& aStack, ErrorResult& aRv) const;
@ -111,7 +109,6 @@ protected:
nsCOMPtr<nsISupports> mData;
nsString mFilename;
int mLineNumber;
nsCOMPtr<nsIException> mInner;
bool mInitialized;
bool mHoldingJSVal;

View File

@ -52,8 +52,6 @@ interface ExceptionMembers
// this was only ever usefully available to chrome JS.
[ChromeOnly, Exposed=Window]
readonly attribute StackFrame? location;
// An inner exception that triggered this, if available.
readonly attribute nsISupports? inner;
// Arbitary data for the implementation.
[Exposed=Window]

View File

@ -7,7 +7,7 @@
#include "nsISupports.idl"
#include "nsIException.idl"
[scriptable, uuid(dd250248-2586-4ec1-a68f-8d14ef452517)]
[scriptable, uuid(875e6645-e762-4da6-9ec8-bf19ab0050df)]
interface nsIXPCException : nsIException
{
// inherits methods from nsIException
@ -16,8 +16,7 @@ interface nsIXPCException : nsIException
in nsresult aResult,
in AUTF8String aName,
in nsIStackFrame aLocation,
in nsISupports aData,
in nsIException aInner);
in nsISupports aData);
};
/* this goes into the C++ header verbatim. */

View File

@ -38,7 +38,7 @@ interface nsIStackFrame : nsISupports
AUTF8String toString();
};
[scriptable, uuid(1caf1461-be1d-4b79-a552-5292b6bf3c35)]
[scriptable, uuid(4371b5bf-6845-487f-8d9d-3f1e4a9badd2)]
interface nsIException : nsISupports
{
// A custom message set by the thrower.
@ -65,8 +65,6 @@ interface nsIException : nsISupports
// A stack trace, if available.
readonly attribute nsIStackFrame location;
// An inner exception that triggered this, if available.
readonly attribute nsIException inner;
// Arbitary data for the implementation.
readonly attribute nsISupports data;