The document discusses the new Jetpack SDK which provides a new way to develop extensions for the Mozilla platform like Firefox. It allows writing extensions using HTML5, CSS3 and JavaScript in a modular way. The Jetpack SDK uses Python and provides tools for testing and packaging extensions. It also has APIs for creating widgets, working with tabs, making HTTP requests, storing data and using timers. Examples shown include extensions for sharing pages to Plurk, displaying apologies, and tracking unread messages on Plurk. The future of Jetpack SDK includes more APIs and improvements to the add-on installation and update process.
3. Who I Am
• (Hsiao-Ting Yu)
• Undergraduate in NTUEE
• One of the Jetpack Ambassadors, volunteers to
spread addons development tips on Mozilla
platform
• Developer of NicoFox and Voyage
• http://plurk.com/littlebtc
• or search B , littlebtc little-b-t-c
4. Overview
•
Extend your Firefox happily!
•
• Not just talking about it, do something about it
15. Using Jetpack SDK
• A toolkit based on Python
• Able to test Jetpack SDK extensions
• Able to pack the extension into XPI file
• But ... command Line IT'S TOO HARD...
19. Coding on Jetpack SDK
• Package-based
• Reusable code, document, data
• JavaScript Code
• CommonJS Module Specification
• Modular and simple to maintain
• Every module works as a "sandbox"
(only exports objects will be public)
• Limited accesses to XPCOM
29. Purpose
• A fun extension to "say sorry"
• doggy Lots of people occupied the bandwidth,
the network on COSCUP sucks!
• jack @doggy I'm sorry, it's my fault!
•
•
• Re-do Bob's work on Jetpack SDK
30. API needed
• page-worker
• Create a invisible page, and work with its DOM
object
• "Visible page" - Panels, are expected in future
release.
• context-menu
• Add items to context menu.
36. Purpose
• Get unread counts on Plurk and display on the
widget
• We don't have panel, so can't do a complex UI like
microblogging viewer
• When writing the extension...
Plurk API needs username/password
even if the user had logged in!!!!!!
• (But there is no good way to make preference UI
in Jetpack SDK now)
37. API Required
• widget
• simple-storage: Store simple object
• request Make request to HTTP server with
XML, JSON, or plain text return
• timer Timer function like setTimeout()
setInterval()
• Self-made module Some prompt dialog
• Provided by XPCOM API in Firefox
38. Self-made module
• Using nsIPromptService XPCOM API, display
dialog for username / password input and alert()-
like dialog. 20 lines
39. Actual code on main.js
• 73 lines
• Doing lots of jobs:
• Handle very simple login/logout
• Communicate with Plurk API
45. Solve some classical problem for extension
on Mozilla platform
No difference from any other
Install?
extension on Firefox
Compatibility? Not your job!
Restart browser? Not Required on
Fx4.0/Gecko2!
46. More Open Development
• Everyone can share their package as library on
Addon Builder
• Code can be widely reused and remixed into new
extensions!
• Good for open source development ecosystem
A Extension B Extension C Extension
A Library B Library
48. API parts
• Panel API
• PageMods API (UserScript )
• Sidebar API
• Notification API
• E10S (multiprocess) support
• Jetpack SDK team are working hard on them...
49. Non-API Parts
• Firefox 4
• New addon widget UI
• Auto and silent update for Jetpack extensions
• Mozilla Addons Website
• Addon Marketplace