XUL Explorer:UseCases/Extension Testing
Extension Test mode
Allows a user to test their extension on Mozilla Firefox without having to package it up.
User selects 'test extension' from a menuitem/button
- Locate firefox executable
- Attempt to read the pref.js file for firefox directory (explorer_browser_path)
- Attempt to auto-locate the firefox directory. Save the browser path to prefs.js(?)
- Launch a file picker for a file. Save the browser path to prefs.js(?)
- Locate the profile
- Attempt to read the pref.js file for the profile directory (explorer_browser_profile_path)
- Gather all the profiles from ~/.mozilla/firefox/ or ~/Application Data/Mozilla/profile
- allow the user to select a profile, or pick the first one if there is only one
- save the profile path to prefs.js (?)
- Launch the file picker for a directory. Save the profile path to prefs.js (?)
- Locate the root directory of the extension
- This should probably be two directories up
- Locate the extension's id
- In the extension's root directory. Either in install.rdf or application.ini
- If we cannot find, throw a neat error
- Create firefox extension text file
- Check if the profile/extensions folder exists. if not, create it.
- Add a new plain text file to extensions/extension_id
- Add root directory to file (using trailing slash, if needed)
- Launch firefox with options -no-remote and -profile
- Pass profile directory
- Wait for firefox to be closed
- delete extensions/extension_id
This is a timeline of what is left to do and when I should have that done
What is left to do?
|Auto-locate Firefox profiles and Firefox executable||Low||
|Read values from prefs.js||Done / Medium||
|Pick files (firefox executable)/directories (profile directory)||Done / High||Done|
|Locate root directory of extension||Done / High||Needed to write in text file. This is tricky because it should point to the same directory as application.ini, but where that file is isn't always relative to the current file. So we have a few options
I am leaning towards option #1Mark Finkle and shaver suggest option #2, but have also suggested defaulting to the last picked directory. Which seems fair
|locate extension id||Done / High||Read application.ini/install.rdf, but how? I have managed to finish application.ini, since it only relies on undocumented interfaces. I have no clue right now on RDF, but Mark Finkle pointed to possible help.|
|create text file/directory||Done / Medium||Create a directory/text file. I don't think this will be difficult at all
|Launch Firefox||High / Medium||Not sure how to do this yet
|Wait for Firefox to close and delete file/directory||Done poorly / High||Important, but not sure how to do this either. If I figure out how to launch Firefox, there will probably be an easy way to catch when it is closed.|
Welcome feedback received, which I am posting along here :
|Move code out of extensionTestManager to XE for better reuse (for example, move out the UI code for CL interfaces, and prefs settings).||Done / Medium||prefs and prompts are in the utils/ directory.|
|Need more explanation about each step, since it is very subtle right now (dialog titlebar). Mark Finkle recommended a wizard.||Done / High||
Pass “profile path” and “firefox path” to extensionTestManager, rather then extensionTestManager try to find these itself
|Done(?) / Medium||
|Need to get rid of that rdf library||Done / Low||This is bothering the heck out of me. I shouldn't be using a 700 line rdf library and use it just once. But that would mean understanding RDF, which still isn't explained all that well, and even worse to try and develop with it.|
|Future suggestion : install other extensions to help debug the current extension. For example, add venkman support if it is not already present.||Low||Not Completed|
Estimated Time of Delivery
- I have had a hell of a time finding the title of another tab (when I did a “Save All” functionality), and I gave up. So finding the root directory will probably take half a day. Locating the extension id will probably take the other half.
- Creating a text file and directory, I don't suspect will take very long. Maybe 2 hours at most.
- finding out how to work with .ini and .rdf files is taking a long time. I am working on this earlier than planned, so I don't think the finish date will change.
- Launching firefox and waiting for it will probably take a full day.
So two days? Meh, I'll make it Wednesday (Monday is a Canuck holiday)
Updated May 24, 2007
With feedback in mind :
- I haven't done a wizard yet, but the documentation assures me its easy
- Moving code around shouldn't take long
I'll try to make it a two day process (because it's a nice round number, unlike 1.5 days). I don't think it will take very long. Oh, but I have to read my own code. Make it 2.5 days. Round up. 3 days. Yeah. 3 days. Double it for debugging, 6 days. But wait for review 7 days. But I don't work weekends, so that's 1 week 2 days. But I have to go to the SSA office, and watch Building K, and I won't be productive, 8 days. Oh, but Monday is holiday, so I'll be finished in 1 week Thursday morning. But I said I like nice round numbers.
It is a pretty simple process.
The first time you run Extension Testing, it will prompt you for your firefox binary. It would also prompt for your profile that you would want to test under. This is suggested to be a different profile than your normal browsing profile. These two prompts are only asked once.
The last prompt will ask you for your extension directory, which should contain your install.rdf file. This would be asked each time. It will then try to run firefox with that extension. When you close firefox, that extension is removed from that profile (it should be safe, but I cannot guarantee anything :) )