customizing mozilla

Mozilla is a very customizable browser, lots of extensions exist. This is a short description of some that I found very useful, and how I modified them.

itsme-1.0.1.xpi - my own customized extension

this plugin is based on a mix of several of the plugins mentioned below: refspoof, diggler, cookie-crumbler and torbutton. with the following changes:
  • download

    diggler extensions:

  • added '+' and '-' buttons to increment / decrement a specified numeric part of the current url

    refspoof extensions:

  • now operates on either: current selection, current link, or the link of the current page
  • search in google
  • search in dictionary.com
  • open in archive.org
  • search in wikipedia
  • translate with google or babelfish, automatically figures out the language of the selected text
  • open with referer=url in new tab.. useful when opening a page which is not specified as a link

    cookiecrumbler extensions:

  • added 'chump' - delete all cookies for the current domain
  • added 'jar' - show all cookies for the current domain

    torbutton extensions:

  • change homepage to about:blank
  • disables cookies
  • disable referer header

    changelog for itsme.xpi

    how to create an extension

    a .xpi file is a .zip file containing a .jar file and a chrome.manifest, and install.rdf describing how to use the .jar file. the .jar file contains javascript, xul, rdf, .dtd and images and css files
  • xul : describes how to extend the userinterface
  • js : contains the script code referenced from the .xul files
  • rdf : info about the package, and describes what .xul files are extended
  • xpi : the whole packages, code and installer
  • jar : the installed code package
  • chrome.manifest : describes the contents of the .jar file
  • install.rdf :
  • dtd : describes language and image resources
    cd jar
    zip -r ../extension.jar .
    cd ..
    zip extension.xpi itsme.jar chrome.manifest install.rdf
    

    how extensions are installed

    Most extensions install themselves by adding skin, locale and content entries to the mozilla/chrome/installed-chrome.txt file, and by adding a .jar file to the mozilla/chrome directory containing the code for these entries.

    On browser startup mozilla will process the contents of installed-chrome.txt, and regenerate the mozilla/chrome/chrome.rdf file. Sometimes it is nescesary to manually delete this file, together with the mozilla/chrome/overlayInfo/ directory, and the components/compreg.dat and components/xpti.dat files before startup. mozilla will rescan the installed components and chrome extensions.

    While developing, it is useful to extract the contents of the .jar file, into a directory, and change the registration in installed-chrome.txt to use the directory instead of the .jar file.

    skin

    locale

    content


    enigmail

    installed files


    diggler

    installed files

    These extra features I have already implemented:

    livehttpheaders

    installed files

    I would like to add a feature that records all the content in the requests in a directory like this:
    root/sitename/path/file/query/, containing files like this: timestamp.requestheader timestamp.requestcontent timestamp.responseheader timestamp.responsecontent
    the sitename should include the protocol if != http, and the portnr if != default
    the query is a optional path element.

    these can be implemented by adding an observer for http-on-modify-request events.
    problem: It is not yet clear to me how I access the http response content.

    how it works

    page info

    this uses the component/nsHeaderInfo.js component, to add a 'headers' property to the defaultView property of the document. the tab in page info is implemented in content/PageInfoOverlay.js

    live headers

    this is implemented in content/LiveHTTPHeaders.js. An observer is registered for 'http-on-examine-response' events.

    I don't think the handler for http-on-modify-request actually serves any purpose.


    refspoof

    installed files

    I would like to see these extra features implemented: both these can be implemented by adding an observer for http-on-modify-request events.

    these extra features I have already implemented:


    useragentswitcher

    installed files


    electrix

    installed files


    jslib

    installed files


    flashplayer

    installed files


    plugins that I want

    find in page

    comm/content/navigator/navigatorOverlay.xul defines the function 'BrowserFind' as the action for the 'view-find' menu entry, and the ctrl-f key.
    comm/content/navigator/browser.js function BrowserFind calls findUtils.js - function findInPage
    comm/content/communicator/findUtils.js contains the code to launch the find dialog.
    toolkit/content/global/finddialog.xul and toolkit/content/global/finddialog.js contain the code for the find dialog.
    find data is saved/restored from nsIFindService["@mozilla.org/find/find_service;1"].
    find is executed using nsIWebBrowserFind, this is implemented in toolkit/content/global/bindings/browser.xml : webBrowserFind
    this interface is implemented in find.xpt

    calling xpcom from web pages

    enable the UniversalXPConnect privilege, to be able to call all xpcom objects:
    netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
    
    and then you can for instance write stuff to the javascript console as follows:
    var jsConsoleService = Components.classes['@mozilla.org/consoleservice;1'].getService();
    jsConsoleService.QueryInterface(Components.interfaces.nsIConsoleService);
    jsConsoleService.logStringMessage('this appears on the js-console.')