Firefox Social API

Shane Caraveo, scaraveo@mozilla.com

Firefox Social API

Why social?

We are social creatures and the web is increasingly a part of our social interactions.

Our users are both mobile and social, we need to provide our users with an approach to social that fits Mozilla values and goals.

How do we weave social into the fabric of the Open Web?

A small history lesson

We've been through a number of experiements with social funtionality

  • Contacts
  • F1 Share
  • Share with Web Activities

Lessons Learned

Agregating social content through APIs has many perils. We can create awesome features for users, but...

  • Unique APIs for each provider
  • Widely varying Terms of Service
  • Provider APIs can be "fragile"
  • One UI does not fit all
  • No business value for providers means no support

Learning from others

Embrace
work with existing and upcoming social content providers
Extend
create an open user centric architecture in Firefox
Innovate
with market share can we influence the future of social?

Goals

Open
existing standards, new APIs are minimal and standards based
User Centric
provide awesome features to users
Business friendly
allow full creative expression to social providers
Ecosystem
improve the state of social on the web

High Level: How does it work?

  • Content panels loading HTML pages from a provider
  • Web worker for background processing
  • postMessage API for communications (ports)
  • navigator.mozSocial APIs to open panels, etc.
  • json manifest for bootstrap configuration

Version 1, Firefox 17

I'll give an overview of the current SocialAPI in three broad areas:

  • User interface elements
  • Back-end architecture that enables that UI
  • Activation process: how does the feature get turned on

Front-end

  • Toolbar button
  • Share button
  • Sidebar
  • Chat windows

Toolbar button

The toolbar button is the primary interaction point, and it:

  • Displays notification icons (provided by the provider) and badges for notifications
  • Shows the user's logged-in state
  • Allows toggling the visibility of the sidebar

Share button

Simple UI, similar to the star button, that allows sharing/unsharing the URL of the current page.

Our current implementation does not support all the use cases we would like, it will need some revisions.

Chat windows

Chat windows appear above content, and allow you to chat while you browse. They can be collapsed and closed, and they stack neatly against each other as you open/close them.

Back-end components

  • FrameWorker
  • navigator.mozSocial API

FrameWorker

  • a custom implementation of the "SharedWorker" concept from the HTML spec
  • an isolated script sandbox that can maintain persistent connections to the social provider, and has access to some APIs from their origin (like localStorage and XHR).
  • used for provider notifications, consolidating shared functionality, such as chat backends, and supporting Firefox UI elements such as the Toolbar button and Share.

navigator.mozSocial API

  • allows communication, via JSON message passing, between the FrameWorker and the social content panels (sidebar, notification panels, chat windows, etc.)
  • provides a couple APIs for interacting with Firefox
  • only exposed to the social panel windows; not exposed to sites loaded in normal tabs

Activation API

  • one-click activation from the web: whitelisted sites can trigger activation from content by firing an ActivateSocialFeature DOM event against their document
  • after this happens, we show a notification explaining what just occurred, and allowing the user to undo
  • feature is off by default, and only exposed once it has been activated from the provider's site

Future Work

  • multiple provider support: switching between multiple installed providers
  • better provider discovery, installation from the web
  • improved share
  • more UI elements, tear off chats, dialogs, etc.
  • content interactions
  • mobile

How can you help make it successful?

  • user stories for more functionality
  • development help
  • ???

Questions?