|
1 /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 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 function run_test() { |
|
13 run_next_test(); |
|
14 } |
|
15 |
|
16 add_task(function* () { |
|
17 remove_bookmarks_html(); |
|
18 |
|
19 Services.prefs.setBoolPref("browser.bookmarks.autoExportHTML", true); |
|
20 do_register_cleanup(() => Services.prefs.clearUserPref("browser.bookmarks.autoExportHTML")); |
|
21 |
|
22 // Initialize nsBrowserGlue before Places. |
|
23 Cc["@mozilla.org/browser/browserglue;1"].getService(Ci.nsIBrowserGlue); |
|
24 |
|
25 // Initialize Places through the History Service. |
|
26 Cc["@mozilla.org/browser/nav-history-service;1"] |
|
27 .getService(Ci.nsINavHistoryService); |
|
28 |
|
29 Services.obs.addObserver(function observer() { |
|
30 Services.obs.removeObserver(observer, "profile-before-change"); |
|
31 check_bookmarks_html(); |
|
32 }, "profile-before-change", false); |
|
33 }); |