background preloader


Facebook Twitter

Extensions: Porting Chrome extensions - Microsoft Edge Development. Porting an extension from Chrome to Microsoft Edge is made easy with the help of theMicrosoft Edge Extension Toolkit.

Extensions: Porting Chrome extensions - Microsoft Edge Development

This developer tool converts an unpacked Chrome extension to an unpacked Microsoft Edge extension by bridging APIs and surfacing any errors in your manifest.json file. API bridges In order to allow for seamless porting of Chrome APIs to supported Microsoft Edge APIs, two scripts are added to your extension’s folder. These scripts bridge APIs (polyfiling where necessary), meaning you won’t have to worry about changing any Chrome specific code in your background script or content scripts.


Working with multiprocess Firefox. This article gives an overview of how Firefox extension developers can ensure that their code works with multiprocess Firefox.

Working with multiprocess Firefox

In current versions of desktop Firefox, chrome code (including code inserted by extensions) and content run in the same operating system process. So extensions can access content directly: gBrowser.selectedBrowser.contentDocument.body.innerHTML = "replaced by chrome code"; However, in multiprocess Firefox (also called Electrolysis or E10S), the extension's code will run in a different process from content, and this kind of direct access will no longer be possible. Instead, the extension will need to factor code that touches content into separate scripts that are called frame scripts. Extension code running in the chrome process must use asynchronous messaging when communicating with its frame script running in the content process.

For more details on using the message manager and content scripts, refer to the message manager guide. Checking whether you're affected. 981418 – CustomizableUI type:view and type:button widgets need an onBeforeCreated handler. Firefox addon-sdk - listen for page navigation. - gwt-firefox-extension - A set of bindings for XPCOM that allows GWT developers to write Firefox extensions.

Using Google Chrome locale files in Firefox extensions, updated. Var MY_EXTENSION_STRINGS = { "strings" : {}, get : function (key, substitutions) { if (key in this.strings) { var bundle = this.strings[key]; var message = this.strings[key].message; if ("placeholders" in bundle) { for (var i in bundle.placeholders) { var regex = new RegExp("\\$" + i + "\\$", "g"); message = message.replace(regex, bundle.placeholders[i].content); if (typeof substitutions !

Using Google Chrome locale files in Firefox extensions, updated

If (typeof substitutions ! Substitutions = [ substitutions ]; if (substitutions) { for (var i = 0, _len = substitutions.length; i < _len; i++) { var regex = new RegExp("\\$" + (i+1), "g"); message = message.replace(regex, substitutions[i]); return message; return ""; (function (extension_namespace, string_object) { var localeOrder = ["en-US"]; // Get the user's Firefox locale. var chromeRegService = Components.classes[";1"].getService();

Coding style guide · mozilla/addon-sdk Wiki. This document attempts to explain the basic styles and patterns that are used in the Jetpack codebase.

Coding style guide · mozilla/addon-sdk Wiki

While existing code may not always comply to this style, new code should try to conform to these standards so that it is as easy to maintain as existing code. Of course every rule has an exception, but it's important to know the rules nonetheless! General 2-column indentation. 80-character limit for all lines. Use double quotation symbol " for strings as they are a standard in rest of Mozilla code base. // Good! Use dots at the end of lines, not at the front: // Goodconst browsers = Cc[";1"]. getService(Ci.nsIWindowMediator). getEnumerator("navigator:browser"); // Badconst browsers = Cc[";1"] .getService(Ci.nsIWindowMediator) .getEnumerator("navigator:browser"); Avoid use of error prone undefined (which can be redefined) and prefer void(0) instead.

Declarations Variables Forget about var and use const instead. Adding a Toolbar Button in a Bootstrapped Firefox Extension - Salsita Software. 14 December 2012 by Matthew Gertner - Category: Technical Articles Adding a toolbar button in a Firefox extension is simple.

Adding a Toolbar Button in a Bootstrapped Firefox Extension - Salsita Software

Since the Firefox user interface is described using XUL, it is enough to inject a snippet of XUL into the “toolbar palette” in browser.xul. Traditionally this would be done with a XUL overlay. Experienced XUL developers know that a button added like this won’t show up in the toolbar unless it is added explicitly by the user (using View/Toolbars/Customize…). This can be solved by adding the button to the toolbar manually and saving the toolbar’s “currentset”, which contains the list of buttons it contains. Firefox addon-sdk : handle http request timeout. Add-on SDK FAQ: Content Script Access. Update: the SDK 1.2 beta builds ( including this one, just released today ) now include a more refined version of this content.

Add-on SDK FAQ: Content Script Access

If you’re interested in this material I strongly suggest that you download this beta and take a look at the bundled docs. This post is an attempt to clearly explain how content scripts work. I am posting this particular topic as a blog post in hopes of getting feedback on the wording, but the content below is actually part of a larger patch against the SDK documentation that Will Bamberg created as part of this SDK bug. Firefox addon - How to create hidden iframe/browser from JavaScript XPCOM component. JavaScript Singletons in Firefox Add-ons.

Occasionally when developing add-ons for Firefox, you want your JavaScript to only run once for the lifetime of the application.

JavaScript Singletons in Firefox Add-ons

Normally, you would place your code in a browser overlay, but this causes the code to run every time a new window is opened. There are several ways to get around this. You could write an XPCOM service or use a JavaScript module. Do firefox addons have something similar to "background page" concept. Firefox - Create mozilla extension to display a popup and iframe in it. Firefox addon - How to remove XUL item from toolbar programatically. Restartless add-on example code. Mfinkle’s recent posts [] on restartless add-ons reminded me that I was going to write a more detailed post about my restartless GitHub repository, but I’ve been distracted with another project.

Restartless add-on example code

So briefly, I’ve put together some helper functions [] that have been useful for developing various restartless add-ons. I’ve organized the repository to have a bunch of “examples/” branches that build on top of other named branches that implement helper functions. These first few are very simple examples: Firefox 4 Restartless Add-ons « Musings. Index of /manual/Tasks. Bootstrapped extensions - Extensions. Note: All extensions created using the Add-on SDK are bootstrapped!

Bootstrapped extensions - Extensions

All the bootstrapping code is generated for you, so you don't really need to think about it. Not using the Add-on SDK? 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. Bootstrapped Add-ons. Setting up an extension development environment. This article gives suggestions on how to set up your Mozilla application for extension development.

Unless otherwise specified, these suggestions apply to both Firefox and Thunderbird as well as SeaMonkey version 2.0 and above. Overview Create a development user profile to run your development firefox session; with special development preferences in about:config. Install some Firefox development extensions to your dev profile. Edit files in the extensions folder of your profile and restart the application with the dev profile. Building an extension. Introduction This tutorial will take you through the steps required to build a very basic extension - one which adds a status bar panel to the Firefox browser containing the text "Hello, World!

". Note: The extension created by this tutorial won't work in Firefox versions that don't have a static status bar (that is, Firefox 4 and up). Building Restartless Addons for Firefox. Making Of: Restartless Firefox Add-ons. Adblock Plus and (a little) more: Why you should make your next add-on restartless. Adblock Plus and (a little) more: Modularization in a restartless extension.

Modularization in a restartless extension · 2012-07-12 17:21 by Wladimir Palant A simple restartless extension can probably keep all its code in the bootstrap.js file. However, it gets crowded there very soon. Erikvold (Erik) Firefox. Addon Firefox restartless. GWT. Chrome addon.