Bug 403852: Unable to access nsIDOMFile using the [] operator. r+sr=sicking, b=dsicore

This commit is contained in:
dcamp@mozilla.com 2007-12-17 13:20:40 -08:00
Родитель 0669a9b4c3
Коммит 61bf055bb4
3 изменённых файлов: 42 добавлений и 1 удалений

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

@ -116,6 +116,7 @@ _TEST_FILES = test_bug5141.html \
test_bug402150.html \
test_bug402150.html^headers^ \
test_bug401662.html \
test_bug403852.html \
test_bug403868.xml \
test_bug405182.html \
$(NULL)

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

@ -0,0 +1,40 @@
<!DOCTYPE HTML>
<html>
<head>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=403852
-->
<title>Test for Bug 403852</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=403852">Mozilla Bug 403852</a>
<p id="display">
<input id="fileList" type="file"></input>
</p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var dirSvc = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties);
var testFile = dirSvc.get("ProfD", Components.interfaces.nsIFile);
testFile.append("prefs.js");
var fileList = document.getElementById('fileList');
fileList.value = testFile.path;
// Make sure the file is accessible with indexed notation
var domFile = fileList.files[0];
is(domFile.fileName, "prefs.js", "fileName should be prefs.js");
</script>
</pre>
</body> </html>

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

@ -1213,7 +1213,7 @@ static nsDOMClassInfoData sClassInfoData[] = {
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(FileList, nsFileListSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
ARRAY_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(File, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(FileException, nsDOMGenericSH,