https://github.com/mozilla/gecko-dev
Raw File
Tip revision: 51bb42c7e1061cedbb9ebe6091da7040f204fc3c authored by tbirdbld on 22 August 2012, 01:58:16 UTC
Added THUNDERBIRD_15_0b5_RELEASE THUNDERBIRD_15_0b5_BUILD1 tag(s) for changeset 205115c395d4. DONTBUILD CLOSED TREE a=release
Tip revision: 51bb42c
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