toolkit/components/contentprefs/ContentPrefInstance.jsm

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 4
michael@0 5 'use strict';
michael@0 6
michael@0 7 const Cc = Components.classes;
michael@0 8 const Ci = Components.interfaces;
michael@0 9
michael@0 10 this.EXPORTED_SYMBOLS = ['ContentPrefInstance'];
michael@0 11
michael@0 12 // This is a wrapper for nsIContentPrefService that alleviates the need to pass
michael@0 13 // an nsILoadContext argument to every method. Pass the context to the constructor
michael@0 14 // instead and continue on your way in blissful ignorance.
michael@0 15
michael@0 16 this.ContentPrefInstance = function ContentPrefInstance(aContext) {
michael@0 17 this._contentPrefSvc = Cc["@mozilla.org/content-pref/service;1"].
michael@0 18 getService(Ci.nsIContentPrefService);
michael@0 19 this._context = aContext;
michael@0 20 };
michael@0 21
michael@0 22 ContentPrefInstance.prototype = {
michael@0 23 getPref: function ContentPrefInstance_init(aName, aGroup, aCallback) {
michael@0 24 return this._contentPrefSvc.getPref(aName, aGroup, this._context, aCallback);
michael@0 25 },
michael@0 26
michael@0 27 setPref: function ContentPrefInstance_setPref(aGroup, aName, aValue) {
michael@0 28 return this._contentPrefSvc.setPref(aGroup, aName, aValue, this._context);
michael@0 29 },
michael@0 30
michael@0 31 hasPref: function ContentPrefInstance_hasPref(aGroup, aName) {
michael@0 32 return this._contentPrefSvc.hasPref(aGroup, aName, this._context);
michael@0 33 },
michael@0 34
michael@0 35 hasCachedPref: function ContentPrefInstance_hasCachedPref(aGroup, aName) {
michael@0 36 return this._contentPrefSvc.hasCachedPref(aGroup, aName, this._context);
michael@0 37 },
michael@0 38
michael@0 39 removePref: function ContentPrefInstance_removePref(aGroup, aName) {
michael@0 40 return this._contentPrefSvc.removePref(aGroup, aName, this._context);
michael@0 41 },
michael@0 42
michael@0 43 removeGroupedPrefs: function ContentPrefInstance_removeGroupedPrefs() {
michael@0 44 return this._contentPrefSvc.removeGroupedPrefs(this._context);
michael@0 45 },
michael@0 46
michael@0 47 removePrefsByName: function ContentPrefInstance_removePrefsByName(aName) {
michael@0 48 return this._contentPrefSvc.removePrefsByName(aName, this._context);
michael@0 49 },
michael@0 50
michael@0 51 getPrefs: function ContentPrefInstance_getPrefs(aGroup) {
michael@0 52 return this._contentPrefSvc.getPrefs(aGroup, this._context);
michael@0 53 },
michael@0 54
michael@0 55 getPrefsByName: function ContentPrefInstance_getPrefsByName(aName) {
michael@0 56 return this._contentPrefSvc.getPrefsByName(aName, this._context);
michael@0 57 },
michael@0 58
michael@0 59 addObserver: function ContentPrefInstance_addObserver(aName, aObserver) {
michael@0 60 return this._contentPrefSvc.addObserver(aName, aObserver);
michael@0 61 },
michael@0 62
michael@0 63 removeObserver: function ContentPrefInstance_removeObserver(aName, aObserver) {
michael@0 64 return this._contentPrefSvc.removeObserver(aName, aObserver);
michael@0 65 },
michael@0 66
michael@0 67 get grouper() {
michael@0 68 return this._contentPrefSvc.grouper;
michael@0 69 },
michael@0 70
michael@0 71 get DBConnection() {
michael@0 72 return this._contentPrefSvc.DBConnection;
michael@0 73 }
michael@0 74 };

mercurial