Closed Bug 940315 Opened 6 years ago Closed 6 years ago

Don't use a generic hash function to generate database filenames

Categories

(Core :: Storage: IndexedDB, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla28

People

(Reporter: janv, Assigned: vendo)

Details

(Whiteboard: [qa-])

Attachments

(1 file, 1 obsolete file)

This is a followup for bug 780408.
Vendo, want to help with this?
Attached patch bug940315-fix (obsolete) — Splinter Review
I can try. Thanks.  The current hash function has been extracted in patch
Assignee: nobody → vendo.ruzicka
Status: NEW → ASSIGNED
Attachment #8335569 - Flags: review?(Jan.Varga)
Comment on attachment 8335569 [details] [diff] [review]
bug940315-fix

Review of attachment 8335569 [details] [diff] [review]:
-----------------------------------------------------------------

Please, double check that HashName() produces the same output as HashString(), thanks.

::: dom/indexedDB/OpenDatabaseHelper.cpp
@@ +66,5 @@
> +inline
> +uint32_t
> +RotateBitsLeft32(uint32_t value)
> +{
> +  uint8_t bits = 5;

hm, I don't think it's worth to have this as a constant, convert it to a parameter, please

@@ +77,5 @@
> +{
> +  const char16_t* str = aName.BeginReading();
> +  size_t length = aName.Length();
> +
> +  const uint32_t GoldenRatioU32 = 0x9E3779B9U;

rename it to kGoldenRatioU32 and move after  kSQLiteSchemaVersion, please
Attachment #8335569 - Flags: review?(Jan.Varga)
Attached patch bug940315-fixSplinter Review
updated and output checked by
printf("\n\n\ Names:   %d  =  %d \n", HashName(aName), HashString(aName));
./mach mochitest-plain dom/indexedDB/test/test_open_empty_db.html
Attachment #8335569 - Attachment is obsolete: true
Attachment #8335899 - Flags: review?(Jan.Varga)
Comment on attachment 8335899 [details] [diff] [review]
bug940315-fix

Review of attachment 8335899 [details] [diff] [review]:
-----------------------------------------------------------------

looks good, r=me
Attachment #8335899 - Flags: review?(Jan.Varga) → review+
https://hg.mozilla.org/mozilla-central/rev/8a64e21f0e58
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla28
Whiteboard: [qa-]
You need to log in before you can comment on or make changes to this bug.