The slides to my talk, which introduced listeners to the extension concept of Firefox and especially explained how to write an Add-on SDK based extension.
2. I'm Martin aka freaktechnik
● Information Technology and Electrical
Engineering student
● Euphonium player
● Nightingale Media Player developer
● Firefox Add-on developer
3. Goals
● Basic Firefox Extension Knowledge
● Tools for Development
● Add-on SDK Extension Structure and API
12. Basic Extension Structure
● lib →main modules
● data →misc files
● test →unit test modules
● package.json →add-on metadata
13. Modules
● Where functionality is
● Prebuilt SDK modules
● 3rd party “libraries“
● Custom modules for Add-on logic
14. SDK Modules
● Split into high-level and low-level API modules
● High-level modules provide simple APIs for
things like
– Page content modification (sdk/page-mod)
– Tabs (sdk/tabs)
– Requests (sdk/request)
– Buttons and toolbars (sdk/ui)
– Panels (sdk/panel)
– Clipboard (sdk/clipboard)
– Passwords (sdk/passwords)
15. Custom Modules
● Main loading point module (usually main.js)
● require() to import other modules
● exports object for public symbols
16. Content Scripts
● Scripts that run in a browser context
● Still run in a separated sandbox
● They have access to the document's DOM
● port for communication
17. Debugging
● Firefox 31
● Always enabled via run command
● Content-scripts can't be reached
18. XPCOM with Jetpack
● const { Cu, Ci, Cr, Cc } =
require('chrome')
● Be nice to the global scope:
const { jsm } =
require('resource://some.jsm');
● You can define components
AMO
Questions/Understanding (bad at explaining) → ask them directly
Just ZIP files
Also Themes (no scripts anymore), langpacks and searchengines (sometimes recognized as normal extension)
Components can be in nearly any language
Manually load components → need to use JS to load binaries
XPCOM API wrappers to commonjs
→ stable API (for example e10s doesn't affect you in most cases)
SDK isn't bundled anymore with jpm...
-> CommonJS and chrome JS, also everything is mozJS, no DOM etc.
Init
Run
Xpi
Test
help
(testall, -b etc.)
Console output in console when run, else browser console (important, not web console)