Add Firefox add-on stub
Bump dropbox dep to a version which works when using a Browserify bundle in a Firefox add-on

Bump dropbox-js dep version to a fork which improves detection
of the environment in a way that uses window.XmlHTTPRequest when
running under Browserify instead of trying to use the 'xhr2' shim
that is otherwise used under Node.js

Trying to use the xhr2 shim under Browserify was inefficient and
also didn't work automatically because Browserify did not see
that Dropbox-js required 'xhr2' at build time due to the way
Dropbox-js wraps require().
Use TypeScript for Firefox add-on stub

 * Add src/ dir for .ts sources, use lib/ and data/
   for the built resources

 * Add stub file for Firefox add-on SDK typings
Add CSS build dir to .gitignore
Get web UI working in Firefox addon with the HTTP VFS

 * Add function to detect Firefox addon environment and
   use the HTTP VFS instead of Dropbox temporarily.

   Supporting the Dropbox auth flow in the add-on requires
   additional work.

 * Copy compiled scripts and styles from webui/ build
   dir to Firefox add-on data/ dir.
Avoid reloading add-on panel each time the Firefox extension is opened
Setup communication between Firefox add-on and the web front-end

Add a content script to the add-on which serves as a proxy
between the priviledged add-on code and the isolated
web front-end for the app.
Propagate current tab URL from add-on to extension front-end

 * When the extension's panel is loaded for the first time,
   notify the front-end of the active URL

 * Share webui/page_access.ts module which defines the API for
   interaction between the browser-specific extension and
   the front-end between the front-end and the extension code.

   The content script for the extension's panel is now browserify-ed
   so that it can use shared interfaces from webui/

 * Disable strict mode when initialization the extension to suppress
   a large number of warnings when visiting common websites which
   hide logging messages from the app itself.

   This preference modification should in future only be applied
   when developing the extension.
Enable Dropbox login in Firefox add-on

The standard OAuth redirect flow does not work
in the context of a Firefox add-on where the original
page is at a resource:// URL since redirects
from http:// -> resource:// URLs by a
content or page script appear to be disallowed

This fixes the issue by having the OAuth flow redirect
back to a dummy http://localhost URL after authentication.

The add-on's priviledged main script then intercepts the redirect and
redirects the panel's content URL back to the app.

There are a couple of issues with the current implementation:

 * There can be a flash of an error page after the OAuth
   flow before the main app is reloaded.

 * A hack is used to prevent dropbox-js trying to remove the
   access credentials from window.location.hash after authentication
   completes as the window.history.replaceState() call fails
   and results in the rest of the page failing to load.
Add a setup pane which is displayed during the initial connection to Dropbox

Instead of displaying the login screen right away, display
a 'Connecting to Dropbox...' screen during the initial setup.

Once setup is complete, the user will see the main vault login screen.
Add functions for matching and filtering items by URL
Fix infinite loop when comparing invalid URLs and errors when comparing empty/invalid URLs

stringutils.endsWith() would incorrectly return true
if the suffix was one character longer than the search
string.

Also return zero as the match score if either
the item or target URLs are empty or invalid.
Show items matching the current tab if the search filter is empty

When the search filter is empty, default to showing only items
matching the URL of the current tab.

If no items appear to match the current tab then the full list is
shown for the user to search or browse.

If the user starts typing in the search box then the full list of
items is searched for matches.
If no items matching current URL or no current URL is set, show all items in list
Initial implementation of form autofill in Firefox addon

Add a button to the item details view page to trigger
autofill. When clicked, the <input> fields on the current page
are collected, the web front-end matches them against the item
and sends back a list of auto-fill entries to the page via
the main add-on script.

This version works for a few sites (Evernote, Dropbox)
but the username and password fields are not detected correctly
for many others.
Improve field matching accuracy

 * Set the InputField.type attribute based on the field type.
   This improves matching of the password field.

 * Make comparison of field ID/name against common values for
   username/account field case-insensitive
Switch from item detail view back to main item list when changing pages

When changing pages, the previously selected item is likely
not to be relevant any longer, so reset the selection.

It would be better here not to reset the selection
if the best URL match remained unchanged after the URL change,
eg. when following a link to another on the same domain.
Update item list filter for current URL after loading panel

Just after the panel had been initialized when clicking the toolbar
icon, the add-on tried to notify the panel about a URL change before
the panel's content script had executed.

Wait for a 'ready' event from the panel's content script before
notifying it about the current URL.
Use window.postMessage() instead of callbacks for panel content script <-> front-end communication

Newer Firefox releases (>= 31) have stricter separation between
content scripts and page scripts and do not allow functions to be passed
as arguments to functions that have been exported by the content script
to the page script.

Instead use window.postMessage() as a replacement for callbacks to
notify the front-end when the current URL changes or form fields
have been gathered.

This method should also be more portable to other environments
since window.postMessage() is the standard cross-domain messaging API
Update item location field to match URLs list on save

When saving an item, set the location property in the overview
to match the first URL in the item's URLs list.

The URL is duplicated in the overview data and the encrypted content
for use when searching items.