Closed
Bug 74943
Opened 25 years ago
Closed 18 years ago
Problems with IDL function GetMessages
Categories
(MailNews Core :: Backend, defect)
MailNews Core
Backend
Tracking
(Not tracked)
RESOLVED
WONTFIX
People
(Reporter: BenB, Assigned: BenB)
Details
Attachments
(2 files)
|
3.74 KB,
patch
|
Details | Diff | Splinter Review | |
|
7.19 KB,
patch
|
Details | Diff | Splinter Review |
The method nsIMsgFolder::GetMessages has 2 problems:
- It requires an nsIMsgWindow as param (eek!)
- It fails for IMAP, if the impl function GetDatabase didn't happen to be
called. Local fails, too, probably for the same reason. news works.
I can work around 1. by passing nsnull as argument. I hacked nsMsgProtocol not
to put up a prompt, in this case; not sure, if that was needed. There might be
more cases, were the null msgwindow is a problem, and I just didn't run into
them yet.
In general, functions like that shouldn't know anything at all about UI. IMO,
they should be redesigned, e.g. throwing certain error codes, when an error
occurs (instead of trying to display the error themselves). I probably fix that
myself, though.
I have a fix for problem 2 IMAP. I can probably produce one for Local as well.
| Assignee | ||
Comment 1•25 years ago
|
||
Correction: I probably *won't* fix that myself, though.
| Assignee | ||
Comment 2•25 years ago
|
||
I found the reason for problem 2 Local as well: Somebody seems to have confused
NS_FAILED() with NS_SUCCEEDED().
Comment 3•25 years ago
|
||
ben, could you be a little more specific? what code is getting NS_FAILED
confused with NS_SUCCEEDED?
| Assignee | ||
Comment 4•25 years ago
|
||
| Assignee | ||
Comment 5•25 years ago
|
||
heh, bienvenu, slowly, slooowly ;-P. I hope, the patch makes it clear.
The patch is rough, propably not good enough for checkin. Feedback for it would
be nice, though.
Comment 6•25 years ago
|
||
I don't really buy that last bit about NS_SUCCEEDED and NS_FAILED - I believe it
was intentional to return NS_ERROR_NOT_INITIALIZED when we had to parse the
local mail folder - this happens asynchronously so the caller should not expect
the db to be ready. Perhaps other code is not handling that return code correctly.
| Assignee | ||
Comment 7•25 years ago
|
||
Yeah, you could be right.
But fact it now works for me, while it didn't before. In my case, the parsing
has already happened or is quick (small folder). It seems like that parse call
also initializes the db (and only parses in the rare event that that didn't
happen already). You see, I'm just guessing again, I might look into the code
closer tomorrow.
As for the right solution, it's important to me that the call succeeds (if at
all possible) and that I don't have to provide a window. I can well live with
synconous solutions.
Comment 8•25 years ago
|
||
I don't quite get the change to nsMsgProtocol::GetPromptDialogFromUrl - it
already checks for a null msgWindow, didn't it? NS_ENSURE_TRUE(msgWindow,
NS_ERROR_FAILURE);
So it wouldn't crash without a msgWindow. Are you just unhappy about it
returning an error? In which case you could just say NS_ENSURE_TRUE(msgWindow,
NS_OK); Or, if you don't want the assert, you could do what you did, I guess.
But the assert is useful for us, since we don't want to be dropping errors,
whereas you want to drop errors because you don't have a window. I'd prefer that
we see the assert in this case.
The change to imap looks OK.
We don't want to make folder parsing synchronous, and you don't want us to
either - it will lock up the UI, which is a guaranteed way to make people
complain. My guess is that you just aren't handling the error that comes back,
right? Are you calling from JS and not catching exceptions?
| Assignee | ||
Comment 9•25 years ago
|
||
> it already checks for a null msgWindow, didn't it? NS_ENSURE_TRUE(msgWindow,
> NS_ERROR_FAILURE);
I don't wanted functions to "fail" just because I have no "window". I never have
a window, so it would always fail for me. Not good.
As for OnStopRequest, maybe it's best, if I just return |aStatus| as return code.
I could make GetPromptDialogFromUrl fail and just make its callers more tolerant.
As for the assert, I don't care about the debug code, so I'll leave the
assertion in for you.
> it will lock up the UI, which is a guaranteed way to make people
> complain.
I have no UI. But let's discuss this via email.
| Assignee | ||
Comment 10•25 years ago
|
||
| Assignee | ||
Comment 11•25 years ago
|
||
The new patch addresses most of your feedback. It is still a hack in some places
(marked with "IGNORE"), but that can be resolved with a bit more work, I guess.
I did not address the parse mailbox problem, pending discussion with bienvenu.
| Assignee | ||
Updated•25 years ago
|
Summary: GetMessages problems → Problems with IDL function GetMessages
Comment 12•24 years ago
|
||
Will this be going in anytime soon, or has it gone in allready?
| Assignee | ||
Comment 13•24 years ago
|
||
Why are you asking?
(My work on the alternative test client has been stalled, that's why my interest
dropped.)
Updated•21 years ago
|
Product: MailNews → Core
Comment 14•18 years ago
|
||
While I admit that having to pass around nsIMsgWindows everywhere merely for error reporting and prompting is annoying, that is a problem best solved in another bug and as part of a more widespread cleanup effort. Besides, password prompting may be an irrelevant issue anyways due to the password manager rewrite to be implemented soon.
Looking over the news changes solely: we don't do anything with the error message anyways, and I'm not so sure that differing between authentication failure and abortion is relevant, as the only use case I can see (not changing the password) has already handled it by this point.
I don't really see much point to any of the other changes, and nothing really strikes at the issue the summary implies, but I'll punt this off to bienvenu to make the call...
Comment 15•18 years ago
|
||
we long ago changed nsImapMailFolder::GetMessages to call GetDatabase() so I think that part of the patch is not needed anymore. I suspect a lot of this has bit-rotted.
Avoiding passing around or propagating nsIMsgWindows is a much bigger task. I think I'd just mark this wontfix and worry about that work elsewhere.
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → WONTFIX
Updated•18 years ago
|
Product: Core → MailNews Core
You need to log in
before you can comment on or make changes to this bug.
Description
•