зеркало из https://github.com/mozilla/pjs.git
Bug 407303: only check JAR loads for unsafe content types if the underlying load completed successfully. r+sr=bz, blocking1.9=schrep
This commit is contained in:
Родитель
fb9ffb54b2
Коммит
8e0f93d5f2
|
@ -724,11 +724,8 @@ nsJARChannel::OnDownloadComplete(nsIDownloader *downloader,
|
|||
{
|
||||
nsresult rv;
|
||||
|
||||
// Grab the security info from our base channel
|
||||
nsCOMPtr<nsIChannel> channel(do_QueryInterface(request));
|
||||
if (channel) {
|
||||
channel->GetSecurityInfo(getter_AddRefs(mSecurityInfo));
|
||||
|
||||
PRUint32 loadFlags;
|
||||
channel->GetLoadFlags(&loadFlags);
|
||||
if (loadFlags & LOAD_REPLACE) {
|
||||
|
@ -748,8 +745,15 @@ nsJARChannel::OnDownloadComplete(nsIDownloader *downloader,
|
|||
mJarURI = newURI;
|
||||
}
|
||||
}
|
||||
status = rv;
|
||||
if (NS_SUCCEEDED(status)) {
|
||||
status = rv;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(status) && channel) {
|
||||
// Grab the security info from our base channel
|
||||
channel->GetSecurityInfo(getter_AddRefs(mSecurityInfo));
|
||||
|
||||
nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(channel));
|
||||
if (httpChannel) {
|
||||
|
@ -774,12 +778,9 @@ nsJARChannel::OnDownloadComplete(nsIDownloader *downloader,
|
|||
mIsUnsafe = unsafe;
|
||||
}
|
||||
}
|
||||
|
||||
// XXX: THIS IS TEMPORARY
|
||||
//mIsUnsafe = PR_FALSE;
|
||||
}
|
||||
|
||||
if (mIsUnsafe) {
|
||||
if (NS_SUCCEEDED(status) && mIsUnsafe) {
|
||||
PRBool allowUnpack = PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIPrefBranch> prefs =
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
// Regression test for bug 407303 - A failed channel should not be checked
|
||||
// for an unsafe content type.
|
||||
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
|
||||
// XXX: NS_ERROR_UNKNOWN_HOST is not in Components.results
|
||||
const NS_ERROR_UNKNOWN_HOST = 0x804B001E;
|
||||
|
||||
var listener = {
|
||||
QueryInterface: function(iid) {
|
||||
if (iid.equals(Ci.nsISupports) ||
|
||||
iid.equals(Ci.nsIRequestObserver))
|
||||
return this;
|
||||
throw Cr.NS_ERROR_NO_INTERFACE;
|
||||
},
|
||||
|
||||
onStartRequest: function(request, context) {
|
||||
},
|
||||
|
||||
onDataAvailable: function(request, context, stream, offset, count) {
|
||||
do_throw("shouldn't get data!");
|
||||
},
|
||||
|
||||
onStopRequest: function(request, context, status) {
|
||||
do_check_eq(status, NS_ERROR_UNKNOWN_HOST);
|
||||
do_test_finished();
|
||||
}
|
||||
};
|
||||
|
||||
function run_test() {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
|
||||
var channel = ios.newChannel("jar:http://test.invalid/test.jar!/index.html",
|
||||
null, null);
|
||||
channel.asyncOpen(listener, null);
|
||||
do_test_pending();
|
||||
}
|
Загрузка…
Ссылка в новой задаче