Bug 1398043 - P2: Temporary fix for updating the existing response_padding_size to 0 when it's an opaque response with null padding size. r=bkelly
authorTom Tung <shes050117@gmail.com>
Fri, 08 Sep 2017 17:23:52 +0800
changeset 429210 60499cc10fc4fc4dcab67c6696165bdfa30a4c7a
parent 429209 01ccedeeaf8a52510aa493607a18617287910694
child 429211 83878b29466cfb4abb952019f9f32c402875913c
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbkelly
bugs1398043
milestone57.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 1398043 - P2: Temporary fix for updating the existing response_padding_size to 0 when it's an opaque response with null padding size. r=bkelly MozReview-Commit-ID: EKcUwqfTWvj
dom/cache/DBSchema.cpp
--- a/dom/cache/DBSchema.cpp
+++ b/dom/cache/DBSchema.cpp
@@ -2079,17 +2079,27 @@ ReadResponse(mozIStorageConnection* aCon
     aSavedResponseOut->mValue.principalInfo() =
       mozilla::ipc::ContentPrincipalInfo(attrs, void_t(), specNoSuffix);
   }
 
   bool nullPadding = false;
   rv = state->GetIsNull(6, &nullPadding);
   if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
 
+#ifdef NIGHTLY_BUILD
+  bool shouldUpdateTo26 = false;
+  if (nullPadding && aSavedResponseOut->mValue.type() == ResponseType::Opaque) {
+    // XXXtt: This should be removed in the future (e.g. Nightly 58) by
+    // bug 1398167.
+    shouldUpdateTo26 = true;
+    aSavedResponseOut->mValue.paddingSize() = 0;
+  } else if (nullPadding) {
+#else
   if (nullPadding) {
+#endif // NIGHTLY_BUILD
     MOZ_DIAGNOSTIC_ASSERT(aSavedResponseOut->mValue.type() !=
                           ResponseType::Opaque);
     aSavedResponseOut->mValue.paddingSize() =
       InternalResponse::UNKNOWN_PADDING_SIZE;
   } else {
     MOZ_DIAGNOSTIC_ASSERT(aSavedResponseOut->mValue.type() ==
                           ResponseType::Opaque);
     int64_t paddingSize = 0;
@@ -2098,16 +2108,30 @@ ReadResponse(mozIStorageConnection* aCon
 
     MOZ_DIAGNOSTIC_ASSERT(paddingSize >= 0);
     aSavedResponseOut->mValue.paddingSize() = paddingSize;
   }
 
   rv = state->GetBlobAsUTF8String(7, aSavedResponseOut->mValue.channelInfo().securityInfo());
   if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
 
+#ifdef NIGHTLY_BUILD
+  if (shouldUpdateTo26) {
+    // XXXtt: This is a quick fix for not updating properly in Nightly 57.
+    // Note: This should be removed in the future (e.g. Nightly 58) by
+    // bug 1398167.
+    rv = aConn->ExecuteSimpleSQL(NS_LITERAL_CSTRING(
+      "UPDATE entries SET response_padding_size = 0 "
+        "WHERE response_type = 4 " // opaque response
+          "AND response_padding_size IS NULL"
+    ));
+    if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
+  }
+#endif // NIGHTLY_BUILD
+
   rv = aConn->CreateStatement(NS_LITERAL_CSTRING(
     "SELECT "
       "name, "
       "value "
     "FROM response_headers "
     "WHERE entry_id=:entry_id;"
   ), getter_AddRefs(state));
   if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }