Page MenuHomePhabricator

It is unclear what is supposed to be stored in ve.init.platform.imageInfoCache
Closed, ResolvedPublic1 Estimated Story Points

Description

It is unclear what is supposed to be stored in ve.init.platform.imageInfoCache.

MWMediaDialog (in ve.ui.MWMediaDialog.prototype.confirmSelectedImage) is stuffing oodles of probably completely useless image metadata there (when calling ve.init.platform.imageInfoCache.set( obj )), especially after uploading an image from the dialog. This probably leaks some memory.

Event Timeline

matmarex raised the priority of this task from to Needs Triage.
matmarex updated the task description. (Show Details)
matmarex subscribed.
Restricted Application added subscribers: StudiesWorld, Aklapper. · View Herald Transcript

This is used for efficiently sizing/editing of media in the edit page, isn't it?

From grepping around, it looks like it's just width, height, and mediaType.

The API request for uncached images just fetches iiprop:size|mediatype, which gets us:

"imageinfo": [
                    {
                        "size": 2309396,
                        "width": 3250,
                        "height": 4333,
                        "mediatype": "BITMAP"
                    }
                ]

Of those, only width, height, and mediatype are ever actually used... so trimming the media dialog caching down to match the API request looks harmless.

Change 273923 had a related patch set uploaded (by DLynch):
MWMediaDialog: Only cache relevant information

https://gerrit.wikimedia.org/r/273923

Change 273923 merged by jenkins-bot:
MWMediaDialog: Only cache relevant information

https://gerrit.wikimedia.org/r/273923

Jdforrester-WMF assigned this task to DLynch.
Jdforrester-WMF triaged this task as Medium priority.

Deeming this now clear.