Skip to content

Commit

Permalink
Bug 1143894 - Part 1: Clear the ErrorResult message if InternalHeader…
Browse files Browse the repository at this point in the history
…s::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.
  • Loading branch information
rmottola committed Jun 25, 2019
1 parent 72203a9 commit fd5afc2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions dom/cache/DBSchema.cpp
Expand Up @@ -835,11 +835,17 @@ DBSchema::MatchByVaryHeader(mozIStorageConnection* aConn,

nsAutoCString queryValue;
queryHeaders->Get(varyValues[i], queryValue, errorResult);
if (errorResult.Failed()) { return errorResult.ErrorCode(); };
if (errorResult.Failed()) {
errorResult.ClearMessage();
return errorResult.ErrorCode();
}

nsAutoCString cachedValue;
cachedHeaders->Get(varyValues[i], cachedValue, errorResult);
if (errorResult.Failed()) { return errorResult.ErrorCode(); };
if (errorResult.Failed()) {
errorResult.ClearMessage();
return errorResult.ErrorCode();
}

if (queryValue != cachedValue) {
varyHeadersMatch = false;
Expand Down

0 comments on commit fd5afc2

Please sign in to comment.