Closed Bug 1135251 Opened 11 years ago Closed 10 years ago

[Gallery] ThumbnailList class should not call navigator.mozL10n.ready()

Categories

(Firefox OS Graveyard :: Gaia::Gallery, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: djf, Assigned: pdahiya)

Details

Attachments

(1 file)

gallery/js/thumbnail_list.js calls mozL10n.ready() in its constructor. Currently gallery only ever creates a single ThumbnailList with the same lifetime as the app, so this is okay. But if we ever modified it to create multiple ThumbnailList objects, then this would be a tricky memory leak. So we should change this. I suggest modifying ThumbnailList to use once() for its initial localization. Then, once Gallery has created its thumbnail list, it can call ready() at the global level to invoke thumbnailList.localize() when the language changes. See https://bugzilla.mozilla.org/show_bug.cgi?id=1068976#c7 and https://bugzilla.mozilla.org/show_bug.cgi?id=1134436#c6 for more details.
Punam, Would you take this bug, please?
Flags: needinfo?(pdahiya)
Assignee: nobody → pdahiya
Flags: needinfo?(pdahiya)
Thanks for filing, assigning myself to fix after updating Bug 1134436 patch.
Comment on attachment 8568690 [details] [review] [gaia] punamdahiya:Bug1135251 > mozilla-b2g:master Hi David Please review attached PR updated with ThumbnailList to use once for its initial localization and ready call moved to global level inside startup.js after thumbnails are created. Thanks!
Attachment #8568690 - Flags: review?(dflanagan)
Comment on attachment 8568690 [details] [review] [gaia] punamdahiya:Bug1135251 > mozilla-b2g:master r- because I think this patch can cause the list to be localized twice on startup. If you just do the ready() call right after calling the ThumbnailList constructor (with nothing async in between) then I think that is all that is needed. See my comment on github.
Attachment #8568690 - Flags: review?(dflanagan) → review-
Comment on attachment 8568690 [details] [review] [gaia] punamdahiya:Bug1135251 > mozilla-b2g:master Hi David I have updated patch with your review feedback. You are right we don't need explicit l10n once call in ThumbnailList constructor if we move ready() call right after creating thumbnailList instance. Thanks
Attachment #8568690 - Flags: review- → review?(dflanagan)
Comment on attachment 8568690 [details] [review] [gaia] punamdahiya:Bug1135251 > mozilla-b2g:master Looks good to me!
Attachment #8568690 - Flags: review?(dflanagan) → review+
Keywords: checkin-needed
Keywords: checkin-needed
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: