fix js warnings. #68525. thanks to hwaara for the patch. r=timeless, sr=alecf,sspitzer

This commit is contained in:
sspitzer%netscape.com 2001-02-15 06:29:47 +00:00
Родитель c45959de9b
Коммит ff95dba345
2 изменённых файлов: 24 добавлений и 43 удалений

Просмотреть файл

@ -30,7 +30,9 @@ function fillThreadPaneContextMenu()
if(numSelected >= 0) if(numSelected >= 0)
{ {
selectedMessage = selectedMessages[0]; selectedMessage = selectedMessages[0];
isNewsgroup = GetMessageType(selectedMessage) == "news"; if (selectedMessage) {
isNewsgroup = GetMessageType(selectedMessage) == "news";
}
} }
@ -61,36 +63,16 @@ function fillThreadPaneContextMenu()
return(true); return(true);
} }
function GetMessageType(message)
{
var compositeDataSource = GetCompositeDataSource("MessageProperty");
var messageResource = message.QueryInterface(Components.interfaces.nsIRDFResource);
if(messageResource && compositeDataSource)
{
var property =
RDF.GetResource('http://home.netscape.com/NC-rdf#MessageType');
if (!property) return null;
var result = compositeDataSource.GetTarget(messageResource, property , true);
if (!result) return null;
result = result.QueryInterface(Components.interfaces.nsIRDFLiteral);
if (!result) return null;
return result.Value;
}
return null;
}
function SetupNewMessageWindowMenuItem(menuID, numSelected, forceHide) function SetupNewMessageWindowMenuItem(menuID, numSelected, forceHide)
{ {
ShowMenuItem(menuID, (numSelected <= 1) && !forceHide); ShowMenuItem(menuID, (numSelected <= 1) && !forceHide);
EnableMenuItem(menuID, true); EnableMenuItem(menuID, (numSelected == 1));
} }
function SetupEditAsNewMenuItem(menuID, numSelected, forceHide) function SetupEditAsNewMenuItem(menuID, numSelected, forceHide)
{ {
ShowMenuItem(menuID, (numSelected <= 1)&& !forceHide); ShowMenuItem(menuID, (numSelected <= 1)&& !forceHide);
EnableMenuItem(menuID, true); EnableMenuItem(menuID, (numSelected == 1));
} }
function SetupReplyToSenderMenuItem(menuID, numSelected, forceHide) function SetupReplyToSenderMenuItem(menuID, numSelected, forceHide)
@ -334,7 +316,7 @@ function fillMessagePaneContextMenu(contextMenu)
var isNewsgroup = false; var isNewsgroup = false;
if(numSelected == 1) if ((numSelected == 1) && message)
isNewsgroup = GetMessageType(message) == "news"; isNewsgroup = GetMessageType(message) == "news";
var hideMailItems = AreBrowserItemsShowing(); var hideMailItems = AreBrowserItemsShowing();

Просмотреть файл

@ -124,13 +124,11 @@ function InitMessageMenu()
function GetMessageType(message) function GetMessageType(message)
{ {
var compositeDS = GetCompositeDataSource("MessageProperty"); var compositeDS = GetCompositeDataSource("MessageProperty");
var property = RDF.GetResource('http://home.netscape.com/NC-rdf#MessageType'); var property = RDF.GetResource('http://home.netscape.com/NC-rdf#MessageType');
var result = compositeDS.GetTarget(message, property, true); var result = compositeDS.GetTarget(message, property, true);
result = result.QueryInterface(Components.interfaces.nsIRDFLiteral); result = result.QueryInterface(Components.interfaces.nsIRDFLiteral);
return result.Value; return result.Value;
} }
function InitMessageMark() function InitMessageMark()
@ -157,7 +155,6 @@ function InitMarkFlaggedItem(id)
item.setAttribute("checked", areMessagesFlagged); item.setAttribute("checked", areMessagesFlagged);
} }
function SelectedMessagesAreRead() function SelectedMessagesAreRead()
{ {
var aMessage = GetSelectedMessage(0); var aMessage = GetSelectedMessage(0);
@ -361,9 +358,9 @@ function MsgDeleteMessage(reallyDelete, fromToolbar)
function MsgCopyMessage(destFolder) function MsgCopyMessage(destFolder)
{ {
// Get the id for the folder we're copying into // Get the id for the folder we're copying into
destUri = destFolder.getAttribute('id'); var destUri = destFolder.getAttribute('id');
destResource = RDF.GetResource(destUri); var destResource = RDF.GetResource(destUri);
destMsgFolder = destResource.QueryInterface(Components.interfaces.nsIMsgFolder); var destMsgFolder = destResource.QueryInterface(Components.interfaces.nsIMsgFolder);
var srcFolder = GetLoadedMsgFolder(); var srcFolder = GetLoadedMsgFolder();
if(srcFolder) if(srcFolder)
@ -378,9 +375,9 @@ function MsgCopyMessage(destFolder)
function MsgMoveMessage(destFolder) function MsgMoveMessage(destFolder)
{ {
// Get the id for the folder we're copying into // Get the id for the folder we're copying into
destUri = destFolder.getAttribute('id'); var destUri = destFolder.getAttribute('id');
destResource = RDF.GetResource(destUri); var destResource = RDF.GetResource(destUri);
destMsgFolder = destResource.QueryInterface(Components.interfaces.nsIMsgFolder); var destMsgFolder = destResource.QueryInterface(Components.interfaces.nsIMsgFolder);
var srcFolder = GetLoadedMsgFolder(); var srcFolder = GetLoadedMsgFolder();
if(srcFolder) if(srcFolder)
@ -731,7 +728,6 @@ function MsgMarkAsFlagged(markFlagged)
MarkMessagesFlagged(compositeDataSource, selectedMessages, markFlagged); MarkMessagesFlagged(compositeDataSource, selectedMessages, markFlagged);
} }
function MsgMarkAllRead() function MsgMarkAllRead()
{ {
var compositeDataSource = GetCompositeDataSource("MarkAllMessagesRead"); var compositeDataSource = GetCompositeDataSource("MarkAllMessagesRead");
@ -760,7 +756,6 @@ function MsgDownloadSelected()
function MsgMarkThreadAsRead() function MsgMarkThreadAsRead()
{ {
var messageList = GetSelectedMessages(); var messageList = GetSelectedMessages();
if(messageList.length == 1) if(messageList.length == 1)
{ {
@ -769,30 +764,33 @@ function MsgMarkThreadAsRead()
MarkThreadAsRead(compositeDataSource, message); MarkThreadAsRead(compositeDataSource, message);
} }
} }
function MsgViewPageSource() function MsgViewPageSource()
{ {
dump("MsgViewPageSource(); \n "); //dump("MsgViewPageSource(); \n ");
var messages = GetSelectedMessages(); var messages = GetSelectedMessages();
ViewPageSource(messages); ViewPageSource(messages);
} }
function MsgFind() { function MsgFind()
{
messenger.find(); messenger.find();
} }
function MsgFindAgain() {
function MsgFindAgain()
{
messenger.findAgain(); messenger.findAgain();
} }
function MsgSearchMessages() { function MsgSearchMessages()
{
var preselectedFolder = GetFirstSelectedMsgFolder(); var preselectedFolder = GetFirstSelectedMsgFolder();
window.openDialog("chrome://messenger/content/SearchDialog.xul", "SearchMail", "chrome,resizable", { folder: preselectedFolder }); window.openDialog("chrome://messenger/content/SearchDialog.xul", "SearchMail", "chrome,resizable", { folder: preselectedFolder });
} }
function MsgFilters() { function MsgFilters()
{
var preselectedFolder = GetFirstSelectedMsgFolder(); var preselectedFolder = GetFirstSelectedMsgFolder();
window.openDialog("chrome://messenger/content/FilterListDialog.xul", "FilterDialog", "chrome,resizable", { folder: preselectedFolder }); window.openDialog("chrome://messenger/content/FilterListDialog.xul", "FilterDialog", "chrome,resizable", { folder: preselectedFolder });
} }
@ -803,12 +801,14 @@ function MsgViewAllHeaders()
MsgReload(); MsgReload();
return true; return true;
} }
function MsgViewNormalHeaders() function MsgViewNormalHeaders()
{ {
pref.SetIntPref("mail.show_headers",1); pref.SetIntPref("mail.show_headers",1);
MsgReload(); MsgReload();
return true; return true;
} }
function MsgViewBriefHeaders() function MsgViewBriefHeaders()
{ {
pref.SetIntPref("mail.show_headers",0); pref.SetIntPref("mail.show_headers",0);
@ -837,7 +837,6 @@ function MsgSendUnsentMsg()
function PrintEnginePrint() function PrintEnginePrint()
{ {
var messageList = GetSelectedMessages(); var messageList = GetSelectedMessages();
numMessages = messageList.length; numMessages = messageList.length;