我正在开发一个非常简单的 Thunderbird 扩展,它应该在发送邮件时提醒发件人的姓名以及收件人的姓名。问题是下面的代码片段中的 gMsgCompose.compFields.from 字段为空(.to 字段按预期工作),它处理“compose-send-message”事件。我在这里想念什么?
function send_event_handler( evt ) {
var msgcomposeWindow = document.getElementById( "msgcomposeWindow" );
var msg_type = msgcomposeWindow.getAttribute( "msgtype" );
// do not continue unless this is an actual send event
if( !(msg_type == nsIMsgCompDeliverMode.Now || msg_type == nsIMsgCompDeliverMode.Later) )
return;
var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(Components.interfaces.nsIPromptService);
promptService.alert(window, "From", gMsgCompose.compFields.from);
promptService.alert(window, "To", gMsgCompose.compFields.to);
}
window.addEventListener( "compose-send-message", send_event_handler, true );