Closed
Bug 1308727
Opened 8 years ago
Closed 8 years ago
Refactor favicon handling for session persistence and guaranteed resolution of error icons.
Categories
(Thunderbird :: Mail Window Front End, defect)
Thunderbird
Mail Window Front End
Tracking
(Not tracked)
RESOLVED
FIXED
Thunderbird 52.0
People
(Reporter: alta88, Assigned: alta88)
References
(Blocks 1 open bug)
Details
Attachments
(1 file, 2 obsolete files)
30.29 KB,
patch
|
mkmelin
:
review+
|
Details | Diff | Splinter Review |
This patch attempts to fix the 2 main problems with the original implementation, as described in Bug 748950#c4.
1. Favicons are loaded into an html:img node, which returns errors well, thus guaranteeing resolution and getting rid of the current gross hack.
2. The folder URI keyed favicon urls are moved to a cache object on gFolderTreeView from the current rowMap item location, ensuring session persistence once resolved.
3. Some tweaks to ensure getImageSrc does as little unnecessary work as possible.
Note: this patch is based off the patches in Bug 497488. It is also intended to lay the groundwork for making it a simple fix for bug 748950 mail server favicons.
Assignee: nobody → alta88
Attachment #8799134 -
Flags: review?(mkmelin+mozilla)
tweaks.
Attachment #8799134 -
Attachment is obsolete: true
Attachment #8799134 -
Flags: review?(mkmelin+mozilla)
Attachment #8799231 -
Flags: review?(mkmelin+mozilla)
Comment 3•8 years ago
|
||
Comment on attachment 8799231 [details] [diff] [review]
favicons.patch
Review of attachment 8799231 [details] [diff] [review]:
-----------------------------------------------------------------
I'm not sure why you want to distinguish between null and undefined, but that would be error prone.
::: mail/base/content/folderPane.js
@@ +919,5 @@
> if (folder.server.type != "rss" || folder.isServer)
> return "";
>
> + let favicon = this.getFolderCacheProperty(folder, "favicon");
> + if (favicon != undefined)
if (favicon)
@@ +1491,5 @@
> + * @return value or null.
> + */
> + getFolderCacheProperty: function(aFolder, aProperty) {
> + if (!aFolder || !aProperty)
> + return null;
wouldn't that be programmer error? seems better to just let things blow up if you pass in nulls
::: mail/base/content/mailTabs.js
@@ +282,4 @@
> return;
> }
>
> + if (favicon == undefined) {
if (!favicon)
::: mailnews/extensions/newsblog/content/FeedUtils.jsm
@@ +635,2 @@
>
> + if (aIconUrl != undefined)
if (aIconUrl)
::: mailnews/extensions/newsblog/content/feed-subscriptions.js
@@ +315,5 @@
> {
> for (let child of item.children)
> {
> + if (!child.container) {
> + if (child.favicon != undefined)
here too just falsy/truthy comparisons please
(In reply to Magnus Melin from comment #3)
> Comment on attachment 8799231 [details] [diff] [review]
> favicons.patch
>
> Review of attachment 8799231 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> I'm not sure why you want to distinguish between null and undefined, but
> that would be error prone.
>
it's an inherent part of the design. the possible values are undefined, "", or the valid url string. it's very important to only do the favicon processing once, and the initial state is represented most appropriately by undefined. using null could be possible, but it would preclude null as a "never previously processed" value. (yes, i know it would need stricter === equality, but currently null isn't used as a permanent resolved value).
so "" means resolved, but with no valid url, go use the default favicon from css. the change that should be made here is somevar === or !== undefined to be futureproof.
Comment 5•8 years ago
|
||
Thx for the explanation. I still think it would be better to have null mean unprocessed, and "" for processed-but-n/a
but that hardly makes any difference, it would just mean changing to somevar == null or != null, instead of undefined. is that what you want? a falsy evaluationn like (!somevar) simply won't work. and it means somevar can't ever be resolved to null, other things may want to use this cache.
the other thing about null as a resolved value - it's certainly preferable to "", but it's only due to some issue (i recall it from the original favicon review) with getImageSrc having a problem with null. but probably getCellProperties and others are fine with null, and this cache would be a good use there. that's why i did it this way.
Comment 8•8 years ago
|
||
(In reply to alta88 from comment #6)
> but that hardly makes any difference, it would just mean changing to somevar
> == null or != null, instead of undefined. is that what you want? a falsy
I think that would be preferable yes.
updated. this also makes some tweaks, mainly removing old skool callback arg as a fat arrow style function binds automatically to |this|.
Attachment #8799231 -
Attachment is obsolete: true
Attachment #8799231 -
Flags: review?(mkmelin+mozilla)
Attachment #8800286 -
Flags: review?(mkmelin+mozilla)
Assignee | ||
Comment 10•8 years ago
|
||
ping?
Comment 11•8 years ago
|
||
Comment on attachment 8800286 [details] [diff] [review]
favicons.patch
Review of attachment 8800286 [details] [diff] [review]:
-----------------------------------------------------------------
Looks good to me, sorry for the delay! r=mkmelin
Attachment #8800286 -
Flags: review?(mkmelin+mozilla) → review+
Comment 13•8 years ago
|
||
Status: NEW → RESOLVED
Closed: 8 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 52.0
You need to log in
before you can comment on or make changes to this bug.
Description
•