Back out changeset 6bc1a3d1a1ee (bug 519686 - multi-locale bookmarks)

This commit is contained in:
Gavin Sharp 2009-10-15 23:05:32 -04:00
Родитель 02e5a2d5d2
Коммит 2573a2f2b1
3 изменённых файлов: 20 добавлений и 31 удалений

Просмотреть файл

@ -82,35 +82,22 @@ BrowserStartup.prototype = {
Cu.import("resource://gre/modules/utils.js");
try {
let observer = {
onStreamComplete : function(aLoader, aContext, aStatus, aLength, aResult) {
let converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"].
createInstance(Ci.nsIScriptableUnicodeConverter);
let jsonStr = "";
try {
converter.charset = "UTF-8";
jsonStr = converter.convertFromByteArray(aResult, aResult.length);
// Get bookmarks.html file location
let dirService = Cc["@mozilla.org/file/directory_service;1"].
getService(Ci.nsIProperties);
PlacesUtils.restoreBookmarksFromJSONString(jsonStr, true);
} catch (ex) {
Cu.reportError("Failed to parse default bookmarks from bookmarks.json: " + err);
}
}
};
let ioSvc = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
let uri = ioSvc.newURI("chrome://browser/locale/bookmarks.json", null, null);
let channel = ioSvc.newChannelFromURI(uri);
let sl = Cc["@mozilla.org/network/stream-loader;1"].
createInstance(Ci.nsIStreamLoader);
sl.init(observer);
channel.asyncOpen(sl, channel);
} catch (err) {
// Report the error, but ignore it.
Cu.reportError("Failed to load default bookmarks from bookmarks.json: " + err);
}
let bookmarksFile = dirService.get("profDef", Ci.nsILocalFile);
bookmarksFile.append("bookmarks.json");
if (bookmarksFile.exists()) {
// import the file
try {
PlacesUtils.restoreBookmarksFromJSONFile(bookmarksFile);
} catch (err) {
// Report the error, but ignore it.
Cu.reportError("bookmarks.json file could be corrupt. " + err);
}
} else
Cu.reportError("Unable to find default bookmarks.json file.");
},
// nsIObserver

Просмотреть файл

@ -103,14 +103,17 @@ installers-%: clobber-% langpack-% repackage-zip-%
NO_JA_JP_MAC_AB_CD := $(if $(filter ja-JP-mac, $(AB_CD)),ja,$(AB_CD))
bookmarks.json: bookmarks.inc generic/profile/bookmarks.json.in
%/defaults/profile/bookmarks.json: bookmarks.inc generic/profile/bookmarks.json.in
$(SYSINSTALL) -D $(dir $@)
$(PYTHON) $(topsrcdir)/config/Preprocessor.py \
-I $< \
-DAB_CD=$(NO_JA_JP_MAC_AB_CD) \
$(srcdir)/generic/profile/bookmarks.json.in \
> $@
libs realchrome:: bookmarks.json
libs:: $(FINAL_TARGET)/defaults/profile/bookmarks.json ;
install:: $(DESTDIR)$(mozappdir)/defaults/profile/bookmarks.json ;
ifdef MOZ_UPDATER
ifdef LOCALE_MERGEDIR

Просмотреть файл

@ -13,7 +13,6 @@
locale/@AB_CD@/browser/checkbox.dtd (%chrome/checkbox.dtd)
locale/@AB_CD@/browser/notification.dtd (%chrome/notification.dtd)
locale/@AB_CD@/browser/prompt.dtd (%chrome/prompt.dtd)
locale/@AB_CD@/browser/bookmarks.json (bookmarks.json)
# Fennec-specific overrides of generic strings
* locale/@AB_CD@/browser/netError.dtd (%chrome/overrides/netError.dtd)