summaryrefslogtreecommitdiff
path: root/mozilla-1601707.patch
blob: 1a0ab4fad43e1e4281996968c2b9f82919176388 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
diff -up firefox-72.0/dom/indexedDB/ActorsParent.cpp.mozilla-1601707 firefox-72.0/dom/indexedDB/ActorsParent.cpp
--- firefox-72.0/dom/indexedDB/ActorsParent.cpp.mozilla-1601707	2020-01-03 19:57:54.000000000 +0100
+++ firefox-72.0/dom/indexedDB/ActorsParent.cpp	2020-01-07 13:33:31.950688264 +0100
@@ -24617,11 +24617,11 @@ nsresult ObjectStoreAddOrPutRequestOp::D
   // if we allow overwrite or not. By not allowing overwrite we raise
   // detectable errors rather than corrupting data.
   DatabaseConnection::CachedStatement stmt;
-  const auto& optReplaceDirective = (!mOverwrite || keyUnset)
-                                        ? NS_LITERAL_CSTRING("")
-                                        : NS_LITERAL_CSTRING("OR REPLACE ");
   rv = aConnection->GetCachedStatement(
-      NS_LITERAL_CSTRING("INSERT ") + optReplaceDirective +
+      NS_LITERAL_CSTRING("INSERT ") +
+	  ((!mOverwrite || keyUnset)
+           ? NS_LITERAL_CSTRING("")
+           : NS_LITERAL_CSTRING("OR REPLACE ")) +
           NS_LITERAL_CSTRING("INTO object_data "
                              "(object_store_id, key, file_ids, data) "
                              "VALUES (:") +
@@ -26457,10 +26457,6 @@ nsresult Cursor::OpenOp::DoIndexDatabase
 
   const bool usingKeyRange = mOptionalKeyRange.isSome();
 
-  const auto& indexTable = mCursor->mUniqueIndex
-                               ? NS_LITERAL_CSTRING("unique_index_data")
-                               : NS_LITERAL_CSTRING("index_data");
-
   // The result of MakeColumnPairSelectionList is stored in a local variable,
   // since inlining it into the next statement causes a crash on some Mac OS X
   // builds (see https://bugzilla.mozilla.org/show_bug.cgi?id=1168606#c110).
@@ -26478,7 +26474,9 @@ nsresult Cursor::OpenOp::DoIndexDatabase
                                  "object_data.file_ids, "
                                  "object_data.data "
                                  "FROM ") +
-                             indexTable +
+                             (mCursor->mUniqueIndex
+                                 ? NS_LITERAL_CSTRING("unique_index_data")
+                                 : NS_LITERAL_CSTRING("index_data")) +
                              NS_LITERAL_CSTRING(
                                  " AS index_table "
                                  "JOIN object_data "
@@ -26563,10 +26561,6 @@ nsresult Cursor::OpenOp::DoIndexKeyDatab
 
   const bool usingKeyRange = mOptionalKeyRange.isSome();
 
-  const auto& table = mCursor->mUniqueIndex
-                          ? NS_LITERAL_CSTRING("unique_index_data")
-                          : NS_LITERAL_CSTRING("index_data");
-
   // The result of MakeColumnPairSelectionList is stored in a local variable,
   // since inlining it into the next statement causes a crash on some Mac OS X
   // builds (see https://bugzilla.mozilla.org/show_bug.cgi?id=1168606#c110).
@@ -26581,7 +26575,10 @@ nsresult Cursor::OpenOp::DoIndexKeyDatab
                              NS_LITERAL_CSTRING(
                                  "object_data_key "
                                  " FROM ") +
-                             table + NS_LITERAL_CSTRING(" WHERE index_id = :") +
+                             (mCursor->mUniqueIndex
+                                 ? NS_LITERAL_CSTRING("unique_index_data")
+                                 : NS_LITERAL_CSTRING("index_data")) +
+                             NS_LITERAL_CSTRING(" WHERE index_id = :") +
                              kStmtParamNameId;
 
   const auto keyRangeClause = MaybeGetBindingClauseForKeyRange(
bgstack15