Bug 1143894 - Part 1: Clear the ErrorResult message if InternalHeaders::Get fails; r=bkelly
authorEhsan Akhgari <ehsan@mozilla.com>
Mon, 16 Mar 2015 19:10:35 -0400
changeset 265255 958151e0cfd26a957c61b120cbae9ab1513ece7c
parent 265254 a05e2e985d0bf6efe93ec2e1095262a71d5870f4
child 265256 3ea234420460f0e87a05df0bf4ff2e36b5b03442
push id830
push userraliiev@mozilla.com
push dateFri, 19 Jun 2015 19:24:37 +0000
treeherdermozilla-release@932614382a68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbkelly
bugs1143894
milestone39.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
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.
dom/cache/DBSchema.cpp
--- a/dom/cache/DBSchema.cpp
+++ b/dom/cache/DBSchema.cpp
@@ -816,21 +816,27 @@ DBSchema::MatchByVaryHeader(mozIStorageC
 
   for (uint32_t i = 0; i < varyValues.Length(); ++i) {
     if (varyValues[i].EqualsLiteral("*")) {
       continue;
     }
 
     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;
       break;
     }
   }
 
   *aSuccessOut = varyHeadersMatch;