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