This fixes the double channel load caused by the directory viewer.

This commit is contained in:
dougt%netscape.com 2001-04-18 22:01:12 +00:00
Родитель 138e2d8e2c
Коммит 4a46df35c0
1 изменённых файлов: 30 добавлений и 2 удалений

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

@ -507,9 +507,37 @@ nsHTTPIndexParser::OnStartRequest(nsIRequest *request, nsISupports* aContext)
if (! ok)
return NS_ERROR_FAILURE;
}
if (!aContext) {
nsCOMPtr<nsIChannel> channel(do_QueryInterface(request));
NS_ASSERTION(channel, "request should be a channel");
// Get the directory from the context
mDirectory = do_QueryInterface(aContext);
// lets hijack the notifications:
channel->SetNotificationCallbacks(this);
// now create the top most resource
nsCOMPtr<nsIURI> uri;
channel->GetURI(getter_AddRefs(uri));
nsXPIDLCString entryuriC;
uri->GetSpec(getter_Copies(entryuriC));
nsCOMPtr<nsIRDFResource> entry;
rv = gRDF->GetResource(entryuriC, getter_AddRefs(entry));
nsString uriUnicode;
uriUnicode.AssignWithConversion(entryuriC);
nsCOMPtr<nsIRDFLiteral> URLVal;
rv = gRDF->GetLiteral(uriUnicode.GetUnicode(), getter_AddRefs(URLVal));
mDataSource->Assert(entry, kHTTPIndex_URL, URLVal, PR_TRUE);
mDirectory = do_QueryInterface(entry);
}
else
{
// Get the directory from the context
mDirectory = do_QueryInterface(aContext);
}
if (!mDirectory) {
request->Cancel(NS_BINDING_ABORTED);