зеркало из https://github.com/mozilla/pjs.git
Bug 407296 ? bad problems if browser.places.leftPaneFolderId points to an id that does not exist: places organizer is blank (r=mano)
This commit is contained in:
Родитель
a3f36dae61
Коммит
8c636f6869
|
@ -53,6 +53,7 @@ const DESCRIPTION_ANNO = "bookmarkProperties/description";
|
||||||
const POST_DATA_ANNO = "bookmarkProperties/POSTData";
|
const POST_DATA_ANNO = "bookmarkProperties/POSTData";
|
||||||
const LMANNO_FEEDURI = "livemark/feedURI";
|
const LMANNO_FEEDURI = "livemark/feedURI";
|
||||||
const LMANNO_SITEURI = "livemark/siteURI";
|
const LMANNO_SITEURI = "livemark/siteURI";
|
||||||
|
const ORGANIZER_FOLDER_ANNO = "PlacesOrganizer/OrganizerFolder";
|
||||||
const ORGANIZER_QUERY_ANNO = "PlacesOrganizer/OrganizerQuery";
|
const ORGANIZER_QUERY_ANNO = "PlacesOrganizer/OrganizerQuery";
|
||||||
|
|
||||||
#ifdef XP_MACOSX
|
#ifdef XP_MACOSX
|
||||||
|
@ -1808,28 +1809,24 @@ var PlacesUtils = {
|
||||||
|
|
||||||
// get the folder id for the organizer left-pane folder
|
// get the folder id for the organizer left-pane folder
|
||||||
get leftPaneFolderId() {
|
get leftPaneFolderId() {
|
||||||
var prefs = Cc["@mozilla.org/preferences-service;1"].
|
|
||||||
getService(Ci.nsIPrefBranch2);
|
|
||||||
var leftPaneRoot = -1;
|
var leftPaneRoot = -1;
|
||||||
var allBookmarksId;
|
var allBookmarksId;
|
||||||
try {
|
var items = this.annotations.getItemsWithAnnotation(ORGANIZER_FOLDER_ANNO, {});
|
||||||
leftPaneRoot = prefs.getIntPref("browser.places.leftPaneFolderId");
|
if (items.length != 0 && items[0] != -1)
|
||||||
// if the pref is set to -1 then we must create a new root because we have a new places.sqlite
|
leftPaneRoot = items[0];
|
||||||
if (leftPaneRoot != -1) {
|
if (leftPaneRoot != -1) {
|
||||||
// Build the leftPaneQueries Map
|
// Build the leftPaneQueries Map
|
||||||
delete this.leftPaneQueries;
|
delete this.leftPaneQueries;
|
||||||
this.leftPaneQueries = {};
|
this.leftPaneQueries = {};
|
||||||
var items = this.annotations.getItemsWithAnnotation(ORGANIZER_QUERY_ANNO, { });
|
var items = this.annotations.getItemsWithAnnotation(ORGANIZER_QUERY_ANNO, { });
|
||||||
for (var i=0; i < items.length; i++) {
|
for (var i=0; i < items.length; i++) {
|
||||||
var queryName = this.annotations
|
var queryName = this.annotations
|
||||||
.getItemAnnotation(items[i], ORGANIZER_QUERY_ANNO);
|
.getItemAnnotation(items[i], ORGANIZER_QUERY_ANNO);
|
||||||
this.leftPaneQueries[queryName] = items[i];
|
this.leftPaneQueries[queryName] = items[i];
|
||||||
}
|
|
||||||
delete this.leftPaneFolderId;
|
|
||||||
return this.leftPaneFolderId = leftPaneRoot;
|
|
||||||
}
|
}
|
||||||
|
delete this.leftPaneFolderId;
|
||||||
|
return this.leftPaneFolderId = leftPaneRoot;
|
||||||
}
|
}
|
||||||
catch (ex) { }
|
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
const EXPIRE_NEVER = this.annotations.EXPIRE_NEVER;
|
const EXPIRE_NEVER = this.annotations.EXPIRE_NEVER;
|
||||||
|
@ -1893,7 +1890,8 @@ var PlacesUtils = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
this.bookmarks.runInBatchMode(callback, null);
|
this.bookmarks.runInBatchMode(callback, null);
|
||||||
prefs.setIntPref("browser.places.leftPaneFolderId", leftPaneRoot);
|
this.annotations.setItemAnnotation(leftPaneRoot, ORGANIZER_FOLDER_ANNO,
|
||||||
|
true, 0, EXPIRE_NEVER);
|
||||||
delete this.leftPaneFolderId;
|
delete this.leftPaneFolderId;
|
||||||
return this.leftPaneFolderId = leftPaneRoot;
|
return this.leftPaneFolderId = leftPaneRoot;
|
||||||
},
|
},
|
||||||
|
|
Загрузка…
Ссылка в новой задаче