Hi,

I'm glad that the parserVersion hack is useful, but it's worth noting
that this is only useful for people who have upgraded to 0.5 or
greater.  To cater for people who have not upgraded, the function
still has to be defined in the command itself.  And if you do
implement it in the command itself please note the following...

The function added in CmdUtils (https://ubiquity.mozilla.com/hg/
ubiquity-firefox/rev/651ba8eea7bf) leaves out the following check:

        return (branch.getPrefType("parserVersion") != 0) ? branch.getIntPref
("parserVersion") == 2 : false;

Versions prior to 0.5 of course do not have this parserVersion
preference and so getIntPref fails with an exception:

        [Exception... "Component returned failure code: 0x8000ffff
(NS_ERROR_UNEXPECTED) [nsIPrefBranch.getIntPref]" nsresult:
"0x8000ffff (NS_ERROR_UNEXPECTED)" location: "JS frame :: file:///
... /extensions/[email protected]/modules/
sandboxfactory.js#ubiquity://command-editor-code :: parserVersion ::
line 5" data: no]

nsIPrefBranch seems to lack some basic functionality such as a
"hasPref" function, or even a nice degradation on the getPref
functions, and so using the following function works with versions
prior to 0.5:

        function parserVersion() {
                var prefs = 
Components.classes["@mozilla.org/preferences-service;
1"].getService(Components.interfaces.nsIPrefService);
                var branch = prefs.getBranch("extensions.ubiquity.");
                return (branch.getPrefType("parserVersion") != 0) ? 
branch.getIntPref
("parserVersion") == 2 : false;
        }

Cheers,
Gary

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"ubiquity-firefox" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/ubiquity-firefox?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to