Back in Part 4 of this series, Extending the Selenium API I showed how to use addPluginProvidedUserExtension method to add new commands to Se-IDE. As a result of some real-world usage, a bit of a bug (well, more of an unimplemented feature technically) was discovered. And that was the exporting of the script to one of the supported RC languages. Something that has now been solved.

So what has changed? Well, if your added functionality applies only to Se-IDE (such as random, or goto or anything else done better in the RC language) then nothing; you still only provide the URL to your JS as the first, and only argument. If you want it exported though, there is an optional second argument to specify.

<?xml version="1.0"??><?xml-stylesheet href="chrome://global/skin/" type="text/css"??><overlay id="preflight_extension_loader_overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml"><script src="chrome://selenium-ide/content/api.js" type="application/x-javascript"></script><script src="chrome://preflight/content/preflight.js" type="application/x-javascript"></script><script type="application/javascript">
        ide_api = new API();
        ide_api.addPluginProvidedUserExtension("chrome://preflight/content/extensions/extension-random.js", "chrome://preflight/content/extensions/extension-random.xml");
    </script></overlay>

Yes, sorry. That is an XML file that needs to be provided. I could have completely rewritten things to not take XML, but the existing code expected it and working is better than pretty more often than not. Here is the format of that XML.

<apidoc><function name="randomString"><param name="options"></param>type and length separated by a pipe. type can be alpha, number or alphanumeric
    <param name="var"></param>variable to store random string
    <comment>Generates a random string of specified type and length</comment></function></apidoc>

Now the astute readers will notice that the information contained in that xml looks suspiciously like that which is is the Reference tab of the Se-IDE. And you would be correct. But that is also the source of another bug that has yet to be addressed: if you want to have your functionality appear in the reference box, it will also be exported via the Se-RC formatters.

This new functionality will be available in the version 1.0.7 of Se-IDE which should be out in the next week.