add: var menuitementry = document.createElement('menuitem'); 
context: function addAttachmentToPopup(popup, attachment, attachmentIndex) {   if (popup)  {     var item = document.createElement('menu');    if ( item )     {           if (!gMessengerBundle)        gMessengerBundle = document.getElementById("bundle_messenger");      // insert the item just before the separator...the separator is the 2nd to last element in the popup.      item.setAttribute('class', 'menu-iconic');      setApplicationIconForAttachment(attachment,item, false);            var numItemsInPopup = popup.childNodes.length;      // find the separator      var indexOfSeparator = 0;      while (popup.childNodes[indexOfSeparator].localName != 'menuseparator')        indexOfSeparator++;      item = popup.insertBefore(item, popup.childNodes[indexOfSeparator]);      var formattedDisplayNameString = gMessengerBundle.getFormattedString("attachmentDisplayNameFormat",                                       [attachmentIndex, attachment.displayName]);      item.setAttribute('label', formattedDisplayNameString);       item.setAttribute('accesskey', attachmentIndex);       var openpopup = document.createElement('menupopup');      openpopup = item.appendChild(openpopup);      var menuitementry = document.createElement('menuitem');           menuitementry.attachment = cloneAttachment(attachment);      menuitementry.setAttribute('oncommand', 'openAttachment(this.attachment)');       if (!gSaveLabel)        gSaveLabel = gMessengerBundle.getString("saveLabel");      if (!gSaveLabelAccesskey)        gSaveLabelAccesskey = gMessengerBundle.getString("saveLabelAccesskey");      if (!gOpenLabel)        gOpenLabel = gMessengerBundle.getString("openLabel");      if (!gOpenLabelAccesskey)        gOpenLabelAccesskey = gMessengerBundle.getString("openLabelAccesskey");      if (!gDetachLabel)        gDetachLabel = gMessengerBundle.getString("detachLabel");      if (!gDetachLabelAccesskey)        gDetachLabelAccesskey = gMessengerBundle.getString("detachLabelAccesskey");      if (!gDeleteLabel)        gDeleteLabel = gMessengerBundle.getString("deleteLabel");      if (!gDeleteLabelAccesskey)        gDeleteLabelAccesskey = gMessengerBundle.getString("deleteLabelAccesskey");      // we should also check if an attachment has been detached...      // but that uses X-Mozilla-External-Attachment-URL, which      // we'd need to check for somehow.      var signedOrEncrypted = false;      if ("content-type" in currentHeaderData)      {        var contentType = currentHeaderData["content-type"].headerValue;        signedOrEncrypted = contentType.indexOf("application/x-pkcs7-mime") >= 0 ||             contentType.indexOf("application/x-pkcs7-signature") >= 0;      }      var canDetach = !(/news-message:/.test(attachment.uri)) &&           !signedOrEncrypted &&          (!(/imap-message/.test(attachment.uri)) || CheckOnline());      menuitementry.setAttribute('label', gOpenLabel);       menuitementry.setAttribute('accesskey', gOpenLabelAccesskey);       menuitementry = openpopup.appendChild(menuitementry);      if (attachment.contentType == 'text/x-moz-deleted')        menuitementry.setAttribute('disabled', true);       var menuseparator = document.createElement('menuseparator');      openpopup.appendChild(menuseparator);            menuitementry = document.createElement('menuitem');      menuitementry.attachment = cloneAttachment(attachment);      menuitementry.setAttribute('oncommand', 'saveAttachment(this.attachment)');       menuitementry.setAttribute('label', gSaveLabel);       menuitementry.setAttribute('accesskey', gSaveLabelAccesskey);       if (attachment.contentType == 'text/x-moz-deleted')        menuitementry.setAttribute('disabled', true);       menuitementry = openpopup.appendChild(menuitementry);      var menuseparator = document.createElement('menuseparator');      openpopup.appendChild(menuseparator);      menuitementry = document.createElement('menuitem');      menuitementry.attachment = attachment;      menuitementry.setAttribute('oncommand', 'this.attachment.detachAttachment()');       menuitementry.setAttribute('label', gDetachLabel);       menuitementry.setAttribute('accesskey', gDetachLabelAccesskey);       if (attachment.contentType == 'text/x-moz-deleted' || !canDetach)        menuitementry.setAttribute('disabled', true);       menuitementry = openpopup.appendChild(menuitementry);      menuitementry = document.createElement('menuitem');      menuitementry.attachment = attachment;      menuitementry.setAttribute('oncommand', 'this.attachment.deleteAttachment()');       menuitementry.setAttribute('label', gDeleteLabel);       menuitementry.setAttribute('accesskey', gDeleteLabelAccesskey);       if (attachment.contentType == 'text/x-moz-deleted' || !canDetach)        menuitementry.setAttribute('disabled', true);       menuitementry = openpopup.appendChild(menuitementry);    }  // if we created a menu item for this attachment...  } // if we have a popup} 
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/de6bec84e9e568c64f63a6e7fa2e38b88535f5e1/msgHdrViewOverlay.js/buggy/mail/base/content/msgHdrViewOverlay.js