mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 488922 - Treat bookmarks restore specially
Add observers for bookmarks-restore-* and ignore changes during import and trigger a fresh start on success.
This commit is contained in:
parent
c52dbbee72
commit
4676b9cb18
@ -48,6 +48,7 @@ const SERVICE_NOT_SUPPORTED = "Service not supported on this platform";
|
||||
|
||||
Cu.import("resource://gre/modules/utils.js");
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://weave/ext/Observers.js");
|
||||
Cu.import("resource://weave/util.js");
|
||||
Cu.import("resource://weave/engines.js");
|
||||
Cu.import("resource://weave/stores.js");
|
||||
@ -91,6 +92,28 @@ BookmarksEngine.prototype = {
|
||||
_storeObj: BookmarksStore,
|
||||
_trackerObj: BookmarksTracker,
|
||||
|
||||
_init: function _init() {
|
||||
SyncEngine.prototype._init.call(this);
|
||||
this._handleImport();
|
||||
},
|
||||
|
||||
_handleImport: function _handleImport() {
|
||||
Observers.add("bookmarks-restore-begin", function() {
|
||||
this._log.debug("Ignoring changes from importing bookmarks");
|
||||
this._tracker.ignoreAll = true;
|
||||
}, this);
|
||||
|
||||
Observers.add("bookmarks-restore-success", function() {
|
||||
this._log.debug("Triggering fresh start on successful import");
|
||||
this.resetLastSync();
|
||||
this._tracker.ignoreAll = false;
|
||||
}, this);
|
||||
|
||||
Observers.add("bookmarks-restore-failed", function() {
|
||||
this._tracker.ignoreAll = false;
|
||||
}, this);
|
||||
},
|
||||
|
||||
_sync: Utils.batchSync("Bookmark", SyncEngine),
|
||||
|
||||
_syncStartup: function _syncStart() {
|
||||
|
Loading…
Reference in New Issue
Block a user