Context menus are normally created with some state in mind, such as a range of selected tree items. This state may be required for commands contained in the context menu. In this case, you are expected to provide a context getter in the menu specification. The return value of the context getter will be used as the event object for any command dispatched from the menu.

Context getter for the ``Locals View'', from venkman-views.js...
console.views.locals.getContext =
function lv_getcx(cx)
    cx.jsdValueList = new Array();
    function recordContextGetter (cx, rec, i)
        if (i == 0)
            cx.jsdValue = rec.value;
        return cx;
    return getTreeContext (console.views.locals, cx, recordContextGetter);

The context object can be referenced in conditional attributes as cx. The utility function getTreeContext enumerates the selection for a given XUL tree, calling the recordContextGetter callback once for the primary selection, and then once for each item selected, if more than one row is selected. getTreeContext also points to the object representing the primary selection.

Context menu specification for the ``Locals View'', from venkman-views.js...
    console.menuSpecs["context:locals"] = {
        getContext: this.getContext,
         ["set-eval-obj", {type: "checkbox",
                           checkedif: "has('jsdValue') && " +
                                      "cx.jsdValue.getWrappedValue() == " +
                           enabledif: "has('jsdValue') && " +
                                      "cx.jsdValue.jsType == TYPE_OBJECT"}],
                 {enabledif: " instanceof ValueRecord && " +
                  " == jsdIValue.TYPE_OBJECT  && " +
<... snip ...>