Bug 1409784 - Remove mStringBundle from tabbrowser binding and expose gTabBrowserBundle instead;r=dao

MozReview-Commit-ID: 2P0OIuQwQv1

--HG--
extra : rebase_source : fe9c42a30a7becf6b3257d1face42087ae9b068d
This commit is contained in:
Brian Grinstead 2017-10-18 11:41:21 -07:00
Родитель 00acbee9d6
Коммит 3e5f8f313c
2 изменённых файлов: 18 добавлений и 20 удалений

Просмотреть файл

@ -139,6 +139,9 @@ if (AppConstants.MOZ_CRASHREPORTER) {
XPCOMUtils.defineLazyGetter(this, "gBrowserBundle", function() {
return Services.strings.createBundle("chrome://browser/locale/browser.properties");
});
XPCOMUtils.defineLazyGetter(this, "gTabBrowserBundle", function() {
return Services.strings.createBundle("chrome://browser/locale/tabbrowser.properties");
});
XPCOMUtils.defineLazyGetter(this, "gCustomizeMode", function() {
let scope = {};
@ -8952,8 +8955,8 @@ TabModalPromptBox.prototype = {
allowFocusCheckbox = document.createElementNS(XUL_NS, "checkbox");
let spacer = document.createElementNS(XUL_NS, "spacer");
allowFocusRow.appendChild(spacer);
let label = gBrowser.mStringBundle.getFormattedString("tabs.allowTabFocusByPromptForSite",
[hostForAllowFocusCheckbox]);
let label = gTabBrowserBundle.formatStringFromName("tabs.allowTabFocusByPromptForSite",
[hostForAllowFocusCheckbox], 1);
allowFocusCheckbox.setAttribute("label", label);
allowFocusRow.appendChild(allowFocusCheckbox);
newPrompt.appendChild(allowFocusRow);

Просмотреть файл

@ -17,7 +17,6 @@
</resources>
<content>
<xul:stringbundle anonid="tbstringbundle" src="chrome://browser/locale/tabbrowser.properties"/>
<xul:tabbox anonid="tabbox" class="tabbrowser-tabbox"
flex="1" eventnode="document" xbl:inherits="handleCtrlPageUpDown,tabcontainer"
onselect="if (event.target.localName == 'tabpanels') this.parentNode.updateCurrentBrowser();">
@ -76,9 +75,6 @@
<field name="mPanelContainer" readonly="true">
document.getAnonymousElementByAttribute(this, "anonid", "panelcontainer");
</field>
<field name="mStringBundle">
document.getAnonymousElementByAttribute(this, "anonid", "tbstringbundle");
</field>
<field name="mCurrentTab">
null
</field>
@ -1632,7 +1628,7 @@
} catch (ex) { /* Do nothing. */ }
} else {
// Still no title? Fall back to our untitled string.
title = this.mStringBundle.getString("tabs.emptyTabTitle");
title = gTabBrowserBundle.GetStringFromName("tabs.emptyTabTitle");
}
}
@ -2645,7 +2641,7 @@
if (!aNoInitialLabel) {
if (isBlankPageURL(aURI)) {
t.setAttribute("label", this.mStringBundle.getString("tabs.emptyTabTitle"));
t.setAttribute("label", gTabBrowserBundle.GetStringFromName("tabs.emptyTabTitle"));
} else {
// Set URL as label so that the tab isn't empty initially.
this.setInitialTabTitle(t, aURI, { beforeTabOpen: true });
@ -2913,7 +2909,6 @@
// default to true: if it were false, we wouldn't get this far
var warnOnClose = { value: true };
var bundle = this.mStringBundle;
// focus the window before prompting.
// this will raise any minimized window, which will
@ -2922,18 +2917,18 @@
// see bug #350299 for more details
window.focus();
var warningMessage =
PluralForm.get(tabsToClose, bundle.getString("tabs.closeWarningMultiple"))
PluralForm.get(tabsToClose, gTabBrowserBundle.GetStringFromName("tabs.closeWarningMultiple"))
.replace("#1", tabsToClose);
var buttonPressed =
ps.confirmEx(window,
bundle.getString("tabs.closeWarningTitle"),
gTabBrowserBundle.GetStringFromName("tabs.closeWarningTitle"),
warningMessage,
(ps.BUTTON_TITLE_IS_STRING * ps.BUTTON_POS_0)
+ (ps.BUTTON_TITLE_CANCEL * ps.BUTTON_POS_1),
bundle.getString("tabs.closeButtonMultiple"),
gTabBrowserBundle.GetStringFromName("tabs.closeButtonMultiple"),
null, null,
aCloseTabs == this.closingTabsEnum.ALL ?
bundle.getString("tabs.closeWarningPromptMe") : null,
gTabBrowserBundle.GetStringFromName("tabs.closeWarningPromptMe") : null,
warnOnClose);
var reallyClose = (buttonPressed == 0);
@ -5516,14 +5511,14 @@
let stringWithShortcut = (stringId, keyElemId) => {
let keyElem = document.getElementById(keyElemId);
let shortcut = ShortcutUtils.prettifyShortcut(keyElem);
return this.mStringBundle.getFormattedString(stringId, [shortcut]);
return gTabBrowserBundle.formatStringFromName(stringId, [shortcut], 1);
};
var label;
if (tab.mOverCloseButton) {
label = tab.selected ?
stringWithShortcut("tabs.closeSelectedTab.tooltip", "key_close") :
this.mStringBundle.getString("tabs.closeTab.tooltip");
gTabBrowserBundle.GetStringFromName("tabs.closeTab.tooltip");
} else if (tab._overPlayingIcon) {
let stringID;
if (tab.selected) {
@ -5540,7 +5535,7 @@
"tabs.muteAudio.background.tooltip";
}
label = this.mStringBundle.getString(stringID);
label = gTabBrowserBundle.GetStringFromName(stringID);
}
} else {
label = tab._fullLabel || tab.getAttribute("label");
@ -5554,7 +5549,7 @@
}
}
if (tab.userContextId) {
label = this.mStringBundle.getFormattedString("tabs.containers.tooltip", [label, ContextualIdentityService.getUserContextLabel(tab.userContextId)]);
label = gTabBrowserBundle.formatStringFromName("tabs.containers.tooltip", [label, ContextualIdentityService.getUserContextLabel(tab.userContextId)], 2);
}
}
@ -6372,10 +6367,10 @@
this.mTabClipWidth = Services.prefs.getIntPref("browser.tabs.tabClipWidth");
let { restoreTabsButton } = this;
restoreTabsButton.setAttribute("label", this.tabbrowser.mStringBundle.getString("tabs.restoreLastTabs"));
restoreTabsButton.setAttribute("label", gTabBrowserBundle.GetStringFromName("tabs.restoreLastTabs"));
var tab = this.firstChild;
tab.label = this.tabbrowser.mStringBundle.getString("tabs.emptyTabTitle");
tab.label = gTabBrowserBundle.GetStringFromName("tabs.emptyTabTitle");
tab.setAttribute("onerror", "this.removeAttribute('image');");
window.addEventListener("resize", this);
@ -6616,7 +6611,7 @@
document.getElementById("menu_closeWindow").hidden = !visible;
document.getElementById("menu_close").setAttribute("label",
this.tabbrowser.mStringBundle.getString(visible ? "tabs.closeTab" : "tabs.close"));
gTabBrowserBundle.GetStringFromName(visible ? "tabs.closeTab" : "tabs.close"));
TabsInTitlebar.allowedBy("tabs-visible", visible);
]]></body>