Remove DBConn() and other synchronous mozStorage calls from Places tests
Categories
(Toolkit :: Places, enhancement, P3)
Tracking
()
People
(Reporter: mak, Unassigned, Mentored)
Details
Attachments
(1 file)
Updated•3 years ago
|
| Reporter | ||
Updated•2 years ago
|
Comment 1•2 years ago
|
||
Hello, can I please work on this? Thank you.
| Reporter | ||
Comment 2•2 years ago
•
|
||
Bugs are assigned automatically when a patch is attached.
The scope of the bug is to remove DBConn() from https://searchfox.org/mozilla-central/rev/5f7ad06a2cffb7eda69229238b15198994b548e0/toolkit/components/places/tests/head_common.js#101-134 and then fix all the callers using Sqlite.sys.mjs syntax, that means one of:
Read-only SELECT query:
let db = await PlacesUtils.promiseDatabaseConnection();
let rows = await db.execute(<sql_query>, <query_params>);
Read/write query:
await PlacesUtils.withConnectionWrapper(<unique_label>, async db => {
await db.execute(<sql_query>, <query_params>);
});
There are many examples, you can search on searchfox.org
After modifying the code, you can ./mach build faster and ./mach test toolkit/components/places to verify
Comment 3•2 years ago
|
||
Sir, I tried my best to understand this bug and made an example change. I will be thankful if you can review this and guide me whether I am doing correct or not - https://paste.mozilla.org/Efo68igt
| Reporter | ||
Comment 4•2 years ago
|
||
(In reply to Abhishek from comment #3)
Sir, I tried my best to understand this bug and made an example change. I will be thankful if you can review this and guide me whether I am doing correct or not - https://paste.mozilla.org/Efo68igt
It's mostly ok, though row should be rows because execute may indeed return 0, 1 or multiple rows.
There's also no .dispose() since that's just an array, it will be garbage collected. So you don't need the try/finally.
Then of course the function was synchronous, the new one is asynchronous, so the callers must be fixed.
Comment 5•2 years ago
|
||
Comment 6•2 years ago
|
||
I placed this under WIP because until now, I only modified one file, and I am not sure if everything is correct, especially about the dump_table function. Please have a quick review and I will update other files also
Updated•2 years ago
|
Comment 7•2 years ago
|
||
Sir, my end-semester exams are going to start this week. Once my exams will over, I will continue with this bug. Thanks
Comment 8•2 years ago
|
||
The bug assignee is inactive on Bugzilla, so the assignee is being reset.
Description
•