Bug 1233747 and bug 1235709 - deal better with host-less URIs in the checkbox handling for dialogs in non-selected tabs, r=Aryx

This commit is contained in:
Gijs Kruitbosch 2015-12-30 09:31:18 +00:00
parent 445c4a4615
commit 0e3592326f

View File

@ -7923,13 +7923,17 @@ TabModalPromptBox.prototype = {
delete this._allowTabFocusByPromptPrincipal;
let allowFocusCheckbox; // Define outside the if block so we can bind it into the callback.
if (principalToAllowFocusFor) {
let hostForAllowFocusCheckbox = "";
try {
hostForAllowFocusCheckbox = principalToAllowFocusFor.URI.host;
} catch (ex) { /* Ignore exceptions for host-less URIs */ }
if (hostForAllowFocusCheckbox) {
let allowFocusRow = document.createElementNS(XUL_NS, "row");
allowFocusCheckbox = document.createElementNS(XUL_NS, "checkbox");
let spacer = document.createElementNS(XUL_NS, "spacer");
allowFocusRow.appendChild(spacer);
let label = gBrowser.mStringBundle.getFormattedString("tabs.allowTabFocusByPromptForSite",
[principalToAllowFocusFor.URI.host]);
[hostForAllowFocusCheckbox]);
allowFocusCheckbox.setAttribute("label", label);
allowFocusRow.appendChild(allowFocusCheckbox);
newPrompt.appendChild(allowFocusRow);