Storage Options

154 views
Skip to first unread message

Shashank Gupta

unread,
Oct 7, 2011, 1:41:57 PM10/7/11
to mozilla-labs-jetpack
Hello everyone,

I am a newbie to Addon-SDK. I am making an Addon in which i log some
information meant for manually viewing later on. I came across the
Simple-Storage API but as far as i could figure out, it saves the
information internally in some format which can only be accessed via
function calls i.e. "ss.storage.variable_name". I was wondering if
this information is accessible somehow from windows directory
structure i.e. maybe from some file in the profile directory.

And Secondly is there any way to access the SQlite Database, any third
party API or anything that can be of help.
Something like this
http://groups.google.com/group/mozilla-labs-jetpack/browse_thread/thread/5a2da7059c073784/32d3401c36e89cd5

(Dunno why but the cfx test for this API gives me errors, so not able
to use this)


And Thirdly i wanted to know about the XPCOM API, any resources?

Loic Duros

unread,
Oct 7, 2011, 1:59:00 PM10/7/11
to mozilla-la...@googlegroups.com
On 10/07/2011 01:41 PM, Shashank Gupta wrote:
> And Thirdly i wanted to know about the XPCOM API, any resources?
>
I'm also looking for information regarding XPCOM on Jetpack. One of the
most useful starting point I've found is this article by Myk Melez:
http://mozillalabs.com/jetpack/2010/04/13/develop-with-jetpack-sdk-0-2/
It's a bit dated since it is about version 0.2, however, I have tested
the alert box (under "Creating a custom library"). I had to add to the
simple-dialog.js file the following for it to work:

const {Cc, Ci} = require("chrome");
const xpcom = require("xpcom");
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");

Not sure if the three lines are all needed but it did the trick and works.

Jeff Griffiths

unread,
Oct 7, 2011, 2:22:35 PM10/7/11
to mozilla-la...@googlegroups.com
On 11-10-07 10:41 AM, Shashank Gupta wrote:
> Hello everyone,
>
> I am a newbie to Addon-SDK. I am making an Addon in which i log some
> information meant for manually viewing later on. I came across the
> Simple-Storage API but as far as i could figure out, it saves the
> information internally in some format which can only be accessed via
> function calls i.e. "ss.storage.variable_name". I was wondering if
> this information is accessible somehow from windows directory
> structure i.e. maybe from some file in the profile directory.

The simple-storage data is stored in Firefox's profile directory as a
json file in:

$firefox_profile_dir/jetpack/$extension_id/simple-storage/store.json

Searching for 'simple-storage' or 'store.json' on your file system
should work.

> And Secondly is there any way to access the SQlite Database, any third
> party API or anything that can be of help.
> Something like this
> http://groups.google.com/group/mozilla-labs-jetpack/browse_thread/thread/5a2da7059c073784/32d3401c36e89cd5
>
> (Dunno why but the cfx test for this API gives me errors, so not able
> to use this)

That module was written perhaps before we made major changes to the SDK
and has not been updated since. One technique I know people have used if
they need more than simple storage is using the hidden window module to
access IndexDb.

The Modules page on the wiki might be a good place to look for more
sophisticated use of the SDK:

https://wiki.mozilla.org/Jetpack/Modules

cheers, Jeff

Will Bamberg

unread,
Oct 7, 2011, 2:31:38 PM10/7/11
to mozilla-la...@googlegroups.com
There's a file API too:
https://addons.mozilla.org/en-US/developers/docs/sdk/1.1/packages/api-utils/docs/file.html,
which might be a better fit for what you want.
Reply all
Reply to author
Forward
0 new messages