Remove RDF use from folder-lookup-service
Categories
(MailNews Core :: Backend, enhancement)
Tracking
(Not tracked)
People
(Reporter: benc, Assigned: benc)
References
Details
Attachments
(2 files, 7 obsolete files)
8.44 KB,
patch
|
benc
:
review+
|
Details | Diff | Splinter Review |
16.36 KB,
patch
|
benc
:
review+
|
Details | Diff | Splinter Review |
Currently the folder-lookup-service is just a pass-through to the rdf service.
We want the folder-lookup-service to implement folder lookup and creation all by itself.
Two aspects to this:
- remove RDF code from the FLS. It needs to maintain it's own map of existent folders, and gain the ability to construct new folders.
- The inheritance from nsIRDFResource needs to be removed from existing folder implementations (mainly involves adding the
Init()
function fromnsIRDFResource
tonsIMsgFolder
)
Assignee | ||
Updated•6 years ago
|
Assignee | ||
Updated•6 years ago
|
Assignee | ||
Comment 1•6 years ago
|
||
This patch makes the folder-lookup-service create and track folders itself, rather than just acting as a pass-through to the rdf service.
Assignee | ||
Comment 2•6 years ago
•
|
||
And this one removes the nsIRDFResource inheritance from the folders.
(the remove-rdf-from-fls patch works on its own, and this patch should be applied on top).
Assignee | ||
Comment 3•6 years ago
|
||
I've had clean try runs on both these patches, but there's some test borkage in the tree right now, so I'll hold off going for any review of these until it clears up.
(I made a few cosmetic changes to the patches, so I'd like to run them through another try build first, just to be sure of them).
Assignee | ||
Comment 4•6 years ago
•
|
||
Ignore this one - uploaded the wrong patch!
Assignee | ||
Comment 5•6 years ago
|
||
And here's a rebase of the second patch. This one removes RDF inheritance from the folder classes.
Assignee | ||
Updated•6 years ago
|
Assignee | ||
Comment 6•6 years ago
|
||
Here's the proper version of the first patch. Updates folder-lookup-service to not rely on RDF service.
Assignee | ||
Comment 7•6 years ago
•
|
||
Here's a try run with these patches (actually from before I rebased them - these ones are against yesterdays code):
Looks pretty clean... although I don't know what test_sss_sanitizeOnShutdown.js is... will investigate (update: looks unrelated, see Bug 1529202).
Assignee | ||
Updated•6 years ago
|
benc, have you considered how the new fls handles folders that have been deleted on disk, under a running Tb? Since rdf was a cache, it returned a folder even though it didn't exist on disk, and I had to use exists() since a smart app handles these sorts of edge cases. Just a thought.
Assignee | ||
Comment 9•6 years ago
|
||
(In reply to alta88 from comment #8)
benc, have you considered how the new fls handles folders that have been deleted on disk, under a running Tb? Since rdf was a cache, it returned a folder even though it didn't exist on disk, and I had to use exists() since a smart app handles these sorts of edge cases. Just a thought.
It's a good point - I'd not really considered it. Can you point me at any specific exists() examples in the current code?
I'd imagine they'd still be called - the fls stuff is more-or-less a drop-in replacement for the RDF service, so everything else around it should be preserved...
However, the actual filesystem checking would now be the domain of the pluggable mailstore (ie mbox or maildir or whatever), so maybe there's some updating required (I've definitely found a few places that assume they only need to deal with mbox, so I know there are more lurking out there :-)
Comment 10•6 years ago
|
||
Here's a place:
https://searchfox.org/comm-central/rev/fac8703e87a0c058c70263bb1c5a6fff8815c6e6/mailnews/extensions/newsblog/content/FeedUtils.jsm#667
The comment notes that nonexistent folders can be returned, from a stale cache.
Assignee | ||
Comment 11•6 years ago
•
|
||
After pondering this for a while, I don't think the deal-with-suddenly-disappearing-folders cases will change under my new patches.
In any case, if we really wanted to properly cope with folders being deleted on disk while the app is running in a holistic kind of way, there's a lot more serious work involved...
And I'm inclined to think that it falls in the "don't do that!" section of the user manual :-)
Comment 12•6 years ago
|
||
Comment 13•6 years ago
|
||
Comment 14•6 years ago
|
||
(In reply to :aceman from comment #12)
- let contractID = "@mozilla.org/rdf/resource-factory;1?name=" + scheme;
A 'rdf resource factory'? Is this the final version or will this also be
converted to something else soon?
Ok, I see you have bug 1527772 for this.
Comment 15•6 years ago
|
||
Comment 16•6 years ago
|
||
(In reply to Ben Campbell from comment #11)
After pondering this for a while, I don't think the deal-with-suddenly-disappearing-folders cases will change under my new patches.
In any case, if we really wanted to properly cope with folders being deleted on disk while the app is running in a holistic kind of way, there's a lot more serious work involved...
I don't think an exists() test and then a stock folder delete call, which clears the cache and propagates pretty well in my experience with the folder change listener, is that serious, but will assume you've gotten really deep into folders and have cases which don't fit with the above. The trickiest thing in the old days (before aceman fixed folderpickers) would have been handling account manager folder destinations, and believe almost all accesses of required folders and handled cleanly already.
And I'm inclined to think that it falls in the "don't do that!" section of the user manual :-)
I can't actually agree with that as a good principle. A good principle is code that prevents users from footgunning themselves and recovers when they do. But it's an edge case and your call ;)
Comment 17•6 years ago
|
||
Ben, let's get these through the final reviews now so it can land.
Assignee | ||
Comment 18•6 years ago
|
||
I need to get Bug 1534163 sorted out first (de-RDFing the feeds code). Without that, these changes break stuff.
Assignee | ||
Comment 19•6 years ago
|
||
Fixups as per review in Comment #12:
- added jsdoc blocks
- added an error log if folder creation fails. I used
Cu.reportError()
, so I guess it'll go out the the javascript console. Open to better suggestions! - reworded the comment block that still referred to RDF.
Assignee | ||
Comment 20•6 years ago
|
||
And this one addressing comment #13:
- removed the redundant
Init()
implementation innsLocalMailFolder
. - restored the removed subtest in
test_jaMsgFolder.js
, using thedbFolder.URI
Thanks for picking those ones up!
Also if the patches on Bug 1534163 are also applied, this stuff should work fine on newsfeed folders.
Assignee | ||
Comment 21•6 years ago
|
||
(In reply to alta88 from comment #16)
And I'm inclined to think that it falls in the "don't do that!" section of the user manual :-)
I can't actually agree with that as a good principle. A good principle is code that prevents users from footgunning themselves and recovers when they do. But it's an edge case and your call ;)
Sorry, I didn't mean to sound so flippant about this! But I think the folder-lookup-service doesn't have enough information to deal with these kind of cases, and that they need to be handled at a higher level. For example, IMAP folders can have some pretty complicated (and asynchronous) life cycles.
Also, the exists()
test is something that'd ideally be delegated to the plugablemailstore used by the folder. There's a lot of code that called exists()
to directly check for a mbox, and this still works for maildir (exists()
doesn't care if it's a directory or file). This is all fine for now, but in theory we could have other stores (eg database-backed ones) where this'll break.
Maybe the whole issue is worth moving into a bug of it's own?
Comment 22•6 years ago
|
||
Comment 23•6 years ago
|
||
Updated•6 years ago
|
Comment 25•5 years ago
|
||
I'm sure this stuff had some bitrot since April. I guess the checkin was waiting for bug 1534163 which is ready now.
Assignee | ||
Comment 26•5 years ago
|
||
Rebased rdf-removal patches. Already reviewed by aceman, and no actual changes. But they did span the big eslint/clang-format restylings, so there were a lot of changes to pick through... the try build looks solid, but not sure if it's worth another pair of eyes to sanity check it?
Assignee | ||
Comment 27•5 years ago
|
||
Comment 29•5 years ago
|
||
Pushed by mozilla@jorgk.com:
https://hg.mozilla.org/comm-central/rev/1fec6625cb31
Remove rdf use from folder-lookup-service. r=aceman
https://hg.mozilla.org/comm-central/rev/729209b67d45
Remove RDFResource inheritance from nsMsgDBFolder. r=aceman
Updated•5 years ago
|
Description
•