If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

Deleting all messages from folder generates errors

RESOLVED FIXED in seamonkey2.17

Status

SeaMonkey
MailNews: Message Display
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: ewong, Assigned: Ian Neal)

Tracking

(Blocks: 2 bugs)

Trunk
seamonkey2.17
Dependency tree / graph

SeaMonkey Tracking Flags

(seamonkey2.17 fixed)

Details

Attachments

(1 attachment)

Comment hidden (empty)
(Reporter)

Comment 1

5 years ago
Errors:

rror: An error occurred updating the cmd_delete command: [Exception... "Component returned failure code: 0x8000ffff (NS_ERROR_UNEXPECTED) [nsIMsgDBView.hdrForFirstSelectedMessage]"  nsresult: "0x8000ffff (NS_ERROR_UNEXPECTED)"  location: "JS frame :: chrome://messenger/content/folderDisplay.js :: gFolderDisplay.selectedMessage :: line 18"  data: no]
Source file: chrome://global/content/globalOverlay.js
Line: 81
 ----------
Wed Dec 19 2012 22:05:38
Error: An error occurred updating the button_junk command: [Exception... "Component returned failure code: 0x8000ffff (NS_ERROR_UNEXPECTED) [nsIMsgDBView.hdrForFirstSelectedMessage]"  nsresult: "0x8000ffff (NS_ERROR_UNEXPECTED)"  location: "JS frame :: chrome://messenger/content/folderDisplay.js :: gFolderDisplay.selectedMessage :: line 18"  data: no]
Source file: chrome://global/content/globalOverlay.js
Line: 81
 ----------
Wed Dec 19 2012 22:05:38
Error: An error occurred updating the button_delete command: [Exception... "Component returned failure code: 0x8000ffff (NS_ERROR_UNEXPECTED) [nsIMsgDBView.hdrForFirstSelectedMessage]"  nsresult: "0x8000ffff (NS_ERROR_UNEXPECTED)"  location: "JS frame :: chrome://messenger/content/folderDisplay.js :: gFolderDisplay.selectedMessage :: line 18"  data: no]
Source file: chrome://global/content/globalOverlay.js
Line: 81

bisecting gives the following possible pushes:

 http://hg.mozilla.org/comm-central/rev/c7bf9a085fc4
or
 http://hg.mozilla.org/comm-central/rev/b849a17c4bc1

CC'ing IanN as these are his pushes and maybe can shed a light as to
what's going on.
OS: Windows Vista → All
(Reporter)

Comment 2

5 years ago
Steps to Reproduce:

1) Open Mail & News
2) If you have mail in Inbox, delete them all via <select all> Delete.
3) In Error console, the errors appear.
(Reporter)

Comment 3

5 years ago
I've zeroed in on the cset that's causing the errors.

It's http://hg.mozilla.org/comm-central/rev/b849a17c4bc1.
(Reporter)

Comment 4

5 years ago
With further tests, reverting the following changes makes the
errors disappear:

http://hg.mozilla.org/comm-central/rev/b849a17c4bc1#l2.110->2.118

and 

http://hg.mozilla.org/comm-central/rev/b849a17c4bc1#l2.88->2.101
(Reporter)

Comment 5

5 years ago
Addendum.

It seems as if there's an assumption in the previous code 
(i.e:
function SelectedMessagesAreDeleted()
{
  if (!gDBView || !gDBView.numSelected)
    return false;

  try
  {
    return gDBView.hdrForFirstSelectedMessage.flags &
           Components.interfaces.nsMsgMessageFlags.IMAPDeleted;
  }
  catch (ex)
  {
    // hdrForFirstSelectedMessage found an empty or invalid selection
    // even though numSelected indicated otherwise
    return false;
  }
}

When you delete all the messages, it fails in the try and catches the
exception and returns false.   For some reasons, it doesn't like
gDBView.hdrForFirstSelectedMessage.   Ditto with:


function SelectedMessagesAreJunk()
{
  var isJunk;
  try {
      var junkScore = gDBView.hdrForFirstSelectedMessage.getStringProperty("junkscore");
      isJunk =  ((junkScore != "") && (junkScore != "0"));
  }
  catch (ex) {
      isJunk = false;
  }
  return isJunk;
}

It just doesn't like accessing gDBView.hdrForFirstSelectedMessage for
this particular code pathway.  (Delete message, and I'm assuming Junk
message).  So IanN's patch actually exposes the 'badness' of the assumption
that even though gDBView isn't null, gDBView.hdrForFirstSelectedMessage
is a valid call.  And apparently it isn't a valid call for this set
of condtions(steps).
(Reporter)

Comment 6

5 years ago
(In reply to Edmund Wong (:ewong) from comment #5)
> Addendum.
> 
> It seems as if there's an assumption in the previous code 

The 'assumption' being that the 'try' part succeeds, when it
doesn't.
(Assignee)

Comment 7

5 years ago
Created attachment 695325 [details] [diff] [review]
Fix selectedMessage/selectedMessageUri [Checked in: Comment 10]

Using selectedIndices.length seems to be more reliable than selectedCount.
Alternatively could just make selectedCount return selectedIndices.length
Ideally gDBView.numSelected should be fixed but I don't know that code.
Assignee: nobody → iann_bugzilla
Status: NEW → ASSIGNED
Attachment #695325 - Flags: review?(neil)
Attachment #695325 - Flags: feedback?(ewong)
(Reporter)

Comment 8

5 years ago
Comment on attachment 695325 [details] [diff] [review]
Fix selectedMessage/selectedMessageUri [Checked in: Comment 10]

Works like a charm with the patch.
Attachment #695325 - Flags: feedback?(ewong) → feedback+
(Reporter)

Updated

5 years ago
Blocks: 824429

Comment 9

5 years ago
Comment on attachment 695325 [details] [diff] [review]
Fix selectedMessage/selectedMessageUri [Checked in: Comment 10]

The problem with using this.selectedIndices is that it involves copying an array from C++ to JavaScript, while selectedCount is just an integer, so I'd prefer something that avoided calling selectedIndices except in the case where it might disagree with selectedCount.
Attachment #695325 - Flags: review?(neil) → review+
(Assignee)

Updated

5 years ago
Hardware: x86 → All
Version: SeaMonkey 2.15 Branch → Trunk
(Assignee)

Updated

5 years ago
Summary: Deleting all messages from folder generates errors: → Deleting all messages from folder generates errors
(Assignee)

Comment 10

5 years ago
Comment on attachment 695325 [details] [diff] [review]
Fix selectedMessage/selectedMessageUri [Checked in: Comment 10]

http://hg.mozilla.org/comm-central/rev/30a6d21a5ec2
Attachment #695325 - Attachment description: Fix selectedMessage/selectedMessageUri → Fix selectedMessage/selectedMessageUri [Checked in: Comment 10]
(Assignee)

Updated

5 years ago
status-seamonkey2.17: --- → fixed
Target Milestone: --- → seamonkey2.17
(Assignee)

Updated

5 years ago
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
(Assignee)

Updated

5 years ago
Blocks: 825865
You need to log in before you can comment on or make changes to this bug.