Bug 1200484 (part 10) - Use JS column numbers in indexedDB. r=khuey.

--HG--
extra : rebase_source : a7549e74d28e92911e014e152a245828f01291ad
This commit is contained in:
Nicholas Nethercote 2015-09-01 18:01:02 -07:00
Родитель 27aa77e096
Коммит 95676dc27c
7 изменённых файлов: 47 добавлений и 22 удалений

Просмотреть файл

@ -187,6 +187,7 @@ class IDBDatabase::LogWarningRunnable final
nsCString mMessageName;
nsString mFilename;
uint32_t mLineNumber;
uint32_t mColumnNumber;
uint64_t mInnerWindowID;
bool mIsChrome;
@ -194,11 +195,13 @@ public:
LogWarningRunnable(const char* aMessageName,
const nsAString& aFilename,
uint32_t aLineNumber,
uint32_t aColumnNumber,
bool aIsChrome,
uint64_t aInnerWindowID)
: mMessageName(aMessageName)
, mFilename(aFilename)
, mLineNumber(aLineNumber)
, mColumnNumber(aColumnNumber)
, mInnerWindowID(aInnerWindowID)
, mIsChrome(aIsChrome)
{
@ -209,6 +212,7 @@ public:
LogWarning(const char* aMessageName,
const nsAString& aFilename,
uint32_t aLineNumber,
uint32_t aColumnNumber,
bool aIsChrome,
uint64_t aInnerWindowID);
@ -959,10 +963,10 @@ IDBDatabase::AbortTransactions(bool aShouldWarn)
MOZ_ASSERT(transaction);
nsString filename;
uint32_t lineNo;
transaction->GetCallerLocation(filename, &lineNo);
uint32_t lineNo, column;
transaction->GetCallerLocation(filename, &lineNo, &column);
aDatabase->LogWarning(kWarningMessage, filename, lineNo);
aDatabase->LogWarning(kWarningMessage, filename, lineNo, column);
}
}
};
@ -1337,7 +1341,8 @@ IDBDatabase::Invalidate()
void
IDBDatabase::LogWarning(const char* aMessageName,
const nsAString& aFilename,
uint32_t aLineNumber)
uint32_t aLineNumber,
uint32_t aColumnNumber)
{
AssertIsOnOwningThread();
MOZ_ASSERT(aMessageName);
@ -1346,6 +1351,7 @@ IDBDatabase::LogWarning(const char* aMessageName,
LogWarningRunnable::LogWarning(aMessageName,
aFilename,
aLineNumber,
aColumnNumber,
mFactory->IsChrome(),
mFactory->InnerWindowID());
} else {
@ -1353,6 +1359,7 @@ IDBDatabase::LogWarning(const char* aMessageName,
new LogWarningRunnable(aMessageName,
aFilename,
aLineNumber,
aColumnNumber,
mFactory->IsChrome(),
mFactory->InnerWindowID());
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(runnable)));
@ -1628,6 +1635,7 @@ IDBDatabase::
LogWarningRunnable::LogWarning(const char* aMessageName,
const nsAString& aFilename,
uint32_t aLineNumber,
uint32_t aColumnNumber,
bool aIsChrome,
uint64_t aInnerWindowID)
{
@ -1664,7 +1672,7 @@ LogWarningRunnable::LogWarning(const char* aMessageName,
aFilename,
/* aSourceLine */ EmptyString(),
aLineNumber,
/* aColumnNumber */ 0,
aColumnNumber,
nsIScriptError::warningFlag,
category,
aInnerWindowID)));
@ -1674,7 +1682,7 @@ LogWarningRunnable::LogWarning(const char* aMessageName,
aFilename,
/* aSourceLine */ EmptyString(),
aLineNumber,
/* aColumnNumber */ 0,
aColumnNumber,
nsIScriptError::warningFlag,
category.get())));
}
@ -1693,6 +1701,7 @@ LogWarningRunnable::Run()
LogWarning(mMessageName.get(),
mFilename,
mLineNumber,
mColumnNumber,
mIsChrome,
mInnerWindowID);

Просмотреть файл

@ -313,7 +313,8 @@ private:
void
LogWarning(const char* aMessageName,
const nsAString& aFilename,
uint32_t aLineNumber);
uint32_t aLineNumber,
uint32_t aColumnNumber);
};
} // namespace indexedDB

Просмотреть файл

@ -92,6 +92,7 @@ IDBRequest::InitMembers()
mLoggingSerialNumber = NextSerialNumber();
mErrorCode = NS_OK;
mLineNo = 0;
mColumn = 0;
mHaveResultOrErrorCode = false;
}
@ -104,7 +105,7 @@ IDBRequest::Create(IDBDatabase* aDatabase,
aDatabase->AssertIsOnOwningThread();
nsRefPtr<IDBRequest> request = new IDBRequest(aDatabase);
CaptureCaller(request->mFilename, &request->mLineNo);
CaptureCaller(request->mFilename, &request->mLineNo, &request->mColumn);
request->mTransaction = aTransaction;
request->SetScriptOwner(aDatabase->GetScriptOwner());
@ -168,13 +169,15 @@ IDBRequest::SetLoggingSerialNumber(uint64_t aLoggingSerialNumber)
}
void
IDBRequest::CaptureCaller(nsAString& aFilename, uint32_t* aLineNo)
IDBRequest::CaptureCaller(nsAString& aFilename, uint32_t* aLineNo,
uint32_t* aColumn)
{
MOZ_ASSERT(aFilename.IsEmpty());
MOZ_ASSERT(aLineNo);
MOZ_ASSERT(aColumn);
ThreadsafeAutoJSContext cx;
nsJSUtils::GetCallingLocation(cx, aFilename, aLineNo);
nsJSUtils::GetCallingLocation(cx, aFilename, aLineNo, aColumn);
}
void
@ -271,13 +274,16 @@ IDBRequest::GetErrorAfterResult() const
#endif // DEBUG
void
IDBRequest::GetCallerLocation(nsAString& aFilename, uint32_t* aLineNo) const
IDBRequest::GetCallerLocation(nsAString& aFilename, uint32_t* aLineNo,
uint32_t* aColumn) const
{
AssertIsOnOwningThread();
MOZ_ASSERT(aLineNo);
MOZ_ASSERT(aColumn);
aFilename = mFilename;
*aLineNo = mLineNo;
*aColumn = mColumn;
}
IDBRequestReadyState
@ -516,7 +522,7 @@ IDBOpenDBRequest::CreateForWindow(IDBFactory* aFactory,
MOZ_ASSERT(aScriptOwner);
nsRefPtr<IDBOpenDBRequest> request = new IDBOpenDBRequest(aFactory, aOwner);
CaptureCaller(request->mFilename, &request->mLineNo);
CaptureCaller(request->mFilename, &request->mLineNo, &request->mColumn);
request->SetScriptOwner(aScriptOwner);
@ -533,7 +539,7 @@ IDBOpenDBRequest::CreateForJS(IDBFactory* aFactory,
MOZ_ASSERT(aScriptOwner);
nsRefPtr<IDBOpenDBRequest> request = new IDBOpenDBRequest(aFactory, nullptr);
CaptureCaller(request->mFilename, &request->mLineNo);
CaptureCaller(request->mFilename, &request->mLineNo, &request->mColumn);
request->SetScriptOwner(aScriptOwner);

Просмотреть файл

@ -63,6 +63,7 @@ protected:
uint64_t mLoggingSerialNumber;
nsresult mErrorCode;
uint32_t mLineNo;
uint32_t mColumn;
bool mHaveResultOrErrorCode;
public:
@ -82,7 +83,7 @@ public:
IDBTransaction* aTransaction);
static void
CaptureCaller(nsAString& aFilename, uint32_t* aLineNo);
CaptureCaller(nsAString& aFilename, uint32_t* aLineNo, uint32_t* aColumn);
static uint64_t
NextSerialNumber();
@ -130,7 +131,8 @@ public:
GetError(ErrorResult& aRv);
void
GetCallerLocation(nsAString& aFilename, uint32_t* aLineNo) const;
GetCallerLocation(nsAString& aFilename, uint32_t* aLineNo,
uint32_t* aColumn) const;
bool
IsPending() const

Просмотреть файл

@ -82,6 +82,7 @@ IDBTransaction::IDBTransaction(IDBDatabase* aDatabase,
, mAbortCode(NS_OK)
, mPendingRequestCount(0)
, mLineNo(0)
, mColumn(0)
, mReadyState(IDBTransaction::INITIAL)
, mMode(aMode)
, mCreating(false)
@ -186,7 +187,7 @@ IDBTransaction::CreateVersionChange(
emptyObjectStoreNames,
VERSION_CHANGE);
aOpenRequest->GetCallerLocation(transaction->mFilename,
&transaction->mLineNo);
&transaction->mLineNo, &transaction->mColumn);
transaction->SetScriptOwner(aDatabase->GetScriptOwner());
@ -219,7 +220,8 @@ IDBTransaction::Create(IDBDatabase* aDatabase,
nsRefPtr<IDBTransaction> transaction =
new IDBTransaction(aDatabase, aObjectStoreNames, aMode);
IDBRequest::CaptureCaller(transaction->mFilename, &transaction->mLineNo);
IDBRequest::CaptureCaller(transaction->mFilename, &transaction->mLineNo,
&transaction->mColumn);
transaction->SetScriptOwner(aDatabase->GetScriptOwner());
@ -492,13 +494,16 @@ IDBTransaction::IsOpen() const
}
void
IDBTransaction::GetCallerLocation(nsAString& aFilename, uint32_t* aLineNo) const
IDBTransaction::GetCallerLocation(nsAString& aFilename, uint32_t* aLineNo,
uint32_t* aColumn) const
{
AssertIsOnOwningThread();
MOZ_ASSERT(aLineNo);
MOZ_ASSERT(aColumn);
aFilename = mFilename;
*aLineNo = mLineNo;
*aColumn = mColumn;
}
already_AddRefed<IDBObjectStore>

Просмотреть файл

@ -100,6 +100,7 @@ private:
nsString mFilename;
uint32_t mLineNo;
uint32_t mColumn;
ReadyState mReadyState;
Mode mMode;
@ -205,7 +206,8 @@ public:
}
void
GetCallerLocation(nsAString& aFilename, uint32_t* aLineNo) const;
GetCallerLocation(nsAString& aFilename, uint32_t* aLineNo,
uint32_t* aColumn) const;
// 'Get' prefix is to avoid name collisions with the enum
Mode

Просмотреть файл

@ -480,7 +480,7 @@ IndexedDatabaseManager::CommonPostHandleEvent(EventChainPostVisitor& aVisitor,
ThreadsafeAutoJSContext cx;
RootedDictionary<ErrorEventInit> init(cx);
request->GetCallerLocation(init.mFilename, &init.mLineno);
request->GetCallerLocation(init.mFilename, &init.mLineno, &init.mColno);
init.mMessage = errorName;
init.mCancelable = true;
@ -556,7 +556,7 @@ IndexedDatabaseManager::CommonPostHandleEvent(EventChainPostVisitor& aVisitor,
init.mFilename,
/* aSourceLine */ EmptyString(),
init.mLineno,
/* aColumnNumber */ 0,
init.mColno,
nsIScriptError::errorFlag,
category,
innerWindowID)));
@ -566,7 +566,7 @@ IndexedDatabaseManager::CommonPostHandleEvent(EventChainPostVisitor& aVisitor,
init.mFilename,
/* aSourceLine */ EmptyString(),
init.mLineno,
/* aColumnNumber */ 0,
init.mColno,
nsIScriptError::errorFlag,
category.get())));
}