Categories: Mozilla Development

Bookmark Service getItemGUID Issues

Bug 484026 from last November was an interesting peek into the Firefox bookmarks code. I looked into Dan Mill’s claim that getItemGUID was creating new GUID annotations for deleted items. I started off by creating an xpcshell test for the bug. Interestingly, the test passed! The problem had apparently been fixed at some point.

My first thought on how to proceed was that perhaps the error was being thrown from the wrong method, hence my erroneous attempt to patch nsNavBookmarks.cpp (probably an instance of “if it isn’t broken…”). That would explain why Marco Bonardo didn’t think the change was such a great idea – i.e. you might as well go changing every other possible caller if you aren’t fixing the source.

Nonetheless, it was interesting to note the use of scopers and how declaring this mozStorageStatementScoper eliminated the need for if (statement) statement->reset() calls at every function exit point! I’m sure the idea goes way back, but whoever figured out that a scoping object’s destructor could handle this is a genius in my humble (C++ wise) opinion.

So, even though I didn’t get some C++ action as I had anticipated, I still picked up a thing or two – such as the coding standard used for the bookmarks service xpcshell tests, and how to use the do_throw and do_check_eq functions.

Article info



Leave a Reply

Your email address will not be published. Required fields are marked *