author | Boris Zbarsky <bzbarsky@mit.edu> |
Tue, 07 Jan 2014 19:53:18 -0500 (2014-01-08) | |
changeset 162466 | 8e95a6fcee236b8b9fa4e7d85e3e9c541018ac1f |
parent 162465 | b6d1eaed0807b5adf618e632dd555cea670932cf |
child 162467 | aa070938b0189beea2c2c4762199df2562dcb369 |
push id | 25953 |
push user | cbook@mozilla.com |
push date | Wed, 08 Jan 2014 12:11:30 +0000 (2014-01-08) |
treeherder | mozilla-central@f8b2a073d930 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | khuey |
bugs | 932837 |
milestone | 29.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/dom/base/DOMException.cpp +++ b/dom/base/DOMException.cpp @@ -345,26 +345,38 @@ Exception::GetName(char** aName) return NS_OK; } /* readonly attribute string filename; */ NS_IMETHODIMP Exception::GetFilename(char** aFilename) { NS_ENSURE_TRUE(mInitialized, NS_ERROR_NOT_INITIALIZED); - XPC_STRING_GETTER_BODY(aFilename, mFilename); + + if (mLocation) { + return mLocation->GetFilename(aFilename); + } + + XPC_STRING_GETTER_BODY(aFilename, mFilename); } /* readonly attribute uint32_t lineNumber; */ NS_IMETHODIMP Exception::GetLineNumber(uint32_t *aLineNumber) { NS_ENSURE_ARG_POINTER(aLineNumber); NS_ENSURE_TRUE(mInitialized, NS_ERROR_NOT_INITIALIZED); + if (mLocation) { + int32_t lineno; + nsresult rv = mLocation->GetLineNumber(&lineno); + *aLineNumber = lineno; + return rv; + } + *aLineNumber = mLineNumber; return NS_OK; } /* readonly attribute uint32_t columnNumber; */ NS_IMETHODIMP Exception::GetColumnNumber(uint32_t* aColumnNumber) { @@ -474,25 +486,16 @@ Exception::Initialize(const char *aMessa if (aName) { mName = (char*) nsMemory::Clone(aName, sizeof(char)*(strlen(aName)+1)); } mResult = aResult; if (aLocation) { mLocation = aLocation; - // For now, fill in our location details from our stack frame. - // Later we may allow other locations? - nsresult rc; - if (NS_FAILED(rc = aLocation->GetFilename(&mFilename))) { - return rc; - } - if (NS_FAILED(rc = aLocation->GetLineNumber(&mLineNumber))) { - return rc; - } } else { nsresult rv; nsXPConnect* xpc = nsXPConnect::XPConnect(); rv = xpc->GetCurrentJSStack(getter_AddRefs(mLocation)); if (NS_FAILED(rv)) { return rv; } } @@ -553,16 +556,24 @@ Exception::GetFilename(nsString& retval) MOZ_ASSERT(NS_SUCCEEDED(rv)); CopyUTF8toUTF16(str, retval); nsMemory::Free(str); } uint32_t Exception::LineNumber() const { + if (mLocation) { + int32_t lineno; + if (NS_SUCCEEDED(mLocation->GetLineNumber(&lineno))) { + return lineno; + } + return 0; + } + return mLineNumber; } uint32_t Exception::ColumnNumber() const { return 0; }