зеркало из https://github.com/mozilla/gecko-dev.git
Bug 481342 - Fix some unpacking logic. r+sr=bz
--HG-- rename : docshell/test/bug369814.zip => docshell/test/bug369814.jar
This commit is contained in:
Родитель
d4612bdc64
Коммит
39401f5525
|
@ -61,6 +61,7 @@ _TEST_FILES = \
|
|||
test_bug344861.html \
|
||||
test_bug369814.html \
|
||||
bug369814.zip \
|
||||
bug369814.jar \
|
||||
test_bug384014.html \
|
||||
test_bug387979.html \
|
||||
test_bug404548.html \
|
||||
|
|
Двоичный файл не отображается.
|
@ -149,6 +149,18 @@ var gTests = [
|
|||
"pokes" : { },
|
||||
"func" : anchorTest,
|
||||
},
|
||||
{ "name" : "iframes.html loaded from view-source jar type, pref disabled",
|
||||
"url" : "jar:view-source:http://localhost:8888/tests/docshell/test/bug369814.jar!/iframes.html",
|
||||
"pref" : true,
|
||||
"pokes" : { },
|
||||
"func" : loadErrorTest
|
||||
},
|
||||
{ "name" : "iframes.html loaded from view-source jar type, pref enabled",
|
||||
"url" : "jar:view-source:http://localhost:8888/tests/docshell/test/bug369814.jar!/iframes.html",
|
||||
"pref" : true,
|
||||
"pokes" : { },
|
||||
"func" : loadErrorTest
|
||||
},
|
||||
];
|
||||
|
||||
var gNextTest = 0;
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#include "nsEscape.h"
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
#include "nsIViewSourceChannel.h"
|
||||
#include "nsChannelProperties.h"
|
||||
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
|
@ -786,8 +787,11 @@ nsJARChannel::OnDownloadComplete(nsIDownloader *downloader,
|
|||
nsCAutoString contentType;
|
||||
nsCAutoString charset;
|
||||
NS_ParseContentType(header, contentType, charset);
|
||||
mIsUnsafe = !contentType.EqualsLiteral("application/java-archive") &&
|
||||
!contentType.EqualsLiteral("application/x-jar");
|
||||
nsCAutoString channelContentType;
|
||||
channel->GetContentType(channelContentType);
|
||||
mIsUnsafe = !(contentType.Equals(channelContentType) &&
|
||||
(contentType.EqualsLiteral("application/java-archive") ||
|
||||
contentType.EqualsLiteral("application/x-jar")));
|
||||
rv = httpChannel->GetResponseHeader(NS_LITERAL_CSTRING("Content-Disposition"),
|
||||
header);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
|
@ -820,6 +824,14 @@ nsJARChannel::OnDownloadComplete(nsIDownloader *downloader,
|
|||
}
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(status)) {
|
||||
// Refuse to unpack view-source: jars even if open-unsafe-types is set.
|
||||
nsCOMPtr<nsIViewSourceChannel> viewSource = do_QueryInterface(channel);
|
||||
if (viewSource) {
|
||||
status = NS_ERROR_UNSAFE_CONTENT_TYPE;
|
||||
}
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(status)) {
|
||||
mJarFile = file;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче