mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
Bug 806460 - Part 1: NS_ERROR_ILLEGAL_VALUE in nsINavBookmarksService.insertBookmark while inserting query. r=gps
* * * Bug 806460 - Part 2: more nuanced rejection of malformed records. r=me (fix bustage).
This commit is contained in:
parent
7d99628c11
commit
588a039d52
@ -434,7 +434,7 @@ BookmarksStore.prototype = {
|
||||
preprocessTagQuery: function preprocessTagQuery(record) {
|
||||
if (record.type != "query" ||
|
||||
record.bmkUri == null ||
|
||||
record.folderName == null)
|
||||
!record.folderName)
|
||||
return;
|
||||
|
||||
// Yes, this works without chopping off the "place:" prefix.
|
||||
@ -499,6 +499,13 @@ BookmarksStore.prototype = {
|
||||
return;
|
||||
}
|
||||
|
||||
// Skip malformed records. (Bug 806460.)
|
||||
if (record.type == "query" &&
|
||||
!record.bmkUri) {
|
||||
this._log.warn("Skipping malformed query bookmark: " + record.id);
|
||||
return;
|
||||
}
|
||||
|
||||
// Preprocess the record before doing the normal apply.
|
||||
this.preprocessTagQuery(record);
|
||||
|
||||
|
@ -384,6 +384,24 @@ add_test(function test_reparentOrphans() {
|
||||
}
|
||||
});
|
||||
|
||||
// Tests Bug 806460, in which query records arrive with empty folder
|
||||
// names and missing bookmark URIs.
|
||||
add_test(function test_empty_query_doesnt_die() {
|
||||
let record = new BookmarkQuery("bookmarks", "8xoDGqKrXf1P");
|
||||
record.folderName = "";
|
||||
record.queryId = "";
|
||||
record.parentName = "Toolbar";
|
||||
record.parentid = "toolbar";
|
||||
|
||||
// These should not throw.
|
||||
store.applyIncoming(record);
|
||||
|
||||
delete record.folderName;
|
||||
store.applyIncoming(record);
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
function run_test() {
|
||||
initTestLogging('Trace');
|
||||
run_next_test();
|
||||
|
Loading…
Reference in New Issue
Block a user