Ensure all members are initialized before loading selfie

Theoretically, if a selfie is loaded from corrupted
storage resulting in a thrown exception from the
constructor, this would cause an improperly initialized
HostnameBasedDB instance and overall potentially a
broken uBO.

Related feedback:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1543880#c7
This commit is contained in:
Raymond Hill 2019-07-12 09:05:42 -04:00
parent ba6eb45e9c
commit d6927cf1fe
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 4 additions and 4 deletions

View File

@ -516,14 +516,14 @@
this.nBits = nBits;
this.timer = undefined;
this.strToIdMap = new Map();
if ( selfie !== undefined ) {
this.fromSelfie(selfie);
return;
}
this.hostnameToSlotIdMap = new Map();
this.hostnameSlots = [];
this.strSlots = [];
this.size = 0;
if ( selfie !== undefined ) {
this.fromSelfie(selfie);
return;
}
}
store(hn, bits, s) {