Praise to the Mozilla Developer Center

If you have not seen me blog about it before or heard me mention it in class, I will mention it again. I can not give enough praise to the Mozilla Devleloper Center.

If you’re a developer trying to get a handle on all the new features in the world of Mozilla, it really is the perfect place to start. The article the center provide cover the widest of all areas involved with Mozilla Development.

This evening, I again found an answer to an interesting bug on a function call in my toolkit/components/places/ unit test.

A little background: My function queries history items that I have inserted and tests to see if the items were added successfully to the database, as well; a check to determine if the item has been visited.

http://developer.mozilla.org/en/nsINavHistoryQueryOptions – The service I interface these XPCom functions with ~ to Javascript XPCShell is nsiNavHistoryQuery and nsiNavHistoryQueryOptions.

Now, my problem was that I was not able to query a particular history item without recieving a false on a do_check_true check. I assumed that the problem was something related to a  AddVisit() parameter, TRANSITION_TYPE. A transition is an event, corresponding with a parameter passed to the AddVisit constructor. An example of a transition is when the user followed a bookmark to get to the page, this would be the TRANSITION_BOOKMARK macro. The one I had trouble with is TRANSITION_EMBED.

So I hopped on over to the dev center and found an attribute inside the the nsiNavHistoryQueryOptions interface. This represents the global options for executing a query on something like history items. I found, includeHidden – “If you set this flag you’ll get all items, even hidden ones…” . This sounds like the reason why my query was failing to retrieve that particular transition typed item.

I set the boolean flag, options.includeHidden = true; and re-ran my test, and success it passed.

Perfect it works. So, if you’re stuck, I cant recommend enough, the Mozilla Dev Center for finding help with your projects, it’s already worked for me a couple times. A problem like the one above would have taken me days to figure out there wasnt the information readily available. Good stuff, I’m satisfied.

– Aaron

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: