Make the documentURI of a document and the currentURI of a docshell immutable objects.

Bug 336699, r=darin, sr=jst
This commit is contained in:
bzbarsky@mit.edu
2006-05-31 17:57:14 +00:00
parent fc8d2eac97
commit 6d9dcaa998
9 changed files with 79 additions and 13 deletions

View File

@@ -1267,7 +1267,8 @@ nsDocShell::SetCurrentURI(nsIURI *aURI, nsIRequest *aRequest,
return PR_FALSE;
}
mCurrentURI = aURI; //This assignment addrefs
mCurrentURI = NS_TryToMakeImmutable(aURI);
PRBool isRoot = PR_FALSE; // Is this the root docshell
PRBool isSubFrame = PR_FALSE; // Is this a subframe navigation?
@@ -3343,9 +3344,11 @@ nsDocShell::GetCurrentURI(nsIURI ** aURI)
{
NS_ENSURE_ARG_POINTER(aURI);
*aURI = mCurrentURI;
NS_IF_ADDREF(*aURI);
if (mCurrentURI) {
return NS_EnsureSafeToReturn(mCurrentURI, aURI);
}
*aURI = nsnull;
return NS_OK;
}