Bug 623375 - History sync: failure on javascript: URLs. r=mconnor

This commit is contained in:
Philipp von Weitershausen 2011-01-11 15:04:45 -08:00
Родитель 218c03dd3e
Коммит c8be7f77df
2 изменённых файлов: 21 добавлений и 1 удалений

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

@ -41,6 +41,7 @@ const EXPORTED_SYMBOLS = ['HistoryEngine'];
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cu = Components.utils;
const Cr = Components.results;
const GUID_ANNO = "sync/guid";
@ -428,7 +429,13 @@ HistoryStore.prototype = {
Svc.History.addVisit(uri, date, null, type, type == 5 || type == 6, 0);
if (record.title) {
this._hsvc.setPageTitle(uri, record.title);
try {
this._hsvc.setPageTitle(uri, record.title);
} catch (ex if ex.result == Cr.NS_ERROR_NOT_AVAILABLE) {
// There's no entry for the given URI, either because it's a
// URI that Places ignores (e.g. javascript:) or there were no
// visits. We can just ignore those cases.
}
}
},

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

@ -156,6 +156,19 @@ function run_test() {
let result = Utils.queryAsync(stmt);
do_check_eq([id for (id in store.getAllIDs())].length, 4);
_("Make sure we handle records with javascript: URLs gracefully.");
store.create({id: Utils.makeGUID(),
histUri: "javascript:''",
title: "javascript:''",
visits: [{date: TIMESTAMP3,
type: Ci.nsINavHistoryService.TRANSITION_EMBED}]});
_("Make sure we handle records without any visits gracefully.");
store.create({id: Utils.makeGUID(),
histUri: "http://getfirebug.com",
title: "Get Firebug!",
visits: []});
_("Remove a record from the store.");
store.remove({id: fxguid});
do_check_false(store.itemExists(fxguid));