Bug 860291 - Fix options check in osfile_async_worker.js. r=froydnj
authorDavid Rajchenbach-Teller <dteller@mozilla.com>
Fri, 12 Apr 2013 08:20:31 -0400
changeset 128584 9461d02ac47d062d2db99930313fa1b7725ee1b5
parent 128583 9ee76e6261e60356c1b43d2957b08e7a6b964bd9
child 128585 93f9dc06b4c5457ed0e6bbf929c0aafd2ceb34e5
push id24532
push userryanvm@gmail.com
push dateFri, 12 Apr 2013 19:06:49 +0000
treeherdermozilla-central@2aff2d574a1e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs860291
milestone23.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 860291 - Fix options check in osfile_async_worker.js. r=froydnj
toolkit/components/osfile/osfile_async_worker.js
toolkit/components/osfile/tests/mochi/main_test_osfile_async.js
--- a/toolkit/components/osfile/osfile_async_worker.js
+++ b/toolkit/components/osfile/osfile_async_worker.js
@@ -33,17 +33,17 @@ if (this.Components) {
 
        let start;
        let options;
        if (data.args) {
          options = data.args[data.args.length - 1];
        }
        // If |outExecutionDuration| option was supplied, start measuring the
        // duration of the operation.
-       if (typeof options === "object" && "outExecutionDuration" in options) {
+       if (options && typeof options === "object" && "outExecutionDuration" in options) {
          start = Date.now();
        }
 
        let result;
        let exn;
        let durationMs;
        try {
          let method = data.fun;
--- a/toolkit/components/osfile/tests/mochi/main_test_osfile_async.js
+++ b/toolkit/components/osfile/tests/mochi/main_test_osfile_async.js
@@ -925,10 +925,15 @@ let test_duration = maketest("duration",
       // measurement.
       outExecutionDuration: copyOptions.outExecutionDuration,
       tmpPath: tmpPath
     };
     backupDuration = writeAtomicOptions.outExecutionDuration;
     yield OS.File.writeAtomic(pathDest, contents, writeAtomicOptions);
     test.ok(copyOptions.outExecutionDuration >= backupDuration);
     OS.File.remove(pathDest);
+
+    // Testing an operation that doesn't take arguments at all
+    let file = yield OS.File.open(pathSource);
+    yield file.stat();
+    yield file.close();
   });
 });