Bug 1143894 - Part 1: Clear the ErrorResult message if InternalHeaders::Get fails; r=bkelly

InternalHeaders::Get() may throw NS_ERROR_TYPE_ERR with an associated message.
The semantics of ErrorResult dictate that the message needs to be consumed by
the time that the object gets destroyed, so we need to clear it before
returning in these two places.
This commit is contained in:
Ehsan Akhgari 2015-03-16 19:10:35 -04:00
parent 0dbf1fb8f5
commit 01349908f4

View File

@ -821,11 +821,17 @@ DBSchema::MatchByVaryHeader(mozIStorageConnection* aConn,
nsAutoCString queryValue; nsAutoCString queryValue;
queryHeaders->Get(varyValues[i], queryValue, errorResult); queryHeaders->Get(varyValues[i], queryValue, errorResult);
if (errorResult.Failed()) { return errorResult.ErrorCode(); }; if (errorResult.Failed()) {
errorResult.ClearMessage();
return errorResult.ErrorCode();
}
nsAutoCString cachedValue; nsAutoCString cachedValue;
cachedHeaders->Get(varyValues[i], cachedValue, errorResult); cachedHeaders->Get(varyValues[i], cachedValue, errorResult);
if (errorResult.Failed()) { return errorResult.ErrorCode(); }; if (errorResult.Failed()) {
errorResult.ClearMessage();
return errorResult.ErrorCode();
}
if (queryValue != cachedValue) { if (queryValue != cachedValue) {
varyHeadersMatch = false; varyHeadersMatch = false;