Last Comment Bug 711447 - Close connection in nsPermissionManager
: Close connection in nsPermissionManager
Status: RESOLVED FIXED
[Snappy:p1]
:
Product: Core
Classification: Components
Component: Networking: Cookies (show other bugs)
: Trunk
: x86_64 Linux
: -- normal (vote)
: mozilla12
Assigned To: Rafael Ávila de Espíndola (:espindola) (not reading bugmail)
:
: Patrick McManus [:mcmanus]
Mentors:
Depends on:
Blocks: 662444
  Show dependency treegraph
 
Reported: 2011-12-16 07:20 PST by Rafael Ávila de Espíndola (:espindola) (not reading bugmail)
Modified: 2011-12-22 03:49 PST (History)
3 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Close connection in nsPermissionManager (1.04 KB, patch)
2011-12-16 07:23 PST, Rafael Ávila de Espíndola (:espindola) (not reading bugmail)
mak77: review+
sdwilsh: review-
Details | Diff | Splinter Review
Close connection in nsPermissionManager (3.28 KB, patch)
2011-12-19 08:23 PST, Rafael Ávila de Espíndola (:espindola) (not reading bugmail)
no flags Details | Diff | Splinter Review
Close connection in nsPermissionManager (3.33 KB, patch)
2011-12-19 14:57 PST, Rafael Ávila de Espíndola (:espindola) (not reading bugmail)
dwitte: review+
mak77: feedback+
mozbugs: feedback+
Details | Diff | Splinter Review

Description Rafael Ávila de Espíndola (:espindola) (not reading bugmail) 2011-12-16 07:20:30 PST

    
Comment 1 Rafael Ávila de Espíndola (:espindola) (not reading bugmail) 2011-12-16 07:23:32 PST
Created attachment 582267 [details] [diff] [review]
Close connection in nsPermissionManager

https://tbpl.mozilla.org/?tree=Try&rev=06d000ca95bf
Comment 2 Marco Bonardo [::mak] 2011-12-16 12:55:33 PST
Comment on attachment 582267 [details] [diff] [review]
Close connection in nsPermissionManager

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

looks ok
Comment 3 Shawn Wilsher :sdwilsh 2011-12-17 12:13:10 PST
Comment on attachment 582267 [details] [diff] [review]
Close connection in nsPermissionManager

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

::: extensions/cookie/nsPermissionManager.cpp
@@ +797,5 @@
>        mStmtInsert = nsnull;
>        mStmtDelete = nsnull;
>        mStmtUpdate = nsnull;
> +      mozilla::DebugOnly<nsresult> rv = mDBConn->Close();
> +      MOZ_ASSERT(NS_SUCCEEDED(rv));

You should add a helper method to this and make this and `RemoveAllInternal` call the helper.  We were doing it right in one place, but not the other.
Comment 4 Rafael Ávila de Espíndola (:espindola) (not reading bugmail) 2011-12-19 08:23:20 PST
Created attachment 582835 [details] [diff] [review]
Close connection in nsPermissionManager

https://tbpl.mozilla.org/?tree=Try&rev=6601609921ae
Comment 5 Marco Bonardo [::mak] 2011-12-19 12:21:06 PST
Comment on attachment 582835 [details] [diff] [review]
Close connection in nsPermissionManager

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

::: extensions/cookie/nsPermissionManager.cpp
@@ +620,5 @@
>    return rv;
>  }
>  
> +void
> +nsPermissionManager::CloseDBInternal()

I don't like the Internal suffix here, we usually use it when there's another exposed method with the same name, that's not this case, just CloseDB() will be fine afaict.

@@ +646,1 @@
>        mDBConn = nsnull;

you can move this inside the helper "if (mDBConn)" scope

::: extensions/cookie/nsPermissionManager.h
@@ +221,5 @@
>                                           PRUint32          aExpireType,
>                                           PRInt64           aExpireTime,
>                                           const PRUnichar  *aData);
>    void     NotifyObservers(nsIPermission *aPermission, const PRUnichar *aData);
> +  void     CloseDBInternal();

this may like a nice but simple javadoc explaining what it does.
Comment 6 Rafael Ávila de Espíndola (:espindola) (not reading bugmail) 2011-12-19 14:57:14 PST
Created attachment 582972 [details] [diff] [review]
Close connection in nsPermissionManager

This implement all the comments, except for the javadoc, since the file had no javadoc I just added a plain comment.

https://tbpl.mozilla.org/?tree=Try&rev=8e4a8b9a5073
Comment 7 Marco Bonardo [::mak] 2011-12-19 17:22:33 PST
Comment on attachment 582972 [details] [diff] [review]
Close connection in nsPermissionManager

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

I don't have further comments, I'm forwarding final review to either swilsh or dwitte, on a first come first serve handling, since sdwilsh appears to be on vacation
Comment 8 Sid Stamm [:geekboy or :sstamm] 2011-12-21 11:36:25 PST
Comment on attachment 582972 [details] [diff] [review]
Close connection in nsPermissionManager

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

Looks fine to me too.  I can't technically r+ this, so f+ at taras's request.
Comment 9 dwitte@gmail.com 2011-12-21 12:47:19 PST
Comment on attachment 582972 [details] [diff] [review]
Close connection in nsPermissionManager

Looks good, thanks. r=dwitte
Comment 10 Rafael Ávila de Espíndola (:espindola) (not reading bugmail) 2011-12-21 14:08:59 PST
https://tbpl.mozilla.org/?tree=Mozilla-Inbound&rev=ed120f1a9dea
Comment 11 Ed Morley [:emorley] 2011-12-22 03:49:56 PST
https://hg.mozilla.org/mozilla-central/rev/ed120f1a9dea

Note You need to log in before you can comment on or make changes to this bug.