https://github.com/mozilla/gecko-dev
Raw File
Tip revision: d49bbe497cd81f6b4f6c05f41d930cba433ef645 authored by tbirdbld on 15 August 2012, 15:53:13 UTC
Added THUNDERBIRD_15_0b4_RELEASE THUNDERBIRD_15_0b4_BUILD1 tag(s) for changeset 65cd4f678ab0. DONTBUILD CLOSED TREE a=release
Tip revision: d49bbe4
SettingsDB.jsm
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
 * You can obtain one at http://mozilla.org/MPL/2.0/. */

let EXPORTED_SYMBOLS = ["SettingsDB", "SETTINGSDB_NAME", "SETTINGSSTORE_NAME"];

/* static functions */
let DEBUG = 0;
if (DEBUG) {
  debug = function (s) { dump("-*- SettingsDB: " + s + "\n"); }
} else {
  debug = function (s) {}
}

const SETTINGSDB_NAME = "settings";
const SETTINGSDB_VERSION = 1;
const SETTINGSSTORE_NAME = "settings";

Components.utils.import("resource://gre/modules/IndexedDBHelper.jsm");

function SettingsDB() {}

SettingsDB.prototype = {

  __proto__: IndexedDBHelper.prototype,

  upgradeSchema: function upgradeSchema(aTransaction, aDb, aOldVersion, aNewVersion) {
    let objectStore = aDb.createObjectStore(SETTINGSSTORE_NAME, { keyPath: "settingName" });
    objectStore.createIndex("settingValue", "settingValue", { unique: false });
    debug("Created object stores and indexes");
  },

  init: function init(aGlobal) {
      this.initDBHelper(SETTINGSDB_NAME, SETTINGSDB_VERSION, SETTINGSSTORE_NAME, aGlobal);
  }
}
back to top