Fixing bug 199489. Crash when changing iframe visibility from within the iframe. r=adamlock@netscape.com, sr=heikki@netscape.com.

This commit is contained in:
jst%netscape.com 2003-04-18 18:55:10 +00:00
Родитель 621aa81c2b
Коммит 0033534ef9
3 изменённых файлов: 64 добавлений и 60 удалений

Просмотреть файл

@ -2409,7 +2409,7 @@ nsDocShell::LoadURI(const PRUnichar * aURI,
return NS_OK; // JS may not handle returning of an error code
}
nsCOMPtr<nsIURI> uri;
nsresult rv;
nsresult rv = NS_OK;
// Create the fixup object if necessary
if (!mURIFixup) {
mURIFixup = do_GetService(NS_URIFIXUP_CONTRACTID);
@ -5652,7 +5652,8 @@ nsresult nsDocShell::DoChannelLoad(nsIChannel * aChannel,
}
NS_IMETHODIMP
nsDocShell::ScrollIfAnchor(nsIURI * aURI, PRBool * aWasAnchor, PRUint32 aLoadType, nscoord *cx, nscoord *cy)
nsDocShell::ScrollIfAnchor(nsIURI * aURI, PRBool * aWasAnchor,
PRUint32 aLoadType, nscoord *cx, nscoord *cy)
{
NS_ASSERTION(aURI, "null uri arg");
NS_ASSERTION(aWasAnchor, "null anchor arg");
@ -5667,7 +5668,14 @@ nsDocShell::ScrollIfAnchor(nsIURI * aURI, PRBool * aWasAnchor, PRUint32 aLoadTyp
return NS_OK;
}
nsresult rv = NS_OK;
nsCOMPtr<nsIPresShell> shell;
nsresult rv = GetPresShell(getter_AddRefs(shell));
if (NS_FAILED(rv) || !shell) {
// If we failed to get the shell, or if there is no shell,
// nothing left to do here.
return rv;
}
// NOTE: we assume URIs are absolute for comparison purposes
@ -5753,13 +5761,7 @@ nsDocShell::ScrollIfAnchor(nsIURI * aURI, PRBool * aWasAnchor, PRUint32 aLoadTyp
GetCurScrollPos(ScrollOrientation_X, cx);
GetCurScrollPos(ScrollOrientation_Y, cy);
nsCOMPtr<nsIPresShell> shell;
rv = GetPresShell(getter_AddRefs(shell));
if (NS_FAILED(rv))
return rv;
if (!sNewRef.IsEmpty()) {
if (shell) {
*aWasAnchor = PR_TRUE;
// anchor is there, but if it's a load from history,
@ -5772,14 +5774,15 @@ nsDocShell::ScrollIfAnchor(nsIURI * aURI, PRBool * aWasAnchor, PRUint32 aLoadTyp
// nsUnescape modifies the string that is passed into it.
nsUnescape(str);
// We assume that the bytes are in UTF-8, as it says in the spec:
// We assume that the bytes are in UTF-8, as it says in the
// spec:
// http://www.w3.org/TR/html4/appendix/notes.html#h-B.2.1
// We try the UTF-8 string first, and then try the
// document's charset (see below).
// If the string is not UTF-8, conversion will fail and give us
// an empty Unicode string. In that case, we should just fall
// through to using the page's charset.
// We try the UTF-8 string first, and then try the document's
// charset (see below). If the string is not UTF-8,
// conversion will fail and give us an empty Unicode string.
// In that case, we should just fall through to using the
// page's charset.
rv = NS_ERROR_FAILURE;
NS_ConvertUTF8toUCS2 uStr(str);
if (!uStr.IsEmpty()) {
@ -5787,8 +5790,8 @@ nsDocShell::ScrollIfAnchor(nsIURI * aURI, PRBool * aWasAnchor, PRUint32 aLoadTyp
}
nsMemory::Free(str);
// Above will fail if the anchor name is not UTF-8.
// Need to convert from document charset to unicode.
// Above will fail if the anchor name is not UTF-8. Need to
// convert from document charset to unicode.
if (NS_FAILED(rv)) {
// Get a document charset
@ -5820,7 +5823,6 @@ nsDocShell::ScrollIfAnchor(nsIURI * aURI, PRBool * aWasAnchor, PRUint32 aLoadTyp
rv = shell->GoToAnchor(uStr, scroll);
}
}
}
else {
*aWasAnchor = PR_TRUE;

Просмотреть файл

@ -59,4 +59,4 @@ protected:
nsCOMArray<nsIClipboardDragDropHooks> mHookList;
};
#endif nsDocShellTransferableHooks_h__
#endif // nsDocShellTransferableHooks_h__

Просмотреть файл

@ -252,7 +252,10 @@ nsWebShell::EnsureCommandHandler()
if (!commandUpdater) return NS_ERROR_FAILURE;
nsCOMPtr<nsIDOMWindow> domWindow = do_GetInterface(NS_STATIC_CAST(nsIInterfaceRequestor *, this));
nsresult rv = commandUpdater->Init(domWindow);
#ifdef DEBUG
nsresult rv =
#endif
commandUpdater->Init(domWindow);
NS_ASSERTION(NS_SUCCEEDED(rv), "Initting command manager failed");
}
@ -569,7 +572,6 @@ nsWebShell::OnLinkClickSync(nsIContent *aContent,
nsIDocShell** aDocShell,
nsIRequest** aRequest)
{
nsresult rv;
nsAutoString target(aTargetSpec);
// Initialize the DocShell / Request