tor-browser

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

test_browserGlue_bookmarkshtml.js (1127B)


      1 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
      2 /* vim:set ts=2 sw=2 sts=2 et: */
      3 /* This Source Code Form is subject to the terms of the Mozilla Public
      4 * License, v. 2.0. If a copy of the MPL was not distributed with this
      5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 /**
      8 * Tests that nsBrowserGlue correctly exports bookmarks.html at shutdown if
      9 * browser.bookmarks.autoExportHTML is set to true.
     10 */
     11 
     12 add_task(async function () {
     13  remove_bookmarks_html();
     14 
     15  Services.prefs.setBoolPref("browser.bookmarks.autoExportHTML", true);
     16  registerCleanupFunction(() =>
     17    Services.prefs.clearUserPref("browser.bookmarks.autoExportHTML")
     18  );
     19 
     20  // Initialize nsBrowserGlue before Places.
     21  Cc["@mozilla.org/browser/browserglue;1"].getService(Ci.nsISupports);
     22 
     23  // Initialize Places through the History Service.
     24  Assert.equal(
     25    PlacesUtils.history.databaseStatus,
     26    PlacesUtils.history.DATABASE_STATUS_CREATE
     27  );
     28 
     29  Services.obs.addObserver(function observer() {
     30    Services.obs.removeObserver(observer, "profile-before-change");
     31    check_bookmarks_html();
     32  }, "profile-before-change");
     33 });