Bug 1200484 (part 4) - Expose the column number in nsJSUtils::GetCallingLocation(). r=mrbkap.

The patch also makes the filename optional, to match the column, and to make
GetCallingLocation() more similar to JS::DescribeScriptedCaller().
This commit is contained in:
Nicholas Nethercote 2015-09-01 17:56:03 -07:00
parent 2951bb6385
commit 14ffadf4ee
2 changed files with 8 additions and 6 deletions

View File

@ -35,10 +35,10 @@ using namespace mozilla::dom;
bool
nsJSUtils::GetCallingLocation(JSContext* aContext, nsACString& aFilename,
uint32_t* aLineno)
uint32_t* aLineno, uint32_t* aColumn)
{
JS::AutoFilename filename;
if (!JS::DescribeScriptedCaller(aContext, &filename, aLineno)) {
if (!JS::DescribeScriptedCaller(aContext, &filename, aLineno, aColumn)) {
return false;
}
@ -48,10 +48,10 @@ nsJSUtils::GetCallingLocation(JSContext* aContext, nsACString& aFilename,
bool
nsJSUtils::GetCallingLocation(JSContext* aContext, nsAString& aFilename,
uint32_t* aLineno)
uint32_t* aLineno, uint32_t* aColumn)
{
JS::AutoFilename filename;
if (!JS::DescribeScriptedCaller(aContext, &filename, aLineno)) {
if (!JS::DescribeScriptedCaller(aContext, &filename, aLineno, aColumn)) {
return false;
}

View File

@ -35,9 +35,11 @@ class nsJSUtils
{
public:
static bool GetCallingLocation(JSContext* aContext, nsACString& aFilename,
uint32_t* aLineno);
uint32_t* aLineno = nullptr,
uint32_t* aColumn = nullptr);
static bool GetCallingLocation(JSContext* aContext, nsAString& aFilename,
uint32_t* aLineno);
uint32_t* aLineno = nullptr,
uint32_t* aColumn = nullptr);
static nsIScriptGlobalObject *GetStaticScriptGlobal(JSObject* aObj);