Backed out changeset ef6fba6c2878 (bug 852143) for mochitest-other orange on a CLOSED TREE.

This commit is contained in:
Ryan VanderMeulen 2013-03-27 12:05:32 -04:00
Родитель 6e5f871216
Коммит a521727b0c
2 изменённых файлов: 1 добавлений и 18 удалений

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

@ -347,12 +347,6 @@ AbstractFile.writeAtomic =
throw OS.File.Error.exists("writeAtomic"); throw OS.File.Error.exists("writeAtomic");
} }
if (typeof buffer == "string") {
// Normalize buffer to a C buffer by encoding it
let encoding = options.encoding || "utf-8";
buffer = new TextEncoder(encoding).encode(buffer);
}
if ("flush" in options && !options.flush) { if ("flush" in options && !options.flush) {
// Just write, without any renaming trick // Just write, without any renaming trick
let dest; let dest;
@ -364,6 +358,7 @@ AbstractFile.writeAtomic =
} }
} }
let tmpPath = options.tmpPath; let tmpPath = options.tmpPath;
if (!tmpPath) { if (!tmpPath) {
throw new TypeError("Expected option tmpPath"); throw new TypeError("Expected option tmpPath");

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

@ -411,18 +411,6 @@ let test_read_write_all = maketest("read_write_all", function read_write_all(tes
test.ok(true, "Without a tmpPath, writeAtomic has failed as expected"); test.ok(true, "Without a tmpPath, writeAtomic has failed as expected");
} }
// Write strings, default encoding
let ARBITRARY_STRING = "aeiouyâêîôûçß•";
yield OS.File.writeAtomic(pathDest, ARBITRARY_STRING, {tmpPath: tmpPath});
let array = yield OS.File.read(pathDest);
let IN_STRING = (new TextDecoder()).decode(array);
test.is(ARBITRARY_STRING, IN_STRING, "String write + read with default encoding works");
yield OS.File.writeAtomic(pathDest, ARBITRARY_STRING, {tmpPath: tmpPath, encoding: "utf-16"});
array = yield OS.File.read(pathDest);
IN_STRING = (new TextDecoder("utf-16")).decode(array);
test.is(ARBITRARY_STRING, IN_STRING, "String write + read with utf-16 encoding works");
// Cleanup. // Cleanup.
OS.File.remove(pathDest); OS.File.remove(pathDest);