Checking in patch from Vidur that fixes part of nsbeta2+ bugs 34667, 36745 and 38537, this fixes a crash associated with javascript: URLs and the fact that javascript: URLs are sometimes invoked multiple times. r=me.

This commit is contained in:
jst%netscape.com 2000-05-31 13:57:02 +00:00
Родитель c5894fe52f
Коммит fb27b7b247
1 изменённых файлов: 12 добавлений и 1 удалений

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

@ -285,7 +285,13 @@ public:
nsresult rv;
nsIByteArrayInputStream* str;
rv = NS_NewByteArrayInputStream(&str, mResult, mLength);
*aInputStream = str;
if (NS_SUCCEEDED(rv)) {
mResult = nsnull; // XXX Whackiness. The input stream takes ownership
*aInputStream = str;
}
else {
*aInputStream = nsnull;
}
return rv;
}
@ -409,6 +415,11 @@ nsJSProtocolHandler::NewChannel(nsIURI* uri, nsIChannel* *result)
nsCOMPtr<nsIStreamIOChannel> channel;
rv = NS_NewStreamIOChannel(getter_AddRefs(channel), uri, thunk);
// If the resultant script evaluation actually does return a
// value, we treat it as html.
if (NS_SUCCEEDED(rv)) {
rv = channel->SetContentType("text/html");
}
if (NS_SUCCEEDED(rv)) {
rv = thunk->Init(uri, channel);
}