Bug 1392873 - Fix missing all-tabs-menu when detaching devtools to a separate window r?honza
--- a/devtools/client/inspector/toolsidebar.js
+++ b/devtools/client/inspector/toolsidebar.js
@@ -71,16 +71,17 @@ ToolSidebar.prototype = {
// Rendering
render: function () {
let Tabbar = this.React.createFactory(this.browserRequire(
"devtools/client/shared/components/tabs/tabbar"));
let sidebar = Tabbar({
+ menuDocument: this._toolPanel._toolbox.doc,
showAllTabsMenu: true,
onSelect: this.handleSelectionChange.bind(this),
});
this._tabbar = this.ReactDOM.render(sidebar, this._tabbox);
},
/**
--- a/devtools/client/netmonitor/src/components/tabbox-panel.js
+++ b/devtools/client/netmonitor/src/components/tabbox-panel.js
@@ -45,16 +45,17 @@ function TabboxPanel({
}) {
if (!request) {
return null;
}
return (
Tabbar({
activeTabId,
+ menuDocument: window.parent.document,
onSelect: selectTab,
renderOnlySelected: true,
showAllTabsMenu: true,
},
TabPanel({
id: "headers",
title: HEADERS_TITLE,
},
--- a/devtools/client/shared/components/tabs/tabbar.js
+++ b/devtools/client/shared/components/tabs/tabbar.js
@@ -20,24 +20,26 @@ const { div } = DOM;
/**
* Renders Tabbar component.
*/
let Tabbar = createClass({
displayName: "Tabbar",
propTypes: {
children: PropTypes.array,
+ menuDocument: PropTypes.object,
onSelect: PropTypes.func,
showAllTabsMenu: PropTypes.bool,
activeTabId: PropTypes.string,
renderOnlySelected: PropTypes.bool,
},
getDefaultProps: function () {
return {
+ menuDocument: window.parent.document,
showAllTabsMenu: false,
};
},
getInitialState: function () {
let { activeTabId, children = [] } = this.props;
let tabs = this.createTabs(children);
let activeTab = tabs.findIndex((tab, index) => tab.id === activeTabId);
@@ -192,17 +194,17 @@ let Tabbar = createClass({
// XXX Missing menu API for specifying target (anchor)
// and relative position to it. See also:
// https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XUL/Method/openPopup
// https://bugzilla.mozilla.org/show_bug.cgi?id=1274551
let rect = target.getBoundingClientRect();
let screenX = target.ownerDocument.defaultView.mozInnerScreenX;
let screenY = target.ownerDocument.defaultView.mozInnerScreenY;
menu.popup(rect.left + screenX, rect.bottom + screenY,
- { doc: window.parent.document });
+ { doc: this.props.menuDocument });
return menu;
},
// Rendering
renderTab: function (tab) {
if (typeof tab.panel === "function") {