mozilla/addon-sdk — pull request #1541 by rengelking (2014-07-08 21:16:56+00:00)
Title: Bug 858399 - solution adds context menu to panels

Context menu only shows when contextMenu: true in panel constructor (defaults to false)

Also added get contextMenu property from panel

Also added ability to temporarily change contextMenu property setting in
the panel show(options) function

EXAMPLE USAGE:
var { ToggleButton } = require('sdk/ui/button/toggle');
var panels = require("sdk/panel");

var button = ToggleButton({
id: "my-button",
label: "my button",
icon: {
"16": "./icon-16.png",
"32": "./icon-32.png",
"64": "./icon-64.png"
},
onChange: handleChange
});

var panel = panels.Panel({
contentURL: "https://news.ycombinator.com",
width: 500,
height: 600,
onHide: handleHide,
contextMenu: true //initial contextMenu setting, defaults to false
});

function handleChange(state) {
if (state.checked) {
panel.show({
position: button,
contextMenu: false //override contextMenu constructor setting temporarily
});
}
}

function handleHide() {
console.log("panel.contextMenu:"+panel.contextMenu); //read the current contextMenu setting
button.state('window', {checked: false});
}