tor-browser

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

test_notificationdb_bug1024090.js (990B)


      1 "use strict";
      2 
      3 /**
      4 * @import {NotificationDB} from "../../NotificationDB.sys.mjs"
      5 * @type {NotificationDB}
      6 */
      7 let db;
      8 
      9 add_setup(async function run_test() {
     10  do_get_profile();
     11 
     12  db = ChromeUtils.importESModule(
     13    "moz-src:///dom/notification/NotificationDB.sys.mjs"
     14  ).db;
     15 });
     16 
     17 // For bug 1024090: test edge case of notificationstore.json
     18 add_task(async function test_bug1024090() {
     19  const NOTIFICATION_STORE_PATH = PathUtils.join(
     20    PathUtils.profileDir,
     21    "notificationstore"
     22  );
     23  await IOUtils.remove(NOTIFICATION_STORE_PATH, {
     24    recursive: true,
     25  });
     26  ok(true, "Notification database cleaned.");
     27  info("Cleanup steps completed: " + NOTIFICATION_STORE_PATH);
     28 
     29  // Store one notification
     30  await db.queueTask("save", {
     31    origin: systemNotification.origin,
     32    notification: systemNotification,
     33  });
     34 
     35  let notifications = await db.queueTask("getall", {
     36    origin: systemNotification.origin,
     37  });
     38 
     39  equal(1, notifications.length, "One notification stored");
     40 });