Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/storage/test/unit/   (Firefox Browser Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 1 kB image not shown  

Quelle  test_readonly-immutable-nolock_vfs.js

  Sprache: JAVA
 

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */


// This file tests the readonly-immutable-nolock VFS.

add_task(async function test() {
  const path = PathUtils.join(PathUtils.profileDir, "ro");
  await IOUtils.makeDirectory(path);
  const dbpath = PathUtils.join(path, "test-immutable.sqlite");

  let conn = await Sqlite.openConnection({ path: dbpath });
  await conn.execute("PRAGMA journal_mode = WAL");
  await conn.execute("CREATE TABLE test (id INTEGER PRIMARY KEY)");
  Assert.ok(await IOUtils.exists(dbpath + "-wal"), "wal journal exists");
  await conn.close();

  // The wal should have been merged at this point, but just in case...
  info("Remove auxiliary files and set the folder as readonly");
  await IOUtils.remove(dbpath + "-wal", { ignoreAbsent: true });
  await IOUtils.setPermissions(path, 0o555);
  registerCleanupFunction(async () => {
    await IOUtils.setPermissions(path, 0o777);
    await IOUtils.remove(path, { recursive: true });
  });

  // Windows doesn't disallow creating files in read only folders.
  if (AppConstants.platform == "macosx" || AppConstants.platform == "linux") {
    await Assert.rejects(
      Sqlite.openConnection({ path: dbpath, readOnly: true }),
      /NS_ERROR_FILE/,
      "Should not be able to open the db because it can't create a wal journal"
    );
  }

  // Open the database with ignoreLockingMode.
  let conn2 = await Sqlite.openConnection({
    path: dbpath,
    ignoreLockingMode: true,
  });
  await conn2.execute("SELECT * FROM sqlite_master");
  Assert.ok(
    !(await IOUtils.exists(dbpath + "-wal")),
    "wal journal was not created"
  );
  await conn2.close();
});

Messung V0.5 in Prozent
C=89 H=93 G=90

¤ Dauer der Verarbeitung: 0.18 Sekunden  (vorverarbeitet am  2026-06-06) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.