Labs/Extensions2/Notes

From MozillaWiki
Jump to: navigation, search

Code cross-reference of AMO

A huge thank to Anders Conbere for doing all the work for putting this together.

1-clickweather

general

  • toolbar extension
  • uses a JS import function to namespace javascript included from files
  • uses some complicated object heirarchies to manage prefs / config

prefs

  • uses it's own system to manage prefs
    • uses observer pattern to get updates (as opposed to listenting to the prefs observers)

overlays

  • basic statusbar overlay
    • popupset
  • uses windows for config/about/etc.

state

  • capture in saved xml files

ajax

  • wrote their own AJAX library to handle simple async requests

adblock plus

general

  • content filter
  • localized

prefs

  • uses the built in prefs tools and defaults

overlays

  • dialog for about
  • window for subscribing
  • sidebar

state

  • stores filters as a line deliminted file in the profile

ajax

  • handles it's own async calls with XMLHttpRequest() primitive
    • used for synchronizing subscriptions for filters

autopager

general

  • content enhancement
  • has an interesting auto-xpath generator for grabbing the links it needs

installation

  • handles install with file, lots of poking profile dir, registering content
  • option to install to profile :)

prefs

  • uses firefox supplied prefs framework
  • has a system to dynamically add the prefs file to prevent some of the weirdness in initializing new defaults

overlays

  • extensive use of sidebar, mostly as a container for what appears to be "page" elements
  • statusbar
  • does not use settings overlay, builds it's own UI for that

state

  • installation is handled seperately from everything else, involve file manipulation etc.

ajax

boost

general

  • content enhancement

prefs

  • uses firefox supplied prefs framework
  • does not use settings overlay, builds it's own UI for that
  • builds a library for dealing with prefs
    • wraps setting / getting
    • easily add / remove listeners

overlays

  • basic status bar overlay
  • prefs ui

state ajax

  • has it's own library, doing something weird involving chrome security contexts.
    • /I/ think this is about adding in page elements that can be called into the chrome context, there's some work to sanitize content etc.

colorfultabs

general

  • ui enhancement

installation

  • handles install with file, lots of poking profile dir, registering content

prefs

  • uses firefox supplied prefs framework
  • uses settings overlay

overlays

  • basic status bar overlay
  • uses settings overlay

state ajax

  • has it's own library, doing something weird involving chrome security contexts.
    • /I/ think this is about adding in page elements that can be called into the chrome context, there's some work to sanitize content etc.

ctrl-tab

general

  • ui enhancement

prefs

  • uses firefox supplied prefs framework

overlays

  • only the main overlay used to create a popupset that holds "tab images"

download statusbar

general

  • statusbar
  • includes localization

prefs

  • uses firefox supplied prefs framework

overlays

  • status bar overlay
  • builds it's own window for managing prefs

downthemall

general

  • functionality enhancement
  • includes localization

installation

  • handles install with file, lots of poking profile dir, registering content

prefs

  • uses firefox supplied prefs framework

overlays

  • status bar overlay
  • builds it's own window for managing prefs

state ajax

fast_video_download

general

  • toolbar extension
  • is localized

installation prefs

  • uses the firefox supplied prefs framework
  • and makes use of the options ui

overlays

  • uses the options overlay

state ajax

  • uses raw XMLHTttpRequest object

febe

general

  • functionality enhancement (provides backups of firefox profile)
  • is localized

installation

  • checks for first install and initializes
  • double checks default prefs
  • checks intialization of prefs to prevent exception calls

prefs

  • uses the firefox supplied prefs framework

overlays

  • lots of use of dialog boxes to present data to users
    • including it's own error and alert and confirm boxes (odd)

state ajax

fire_fm

general

  • toolbar extension
  • uses flash for playing files

installation prefs

  • uses the firefox pref framework
  • uses a comma delimited pref for complex data type

overlays

  • overlays many of the dialogs for it's own alerts/errors
  • toolbar overlay for main app
  • overlays options

state

  • extensive use of pref framework for storing state

ajax

  • uses straight XMLHTTPrequest

logging

  • uses log4moz

firebug

general

  • functionality enhancement (provides introspection)
  • localized

installation prefs

  • uses firefox prefs

overlays state ajax logging

flashgot

general installation prefs overlays state ajax logging

greasemonkey

general

  • uses components
  • preloads common scripts into namespace using component
  • has a whole animation library that SHOULD just be jquery
  • custom check for updates to greasemonkey
  • uses rdf, loads all prefs up at start to get settings
  • even uses rdf on it's side to check versions
  • domcontent loaded observer used, seems common everywhere, maybe do this for each extension by default
  • functions litter global namespace
  • custom pref manager
  • custom scripts for reading/writing local files
  • from comments looks like code here is pre ff v 1.0.1
  • custom remote data requested (ajax shitz, xml in their case)
  • 3 custom .xpt typelib files files
  • eventlistener abstraction layer

IE Tab

general

  • custom pref manager IN component
  • other helper functions also in component
  • registers itself to namespace
  • uses "windows*registry*key" service, didn't know that existed
  • has own plugin DLL to link in ie
  • also uses domloaded
  • calls pref service again in other areas (doesn't use abstraction)
  • 2nd pref abstraction!! WTF
  • so it looks like NEITHER is a full abstraction layer, though some functions appear in both, many don't. so one has a setboolpref while the other has a getboolpref
  • eventlistener abstraction layer

ImageTweak

general

  • obvious custom logger
  • domloaded
  • custom get pref (not full manager)

Interclue

general

  • uses RDF format internally
  • uses annoying register stylesheet methods (I had issues with this in Puff)
  • domloaded
  • custom logging
  • custom pref manager
  • writes to local file
  • should you be allowing tracking of all mouse movement?
  • custom ajax class
  • has js linked to html files that are outside the namespace
  • INTERESTING USE of window.opener (unfortunately utilizing iframes) to keep scope by copying interclue to window.interclue and using hte refence to hte window that opened current window
  • lots of minified code (bastards), namely klib.js and loadclues.js
  • seems they minified most of cluecore

NoScript

general

  • uses rdf for ui info
  • various domloaded

prefs

  • crazy amount of preferences (~100 on install)
  • abstracts prefs interfaces

overlays

  • giant overlay file that uses the component with small other files that use it

components

  • okay so tons of classes in here, essentially everything is in the component
  • uses component (8200 line file!!)

state

  • uses file read/write

StumbleUpon

general

  • most in one long file of many functions, tons of namespace polution
  • sets a TON of "global" variables using su_xxx
  • listens to almost every event, including domloaded of course

components

  • uses component for helper functions, including logging and custom ajax

prefs

  • uses prefs and the sqlite db

state

  • has giant database abstraction layer
  • csv file to populate db and sql file to build db

overlays

  • 20k stumbleuponoverlay file that is largely one dimensional with just functions

Tab Mix

general

  • sets about 200 preferences
  • doesn't seem to have a pref abstraction layer
  • whole design seems to be very modular, lots of instances of code appearing to be ripe for abstraction but isnt because of scoping issues
  • has a "session manager" for storing current data that uses RDF, man is this painful

Video Download Helper

general

  • uses built in xml parser loaded
  • really impressive layout
    • seems the brunt is in several components which are called by individual pages, so no namespace issues

Ajax

  • custom ajax

State

  • uses rdf to store data

Pref

  • custom pref layer

Web Developer

general

  • has js and css files in content folder
  • has an entire common folder with helpers to do almost everthing
    • including pref and history managers, stylesheet managers, cookies, files, ajax

prefs

  • preference abstraction functions

WOT

general

  • interesting use of load/unload listeners in almost all js files. they call core to start, including all the code, so i assume they just set these listeners to run checks when a new page loads.

Ajax

  • custom ajax
  • built in api to easily deal with requests (i assume to it's server about a pages reliability)

Prefs

  • uses a config.js to store a ton of constants used throughout the app
  • uses a prefs abstraction

Debuging

  • inline error handling just catching and dump()

State

  • looks like they are using prefs beyond how they should
    • ie storing delimited data (there stuff is a little confusing and im tired so im not 100% sure)