Open Bug 846855 Opened 12 years ago Updated 2 years ago

make nsIDocShellTreeNode::childCount infallible

Categories

(Core :: DOM: Navigation, defect)

defect

Tracking

()

People

(Reporter: froydnj, Unassigned)

Details

Attachments

(1 file)

No description provided.
The only wrinkle is making nsIDocShellTree{Node,Item} builtinclass, since only builtinclass interfaces can have [infallible] attributes. But since nsIDocShell is already builtinclass, this modification doesn't seem like much of a stretch.
Attachment #720057 - Flags: review?(bugs)
Comment on attachment 720057 [details] [diff] [review] make nsIDocShellTreeNode::childCount infallible >-NS_IMETHODIMP >+/* [infallible] */ NS_IMETHODIMP > nsDocShell::GetChildCount(int32_t * aChildCount) > { >- NS_ENSURE_ARG_POINTER(aChildCount); > *aChildCount = mChildList.Length(); > return NS_OK; > } Why removal of NS_ENSURE_ARG_POINTER? (some binary addon might rely on it) >+ int32_t pcnt=0, ncnt=0; space before and after = >+++ b/netwerk/cookie/nsCookieService.cpp >@@ -1439,16 +1439,20 @@ NS_IMETHODIMP > nsCookieService::Observe(nsISupports *aSubject, > const char *aTopic, > const PRUnichar *aData) > { > // check the topic > if (!strcmp(aTopic, "profile-before-change")) { > // The profile is about to change, > // or is going away because the application is shutting down. >+ if (mDBState && mDBState->dbConn && >+ !nsCRT::strcmp(aData, NS_LITERAL_STRING("shutdown-persist").get())) { >+ RemoveAll(); >+ } This change isn't related to this bug.
Attachment #720057 - Flags: review?(bugs) → review+
(In reply to Olli Pettay [:smaug] from comment #2) > >-NS_IMETHODIMP > >+/* [infallible] */ NS_IMETHODIMP > > nsDocShell::GetChildCount(int32_t * aChildCount) > > { > >- NS_ENSURE_ARG_POINTER(aChildCount); > > *aChildCount = mChildList.Length(); > > return NS_OK; > > } > Why removal of NS_ENSURE_ARG_POINTER? > (some binary addon might rely on it) Because if aChildCount is null, we'll return NS_ERROR_INVALID_POINTER. And we can't do that if the method is infallible. > >+++ b/netwerk/cookie/nsCookieService.cpp > >@@ -1439,16 +1439,20 @@ NS_IMETHODIMP > > nsCookieService::Observe(nsISupports *aSubject, > > const char *aTopic, > > const PRUnichar *aData) > > { > > // check the topic > > if (!strcmp(aTopic, "profile-before-change")) { > > // The profile is about to change, > > // or is going away because the application is shutting down. > >+ if (mDBState && mDBState->dbConn && > >+ !nsCRT::strcmp(aData, NS_LITERAL_STRING("shutdown-persist").get())) { > >+ RemoveAll(); > >+ } > This change isn't related to this bug. Doh, sorry about that.
(In reply to Nathan Froyd (:froydnj) (AFKish through 3 January 2014) from comment #3) > (In reply to Olli Pettay [:smaug] from comment #2) > > >-NS_IMETHODIMP > > >+/* [infallible] */ NS_IMETHODIMP > > > nsDocShell::GetChildCount(int32_t * aChildCount) > > > { > > >- NS_ENSURE_ARG_POINTER(aChildCount); > > > *aChildCount = mChildList.Length(); > > > return NS_OK; > > > } > > Why removal of NS_ENSURE_ARG_POINTER? > > (some binary addon might rely on it) > > Because if aChildCount is null, we'll return NS_ERROR_INVALID_POINTER. And > we can't do that if the method is infallible. well, technically we only actually require the method to never fail when called by the inline wrapper right? and we know in that particular case the arg will never be null and so in that special case it will never fail.
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: