Closed Bug 403767 Opened 18 years ago Closed 18 years ago

Remove unnecessary check on InitDB

Categories

(Core :: Networking: Cookies, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: mak, Assigned: mak)

Details

Attachments

(1 file)

nsCookieService::InitDB checks that all table columns are there using the following way: // check if all the expected columns exist nsCOMPtr<mozIStorageStatement> stmt; rv = mDBConn->CreateStatement(NS_LITERAL_CSTRING( "SELECT id, name, value, host, path, expiry, isSecure, isHttpOnly " "FROM moz_cookies"), getter_AddRefs(stmt)); if (NS_SUCCEEDED(rv)) { PRBool hasResult; rv = stmt->ExecuteStep(&hasResult); } if (NS_FAILED(rv)) { [omissis] Since CreateStatement will already FAIL if columns are not there, the ExecuteStep is useless and it is also not resetted. The execute could be removed, the same method to check for columns sanity is already used into nsDownloadManager.cpp, with only the createstatement check. if approved this will be checkin-needed
Attachment #288667 - Flags: review?(dwitte)
Comment on attachment 288667 [details] [diff] [review] Remove unnecessary check nice catch; i tested this to make sure and you're right. (note that it's alright not to explicitly reset stmt here; the destructor will do that automatically when it goes out of scope.) r=me, recommend you request sr=mconnor@mozilla.com, and i'll check it in for you. thanks for the patch!
Attachment #288667 - Flags: review?(dwitte) → review+
Assignee: nobody → mak77
Comment on attachment 288667 [details] [diff] [review] Remove unnecessary check requesting SR
Attachment #288667 - Flags: superreview?(mconnor)
Comment on attachment 288667 [details] [diff] [review] Remove unnecessary check i checked in your patch while modifying that code as part of another bug (bug 403372). so, no need for additional reviews here.
Attachment #288667 - Flags: superreview?(mconnor)
fixed - thanks!
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: