Bug 1443462 - Copy default browser attributes from the initial browser to dynamically created ones. r?mconley
MozReview-Commit-ID: DGy6W2w75Y2
--- a/browser/base/content/tabbrowser.js
+++ b/browser/base/content/tabbrowser.js
@@ -283,20 +283,34 @@ window._gBrowser = {
_setupInitialBrowserAndTab() {
let browser = this.initialBrowser;
this._selectedBrowser = browser;
browser.permanentKey = {};
browser.droppedLinkHandler = handleDroppedLink;
- this._autoScrollPopup = browser._createAutoScrollPopup();
- this._autoScrollPopup.id = "autoscroller";
- document.getElementById("mainPopupSet").appendChild(this._autoScrollPopup);
- browser.setAttribute("autoscrollpopup", this._autoScrollPopup.id);
+ let autoScrollPopup = browser._createAutoScrollPopup();
+ autoScrollPopup.id = "autoscroller";
+ document.getElementById("mainPopupSet").appendChild(autoScrollPopup);
+ browser.setAttribute("autoscrollpopup", autoScrollPopup.id);
+
+ this._defaultBrowserAttributes = {
+ autoscrollpopup: "",
+ contextmenu: "",
+ datetimepicker: "",
+ message: "",
+ messagemanagergroup: "",
+ selectmenulist: "",
+ tooltip: "",
+ type: "",
+ };
+ for (let attribute in this._defaultBrowserAttributes) {
+ this._defaultBrowserAttributes[attribute] = browser.getAttribute(attribute);
+ }
let tab = this.tabs[0];
this._selectedTab = tab;
let uniqueId = this._generateUniquePanelID();
this.mPanelContainer.childNodes[0].id = uniqueId;
tab.linkedPanel = uniqueId;
tab.permanentKey = browser.permanentKey;
@@ -1813,21 +1827,20 @@ window._gBrowser = {
_createBrowser(aParams) {
// Supported parameters:
// userContextId, remote, remoteType, isPreloadBrowser,
// uriIsAboutBlank, sameProcessAsFrameLoader
let b = document.createElementNS(this._XUL_NS, "browser");
b.permanentKey = {};
- b.setAttribute("type", "content");
- b.setAttribute("message", "true");
- b.setAttribute("messagemanagergroup", "browsers");
- b.setAttribute("contextmenu", "contentAreaContextMenu");
- b.setAttribute("tooltip", "aHTMLTooltip");
+
+ for (let attribute in this._defaultBrowserAttributes) {
+ b.setAttribute(attribute, this._defaultBrowserAttributes[attribute]);
+ }
if (aParams.userContextId) {
b.setAttribute("usercontextid", aParams.userContextId);
}
// remote parameter used by some addons, use default in this case.
if (aParams.remote && !aParams.remoteType) {
aParams.remoteType = E10SUtils.DEFAULT_REMOTE_TYPE;
@@ -1863,22 +1876,16 @@ window._gBrowser = {
* therefore the 'preloadedState' attribute is removed from
* that browser altogether
* See more details on Bug 1420285.
*/
if (aParams.isPreloadBrowser) {
b.setAttribute("preloadedState", "preloaded");
}
- b.setAttribute("selectmenulist", "ContentSelectDropdown");
-
- b.setAttribute("datetimepicker", "DateTimePickerPanel");
-
- b.setAttribute("autoscrollpopup", this._autoScrollPopup.id);
-
if (aParams.nextTabParentId) {
if (!aParams.remoteType) {
throw new Error("Cannot have nextTabParentId without a remoteType");
}
// Gecko is going to read this attribute and use it.
b.setAttribute("nextTabParentId", aParams.nextTabParentId.toString());
}