Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
sydp committed Nov 2, 2024
1 parent 1c17ca6 commit 6ba4b2c
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 29 deletions.
56 changes: 28 additions & 28 deletions dfindexeddb/indexeddb/chromium/record.py
Original file line number Diff line number Diff line change
Expand Up @@ -659,25 +659,26 @@ class GlobalMetaDataKey(BaseIndexedDBKey):

METADATA_TYPE_TO_CLASS = {
definitions.GlobalMetadataKeyType
.SCHEMA_VERSION: SchemaVersionKey,
.ACTIVE_BLOB_JOURNAL: ActiveBlobJournalKey,
definitions.GlobalMetadataKeyType
.MAX_DATABASE_ID: MaxDatabaseIdKey,
.DATA_VERSION: DataVersionKey,
definitions.GlobalMetadataKeyType
.DATA_VERSION: DataVersionKey,
.DATABASE_FREE_LIST: DatabaseFreeListKey,
definitions.GlobalMetadataKeyType
.RECOVERY_BLOB_JOURNAL: RecoveryBlobJournalKey,
.DATABASE_NAME: DatabaseNameKey,
definitions.GlobalMetadataKeyType
.ACTIVE_BLOB_JOURNAL: ActiveBlobJournalKey,
.EARLIEST_COMPACTION_TIME: EarliestCompactionTimeKey,
definitions.GlobalMetadataKeyType
.EARLIEST_SWEEP: EarliestSweepKey,
definitions.GlobalMetadataKeyType
.EARLIEST_COMPACTION_TIME: EarliestCompactionTimeKey,
.MAX_DATABASE_ID: MaxDatabaseIdKey,
definitions.GlobalMetadataKeyType
.SCOPES_PREFIX: ScopesPrefixKey,
.RECOVERY_BLOB_JOURNAL: RecoveryBlobJournalKey,
definitions.GlobalMetadataKeyType
.DATABASE_FREE_LIST: DatabaseFreeListKey,
.SCHEMA_VERSION: SchemaVersionKey,
definitions.GlobalMetadataKeyType
.DATABASE_NAME: DatabaseNameKey}
.SCOPES_PREFIX: ScopesPrefixKey,
}

def DecodeValue(self, decoder: utils.LevelDBDecoder) -> Any:
"""Decodes the value from the current position of the LevelDBDecoder.
Expand All @@ -690,16 +691,16 @@ def DecodeValue(self, decoder: utils.LevelDBDecoder) -> Any:
def FromDecoder(
cls, decoder: utils.LevelDBDecoder, key_prefix: KeyPrefix,
base_offset: int = 0
) -> Union[Type[ActiveBlobJournalKey],
Type[DataVersionKey],
Type[DatabaseFreeListKey],
Type[DatabaseNameKey],
Type[EarliestSweepKey],
Type[EarliestCompactionTimeKey],
Type[MaxDatabaseIdKey],
Type[RecoveryBlobJournalKey],
Type[SchemaVersionKey],
Type[ScopesPrefixKey]]:
) -> Union[ActiveBlobJournalKey,
DataVersionKey,
DatabaseFreeListKey,
DatabaseNameKey,
EarliestSweepKey,
EarliestCompactionTimeKey,
MaxDatabaseIdKey,
RecoveryBlobJournalKey,
SchemaVersionKey,
ScopesPrefixKey]:
"""Decodes the global metadata key.
Raises:
Expand All @@ -712,7 +713,7 @@ def FromDecoder(
if not key_class:
raise errors.ParserError('Unknown metadata key type')
return key_class.FromDecoder(
decoder, key_prefix, base_offset) #pytype: disable=bad-return-type
decoder, key_prefix, base_offset)


@dataclass
Expand Down Expand Up @@ -1058,7 +1059,6 @@ def FromDecoder(
"""Decodes the exists entry key."""
offset = decoder.stream.tell()
encoded_user_key = IDBKey.FromDecoder(decoder, offset)

return cls(
offset=base_offset + offset,
key_prefix=key_prefix, encoded_user_key=encoded_user_key)
Expand Down Expand Up @@ -1145,13 +1145,13 @@ class IndexedDbKey(BaseIndexedDBKey):
"""

METADATA_TYPE_TO_CLASS = {
definitions.KeyPrefixType.GLOBAL_METADATA: GlobalMetaDataKey,
definitions.KeyPrefixType.BLOB_ENTRY: BlobEntryKey,
definitions.KeyPrefixType.DATABASE_METADATA: DatabaseMetaDataKey,
definitions.KeyPrefixType.OBJECT_STORE_DATA: ObjectStoreDataKey,
definitions.KeyPrefixType.EXISTS_ENTRY: ExistsEntryKey,
definitions.KeyPrefixType.GLOBAL_METADATA: GlobalMetaDataKey,
definitions.KeyPrefixType.INVALID_TYPE: None,
definitions.KeyPrefixType.INDEX_DATA: IndexDataKey,
definitions.KeyPrefixType.BLOB_ENTRY: BlobEntryKey,
definitions.KeyPrefixType.INVALID_TYPE: None
definitions.KeyPrefixType.OBJECT_STORE_DATA: ObjectStoreDataKey,
}

def DecodeValue(self, decoder: utils.LevelDBDecoder) -> Any:
Expand All @@ -1167,9 +1167,9 @@ def FromDecoder(
decoder: utils.LevelDBDecoder,
key_prefix: KeyPrefix,
base_offset: int = 0
) -> Union[Type[DatabaseMetaDataKey], Type[ExistsEntryKey],
Type[BlobEntryKey], Type[GlobalMetaDataKey],
Type[IndexDataKey], Type[ObjectStoreDataKey]]:
) -> Union[DatabaseMetaDataKey, ExistsEntryKey,
BlobEntryKey, GlobalMetaDataKey,
IndexDataKey, ObjectStoreDataKey]:
"""Decodes the IndexedDB key."""
key_type = key_prefix.GetKeyPrefixType()
key_class = cls.METADATA_TYPE_TO_CLASS.get(key_type)
Expand Down
2 changes: 1 addition & 1 deletion dfindexeddb/indexeddb/chromium/v8.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ def ReadSparseJSArray(self) -> types.JSArray:
js_array.values.append(types.Undefined())

num_properties = self._ReadJSObjectProperties(
js_array.__dict__, definitions.V8SerializationTag.END_SPARSE_JS_ARRAY)
js_array.properties, definitions.V8SerializationTag.END_SPARSE_JS_ARRAY)
_, expected_num_properties = self.decoder.DecodeUint32Varint()
_, expected_length = self.decoder.DecodeUint32Varint()

Expand Down

0 comments on commit 6ba4b2c

Please sign in to comment.