Bug 554165: add compat shim for gBrowser.mStrip to unbreak some extensions, and add a supported accessor for the tab context menu, r=dao

--HG--
extra : rebase_source : 00c018e03debe8ae7caa0bbaae2e01fc730c32d1
This commit is contained in:
Gavin Sharp 2010-03-22 13:49:55 -04:00
Родитель 87239bea22
Коммит 7193d8a001
1 изменённых файлов: 33 добавлений и 0 удалений

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

@ -78,6 +78,10 @@
<children/> <children/>
</content> </content>
<implementation implements="nsIDOMEventListener"> <implementation implements="nsIDOMEventListener">
<property name="tabContextMenu" readonly="true"
onget="return this.tabContainer.contextMenu;"/>
<field name="tabContainer" readonly="true"> <field name="tabContainer" readonly="true">
document.getElementById(this.getAttribute("tabcontainer")); document.getElementById(this.getAttribute("tabcontainer"));
</field> </field>
@ -2286,6 +2290,31 @@
onget="return this.tabContainer;"/> onget="return this.tabContainer;"/>
<property name="mTabs" readonly="true" <property name="mTabs" readonly="true"
onget="return this.tabs;"/> onget="return this.tabs;"/>
<!--
- Compatibility hack: several extensions depend on this property to
- access the tab context menu or tab container, so keep that working for
- now. Ideally we can remove this once extensions are using
- tabbrowser.tabContextMenu and tabbrowser.tabContainer directly.
-->
<property name="mStrip" readonly="true">
<getter>
<![CDATA[
return ({
self: this,
childNodes: [null, this.tabContextMenu, this.tabContainer],
firstChild: { nextSibling: this.tabContextMenu },
getElementsByAttribute: function (attr, attrValue) {
if (attr == "anonid" && attrValue == "tabContextMenu")
return [this.self.tabContextMenu];
return [];
},
// Also support adding event listeners (forward to the tab container)
addEventListener: function (a,b,c) { this.self.tabContainer.addEventListener(a,b,c); },
removeEventListener: function (a,b,c) { this.self.tabContainer.removeEventListener(a,b,c); }
});
]]>
</getter>
</property>
</implementation> </implementation>
<handlers> <handlers>
@ -2491,6 +2520,10 @@
this.tabbrowser.mTabBox; this.tabbrowser.mTabBox;
</field> </field>
<field name="contextMenu" readonly="true">
document.getAnonymousElementByAttribute(this, "anonid", "tabContextMenu");
</field>
<field name="mTabstripWidth">0</field> <field name="mTabstripWidth">0</field>
<field name="mTabstrip"> <field name="mTabstrip">