зеркало из https://github.com/mozilla/gecko-dev.git
Backout 0469cf95fbfe (bug 983571) cause didn't mean to land it yet.
This commit is contained in:
Родитель
7ce5d1f5f0
Коммит
98170a796e
|
@ -1059,27 +1059,6 @@ BrowserGlue.prototype = {
|
|||
importBookmarks = true;
|
||||
} catch(ex) {}
|
||||
|
||||
// Support legacy bookmarks.html format for apps that depend on that format.
|
||||
let autoExportHTML = false;
|
||||
try {
|
||||
autoExportHTML = Services.prefs.getBoolPref("browser.bookmarks.autoExportHTML");
|
||||
} catch (ex) {} // Do not export.
|
||||
if (autoExportHTML) {
|
||||
// Sqlite.jsm and Places shutdown happen at profile-before-change, thus,
|
||||
// to be on the safe side, this should run earlier.
|
||||
AsyncShutdown.profileChangeTeardown.addBlocker(
|
||||
"Places: export bookmarks.html",
|
||||
() => Task.spawn(function* () {
|
||||
try {
|
||||
yield BookmarkHTMLUtils.exportToFile(BookmarkHTMLUtils.defaultPath);
|
||||
} catch(ex) {
|
||||
// At this point there's no UI, so just dump.
|
||||
dump("ERROR: Unable to export bookmarks.html " + ex + "\n"
|
||||
+ ex.stack + "\n");
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
Task.spawn(function() {
|
||||
// Check if Safe Mode or the user has required to restore bookmarks from
|
||||
// default profile's bookmarks.html
|
||||
|
@ -1137,6 +1116,10 @@ BrowserGlue.prototype = {
|
|||
// An import operation is about to run.
|
||||
// Don't try to recreate smart bookmarks if autoExportHTML is true or
|
||||
// smart bookmarks are disabled.
|
||||
let autoExportHTML = false;
|
||||
try {
|
||||
autoExportHTML = Services.prefs.getBoolPref("browser.bookmarks.autoExportHTML");
|
||||
} catch(ex) {}
|
||||
let smartBookmarksVersion = 0;
|
||||
try {
|
||||
smartBookmarksVersion = Services.prefs.getIntPref("browser.places.smartBookmarksVersion");
|
||||
|
@ -1239,6 +1222,19 @@ BrowserGlue.prototype = {
|
|||
this._idleService.removeIdleObserver(this, this._bookmarksBackupIdleTime);
|
||||
delete this._bookmarksBackupIdleTime;
|
||||
}
|
||||
|
||||
// Support legacy bookmarks.html format for apps that depend on that format.
|
||||
try {
|
||||
if (Services.prefs.getBoolPref("browser.bookmarks.autoExportHTML")) {
|
||||
// places-shutdown happens at profile-change-teardown, so here we
|
||||
// can safely add a profile-before-change blocker.
|
||||
AsyncShutdown.profileBeforeChange.addBlocker(
|
||||
"Places: bookmarks.html",
|
||||
() => BookmarkHTMLUtils.exportToFile(BookmarkHTMLUtils.defaultPath)
|
||||
.then(null, Cu.reportError)
|
||||
);
|
||||
}
|
||||
} catch (ex) {} // Do not export.
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim:set ts=2 sw=2 sts=2 et: */
|
||||
/* 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/. */
|
||||
|
||||
/**
|
||||
* Tests that nsBrowserGlue correctly exports bookmarks.html at shutdown if
|
||||
* browser.bookmarks.autoExportHTML is set to true.
|
||||
*/
|
||||
|
||||
function run_test() {
|
||||
run_next_test();
|
||||
}
|
||||
|
||||
add_task(function* () {
|
||||
remove_bookmarks_html();
|
||||
|
||||
Services.prefs.setBoolPref("browser.bookmarks.autoExportHTML", true);
|
||||
do_register_cleanup(() => Services.prefs.clearUserPref("browser.bookmarks.autoExportHTML"));
|
||||
|
||||
// Initialize nsBrowserGlue before Places.
|
||||
Cc["@mozilla.org/browser/browserglue;1"].getService(Ci.nsIBrowserGlue);
|
||||
|
||||
// Initialize Places through the History Service.
|
||||
Cc["@mozilla.org/browser/nav-history-service;1"]
|
||||
.getService(Ci.nsINavHistoryService);
|
||||
|
||||
Services.obs.addObserver(function observer() {
|
||||
Services.obs.removeObserver(observer, "profile-before-change");
|
||||
check_bookmarks_html();
|
||||
}, "profile-before-change", false);
|
||||
});
|
|
@ -9,7 +9,6 @@ support-files =
|
|||
distribution.ini
|
||||
|
||||
[test_421483.js]
|
||||
[test_browserGlue_bookmarkshtml.js]
|
||||
[test_browserGlue_corrupt.js]
|
||||
[test_browserGlue_corrupt_nobackup.js]
|
||||
[test_browserGlue_corrupt_nobackup_default.js]
|
||||
|
|
|
@ -285,8 +285,8 @@ Spinner.prototype = {
|
|||
addBlocker: function(condition) {
|
||||
if (!this._conditions) {
|
||||
throw new Error("Phase " + this._topic +
|
||||
" has already begun, it is too late to register '" +
|
||||
condition.name + "' completion condition.");
|
||||
" has already begun, it is too late to register" +
|
||||
" completion conditions.");
|
||||
}
|
||||
this._conditions.add(condition);
|
||||
},
|
||||
|
@ -454,7 +454,6 @@ Spinner.prototype = {
|
|||
// when they start/stop. For compatibility with existing startup/shutdown
|
||||
// mechanisms, we register a few runstates here.
|
||||
|
||||
this.AsyncShutdown.profileChangeTeardown = getPhase("profile-change-teardown");
|
||||
this.AsyncShutdown.profileBeforeChange = getPhase("profile-before-change");
|
||||
this.AsyncShutdown.sendTelemetry = getPhase("profile-before-change2");
|
||||
this.AsyncShutdown.webWorkersShutdown = getPhase("web-workers-shutdown");
|
||||
|
|
Загрузка…
Ссылка в новой задаче