зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1435437 - Expose gNavigatorBundle as a plain JS object with a stringbundle-like API;r=Gijs
This will allow us to not rely on an actual <stringbundle> while still avoiding a mass rewrite of code that accesses gNavigatorBundle with the more awkward API exposed by gBrowserBundle. MozReview-Commit-ID: 2B4smbo1xZP --HG-- extra : rebase_source : 0f2eef9178cb61802f158efe88b82a723f5e082e
This commit is contained in:
Родитель
7b97a1f8e6
Коммит
9f2a58c64c
|
@ -143,6 +143,18 @@ if (AppConstants.MOZ_CRASHREPORTER) {
|
|||
XPCOMUtils.defineLazyGetter(this, "gBrowserBundle", function() {
|
||||
return Services.strings.createBundle("chrome://browser/locale/browser.properties");
|
||||
});
|
||||
XPCOMUtils.defineLazyGetter(this, "gNavigatorBundle", function() {
|
||||
// This is a stringbundle-like interface to gBrowserBundle, formerly a getter for
|
||||
// the "bundle_browser" element.
|
||||
return {
|
||||
getString(key) {
|
||||
return gBrowserBundle.GetStringFromName(key);
|
||||
},
|
||||
getFormattedString(key, array) {
|
||||
return gBrowserBundle.formatStringFromName(key, array, array.length);
|
||||
}
|
||||
};
|
||||
});
|
||||
XPCOMUtils.defineLazyGetter(this, "gTabBrowserBundle", function() {
|
||||
return Services.strings.createBundle("chrome://browser/locale/tabbrowser.properties");
|
||||
});
|
||||
|
@ -224,12 +236,11 @@ if (AppConstants.platform != "macosx") {
|
|||
var gEditUIVisible = true;
|
||||
}
|
||||
|
||||
/* globals gBrowser, gNavToolbox, gURLBar:true, gNavigatorBundle*/
|
||||
/* globals gBrowser, gNavToolbox, gURLBar:true */
|
||||
[
|
||||
["gBrowser", "content"],
|
||||
["gNavToolbox", "navigator-toolbox"],
|
||||
["gURLBar", "urlbar"],
|
||||
["gNavigatorBundle", "bundle_browser"]
|
||||
].forEach(function(elementGlobal) {
|
||||
var [name, id] = elementGlobal;
|
||||
Object.defineProperty(window, name, {
|
||||
|
|
Загрузка…
Ссылка в новой задаче