Bug 1119957 - Fix test_logger.js bustage from OS.File neutering ArrayBuffers after bug 1077354. r=clokep a=aleth
authoraleth <aleth@instantbird.org>
Mon, 12 Jan 2015 14:26:30 +0100
changeset 21628 702909d96ee0ab3ba48d8aafc826b76f4bc4a8f7
parent 21627 9c437b0d8caf4b3a1221cb07da6e709fc9fd7df3
child 21629 284ea3b98840bbf9f4bbdf8a0fd90d37390befb1
push id1305
push usermbanner@mozilla.com
push dateMon, 23 Feb 2015 19:48:12 +0000
treeherdercomm-beta@3ae4f13858fd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersclokep, aleth
bugs1119957, 1077354
Bug 1119957 - Fix test_logger.js bustage from OS.File neutering ArrayBuffers after bug 1077354. r=clokep a=aleth
chat/components/src/test/test_logger.js
--- a/chat/components/src/test/test_logger.js
+++ b/chat/components/src/test/test_logger.js
@@ -191,17 +191,17 @@ let test_queueFileOperation = function* 
 
   // Repeat above test for a rejected promise.
   let p2 = qFO("path2", dummyRejectedOperation);
   equal(gFP.get("path2"), p2);
   // This should throw since p2 rejected. Drop the error.
   yield p2.then(() => do_throw(), () => {});
   ok(!gFP.has("path2"));
 
-  onPromiseComplete = (aPromise, aHandler) => {
+  let onPromiseComplete = (aPromise, aHandler) => {
     return aPromise.then(aHandler, aHandler);
   }
   let test_queueOrder = (aOperation) => {
     let promise = qFO("queueOrderPath", aOperation);
     let firstOperationComplete = false;
     onPromiseComplete(promise, () => firstOperationComplete = true);
     return qFO("queueOrderPath", () => {
       ok(firstOperationComplete);
@@ -251,18 +251,20 @@ let test_getLogFilePathForTwitterConv = 
   expectedPath = OS.Path.join(
     expectedPath, gLogger.getNewLogFileName("format", dummyTwitterConv.startDate));
   equal(path, expectedPath);
 }
 
 let test_appendToFile = function* () {
   const kStringToWrite = "Hello, world!";
   let path = OS.Path.join(OS.Constants.Path.profileDir, "testFile.txt");
-  let encodedString = (new TextEncoder()).encode(kStringToWrite);
+  let encoder = new TextEncoder();
+  let encodedString = encoder.encode(kStringToWrite);
   gLogger.appendToFile(path, encodedString);
+  encodedString = encoder.encode(kStringToWrite);
   gLogger.appendToFile(path, encodedString);
   let text = (new TextDecoder()).decode(
     yield gLogger.queueFileOperation(path, () => OS.File.read(path)));
   // The read text should be equal to kStringToWrite repeated twice.
   equal(text, kStringToWrite + kStringToWrite);
   yield OS.File.remove(path);
 }