From ca737d3b7956668c2f2ebc2ca58155ec415f742b Mon Sep 17 00:00:00 2001 From: "tbogard%aol.net" Date: Sat, 11 Mar 2000 00:59:08 +0000 Subject: [PATCH] Use the nsIWebNavigation interface for loading an URL where possible instead of the old webShell one. When calling FindChildWithName add the new parameter to state that a child of a different type if ok to return. --- dom/src/base/nsGlobalWindow.cpp | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/dom/src/base/nsGlobalWindow.cpp b/dom/src/base/nsGlobalWindow.cpp index 87465198fca6..c348b7ea1db4 100644 --- a/dom/src/base/nsGlobalWindow.cpp +++ b/dom/src/base/nsGlobalWindow.cpp @@ -1292,8 +1292,10 @@ NS_IMETHODIMP GlobalWindowImpl::Home() else homeURL = url; PR_FREEIF(url); - nsCOMPtr webShell(do_QueryInterface(mDocShell)); - return webShell->LoadURL(homeURL.GetUnicode()); + nsCOMPtr webNav(do_QueryInterface(mDocShell)); + NS_ENSURE_TRUE(webNav, NS_ERROR_FAILURE); + NS_ENSURE_SUCCESS(webNav->LoadURI(homeURL.GetUnicode()), NS_ERROR_FAILURE); + return NS_OK; } NS_IMETHODIMP GlobalWindowImpl::Stop() @@ -1943,7 +1945,7 @@ PRBool GlobalWindowImpl::Resolve(JSContext* aContext, JSObject* aObj, jsval aID) nsCOMPtr child; nsAutoString name(JS_GetStringBytes(JS_ValueToString(aContext, aID))); if(NS_SUCCEEDED(docShellAsNode->FindChildWithName(name.GetUnicode(), - PR_FALSE, nsnull, getter_AddRefs(child)))) + PR_FALSE, PR_FALSE, nsnull, getter_AddRefs(child)))) { if(child) { @@ -2409,12 +2411,18 @@ NS_IMETHODIMP GlobalWindowImpl::OpenInternal(JSContext* cx, jsval* argv, newDocShellItem->SetName(nsnull); nsCOMPtr webShell(do_QueryInterface(newDocShellItem)); - if (loadURL) { + if(loadURL) + { + //XXXPERFORMANCE, we should get the uri and load it directly + //instead of loading with the character string. + nsCOMPtr webNav(do_QueryInterface(newDocShellItem)); + NS_ENSURE_TRUE(webNav, NS_ERROR_FAILURE); nsCOMPtr principal; if (NS_FAILED(secMan->GetSubjectPrincipal(getter_AddRefs(principal)))) return NS_ERROR_FAILURE; nsCOMPtr codebase = do_QueryInterface(principal); - if (codebase) { + if(codebase) + { nsCOMPtr codebaseURI; nsresult rv; if (NS_FAILED(rv = codebase->GetURI(getter_AddRefs(codebaseURI)))) @@ -2426,10 +2434,10 @@ NS_IMETHODIMP GlobalWindowImpl::OpenInternal(JSContext* cx, jsval* argv, webShell->LoadURL(mAbsURL.GetUnicode(), nsnull, PR_TRUE, nsIChannel::LOAD_NORMAL, 0, nsnull, referrer.GetUnicode()); - } else { - webShell->LoadURL(mAbsURL.GetUnicode()); + } + else + webNav->LoadURI(mAbsURL.GetUnicode()); } - } if(windowIsNew) SizeOpenedDocShellItem(newDocShellItem, options, chromeFlags);