mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 11:25:00 +00:00
Bug 1069490 - Part 2: Add columnNumber to nsIStackFrame and set in JSStackFrame. r=bz
This commit is contained in:
parent
7157e4d8a2
commit
94ca85eb44
@ -204,6 +204,7 @@ public:
|
||||
|
||||
StackFrame()
|
||||
: mLineno(0)
|
||||
, mColNo(0)
|
||||
, mLanguage(nsIProgrammingLanguage::UNKNOWN)
|
||||
{
|
||||
}
|
||||
@ -228,10 +229,17 @@ protected:
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
virtual nsresult GetColNo(int32_t* aColNo)
|
||||
{
|
||||
*aColNo = mColNo;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIStackFrame> mCaller;
|
||||
nsString mFilename;
|
||||
nsString mFunname;
|
||||
int32_t mLineno;
|
||||
int32_t mColNo;
|
||||
uint32_t mLanguage;
|
||||
};
|
||||
|
||||
@ -286,6 +294,7 @@ protected:
|
||||
}
|
||||
|
||||
virtual nsresult GetLineno(int32_t* aLineNo) MOZ_OVERRIDE;
|
||||
virtual nsresult GetColNo(int32_t* aColNo) MOZ_OVERRIDE;
|
||||
|
||||
private:
|
||||
virtual ~JSStackFrame();
|
||||
@ -296,6 +305,7 @@ private:
|
||||
bool mFilenameInitialized;
|
||||
bool mFunnameInitialized;
|
||||
bool mLinenoInitialized;
|
||||
bool mColNoInitialized;
|
||||
bool mCallerInitialized;
|
||||
bool mFormattedStackInitialized;
|
||||
};
|
||||
@ -305,6 +315,7 @@ JSStackFrame::JSStackFrame(JS::Handle<JSObject*> aStack)
|
||||
, mFilenameInitialized(false)
|
||||
, mFunnameInitialized(false)
|
||||
, mLinenoInitialized(false)
|
||||
, mColNoInitialized(false)
|
||||
, mCallerInitialized(false)
|
||||
, mFormattedStackInitialized(false)
|
||||
{
|
||||
@ -465,6 +476,35 @@ NS_IMETHODIMP StackFrame::GetLineNumber(int32_t* aLineNumber)
|
||||
return GetLineno(aLineNumber);
|
||||
}
|
||||
|
||||
// virtual
|
||||
nsresult
|
||||
JSStackFrame::GetColNo(int32_t* aColNo)
|
||||
{
|
||||
// We can get called after unlink; in that case we can't do much
|
||||
// about producing a useful value.
|
||||
if (!mColNoInitialized && mStack) {
|
||||
ThreadsafeAutoJSContext cx;
|
||||
JS::Rooted<JSObject*> stack(cx, mStack);
|
||||
JS::ExposeObjectToActiveJS(mStack);
|
||||
JSAutoCompartment ac(cx, stack);
|
||||
JS::Rooted<JS::Value> colVal(cx);
|
||||
if (!JS_GetProperty(cx, stack, "column", &colVal) ||
|
||||
!colVal.isNumber()) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
mColNo = colVal.toNumber();
|
||||
mColNoInitialized = true;
|
||||
}
|
||||
|
||||
return StackFrame::GetColNo(aColNo);
|
||||
}
|
||||
|
||||
/* readonly attribute int32_t columnNumber; */
|
||||
NS_IMETHODIMP StackFrame::GetColumnNumber(int32_t* aColumnNumber)
|
||||
{
|
||||
return GetColNo(aColumnNumber);
|
||||
}
|
||||
|
||||
/* readonly attribute AUTF8String sourceLine; */
|
||||
NS_IMETHODIMP StackFrame::GetSourceLine(nsACString& aSourceLine)
|
||||
{
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, uuid(13b75be1-f950-497b-81e4-a0214a14e5ae)]
|
||||
[scriptable, uuid(f80ac10b-68dd-4482-a8c2-3cbe13fa89af)]
|
||||
interface nsIStackFrame : nsISupports
|
||||
{
|
||||
// see nsIProgrammingLanguage for list of language consts
|
||||
@ -20,6 +20,7 @@ interface nsIStackFrame : nsISupports
|
||||
readonly attribute AString name;
|
||||
// Valid line numbers begin at '1'. '0' indicates unknown.
|
||||
readonly attribute int32_t lineNumber;
|
||||
readonly attribute int32_t columnNumber;
|
||||
readonly attribute AUTF8String sourceLine;
|
||||
readonly attribute nsIStackFrame caller;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user