Closed
Bug 110689
Opened 23 years ago
Closed 6 years ago
code cleanup: CreateStartupUrl() see comment in code
Categories
(MailNews Core :: Backend, defect)
Tracking
(thunderbird_esr6063+ fixed, thunderbird63 fixed)
RESOLVED
FIXED
Thunderbird 63.0
People
(Reporter: sspitzer, Assigned: neil)
Details
Attachments
(1 file, 3 obsolete files)
(deleted),
patch
|
jorgk-bmo
:
review+
jorgk-bmo
:
approval-comm-esr60+
|
Details | Diff | Splinter Review |
code cleanup: CreateStartupUrl() see comment in code
// XXX fix this, so that base doesn't depend on imap, local or news.
// we can't do NS_NewURI(uri, aUrl), because these are imap_message://,
mailbox_message://, news_message:// uris.
// GetMessageServiceFromURI() to get the service, and then have the service
create the appropriate nsI*Url, and
// then QI to nsIURI, and return it.
Comment 1•23 years ago
|
||
I'm moving to future, but if this affects something important, you can move it
back in.
Status: NEW → ASSIGNED
Target Milestone: --- → Future
Comment 2•23 years ago
|
||
Use message server to create nsURI
Comment 3•23 years ago
|
||
This is not just clean up, it also fixes problem of being unable to get
message folder charset when composing fwd inline/draft/template, see bug 66098.
(nsMailboxUrl expect message number in form ?number=<num>, but with current
CreateStartupUrl it gets msg number in form #<num>. So, msg key if left
at default 0xffffffff, and ....
Seth, does #-notation comes from rdf stuff? (otherwise I cannot imagine why
not to always use only ?number= notation...)
Comment 5•23 years ago
|
||
Seth, could you review the patch?
Comment 6•23 years ago
|
||
reassigning to adu@sparc.spb.su
Comment 7•23 years ago
|
||
Well, could anyone review this?
Reporter | ||
Comment 8•23 years ago
|
||
I'm behind in my reviews, give me a few days to get caught up please.
Comment 9•23 years ago
|
||
Removed unneeded |#include|s and |NS_DEFINE_CID|s as well...
Comment 10•23 years ago
|
||
Denis,
with the current code, does GetMsgDBHdrFromURI fail to get a message header for
the draft case?
Comment 11•23 years ago
|
||
Yes, assertion still here:
WARNING: NS_ENSURE_TRUE(msg) failed, file nsMailboxUrl.cpp, line 485
WARNING: NS_ENSURE_TRUE(NS_SUCCEEDED(rv)) failed, file nsMailboxUrl.cpp, line 497
Comment 12•23 years ago
|
||
I set a break point at CreateStartupUrl() and tried forward as inline.
The URI my case,
"mailbox-message://nobody@Local%20Folders/smoketest#39278?fetchCompleteMessage=true"
it was handled by the line below and returned without error.
else if (PL_strncasecmp(uri, "mailbox", 7) == 0)
The change in the patch of using GetMessageServiceFromURI, what does it make
different? I know it fixes the folder charset problem but not clear the reason.
Comment 13•23 years ago
|
||
Naoki, take a look at the code where assertion happens.
I don't have mozilla sources at the moment, but relevant pieces is where
msg key is parsed. Currently, we fail to get msg key from url which
contains msg key in form '#msgkey'. Using GetMessageServiceFromUri()
allows us to successfully parse it. I'll able to provide more details tomorrow,
when I'll get to work.
Comment 14•23 years ago
|
||
GetUri (I checked nsMailboxUrl::GetUri and nsImapUrl::GetUri) behave differently
for forward inline case.
Usually, GetUri returns mURI if not empty, something like this, for a local message,
"mailbox-message://nobody@Local%20Folders/smoketest#39278"
But for inline forward mURI is empty and it generates something like this for
the same local message,
"mailbox-message:/#-1"
Note that the folder name 'smoketest' is not available, so we cannot get
information like a folder charset.
Comment 15•23 years ago
|
||
When we call SetSpec, we eventually get to nsMailboxUrl::ParseSearhPart()
method, which parse msg key in the following way:
char * messageKey = extractAttributeValue(searchPart, "number=");
if (messageKey)
m_messageKey = atol(messageKey); // convert to a long...
So, when we don't have "?number=<...>" in URL, we'll get -1 as msg key.
When we use (as in my patch) GetMessageServiceFromURI and then
message service's GetUrlForUri, we'll get in PrepareMessageUrl, which will
parse #<msgkey> notation for us.
Updated•23 years ago
|
Attachment #67247 -
Attachment is obsolete: true
Comment 16•23 years ago
|
||
I set a break point at nsMailboxUrl::ParseSearhPart().
http://lxr.mozilla.org/seamonkey/source/mailnews/local/src/nsMailboxUrl.cpp#374
it has "?number=<...>" for forward inline too. So still not clear about the problem.
By the change to call GetUrlForUri() which calls PrepareMessageUrl() then
eventually SetUri() is called. So the later call to GetUri can return the stored
URI (so GetFolderCharset does not fail). I think the patch does the right thing
for forward inline but not known about other cases.
Could you make the change specific to forward inline (and ohter draft related)?
I think we can check if the URI ends with "fetchCompleteMessage=true". Then
attach the patch to bug 117956 or bug 66098.
Comment 17•23 years ago
|
||
Is it unreal to get sspitzer to review this?
CreateStartupUrl() is used in only one place besides draft operations
(in save attachment in nsMessenger), so I think draft-specific handling
would be overkill...
Comment 18•23 years ago
|
||
But save attachment does not work with the patch.
I tried both IMAP and local mail, msgService->GetUrlForUri returned error.
nsParseLocalMessageURI returns error if '#' is not found.
I prefer changing it for draft specific at least for now.
Comment 19•23 years ago
|
||
Some XPCOM voodoo magic... I don't understand, why QueryInterface
on nsIURI returned from GetUrlForUi (back to nsIMailNewsUrl) doesn't
work.
I don't see much difference between old CreateStartupUrl() and
XXXMessageService::GetUrlForUri()....
Comment 20•23 years ago
|
||
>why QueryInterface on nsIURI returned from GetUrlForUi (back to nsIMailNewsUrl)
>doesn't work.
The problem is not that. With the patch, it generates URI without '#' which does
not work for the exisiting code nsParseLocalMessageURI().
Comment 21•23 years ago
|
||
OK, will post patch for draft operations to 66098.
But I still don't understand, why is two url naming convensions
needed.
Reassigning back to sspitzer
Updated•23 years ago
|
Attachment #70293 -
Flags: needs-work+
Updated•20 years ago
|
Product: MailNews → Core
Comment 23•17 years ago
|
||
sorry for the spam. making bugzilla reflect reality as I'm not working on these bugs. filter on FOOBARCHEESE to remove these in bulk.
Assignee: sspitzer → nobody
Updated•16 years ago
|
Product: Core → MailNews Core
Comment 25•14 years ago
|
||
This issue prevents my exchange web services code from being able to implement save attachment. I'll probably need to submit a fix for this.
Assignee: nobody → kent
Comment 26•11 years ago
|
||
rkent, will you finish this?
Comment 27•11 years ago
|
||
(In reply to :aceman from comment #26)
> rkent, will you finish this?
Hmmm, that comment 25 was three years ago. I developed a workaround for this, which reduces my incentive to fix this. So I don't have any plans for the near future to get to this, so I should probably just remove my name from the assign.
Assignee: kent → nobody
Assignee | ||
Comment 28•6 years ago
|
||
(In reply to :aceman from comment #26)
> rkent, will you finish this?
It seems that, despite its comment to the contrary, the entire function is unnecessary and can be replaced with NS_NewURI.
The function is used in three places:
* Opening an attachment to a message in a local folder
* Saving an attachment
* Saving a message as text or HTML
I wasn't able to discern any problem with those three functions with these changes applied.
One immediate advantage of this is that you can then save ExQuilla messages as text. It would also remove ExQuilla's need to hook into the attachment saving code. (Obviously its use by the local folder code is not relevant to ExQuilla.) Naturally this would most benefit ExQuilla if it could be uplifted to Thunderbird ESR.
Assignee: nobody → neil
Attachment #70293 -
Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #8998799 -
Flags: review?(acelists)
Comment 29•6 years ago
|
||
Comment on attachment 8998799 [details] [diff] [review]
110689.diff
How have we suffered with CreateStartupUrl() through all the nsIURI changes :-( - Happy to see it go. I'll look into it.
Attachment #8998799 -
Flags: review?(acelists) → review?(jorgk)
Comment 30•6 years ago
|
||
Comment on attachment 8998799 [details] [diff] [review]
110689.diff
Review of attachment 8998799 [details] [diff] [review]:
-----------------------------------------------------------------
https://treeherder.mozilla.org/#/jobs?repo=try-comm-central&revision=118f7cfa6c669e450f8736555dd80fb8804c8493
::: mailnews/local/src/nsMailboxService.cpp
@@ +354,5 @@
> urlString += "&type=";
> urlString += aContentType;
> urlString += "&filename=";
> urlString += aFileName;
> + NS_NewURI(getter_AddRefs(URL), urlString);
No error checking here?
Comment 31•6 years ago
|
||
Comment on attachment 8998799 [details] [diff] [review]
110689.diff
Not compiling on Mac:
/builds/worker/workspace/build/src/comm/mailnews/base/util/nsMsgUtils.cpp:119:22: error: unused variable 'kImapUrlCID' [-Werror,-Wunused-const-variable]
/builds/worker/workspace/build/src/comm/mailnews/base/util/nsMsgUtils.cpp:120:22: error: unused variable 'kCMailboxUrl' [-Werror,-Wunused-const-variable]
/builds/worker/workspace/build/src/comm/mailnews/base/util/nsMsgUtils.cpp:121:22: error: unused variable 'kCNntpUrlCID' [-Werror,-Wunused-const-variable]
Attachment #8998799 -
Flags: review?(jorgk) → review-
Comment 32•6 years ago
|
||
I forgot to run tests, so here again:
https://treeherder.mozilla.org/#/jobs?repo=try-comm-central&revision=44a4f413cfb5e3f7e6e708ffa4dde7ba9f61905f
Comment 33•6 years ago
|
||
This is green (only showing the failures we're currently expecting). Neil, please address comment #30 and comment #31.
Comment 34•6 years ago
|
||
Looking at this again, what about the comment in the hunk that's going to be removed?
// XXX fix this, so that base doesn't depend on imap, local or news.
// we can't do NS_NewURI(uri, aUrl), because these are imap-message://, mailbox-message://, news-message:// uris.
While we're here, do you know where and when the *-message URLs are produced and used? I've seen them around but I don't know the complete picture.
Comment 35•6 years ago
|
||
Rebased for bug 1482720 and removed the unused variables:
https://treeherder.mozilla.org/#/jobs?repo=try-comm-central&revision=26cb41f62233b4ab7003e33079c41ed2cd899308
Attachment #8998799 -
Attachment is obsolete: true
Comment 36•6 years ago
|
||
Pushed by mozilla@jorgk.com:
https://hg.mozilla.org/comm-central/rev/d58a67d582ad
remove CreateStartupUrl() since it's unneeded. r=jorgk
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Updated•6 years ago
|
Target Milestone: Future → Thunderbird 63.0
Updated•6 years ago
|
Attachment #8999503 -
Flags: review+
Assignee | ||
Comment 37•6 years ago
|
||
Sorry for not following the bug closely.
(In reply to Jorg K (GMT+2) from comment #34)
> While we're here, do you know where and when the *-message URLs are produced
> and used? I've seen them around but I don't know the complete picture.
Way back when in the early days of Gecko, before even Outliner, so about 2000ish, the thread pane was generated using RDF.
As such, every message had two URLs, an RDF URI which was the folder URI + '#' + a message key that was used to build the thread pane, and then a Necko-capable -message: URL that could be loaded into an nsIDocShell.
(As you know, folders still use RDF, although these days I believe you like to build the folder pane in JS.)
Sadly there are still some remnants of the RDF message URIs around, although they're completely unnecessary. In fact I think the -message: suffix is also unnecessary, although again there are still some remnants around.
Assignee | ||
Comment 38•6 years ago
|
||
Comment on attachment 8999503 [details] [diff] [review]
110689.diff (v4)
[Approval Request Comment]
Testing completed (on c-c, etc.): Baked on c-c for several weeks
Risk to taking this patch (and alternatives if risky): Low, basically code removal
Attachment #8999503 -
Flags: approval-comm-esr60?
Comment 39•6 years ago
|
||
Why all those uplift requests? What are we gaining in TB 60? Usually the ESR is about stability and security fixes. We've already added "annoying bugs" to that list, but why uplift internal refactoring?
Assignee | ||
Comment 40•6 years ago
|
||
(In reply to Jorg K from comment #39)
> Why all those uplift requests
See bug 1493121 comment 6.
Try run: https://treeherder.mozilla.org/#/jobs?repo=try-comm-central&revision=894dfd0facd5704f29df5413977afe86003a87f8
Updated•6 years ago
|
Attachment #8999503 -
Flags: approval-comm-esr60? → approval-comm-esr60+
Comment 41•6 years ago
|
||
status-thunderbird63:
--- → fixed
status-thunderbird_esr60:
--- → fixed
tracking-thunderbird_esr60:
--- → 63+
Comment 42•6 years ago
|
||
@Jörg: Thanks so much for accepting this! This was important for us to be able to save attachments.
You need to log in
before you can comment on or make changes to this bug.
Description
•