Bug 1149395 - Improve test case for mozSetFileArray recompartmenting. r=mrbkap

CLOSED TREE
This commit is contained in:
Jed Davis 2015-03-31 16:14:00 -04:00
Родитель 5be539182d
Коммит e05c60dc2e
1 изменённых файлов: 9 добавлений и 3 удалений

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

@ -30,14 +30,20 @@ helper.addMessageListener("fail", function onFail(message) {
helper.addMessageListener("file.opened", onFileOpened);
helper.sendAsyncMessage("file.open", "test_bug1146116.txt");
function getGlobal(thing) {
return SpecialPowers.unwrap(SpecialPowers.Cu.getGlobalForObject(thing));
}
function onFileOpened(message) {
const file = message.domFile;
const elem = document.getElementById("file");
isnot(SpecialPowers.Cu.getGlobalForObject(elem), window,
is(getGlobal(elem), window,
"getGlobal() works as expected");
isnot(getGlobal(file), window,
"File from MessageManager is wrapped");
SpecialPowers.wrap(elem).mozSetFileArray([file]);
is(SpecialPowers.unwrap(SpecialPowers.Cu.getGlobalForObject(elem.files[0])),
window, "File read back from input element is not wrapped");
is(getGlobal(elem.files[0]), window,
"File read back from input element is not wrapped");
helper.addMessageListener("file.removed", onFileRemoved);
helper.sendAsyncMessage("file.remove", null);
}