Bug 311672 – Remove the obsolete 2nd parameter from |nsIStringBundleService::createBundle(...)| "JS" callers. r=zeniko/mano

This commit is contained in:
Serge Gautherie 2008-07-12 11:56:02 +02:00
parent 8b9d3981c8
commit 31d8086891
8 changed files with 19 additions and 72 deletions

View File

@ -281,9 +281,8 @@ SessionStartup.prototype = {
}
else { // basic prompt with no options
// get app name from branding properties
var brandStringBundle = this._getStringBundle("chrome://branding/locale/brand.properties");
var brandShortName = brandStringBundle.GetStringFromName("brandShortName");
const brandShortName = this._getStringBundle("chrome://branding/locale/brand.properties")
.GetStringFromName("brandShortName");
// create prompt strings
var ssStringBundle = this._getStringBundle("chrome://browser/locale/sessionstore.properties");
var restoreTitle = ssStringBundle.formatStringFromName("restoredTitle", [brandShortName], 1);
@ -293,12 +292,10 @@ SessionStartup.prototype = {
var promptService = Cc["@mozilla.org/embedcomp/prompt-service;1"].
getService(Ci.nsIPromptService);
// set the buttons that will appear on the dialog
var flags = promptService.BUTTON_TITLE_IS_STRING * promptService.BUTTON_POS_0 +
promptService.BUTTON_TITLE_IS_STRING * promptService.BUTTON_POS_1 +
promptService.BUTTON_POS_0_DEFAULT;
var buttonChoice = promptService.confirmEx(null, restoreTitle, restoreText,
flags, okTitle, cancelTitle, null,
null, {});
@ -315,11 +312,8 @@ SessionStartup.prototype = {
* @returns nsIStringBundle
*/
_getStringBundle: function sss_getStringBundle(aURI) {
var bundleService = Cc["@mozilla.org/intl/stringbundle;1"].
getService(Ci.nsIStringBundleService);
var appLocale = Cc["@mozilla.org/intl/nslocaleservice;1"].
getService(Ci.nsILocaleService).getApplicationLocale();
return bundleService.createBundle(aURI, appLocale);
return Cc["@mozilla.org/intl/stringbundle;1"].
getService(Ci.nsIStringBundleService).createBundle(aURI);
},
/* ........ Storage API .............. */

View File

@ -2052,19 +2052,6 @@ SessionStoreService.prototype = {
return aWindow.document.documentElement.getAttribute(aAttribute) || dimension;
},
/**
* Convenience method to get localized string bundles
* @param aURI
* @returns nsIStringBundle
*/
_getStringBundle: function sss_getStringBundle(aURI) {
var bundleService = Cc["@mozilla.org/intl/stringbundle;1"].
getService(Ci.nsIStringBundleService);
var appLocale = Cc["@mozilla.org/intl/nslocaleservice;1"].
getService(Ci.nsILocaleService).getApplicationLocale();
return bundleService.createBundle(aURI, appLocale);
},
/**
* Get nsIURI from string
* @param string

View File

@ -51,8 +51,6 @@
#include "nsIComponentManager.h"
#include "nsIDateTimeFormat.h"
#include "nsIDOMElement.h"
#include "nsILocale.h"
#include "nsILocaleService.h"
#include "nsILocalFile.h"
#include "nsIDynamicContainer.h"
#include "nsIServiceManager.h"

View File

@ -653,17 +653,9 @@ function getPostData()
function getStringBundle()
{
const bundleURL = "chrome://global/locale/contentAreaCommands.properties";
const sbsContractID = "@mozilla.org/intl/stringbundle;1";
const sbsIID = Components.interfaces.nsIStringBundleService;
const sbs = Components.classes[sbsContractID].getService(sbsIID);
const lsContractID = "@mozilla.org/intl/nslocaleservice;1";
const lsIID = Components.interfaces.nsILocaleService;
const ls = Components.classes[lsContractID].getService(lsIID);
var appLocale = ls.getApplicationLocale();
return sbs.createBundle(bundleURL, appLocale);
return Components.classes["@mozilla.org/intl/stringbundle;1"]
.getService(Components.interfaces.nsIStringBundleService)
.createBundle("chrome://global/locale/contentAreaCommands.properties");
}
function makeWebBrowserPersist()

View File

@ -366,12 +366,9 @@
if (!this._mStrBundle) {
// need to create string bundle manually instead of using <xul:stringbundle/>
// see bug 63370 for details
var localeService = Components.classes["@mozilla.org/intl/nslocaleservice;1"]
.getService(Components.interfaces.nsILocaleService);
var stringBundleService = Components.classes["@mozilla.org/intl/stringbundle;1"]
.getService(Components.interfaces.nsIStringBundleService);
var bundleURL = "chrome://global/locale/browser.properties";
this._mStrBundle = stringBundleService.createBundle(bundleURL, localeService.getApplicationLocale());
this._mStrBundle = Components.classes["@mozilla.org/intl/stringbundle;1"]
.getService(Components.interfaces.nsIStringBundleService)
.createBundle("chrome://global/locale/browser.properties");
}
return this._mStrBundle;
]]></getter>

View File

@ -196,12 +196,9 @@
if (!this._mStrBundle) {
// need to create string bundle manually instead of using <xul:stringbundle/>
// see bug 63370 for details
var localeService = Components.classes["@mozilla.org/intl/nslocaleservice;1"]
.getService(Components.interfaces.nsILocaleService);
var stringBundleService = Components.classes["@mozilla.org/intl/stringbundle;1"]
.getService(Components.interfaces.nsIStringBundleService);
var bundleURL = "chrome://global/locale/dialog.properties";
this._mStrBundle = stringBundleService.createBundle(bundleURL, localeService.getApplicationLocale());
this._mStrBundle = Components.classes["@mozilla.org/intl/stringbundle;1"]
.getService(Components.interfaces.nsIStringBundleService)
.createBundle("chrome://global/locale/dialog.properties");
}
return this._mStrBundle;
]]></getter>

View File

@ -45,9 +45,9 @@
<![CDATA[
if (!this._bundle) {
try {
var stringBundleService = Components.classes["@mozilla.org/intl/stringbundle;1"]
.getService(Components.interfaces.nsIStringBundleService);
this._bundle = stringBundleService.createBundle(this.src, this.appLocale);
this._bundle = Components.classes["@mozilla.org/intl/stringbundle;1"]
.getService(Components.interfaces.nsIStringBundleService)
.createBundle(this.src);
}
catch (e) {
dump("Failed to get stringbundle:\n");
@ -74,21 +74,6 @@
</setter>
</property>
<property name="appLocale">
<getter>
<![CDATA[
try {
var localeService = Components.classes["@mozilla.org/intl/nslocaleservice;1"]
.getService(Components.interfaces.nsILocaleService);
return localeService.getApplicationLocale();
}
catch (ex) {
return null;
}
]]>
</getter>
</property>
<property name="strings">
<getter>
<![CDATA[

View File

@ -175,12 +175,9 @@
try {
// need to create string bundle manually instead of using <xul:stringbundle/>
// see bug 63370 for details
var localeService = Components.classes["@mozilla.org/intl/nslocaleservice;1"]
.getService(Components.interfaces.nsILocaleService);
var stringBundleService = Components.classes["@mozilla.org/intl/stringbundle;1"]
.getService(Components.interfaces.nsIStringBundleService);
var bundleURL = "chrome://global/locale/wizard.properties";
this._bundle = stringBundleService.createBundle(bundleURL);
this._bundle = Components.classes["@mozilla.org/intl/stringbundle;1"]
.getService(Components.interfaces.nsIStringBundleService)
.createBundle("chrome://global/locale/wizard.properties");
} catch (e) {
// This fails in remote XUL, which has to provide titles for all pages
// see bug 142502