Back out c91b18cafc64 (bug 960749)

CLOSED TREE
This commit is contained in:
Phil Ringnalda 2014-03-18 20:40:12 -07:00
parent 5efa0fa5aa
commit 3d1df5e389
4 changed files with 5 additions and 100 deletions

View File

@ -81,7 +81,7 @@ this.DownloadsIPC = {
receiveMessage: function(aMessage) {
let download = aMessage.data;
debug("message: " + aMessage.name);
debug("message: " + aMessage.name + " " + download.id);
switch(aMessage.name) {
case "Downloads:GetList:Return":
this._updateDownloadsArray(download);

View File

@ -6,7 +6,6 @@ support-files =
[test_downloads_navigator_object.html]
[test_downloads_basic.html]
[test_downloads_large.html]
[test_downloads_bad_file.html]
[test_downloads_pause_remove.html]
[test_downloads_pause_resume.html]
skip-if = toolkit=='gonk' # b2g(bug 947167) b2g-debug(bug 947167)

View File

@ -1,93 +0,0 @@
<!DOCTYPE html>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=960749
-->
<head>
<title>Test for Bug 960749 Downloads API</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=960749">Mozilla Bug 960749</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<a href="serve_file.sjs?contentType=application/octet-stream&size=1024" download=".&lt;.EVIL.&gt;\ / : * ? &quot; |file.bin" id="download1">Download #1</a>
<pre id="test">
<script class="testbody" type="text/javascript;version=1.7">
// Testing a simple download, waiting for it to be done.
SimpleTest.waitForExplicitFinish();
var index = -1;
var expected = "_.EVIL.__ _ _ _ _ _ _file.bin";
function next() {
index += 1;
if (index >= steps.length) {
ok(false, "Shouldn't get here!");
return;
}
try {
steps[index]();
} catch(ex) {
ok(false, "Caught exception", ex);
}
}
function checkTargetFilename(download) {
ok(download.path.endsWith(expected),
"Download path leaf name '" + download.path +
"' should match '" + expected + "' filename.");
SimpleTest.finish();
}
function downloadChange(evt) {
var download = evt.download;
if (download.state === "succeeded") {
checkTargetFilename(download);
}
}
function downloadStart(evt) {
var download = evt.download;
download.onstatechange = downloadChange;
}
var steps = [
// Start by setting the pref to true.
function() {
SpecialPowers.pushPrefEnv({
set: [["dom.mozDownloads.enabled", true]]
}, next);
},
// Setup the event listeners.
function() {
SpecialPowers.pushPermissions([
{type: "downloads", allow: true, context: document}
], function() {
navigator.mozDownloadManager.ondownloadstart = downloadStart;
next();
});
},
// Click on the <a download> to start the download.
function() {
document.getElementById("download1").click();
}
];
next();
</script>
</pre>
</body>
</html>

View File

@ -110,18 +110,17 @@ NS_COM_GLUE void NS_MakeRandomString(char *buf, int32_t bufLen);
#define LFSTR "\012"
#define CRLF "\015\012" /* A CR LF equivalent string */
// We use the most restrictive filesystem as our default set of illegal filename
// characters. This is currently Windows.
#define OS_FILE_ILLEGAL_CHARACTERS "\\/:*?\"<>|"
#if defined(XP_MACOSX)
#define FILE_PATH_SEPARATOR "/"
#define OS_FILE_ILLEGAL_CHARACTERS ":"
#elif defined(XP_WIN)
#define FILE_PATH_SEPARATOR "\\"
#define OS_FILE_ILLEGAL_CHARACTERS "/:*?\"<>|"
#elif defined(XP_UNIX)
#define FILE_PATH_SEPARATOR "/"
#define OS_FILE_ILLEGAL_CHARACTERS ""
#else
#error need_to_define_your_file_path_separator_and_maybe_illegal_characters
#error need_to_define_your_file_path_separator_and_illegal_characters
#endif
// Not all these control characters are illegal in all OSs, but we don't really