mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-30 05:35:31 +00:00
49 lines
1.4 KiB
HTML
49 lines
1.4 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<!--
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=578096
|
|
-->
|
|
<head>
|
|
<title>Test for Bug 578096</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=578096">Mozilla Bug 578096</a>
|
|
<p id="display"></p>
|
|
<div id="content">
|
|
<input type="file" id="file" onchange="fireXHR()">
|
|
</div>
|
|
<pre id="test">
|
|
<script class="testbody" type="text/javascript">
|
|
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
|
|
|
const Cc = Components.classes;
|
|
const Ci = Components.interfaces;
|
|
|
|
var file = Cc["@mozilla.org/file/directory_service;1"]
|
|
.getService(Ci.nsIProperties)
|
|
.get("TmpD", Ci.nsIFile);
|
|
file.append("foo.txt");
|
|
file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0600);
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
document.getElementById('file').value = file.path;
|
|
|
|
var xhr = new XMLHttpRequest();
|
|
xhr.onreadystatechange = function(event) {
|
|
if (xhr.readyState == 4) {
|
|
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
|
file.remove(false);
|
|
ok(true, "We didn't throw! Yay!");
|
|
SimpleTest.finish();
|
|
}
|
|
}
|
|
xhr.open('POST', window.location, true);
|
|
xhr.send(document.getElementById('file').files[0]);
|
|
</script>
|
|
</pre>
|
|
</body>
|
|
</html>
|