Title: [261885] trunk/Source/WebCore
Revision
261885
Author
[email protected]
Date
2020-05-19 13:48:13 -0700 (Tue, 19 May 2020)

Log Message

IDBRequestData and IDBClient::TransactionOperation should initialize IndexedDB::IndexRecordType field
<https://webkit.org/b/212096>
<rdar://problem/63406376>

Reviewed by Geoffrey Garen.

IDBRequestData tested by IPC::Decoder::decode() and
IPC::Encoder::operator<<() running on WebKit2 API and layout
tests.

* Modules/indexeddb/IndexedDB.h:
(WTF::EnumTraits<WebCore::IndexedDB::IndexRecordType>): Add.
* Modules/indexeddb/client/TransactionOperation.h:
(WebCore::IDBClient::TransactionOperation::m_indexRecordType):
- Add default initializer.
* Modules/indexeddb/shared/IDBRequestData.h:
(WebCore::IDBRequestData::m_indexRecordType):
- Add default initializer.
(WebCore::IDBRequestData::encode const):
(WebCore::IDBRequestData::decode):
- Switch from encodeEnum() and decodeEnum() to modern
  equivalents that check for valid enum values.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (261884 => 261885)


--- trunk/Source/WebCore/ChangeLog	2020-05-19 20:20:14 UTC (rev 261884)
+++ trunk/Source/WebCore/ChangeLog	2020-05-19 20:48:13 UTC (rev 261885)
@@ -1,3 +1,28 @@
+2020-05-19  David Kilzer  <[email protected]>
+
+        IDBRequestData and IDBClient::TransactionOperation should initialize IndexedDB::IndexRecordType field
+        <https://webkit.org/b/212096>
+        <rdar://problem/63406376>
+
+        Reviewed by Geoffrey Garen.
+
+        IDBRequestData tested by IPC::Decoder::decode() and
+        IPC::Encoder::operator<<() running on WebKit2 API and layout
+        tests.
+
+        * Modules/indexeddb/IndexedDB.h:
+        (WTF::EnumTraits<WebCore::IndexedDB::IndexRecordType>): Add.
+        * Modules/indexeddb/client/TransactionOperation.h:
+        (WebCore::IDBClient::TransactionOperation::m_indexRecordType):
+        - Add default initializer.
+        * Modules/indexeddb/shared/IDBRequestData.h:
+        (WebCore::IDBRequestData::m_indexRecordType):
+        - Add default initializer.
+        (WebCore::IDBRequestData::encode const):
+        (WebCore::IDBRequestData::decode):
+        - Switch from encodeEnum() and decodeEnum() to modern
+          equivalents that check for valid enum values.
+
 2020-05-19  Simon Fraser  <[email protected]>
 
         Push a PlatformDisplayID to scrolling trees, and allow the scrolling thread to get displayDidRefresh notifications

Modified: trunk/Source/WebCore/Modules/indexeddb/IndexedDB.h (261884 => 261885)


--- trunk/Source/WebCore/Modules/indexeddb/IndexedDB.h	2020-05-19 20:20:14 UTC (rev 261884)
+++ trunk/Source/WebCore/Modules/indexeddb/IndexedDB.h	2020-05-19 20:48:13 UTC (rev 261885)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013-2020 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -117,6 +118,14 @@
 
 namespace WTF {
 
+template<> struct EnumTraits<WebCore::IndexedDB::IndexRecordType> {
+    using values = EnumValues<
+        WebCore::IndexedDB::IndexRecordType,
+        WebCore::IndexedDB::IndexRecordType::Key,
+        WebCore::IndexedDB::IndexRecordType::Value
+    >;
+};
+
 template<> struct EnumTraits<WebCore::IndexedDB::ObjectStoreOverwriteMode> {
     using values = EnumValues<
         WebCore::IndexedDB::ObjectStoreOverwriteMode,
@@ -126,6 +135,6 @@
     >;
 };
 
-}
+} // namespace WTF
 
 #endif // ENABLED(INDEXED_DATABASE)

Modified: trunk/Source/WebCore/Modules/indexeddb/client/TransactionOperation.h (261884 => 261885)


--- trunk/Source/WebCore/Modules/indexeddb/client/TransactionOperation.h	2020-05-19 20:20:14 UTC (rev 261884)
+++ trunk/Source/WebCore/Modules/indexeddb/client/TransactionOperation.h	2020-05-19 20:48:13 UTC (rev 261885)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2015-2020 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -129,7 +129,7 @@
     uint64_t m_objectStoreIdentifier { 0 };
     uint64_t m_indexIdentifier { 0 };
     std::unique_ptr<IDBResourceIdentifier> m_cursorIdentifier;
-    IndexedDB::IndexRecordType m_indexRecordType;
+    IndexedDB::IndexRecordType m_indexRecordType { IndexedDB::IndexRecordType::Key };
     Function<void()> m_performFunction;
     Function<void(const IDBResultData&)> m_completeFunction;
 

Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBRequestData.h (261884 => 261885)


--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBRequestData.h	2020-05-19 20:20:14 UTC (rev 261884)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBRequestData.h	2020-05-19 20:48:13 UTC (rev 261885)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2015-2020 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -87,7 +87,7 @@
     std::unique_ptr<IDBResourceIdentifier> m_cursorIdentifier;
     uint64_t m_objectStoreIdentifier { 0 };
     uint64_t m_indexIdentifier { 0 };
-    IndexedDB::IndexRecordType m_indexRecordType;
+    IndexedDB::IndexRecordType m_indexRecordType { IndexedDB::IndexRecordType::Key };
 
     mutable Optional<IDBDatabaseIdentifier> m_databaseIdentifier;
     uint64_t m_requestedVersion { 0 };
@@ -108,7 +108,7 @@
 {
     encoder << m_serverConnectionIdentifier << m_objectStoreIdentifier << m_indexIdentifier << m_databaseIdentifier << m_requestedVersion;
 
-    encoder.encodeEnum(m_indexRecordType);
+    encoder << m_indexRecordType;
     encoder.encodeEnum(m_requestType);
 
     encoder << !!m_requestIdentifier;
@@ -145,7 +145,7 @@
     if (!decoder.decode(request.m_requestedVersion))
         return false;
 
-    if (!decoder.decodeEnum(request.m_indexRecordType))
+    if (!decoder.decode(request.m_indexRecordType))
         return false;
 
     if (!decoder.decodeEnum(request.m_requestType))
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to