зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1257919 part 3. Make the various toString methods on exceptions take an explicit JSContext. r=khuey
This commit is contained in:
Родитель
44088b97d0
Коммит
12ede800fa
|
@ -400,7 +400,7 @@ Exception::GetData(nsISupports** aData)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
Exception::ToString(nsACString& _retval)
|
||||
Exception::ToString(JSContext* aCx, nsACString& _retval)
|
||||
{
|
||||
NS_ENSURE_TRUE(mInitialized, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
|
@ -413,7 +413,7 @@ Exception::ToString(nsACString& _retval)
|
|||
|
||||
if (mLocation) {
|
||||
// we need to free this if it does not fail
|
||||
nsresult rv = mLocation->ToString(location);
|
||||
nsresult rv = mLocation->ToString(aCx, location);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
|
@ -547,13 +547,13 @@ Exception::GetStack(nsAString& aStack, ErrorResult& aRv) const
|
|||
}
|
||||
|
||||
void
|
||||
Exception::Stringify(nsString& retval)
|
||||
Exception::Stringify(JSContext* aCx, nsString& retval)
|
||||
{
|
||||
nsCString str;
|
||||
#ifdef DEBUG
|
||||
DebugOnly<nsresult> rv =
|
||||
#endif
|
||||
ToString(str);
|
||||
ToString(aCx, str);
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
||||
CopyUTF8toUTF16(str, retval);
|
||||
}
|
||||
|
@ -592,7 +592,7 @@ DOMException::GetCode(uint16_t* aCode)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
DOMException::ToString(nsACString& aReturn)
|
||||
DOMException::ToString(JSContext* aCx, nsACString& aReturn)
|
||||
{
|
||||
aReturn.Truncate();
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ public:
|
|||
|
||||
void GetStack(nsAString& aStack, ErrorResult& aRv) const;
|
||||
|
||||
void Stringify(nsString& retval);
|
||||
void Stringify(JSContext* aCx, nsString& retval);
|
||||
|
||||
// XPCOM factory ctor.
|
||||
Exception();
|
||||
|
@ -131,7 +131,7 @@ public:
|
|||
NS_DECL_NSIDOMDOMEXCEPTION
|
||||
|
||||
// nsIException overrides
|
||||
NS_IMETHOD ToString(nsACString& aReturn) override;
|
||||
NS_IMETHOD ToString(JSContext* aCx, nsACString& aReturn) override;
|
||||
|
||||
// nsWrapperCache overrides
|
||||
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
||||
|
|
|
@ -478,6 +478,7 @@ DOMInterfaces = {
|
|||
'binaryNames': {
|
||||
'message': 'messageMoz',
|
||||
},
|
||||
'implicitJSContext': [ '__stringifier' ],
|
||||
},
|
||||
|
||||
'ExtendableEvent': {
|
||||
|
|
|
@ -763,7 +763,7 @@ NS_IMETHODIMP StackFrame::GetNativeSavedFrame(JS::MutableHandle<JS::Value> aSave
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP StackFrame::ToString(nsACString& _retval)
|
||||
NS_IMETHODIMP StackFrame::ToString(JSContext* aCx, nsACString& _retval)
|
||||
{
|
||||
_retval.Truncate();
|
||||
|
||||
|
|
|
@ -878,7 +878,7 @@ nsXPCWrappedJSClass::CheckForException(XPCCallContext & ccx,
|
|||
fputs(line, stdout);
|
||||
fputs(preamble, stdout);
|
||||
nsCString text;
|
||||
if (NS_SUCCEEDED(xpc_exception->ToString(text)) &&
|
||||
if (NS_SUCCEEDED(xpc_exception->ToString(cx, text)) &&
|
||||
!text.IsEmpty()) {
|
||||
fputs(text.get(), stdout);
|
||||
fputs("\n", stdout);
|
||||
|
@ -905,7 +905,7 @@ nsXPCWrappedJSClass::CheckForException(XPCCallContext & ccx,
|
|||
scriptError = do_CreateInstance(XPC_SCRIPT_ERROR_CONTRACTID);
|
||||
if (nullptr != scriptError) {
|
||||
nsCString newMessage;
|
||||
rv = xpc_exception->ToString(newMessage);
|
||||
rv = xpc_exception->ToString(cx, newMessage);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// try to get filename, lineno from the first
|
||||
// stack frame location.
|
||||
|
|
|
@ -35,6 +35,7 @@ interface nsIStackFrame : nsISupports
|
|||
// or null if this is not a native JavaScript stack frame.
|
||||
readonly attribute jsval nativeSavedFrame;
|
||||
|
||||
[implicit_jscontext]
|
||||
AUTF8String toString();
|
||||
};
|
||||
|
||||
|
@ -70,5 +71,6 @@ interface nsIException : nsISupports
|
|||
readonly attribute nsISupports data;
|
||||
|
||||
// A generic formatter - make it suitable to print, etc.
|
||||
[implicit_jscontext]
|
||||
AUTF8String toString();
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче