--- a/browser/components/nsBrowserGlue.js
+++ b/browser/components/nsBrowserGlue.js
@@ -134,25 +134,16 @@ XPCOMUtils.defineLazyGetter(this, "Shell
return Cc["@mozilla.org/browser/shell-service;1"].
getService(Ci.nsIShellService);
}
catch(ex) {
return null;
}
});
-XPCOMUtils.defineLazyGetter(this, "gBrandBundle", function() {
- return Services.strings.createBundle('chrome://branding/locale/brand.properties');
-});
-
-XPCOMUtils.defineLazyGetter(this, "gBrowserBundle", function() {
- return Services.strings.createBundle('chrome://browser/locale/browser.properties');
-});
-
-
XPCOMUtils.defineLazyModuleGetter(this, "FormValidationHandler",
"resource:///modules/FormValidationHandler.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "WebChannel",
"resource://gre/modules/WebChannel.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "ReaderParent",
"resource:///modules/ReaderParent.jsm");
@@ -750,17 +741,17 @@ BrowserGlue.prototype = {
if (buildDate + acceptableAge < today) {
Cc["@mozilla.org/updates/update-service;1"].getService(Ci.nsIApplicationUpdateService).checkForBackgroundUpdates();
}
}
},
_onSafeModeRestart: function BG_onSafeModeRestart() {
// prompt the user to confirm
- let strings = gBrowserBundle;
+ let strings = Services.strings.createBundle("chrome://browser/locale/browser.properties");
let promptTitle = strings.GetStringFromName("safeModeRestartPromptTitle");
let promptMessage = strings.GetStringFromName("safeModeRestartPromptMessage");
let restartText = strings.GetStringFromName("safeModeRestartButton");
let buttonFlags = (Services.prompt.BUTTON_POS_0 *
Services.prompt.BUTTON_TITLE_IS_STRING) +
(Services.prompt.BUTTON_POS_1 *
Services.prompt.BUTTON_TITLE_CANCEL) +
Services.prompt.BUTTON_POS_0_DEFAULT;
@@ -808,17 +799,19 @@ BrowserGlue.prototype = {
Services.prefs.setIntPref("browser.slowStartup.samples", samples);
},
_showSlowStartupNotification: function () {
let win = this.getMostRecentBrowserWindow();
if (!win)
return;
- let productName = gBrandBundle.GetStringFromName("brandFullName");
+ let productName = Services.strings
+ .createBundle("chrome://branding/locale/brand.properties")
+ .GetStringFromName("brandFullName");
let message = win.gNavigatorBundle.getFormattedString("slowStartup.message", [productName]);
let buttons = [
{
label: win.gNavigatorBundle.getString("slowStartup.helpButton.label"),
accessKey: win.gNavigatorBundle.getString("slowStartup.helpButton.accesskey"),
callback: function () {
win.openUILinkIn("https://support.mozilla.org/kb/reset-firefox-easily-fix-most-problems", "tab");
@@ -846,17 +839,19 @@ BrowserGlue.prototype = {
let win = this.getMostRecentBrowserWindow();
if (!win)
return;
Cu.import("resource://gre/modules/ResetProfile.jsm");
if (!ResetProfile.resetSupported())
return;
- let productName = gBrandBundle.GetStringFromName("brandShortName");
+ let productName = Services.strings
+ .createBundle("chrome://branding/locale/brand.properties")
+ .GetStringFromName("brandShortName");
let resetBundle = Services.strings
.createBundle("chrome://global/locale/resetProfile.properties");
let message = resetBundle.formatStringFromName("resetUnusedProfile.message", [productName], 1);
let buttons = [
{
label: resetBundle.formatStringFromName("refreshProfile.resetButton.label", [productName], 1),
accessKey: resetBundle.GetStringFromName("refreshProfile.resetButton.accesskey"),
@@ -1195,17 +1190,19 @@ BrowserGlue.prototype = {
aCancelQuit.data =
!win.gBrowser.warnAboutClosingTabs(win.gBrowser.closingTabsEnum.ALL);
}
return;
}
let prompt = Services.prompt;
let quitBundle = Services.strings.createBundle("chrome://browser/locale/quitDialog.properties");
- let appName = gBrandBundle.GetStringFromName("brandShortName");
+ let brandBundle = Services.strings.createBundle("chrome://branding/locale/brand.properties");
+
+ let appName = brandBundle.GetStringFromName("brandShortName");
let quitDialogTitle = quitBundle.formatStringFromName("quitDialogTitle",
[appName], 1);
let neverAskText = quitBundle.GetStringFromName("neverAsk2");
let neverAsk = {value: false};
let choice;
if (allWindowsPrivate) {
let text = quitBundle.formatStringFromName("messagePrivate", [appName], 1);
@@ -1272,29 +1269,31 @@ BrowserGlue.prototype = {
}
var actions = update.getProperty("actions");
if (!actions || actions.indexOf("silent") != -1)
return;
var formatter = Cc["@mozilla.org/toolkit/URLFormatterService;1"].
getService(Ci.nsIURLFormatter);
- var appName = gBrandBundle.GetStringFromName("brandShortName");
+ var browserBundle = Services.strings.createBundle("chrome://browser/locale/browser.properties");
+ var brandBundle = Services.strings.createBundle("chrome://branding/locale/brand.properties");
+ var appName = brandBundle.GetStringFromName("brandShortName");
function getNotifyString(aPropData) {
var propValue = update.getProperty(aPropData.propName);
if (!propValue) {
if (aPropData.prefName)
propValue = formatter.formatURLPref(aPropData.prefName);
else if (aPropData.stringParams)
- propValue = gBrowserBundle.formatStringFromName(aPropData.stringName,
- aPropData.stringParams,
- aPropData.stringParams.length);
+ propValue = browserBundle.formatStringFromName(aPropData.stringName,
+ aPropData.stringParams,
+ aPropData.stringParams.length);
else
- propValue = gBrowserBundle.GetStringFromName(aPropData.stringName);
+ propValue = browserBundle.GetStringFromName(aPropData.stringName);
}
return propValue;
}
if (actions.indexOf("showNotification") != -1) {
let text = getNotifyString({propName: "notificationText",
stringName: "puNotifyText",
stringParams: [appName]});
@@ -1604,17 +1603,18 @@ BrowserGlue.prototype = {
}
});
},
/**
* Show the notificationBox for a locked places database.
*/
_showPlacesLockedNotificationBox: function BG__showPlacesLockedNotificationBox() {
- var applicationName = gBrandBundle.GetStringFromName("brandShortName");
+ var brandBundle = Services.strings.createBundle("chrome://branding/locale/brand.properties");
+ var applicationName = brandBundle.GetStringFromName("brandShortName");
var placesBundle = Services.strings.createBundle("chrome://browser/locale/places/places.properties");
var title = placesBundle.GetStringFromName("lockPrompt.title");
var text = placesBundle.formatStringFromName("lockPrompt.text", [applicationName], 1);
var buttonText = placesBundle.GetStringFromName("lockPromptInfoButton.label");
var accessKey = placesBundle.GetStringFromName("lockPromptInfoButton.accessKey");
var helpTopic = "places-locked";
var url = Cc["@mozilla.org/toolkit/URLFormatterService;1"].
@@ -2215,17 +2215,19 @@ BrowserGlue.prototype = {
}
Services.prefs.setBoolPref("dom.ipc.plugins.flash.disable-protected-mode", true);
Services.prefs.setBoolPref("browser.flash-protected-mode-flip.done", true);
let win = this.getMostRecentBrowserWindow();
if (!win) {
return;
}
- let productName = gBrandBundle.GetStringFromName("brandShortName");
+ let productName = Services.strings
+ .createBundle("chrome://branding/locale/brand.properties")
+ .GetStringFromName("brandShortName");
let message = win.gNavigatorBundle.
getFormattedString("flashHang.message", [productName]);
let buttons = [{
label: win.gNavigatorBundle.getString("flashHang.helpButton.label"),
accessKey: win.gNavigatorBundle.getString("flashHang.helpButton.accesskey"),
callback: function() {
win.openUILinkIn("https://support.mozilla.org/kb/flash-protected-mode-autodisabled", "tab");
}
@@ -2281,16 +2283,17 @@ ContentPermissionPrompt.prototype = {
* @param aOptions Options for the PopupNotification
*/
_showPrompt: function CPP_showPrompt(aRequest, aMessage, aPermission, aActions,
aNotificationId, aAnchorId, aOptions) {
function onFullScreen() {
popup.remove();
}
+ var browserBundle = Services.strings.createBundle("chrome://browser/locale/browser.properties");
var browser = this._getBrowserForRequest(aRequest);
var chromeWin = browser.ownerDocument.defaultView;
var requestPrincipal = aRequest.principal;
// Transform the prompt actions into PopupNotification actions.
var popupNotificationActions = [];
for (var i = 0; i < aActions.length; i++) {
@@ -2299,18 +2302,18 @@ ContentPermissionPrompt.prototype = {
// Don't offer action in PB mode if the action remembers permission for more than a session.
if (PrivateBrowsingUtils.isWindowPrivate(chromeWin) &&
promptAction.expireType != Ci.nsIPermissionManager.EXPIRE_SESSION &&
promptAction.action) {
continue;
}
var action = {
- label: gBrowserBundle.GetStringFromName(promptAction.stringId),
- accessKey: gBrowserBundle.GetStringFromName(promptAction.stringId + ".accesskey"),
+ label: browserBundle.GetStringFromName(promptAction.stringId),
+ accessKey: browserBundle.GetStringFromName(promptAction.stringId + ".accesskey"),
callback: function() {
if (promptAction.callback) {
promptAction.callback();
}
// Remember permissions.
if (promptAction.action) {
Services.perms.addFromPrincipal(requestPrincipal, aPermission,
@@ -2369,36 +2372,37 @@ ContentPermissionPrompt.prototype = {
// pointerLock (but before the user has granted permission), we should
// remove the now-impotent notification.
browser.addEventListener("mozfullscreenchange", onFullScreen, true);
}
},
_promptGeo : function(aRequest) {
var secHistogram = Services.telemetry.getHistogramById("SECURITY_UI");
+ var browserBundle = Services.strings.createBundle("chrome://browser/locale/browser.properties");
var requestingURI = aRequest.principal.URI;
var message;
// Share location action.
var actions = [{
stringId: "geolocation.shareLocation",
action: null,
expireType: null,
callback: function() {
secHistogram.add(Ci.nsISecurityUITelemetry.WARNING_GEOLOCATION_REQUEST_SHARE_LOCATION);
},
}];
if (requestingURI.schemeIs("file")) {
- message = gBrowserBundle.formatStringFromName("geolocation.shareWithFile",
- [requestingURI.path], 1);
+ message = browserBundle.formatStringFromName("geolocation.shareWithFile",
+ [requestingURI.path], 1);
} else {
- message = gBrowserBundle.formatStringFromName("geolocation.shareWithSite",
- [requestingURI.host], 1);
+ message = browserBundle.formatStringFromName("geolocation.shareWithSite",
+ [requestingURI.host], 1);
// Always share location action.
actions.push({
stringId: "geolocation.alwaysShareLocation",
action: Ci.nsIPermissionManager.ALLOW_ACTION,
expireType: null,
callback: function() {
secHistogram.add(Ci.nsISecurityUITelemetry.WARNING_GEOLOCATION_REQUEST_ALWAYS_SHARE);
},
@@ -2421,20 +2425,21 @@ ContentPermissionPrompt.prototype = {
secHistogram.add(Ci.nsISecurityUITelemetry.WARNING_GEOLOCATION_REQUEST);
this._showPrompt(aRequest, message, "geo", actions, "geolocation",
"geo-notification-icon", options);
},
_promptWebNotifications : function(aRequest) {
+ var browserBundle = Services.strings.createBundle("chrome://browser/locale/browser.properties");
var requestingURI = aRequest.principal.URI;
- var message = gBrowserBundle.formatStringFromName("webNotifications.showFromSite",
- [requestingURI.host], 1);
+ var message = browserBundle.formatStringFromName("webNotifications.showFromSite",
+ [requestingURI.host], 1);
var actions = [
{
stringId: "webNotifications.showForSession",
action: Ci.nsIPermissionManager.ALLOW_ACTION,
expireType: Ci.nsIPermissionManager.EXPIRE_SESSION,
callback: function() {},
},
@@ -2454,20 +2459,21 @@ ContentPermissionPrompt.prototype = {
this._showPrompt(aRequest, message, "desktop-notification", actions,
"web-notifications",
"web-notifications-notification-icon", null);
},
_promptPointerLock: function CPP_promtPointerLock(aRequest, autoAllow) {
+ let browserBundle = Services.strings.createBundle("chrome://browser/locale/browser.properties");
let requestingURI = aRequest.principal.URI;
let originString = requestingURI.schemeIs("file") ? requestingURI.path : requestingURI.host;
- let message = gBrowserBundle.formatStringFromName(autoAllow ?
+ let message = browserBundle.formatStringFromName(autoAllow ?
"pointerLock.autoLock.title2" : "pointerLock.title2",
[originString], 1);
// If this is an autoAllow info prompt, offer no actions.
// _showPrompt() will allow the request when it's dismissed.
let actions = [];
if (!autoAllow) {
actions = [
{