56 var
Cr = Components.results;
57 var
Cc = Components.classes;
58 var
Ci = Components.interfaces;
59 var
Cu = Components.utils;
61 Cu.import(
"resource://gre/modules/XPCOMUtils.jsm");
74 contractID:
"@songbirdnest.com/moz/sburlformatter;1",
75 classID: Components.ID(
"{4dc7da1b-89d1-48b5-8582-64c98bfb3410}"),
80 { category:
"extension-update-params",
entry:
"VENDOR" },
81 { category:
"extension-update-params",
entry:
"NAME" },
82 { category:
"extension-update-params",
entry:
"PRODUCT" },
83 { category:
"extension-update-params",
entry:
"ID" },
84 { category:
"extension-update-params",
entry:
"VERSION" },
85 { category:
"extension-update-params",
entry:
"APPBUILDID" },
86 { category:
"extension-update-params",
entry:
"BUILD_ID" },
87 { category:
"extension-update-params",
entry:
"BUILD_TARGET" },
88 { category:
"extension-update-params",
entry:
"PLATFORMVERSION" },
89 { category:
"extension-update-params",
entry:
"PLATFORM_VERSION" },
90 { category:
"extension-update-params",
entry:
"PLATFORMBUILDID" },
91 { category:
"extension-update-params",
entry:
"APP" },
92 { category:
"extension-update-params",
entry:
"OS" },
93 { category:
"extension-update-params",
entry:
"XPCOMABI" },
94 { category:
"extension-update-params",
entry:
"DISTRIBUTION" },
95 { category:
"extension-update-params",
entry:
"DISTRIBUTION_VERSION" },
96 { category:
"extension-update-params",
entry:
"CHANNEL" },
97 { category:
"extension-update-params",
entry:
"OS_VERSION" },
98 { category:
"extension-update-params",
entry:
"CUSTOM1" },
99 { category:
"extension-update-params",
entry:
"CUSTOM2" } ],
104 this._appInfo =
Cc[
"@mozilla.org/xre/runtime;1"].
107 return this._appInfo;
110 LOCALE:
function()
Cc[
"@mozilla.org/chrome/chrome-registry;1"].
111 getService(
Ci.nsIXULChromeRegistry).getSelectedLocale(
'global'),
112 VENDOR:
function() this.appInfo.vendor,
113 NAME:
function() this.appInfo.name,
114 PRODUCT:
function() this.appInfo.name,
115 ID:
function() this.appInfo.ID,
116 VERSION:
function() this.appInfo.version,
117 APPBUILDID:
function() this.appInfo.appBuildID,
118 BUILD_ID:
function() this.appInfo.appBuildID,
119 BUILD_TARGET:
function() this.appInfo.OS +
"_" + this.getABI(),
120 PLATFORMVERSION:
function() this.appInfo.platformVersion,
121 PLATFORM_VERSION:
function() this.appInfo.platformVersion,
122 PLATFORMBUILDID:
function() this.appInfo.platformBuildID,
123 APP:
function() this.appInfo.name.toLowerCase().replace(/ /,
""),
124 OS:
function() this.appInfo.OS,
125 XPCOMABI:
function() this.appInfo.XPCOMABI,
128 CHANNEL:
function() this.getUpdateChannel(),
129 OS_VERSION:
function() this.getOSVersion(),
130 CUSTOM1:
function()
"custom_parameter_1",
131 CUSTOM2:
function()
"custom_parameter_2",
134 getABI:
function () {
137 abi = this.appInfo.XPCOMABI;
142 if (
"@mozilla.org/xpcom/mac-utils;1" in
Cc) {
143 macutils = Cc[
"@mozilla.org/xpcom/mac-utils;1"]
144 .getService(
Ci.nsIMacUtils);
147 if (macutils && macutils.isUniversalBinary)
148 abi =
"Universal-gcc3";
155 getPrefValue:
function (aPrefName) {
156 var
prefSvc =
Cc[
'@mozilla.org/preferences-service;1'].getService(
Ci.nsIPrefBranch2);
157 var prefValue =
"default";
158 var
defaults = prefSvc.QueryInterface(
Ci.nsIPrefService)
159 .getDefaultBranch(
null);
161 prefValue = defaults.getCharPref(aPrefName);
173 getUpdateChannel:
function uf_getUpdateChannel() {
174 var
prefSvc =
Cc[
'@mozilla.org/preferences-service;1'].getService(
Ci.nsIPrefBranch2);
175 var channel =
"default";
179 var
defaults = prefSvc.QueryInterface(
Ci.nsIPrefService)
180 .getDefaultBranch(
null);
189 if (partners.length) {
193 for each (prefName
in partners) {
194 prefValue = prefSvc.getCharPref(prefName);
195 channel +=
"-" + prefValue;
206 getOSVersion:
function uf_getOSVersion() {
207 var osVersion =
"default";
208 var sysInfo = Components.classes[
"@mozilla.org/system-info;1"]
209 .getService(Components.interfaces.nsIPropertyBag2);
211 osVersion = sysInfo.getProperty(
"name") +
" " + sysInfo.getProperty(
"version");
218 osVersion +=
" (" + sysInfo.getProperty(
"secondaryLibrary") +
")";
229 get enumerator() {
return null; },
230 getProperty:
function (aPropName) {
return null; },
233 getPropertyAsInt32 :
function(aPropName) {
return null; },
234 getPropertyAsUint32 :
function(aPropName) {
return null; },
235 getPropertyAsInt64 :
function(aPropName) {
return null; },
236 getPropertyAsUint64 :
function(aPropName) {
return null; },
237 getPropertyAsDouble :
function(aPropName) {
return null; },
238 getPropertyAsACString :
function(aPropName) {
return null; },
239 getPropertyAsAUTF8String :
function(aPropName) {
return null; },
240 getPropertyAsBool :
function(aPropName) {
return null; },
241 getPropertyAsInterface :
function(aPropName, aIID, aRetVal) { aRetVal =
null;
return; },
242 get :
function(aPropName) {
return null; },
243 hasKey :
function(aPropName) {
return (aPropName in this._defaults); },
245 getPropertyAsAString:
function(aPropName) {
246 if (aPropName in this._defaults)
247 return this._defaults[aPropName]();
251 formatURL:
function uf_formatURL(aFormat, aMappings) {
253 var _overrides = aMappings;
255 var replacementCallback =
function(aMatch, aKey) {
258 return _overrides.getProperty(aKey);
264 if (aKey in _this._defaults)
265 return _this._defaults[aKey]();
267 Cu.reportError(
"formatURL: Couldn't find value for key: " + aKey);
272 return aFormat.replace(/%(\w{3,})%/g, replacementCallback);
275 formatURLPref:
function uf_formatURLPref(aPref, aMappings) {
277 var PS =
Cc[
'@mozilla.org/preferences-service;1']
278 .getService(
Ci.nsIPrefBranch);
281 format = PS.getComplexValue(aPref,
Ci.nsISupportsString).data;
283 Cu.reportError(
"formatURLPref: Couldn't get pref: " + aPref);
284 return "about:blank";
287 if (!PS.prefHasUserValue(aPref) &&
288 /^chrome:\/\/.+\/locale\/.+\.properties$/.test(format)) {
291 format = PS.getComplexValue(aPref,
Ci.nsIPrefLocalizedString).data;
295 return this.
formatURL(format, aMappings);
nsString encodeURIComponent(const nsString &c)
sbDeviceFirmwareAutoCheckForUpdate prototype contractID
function formatURL(aFormat, aIsPref)
sbOSDControlService prototype QueryInterface
sbDeviceFirmwareAutoCheckForUpdate prototype classDescription
getService(Ci.sbIFaceplateManager)
sbDeviceFirmwareAutoCheckForUpdate prototype classID
sbWindowsAutoPlayServiceCfg _xpcom_categories