B2G/gecko/testing/peptest/peptest/extension/resource/mozmill/driver/controller.js
/**
   * Recursive function which iterates through all menu elements and
   * populates the menus with dynamic menu entries.
   *
   * @param {node} menu
   *        Top menu node whose elements have to be populated
   */
Recursive function which iterates through all menu elements and
populates the menus with dynamic menu entries.

@param {node} menu
Top menu node whose elements have to be populated
Recursive function which iterates through all menu elements and populates the menus with dynamic menu entries . @param { node } menu Top menu node whose elements have to be populated
function Menu__buildMenu(menu) {
    var items = menu ? menu.childNodes : null;
    Array.forEach(items, function (item) {
      if (item.tagName == "menu") {
        var popup = item.querySelector("menupopup");
        if (popup) {
          if (popup.allowevents) {
            var popupEvent = this._controller.window.document.createEvent("MouseEvent");
            popupEvent.initMouseEvent("popupshowing", true, true,
                                      this._controller.window, 0, 0, 0, 0, 0,
                                      false, false, false, false, 0, null);
            popup.dispatchEvent(popupEvent);
          }
          this._buildMenu(popup);
        }
      }
    }, this);
  }
function Menu__buildMenu ( menu ) { var items = menu ? menu . childNodes : null ; Array . forEach ( items , function ( item ) { if ( item . tagName == "menu" ) { var popup = item . querySelector ( "menupopup" ) ; if ( popup ) { if ( popup . allowevents ) { var popupEvent = this . _controller . window . document . createEvent ( "MouseEvent" ) ; popupEvent . initMouseEvent ( "popupshowing" , true , true , this . _controller . window , 0 , 0 , 0 , 0 , 0 , false , false , false , false , 0 , null ) ; popup . dispatchEvent ( popupEvent ) ; } this . _buildMenu ( popup ) ; } } } , this ) ; }
Recursive function which iterates through all menu elements and
 populates the menus with dynamic menu entries.
Recursive function which iterates through all menu elements and populates the menus with dynamic menu entries .
// When we have a menu node, fake a click onto it to populate // the sub menu with dynamic entries