tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_asyncbadadd.js (868B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
      4 */
      5 
      6 const FILENAME = "missing.txt";
      7 
      8 var observer = {
      9  onStartRequest() {},
     10 
     11  onStopRequest(request, status) {
     12    Assert.equal(status, Cr.NS_ERROR_FILE_NOT_FOUND);
     13    zipW.close();
     14    Assert.equal(ZIP_EOCDR_HEADER_SIZE, tmpFile.fileSize);
     15    do_test_finished();
     16  },
     17 };
     18 
     19 function run_test() {
     20  zipW.open(tmpFile, PR_RDWR | PR_CREATE_FILE | PR_TRUNCATE);
     21 
     22  var source = tmpDir.clone();
     23  source.append(FILENAME);
     24  zipW.addEntryFile(FILENAME, Ci.nsIZipWriter.COMPRESSION_NONE, source, true);
     25 
     26  do_test_pending();
     27  zipW.processQueue(observer, null);
     28 
     29  // With nothing to actually do the queue would have completed immediately
     30  Assert.ok(!zipW.inQueue);
     31 }