Bug #24274--> delay creating a dummy channel in DoLoadURL until we are sure

we are going to need it.
r=bienvenu,travis
a=chofmann
This commit is contained in:
mscott%netscape.com 2000-01-20 03:54:35 +00:00
Родитель 54fc7472cf
Коммит 2fc75424f3
2 изменённых файлов: 12 добавлений и 4 удалений

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

@ -1627,9 +1627,11 @@ nsWebShell::DoLoadURL(nsIURI * aUri,
*/ */
nsIInterfaceRequestor * interfaceRequestor = NS_STATIC_CAST(nsIInterfaceRequestor *, this); nsIInterfaceRequestor * interfaceRequestor = NS_STATIC_CAST(nsIInterfaceRequestor *, this);
nsCOMPtr<nsIChannel> dummyChannel; nsCOMPtr<nsIChannel> dummyChannel;
// creating a channel is expensive...don't create it unless we know we have to
// so move the creation down into each of the if clauses...
if (nsnull != (const char *) ref) {
rv = NS_OpenURI(getter_AddRefs(dummyChannel), aUri, nsnull, interfaceRequestor); rv = NS_OpenURI(getter_AddRefs(dummyChannel), aUri, nsnull, interfaceRequestor);
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
if (nsnull != (const char *) ref) {
rv = OnStartDocumentLoad(mDocLoader, aUri, "load"); rv = OnStartDocumentLoad(mDocLoader, aUri, "load");
// Go to the anchor in the current document // Go to the anchor in the current document
rv = presShell->GoToAnchor(nsAutoString(ref)); rv = presShell->GoToAnchor(nsAutoString(ref));
@ -1645,6 +1647,8 @@ nsWebShell::DoLoadURL(nsIURI * aUri,
} }
else if (aType == nsISessionHistory::LOAD_HISTORY) else if (aType == nsISessionHistory::LOAD_HISTORY)
{ {
rv = NS_OpenURI(getter_AddRefs(dummyChannel), aUri, nsnull, interfaceRequestor);
if (NS_FAILED(rv)) return rv;
rv = OnStartDocumentLoad(mDocLoader, aUri, "load"); rv = OnStartDocumentLoad(mDocLoader, aUri, "load");
// Go to the top of the current document // Go to the top of the current document
nsCOMPtr<nsIViewManager> viewMgr; nsCOMPtr<nsIViewManager> viewMgr;

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

@ -1627,9 +1627,11 @@ nsWebShell::DoLoadURL(nsIURI * aUri,
*/ */
nsIInterfaceRequestor * interfaceRequestor = NS_STATIC_CAST(nsIInterfaceRequestor *, this); nsIInterfaceRequestor * interfaceRequestor = NS_STATIC_CAST(nsIInterfaceRequestor *, this);
nsCOMPtr<nsIChannel> dummyChannel; nsCOMPtr<nsIChannel> dummyChannel;
// creating a channel is expensive...don't create it unless we know we have to
// so move the creation down into each of the if clauses...
if (nsnull != (const char *) ref) {
rv = NS_OpenURI(getter_AddRefs(dummyChannel), aUri, nsnull, interfaceRequestor); rv = NS_OpenURI(getter_AddRefs(dummyChannel), aUri, nsnull, interfaceRequestor);
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
if (nsnull != (const char *) ref) {
rv = OnStartDocumentLoad(mDocLoader, aUri, "load"); rv = OnStartDocumentLoad(mDocLoader, aUri, "load");
// Go to the anchor in the current document // Go to the anchor in the current document
rv = presShell->GoToAnchor(nsAutoString(ref)); rv = presShell->GoToAnchor(nsAutoString(ref));
@ -1645,6 +1647,8 @@ nsWebShell::DoLoadURL(nsIURI * aUri,
} }
else if (aType == nsISessionHistory::LOAD_HISTORY) else if (aType == nsISessionHistory::LOAD_HISTORY)
{ {
rv = NS_OpenURI(getter_AddRefs(dummyChannel), aUri, nsnull, interfaceRequestor);
if (NS_FAILED(rv)) return rv;
rv = OnStartDocumentLoad(mDocLoader, aUri, "load"); rv = OnStartDocumentLoad(mDocLoader, aUri, "load");
// Go to the top of the current document // Go to the top of the current document
nsCOMPtr<nsIViewManager> viewMgr; nsCOMPtr<nsIViewManager> viewMgr;