HomeStorage

Add-ons using the techniques described in this document are considered a legacy technology in Firefox. Don't use these techniques to develop new add-ons. Use WebExtensions instead. If you maintain an add-on which uses the techniques described here, consider migrating it to use WebExtensions.

Starting from Firefox 53, no new legacy add-ons will be accepted on addons.mozilla.org (AMO) for desktop Firefox and Firefox for Android.

Starting from Firefox 57, WebExtensions will be the only supported extension type. Desktop Firefox and Firefox for Android will not load other extension types.

Even before Firefox 57, changes coming up in the Firefox platform will break many legacy extensions. These changes include multiprocess Firefox (e10s), sandboxing, and multiple content processes. Legacy extensions that are affected by these changes should migrate to WebExtensions if they can. See the "Compatibility Milestones" document for more information.

A wiki page containing resources, migration paths, office hours, and more, is available to help developers transition to the new technologies.

Summary

Each HomeStorage object is associated with a single dataset. This object is used to save and delete data. Consumers can retreive a HomeStorage object through the HomeProvider API.

Method Overview

Promise save(in array items)
Promise deleteAll()

Item attributes

Attributes that can be specified on the items passed into save. These attributes will result in different displays when using the Home.panels API.

Attribute Type Required Description
url string yes URL associated with this item
title string no Title for the item.
description string no Description for the item.
image_url string no URL to an image associated with the item. Images are displayed in 95dp squares (95px on mdpi devices, 190px on xhdpi devices). Currently local images do not work (see bug 1004517).
filter string no Used to filter items in a dataset.
background_url string no

URL to a background image for the item.

New in Firefox 41.

background_color string no

Background color for the item, specified in hexadecimal notation. For example: #FF9500.

New in Firefox 41.

Methods

save()

Stores an array of data items. Returns a promise that is fulfilled after the data is saved.

Promise save(
  in array items,
  in object options
)
Parameters
items
An array of items to save. For performance reasons, we will throw an exception if you try to store more than 100 items at once. Additionally, a home panel view will only display 100 items at once.
options
(Optional) JS object holding additional configuration properties.
Attribute Type Description
replace boolean Whether or not to replace existing items.

deleteAll()

Deletes all items associated with this dataset. Returns a promise that is fulfilled after the data is deleted.

Promise deleteAll(
)

Document Tags and Contributors

 Contributors to this page: rebloor, andrewtruongmoz, wbamberg, leibovic
 Last updated by: rebloor,