michael@0: // Regression test for bug 379841 - nsIZipReader's last modified time ignores seconds michael@0: michael@0: const Cc = Components.classes; michael@0: const Ci = Components.interfaces; michael@0: const path = "data/test_bug379841.zip"; michael@0: // Retrieved time should be within 2 seconds of original file's time. michael@0: const MAX_TIME_DIFF = 2000000; michael@0: michael@0: var ENTRY_NAME = "test"; michael@0: // Actual time of file was 07 May 2007 13:35:49 UTC michael@0: var ENTRY_TIME = new Date(Date.UTC(2007, 4, 7, 13, 35, 49, 0)); michael@0: michael@0: function run_test() { michael@0: var file = do_get_file(path); michael@0: var zipReader = Cc["@mozilla.org/libjar/zip-reader;1"]. michael@0: createInstance(Ci.nsIZipReader); michael@0: zipReader.open(file); michael@0: var entry = zipReader.getEntry(ENTRY_NAME); michael@0: var diff = Math.abs(entry.lastModifiedTime - ENTRY_TIME.getTime()*1000); michael@0: zipReader.close(); michael@0: if (diff >= MAX_TIME_DIFF) michael@0: do_throw(diff); michael@0: }