Bug 697319 - First browser should be dynamically created to allow honoring of browser.tabs.remote pref (r=gavin)

This commit is contained in:
Bill McCloskey 2013-04-09 18:11:04 -07:00
parent 420fc897ca
commit fb19038e8b

View File

@ -28,10 +28,7 @@
<xul:notificationbox flex="1">
<xul:hbox flex="1" class="browserSidebarContainer">
<xul:vbox flex="1" class="browserContainer">
<xul:stack flex="1" class="browserStack">
<xul:browser anonid="initialBrowser" type="content-primary" message="true" disablehistory="true"
xbl:inherits="tooltip=contenttooltip,contextmenu=contentcontextmenu,autocompletepopup"/>
</xul:stack>
<xul:stack flex="1" class="browserStack" anonid="browserStack"/>
</xul:vbox>
</xul:hbox>
</xul:notificationbox>
@ -1328,26 +1325,14 @@
if (aOwner)
t.owner = aOwner;
var b = document.createElementNS(
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
"browser");
var b = this._createBrowserElement();
b.setAttribute("type", "content-targetable");
b.setAttribute("message", "true");
b.setAttribute("contextmenu", this.getAttribute("contentcontextmenu"));
b.setAttribute("tooltip", this.getAttribute("contenttooltip"));
if (Services.prefs.getPrefType("browser.tabs.remote") == Services.prefs.PREF_BOOL &&
Services.prefs.getBoolPref("browser.tabs.remote")) {
b.setAttribute("remote", "true");
}
if (window.gShowPageResizers && document.getElementById("addon-bar").collapsed &&
window.windowState == window.STATE_NORMAL) {
b.setAttribute("showresizer", "true");
}
if (this.hasAttribute("autocompletepopup"))
b.setAttribute("autocompletepopup", this.getAttribute("autocompletepopup"));
b.setAttribute("autoscrollpopup", this._autoScrollPopup.id);
// Create the browserStack container
@ -1415,7 +1400,6 @@
this.mTabFilters[position] = filter;
b._fastFind = this.fastFind;
b.droppedLinkHandler = handleDroppedLink;
// Dispatch a new tab notification. We do this once we're
// entirely done, so that things are in a consistent state
@ -2716,9 +2700,37 @@
]]></body>
</method>
<method name="_createBrowserElement">
<body><![CDATA[
var b = document.createElementNS(
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
"browser");
b.setAttribute("message", "true");
b.setAttribute("contextmenu", this.getAttribute("contentcontextmenu"));
b.setAttribute("tooltip", this.getAttribute("contenttooltip"));
if (this.hasAttribute("autocompletepopup"))
b.setAttribute("autocompletepopup", this.getAttribute("autocompletepopup"));
if (Services.prefs.getBoolPref("browser.tabs.remote"))
b.setAttribute("remote", "true");
b.droppedLinkHandler = handleDroppedLink;
return b;
]]></body>
</method>
<constructor>
<![CDATA[
this.mCurrentBrowser = document.getAnonymousElementByAttribute(this, "anonid", "initialBrowser");
let browser = this._createBrowserElement();
this.mCurrentBrowser = browser;
browser.setAttribute("type", "content-primary");
browser.setAttribute("disablehistory", "true");
let stack = document.getAnonymousElementByAttribute(this, "anonid", "browserStack");
stack.appendChild(browser);
this.mCurrentTab = this.tabContainer.firstChild;
document.addEventListener("keypress", this, false);
window.addEventListener("sizemodechange", this, false);
@ -2735,7 +2747,6 @@
this._autoScrollPopup.id = "autoscroller";
this.appendChild(this._autoScrollPopup);
this.mCurrentBrowser.setAttribute("autoscrollpopup", this._autoScrollPopup.id);
this.mCurrentBrowser.droppedLinkHandler = handleDroppedLink;
this.updateWindowResizers();
// Hook up the event listeners to the first browser