AWS Community Day CPH - Three problems of Terraform
Fuel - Firefox 3 (June '07)
1. FUEL
Paris - June 23, 2007
John Resig - Mozilla Corp.
2. What is FUEL?
• JavaScript API for Mozilla development
• Focus on solving most common problems
• Emphasis on Firefox Extension Dev
• Improve portability
• Targeting Web Developers
3. Implementation
• Written in pure JavaScript
• (Users can crack it open and see how it
works.)
• Wrappers around XPCOM objects
4. Simplify Concepts
• Provide a consistent means of doing these:
• Events
• foo.events.addListener( “test”, fn );
• Iteration
• foo.all.forEach( fn );
• Add/Remove
• foo.add( obj ) / obj.remove()
6. Application Events
• Make sure the application is ready to be
interacted with (all aspects are loaded):
Application.events.addListener(“ready”, fn);
• Handle when a user exits thefn); application:
Application.events.addListener(“quit”,
7. Preferences
• Coverage of the most common preference
tasks.
• Get/Set Preferences:
Application.prefs.getValue(“my.pref”, default);
Application.prefs.setValue(“my.pref”, “value”);
• Extension Preferences: true);
myExt.prefs.setValue(“autosave”,
8. Preferences (cont.)
• Get all preferences that have been modified
by the user:
Application.prefs.all.forEach(function(p){
if ( p.modified )
// do something
});
9. Storage
• Temporary, runtime, data storage and
retrieval.
• Application-wide storage:
Application.storage.set(“data”, 4);
• Extension-level storage:
myExt.storage.get(“data”, 0);
10. FUEL 0.2
• Window/Browser Tabs, Bookmarks
• Will be in Firefox 3.0a6 (under final review)
• API: http://wiki.mozilla.org/FUEL/0.2/API
11. Browser
• Get the current active browser window:
Application.activeWindow
• Get the URL of the active tab:
Application.activeWindow.activeTab.url
12. Browser (cont.)
• Open and activate a new tab:
Application.activeWindow
.open(quot;http://google.com/quot;).focus();
• Close all Google-related tabs:
Application.activeWindow.tabs.forEach(function(tab){
if ( tab.url.match(/google/) )
tab.remove();
});
13. Bookmarks
• Add a new bookmark:
Application.bookmarks.add(quot;Mozillaquot;, quot;http://mozilla.org/quot;);
• Remove all Google-related bookmarks:
Application.bookmarks.all.forEach(function(cur){
if ( cur.url.match(/google.com/) )
cur.remove();
});
15. More Info
• All about FUEL:
http://wiki.mozilla.org/FUEL
• Test Suite:
http://mxr.mozilla.org/seamonkey/source/browser/fuel/test/
• Contact:
• Mark Finkle (mfinkle@mozilla.com)
• John Resig (jresig@mozilla.com)