Open Bug 1636159 Opened 3 years ago Updated 3 years ago

Remove const_cast in AllocPBackgroundIDBRequestParent methods


(Core :: Storage: IndexedDB, task, P3)





(Reporter: sg, Unassigned)



Two const-removing const_casts are remaining in dom/indexedDB/ActorsParent.cpp, in the NormalTransaction::AllocPBackgroundIDBRequestParent and VersionChangeTransaction::AllocPBackgroundIDBRequestParent methods.

Removing them requires

changing the signature of TransactionBase::AllocRequest to `AllocRequest(

const RequestParams& aParams, bool aTrustParams)`

changing the RequestParams&& argument from ObjectStoreAddOrPutRequestOp::ObjectStoreAddOrPutRequestOp to const RequestParams&

instead of initializing mParams inObjectStoreAddOrPutRequestOp::ObjectStoreAddOrPutRequestOp do that lazily from the RecvPBackgroundIDBRequestConstructor methods

An alternative to steps 2 and 3 would be to remove the RequestParams argument entirely from ObjectStoreAddOrPutRequestOp::ObjectStoreAddOrPutRequestOp, but that would make its initialization even more complex as the initialization of other members also depends on it. This might be considered if this were done consistently for all request types. In that case, we could also avoid copying the keys from the optionalKeyRange parameters for several request types.

Severity: -- → N/A
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.