background preloader

Firefox

Facebook Twitter

Tabs. Open, manipulate, and access tabs, and receive tab events.

tabs

Usage Open a tab You can open a new tab, specifying various properties including location: var tabs = require("sdk/tabs"); tabs.open(" Track tabs You can register event listeners to be notified when tabs open, close, finish loading DOM content, or are made active or inactive: var tabs = require("sdk/tabs"); tabs.on('open', function onOpen(tab) { myOpenTabs.push(tab);}); tabs.on('ready', function(tab) { console.log('tab is loaded', tab.title, tab.url)}); Access tabs The module itself can be used as a list of all opened tabs across all windows. Var tabs = require('sdk/tabs');for each (var tab in tabs) console.log(tab.title); You can also access individual tabs by index: You can access the currently active tab: Track a single tab Given a tab, you can register event listeners to be notified when the tab is closed, activated or deactivated, or when the page hosted by the tab is loaded or retrieved from the "back-forward cache":

Adblock Plus and (a little) more: How many hacks does it take to make your extension install without a restart? How many hacks does it take to make your extension install without a restart?

Adblock Plus and (a little) more: How many hacks does it take to make your extension install without a restart?

· 2010-09-10 15:50 by Wladimir Palant Dave Townsend did some really great work on the add-on manager recently, he managed to completely rewrite the old crappy backend code and replace it with something far more sane. Along the way a new feature was added: starting with Firefox 4 some add-ons should be able to opt-in and install/uninstall without requiring a browser restart. This feature was primarily meant for JetPack-built extensions but is generally open to all other extensions as well. I tried enabling this feature for Adblock Plus and found that there is an awful number of catches attached to it. Catch 1: No XPCOM components. At this point my hack-o-meter exploded and, as you all well know, programming without a functional hack-o-meter isn’t safe. Tags: adblock plus gecko Commenting is closed for this article. Bootstrapped extensions - Extensions.

Traditional extensions include overlays, wherein the application can load up XUL from the extension's package and automatically apply it atop its own UI.

Bootstrapped extensions - Extensions

While this makes creating extensions that add to the application's user interface relatively easy, it means that updating, installing, or disabling an extension requires an application restart. Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) introduces bootstrapped extensions. These are special extensions that, instead of using overlays to apply their user interface to the application, programmatically insert themselves into the application. This is done using a special script file that's included in the extension that contains functions the browser calls to command the extension to install, uninstall, start up, and shut down.

All the application does is call into this script file; the extension is responsible for adding and removing its user interface and handling any other setup and shutdown tasks it requires. startup Parameters. Extension Manager:Bootstrapped Extensions. Note: This page contains preliminary documentation of the feature and is mainly of historical interest.

Extension Manager:Bootstrapped Extensions

The documentation is at MDC. Bootstrapped add-ons are a special kind of add-on that developers can choose to use instead of normal add-ons in order to allow users to install and use the add-on without needing to restart the application. In order to do this, rather than the application loading chrome and components from the add-on it is up to the add-on developer to do all of this manually. All the application will do is execute a bootstrap script that the add-on provides, telling it to startup. The add-on can do whatever it likes at that point however it must undo anything it has done when we call the bootstrap script to tell it to shutdown. Starting up and Shutting down. Firefox Add-ons - Erik Vold's Blog. Alright, part four has been a long time coming, but I finally got around to typing out an localization include for restartless Firefox 4 addons which I'm ready to talk about. If you haven't read part 2 it's all about how to use includes, so read it first, if you don't know what a restartless addon is, then start with part 1 .

To start off with I wrote this include for Restartless Restart , and I consider that to be my demo. Overview Alright, so you should know how to use includes in a restartless addon now, and I shouldn't have to explain why localizing your addon is important, and you have an example; here are some notes: To begin with you will need to copy this l10n.js file in to your addon, then include it at startup (in your addons bootstrap.js file) and create the all important underscore function (literally "_(aKey)"), like so: Setup Using _ _ takes 2 arguments aKey, and aLocale which is optional. aKey is the key for the text in your .properties file. Restartless Restart Add-on for Firefox - Erik Vold's Blog. Firefox 4 Restartless Add-ons. Firefox 4 Restartless Add-ons <?

Firefox 4 Restartless Add-ons

Xml version="1.0" encoding="UTF-8"? Firefox 4 Restartless Add-ons « Musings. Dgutov/bmreplace. Bootstrap: how to add icon/button into toolbar? Addon Firefox restartless.