Page MenuHomePhabricator

20kb project logo image requested on every page (betawiki.png)
Closed, ResolvedPublic

Description

As a followup from performance review (T254950):

"I've noticed a very minor thing when testing the site out for performance. There's a 20kb image that's requested on every page and never displayed: https://api.wikimedia.beta.wmflabs.org/static/images/project-logos/betawiki.png

I suppose it comes from some CSS (as the default site logo does), as I can't find it in the HTML. There's probably some other CSS from the skin to hide the original logo, but not in a way that stops it from loading."

Event Timeline

The root of the problem is that the MediaWiki is preloading the logo for the site, but the skin has a hard-coded logo and thus does not use the configured value. This is also evident through a warning message that appears in the console; for example, in my local install, I get the following:

The resource http://default.web.mw.localhost:8080/mediawiki/resources/assets/wiki.png?86a63 was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate `as` value and it is preloaded intentionally.

The solution would have to be not hardcoding the logo in the skin or finding a way to convince MediaWiki not to preload the default configured logo.

Although this issue was identified in T254950#6532543 during the performance review of the WikimediaApiPortalOAuth extension, it is an issue in the WikimediaApiPortal skin.

Aklapper renamed this task from 20kb image requested on every page to 20kb project logo image requested on every page (betawiki.png).Oct 17 2020, 4:54 PM

It is provided by ResourceLoaderSkinModule::getPreloadLinks. A solution could be extending that class and overriding getPreloadLinks to return an empty array.

It is also present in the skins MinervaNeue and Vector (legacy skin)'s Desktop Improvements (Vector 2022) (skin version 2), so a change to ResourceLoaderSkinModule might be a better way, such as making it an optional feature.

Change 634764 had a related patch set uploaded (by Cicalese; owner: Cicalese):
[mediawiki/skins/WikimediaApiPortal@master] Prevent preloading of logo.

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

Thank you for the suggestions, @Mainframe98. Very helpful! I opted to go with extending the class for now, which works great.

Change 634828 had a related patch set uploaded (by Cicalese; owner: Cicalese):
[mediawiki/core@master] Make logo preloading an optional feature.

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

The second patch is an alternative to the first taking the suggestion to make preloading an optional, default feature in ResourceLoaderSkinModule. Feedback on the patches, including which approach is preferred, is welcome.

Change 634833 had a related patch set uploaded (by Cicalese; owner: Cicalese):
[mediawiki/skins/WikimediaApiPortal@master] Make logo preloading an optional feature.

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

Change 635558 had a related patch set uploaded (by Cicalese; owner: Cicalese):
[mediawiki/skins/Vector@master] Enable logo preloading.

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

Change 634764 abandoned by Cicalese:
[mediawiki/skins/WikimediaApiPortal@master] Prevent preloading of logo.

Reason:
Abandoned in favor of I5731dd3c5da73b6e6b45c4160f5a82fb399866d8.

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

Change 634833 abandoned by Cicalese:
[mediawiki/skins/WikimediaApiPortal@master] Make logo preloading an optional feature.

Reason:
No longer necessary since the default was changed in the core patch.

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

Change 635558 abandoned by Cicalese:
[mediawiki/skins/Vector@master] Enable logo preloading.

Reason:
A solution that does not require a change to Vector was found in I5731dd3c5da73b6e6b45c4160f5a82fb399866d8.

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

Change 634833 restored by Cicalese:
[mediawiki/skins/WikimediaApiPortal@master] Make logo preloading an optional feature.

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

Change 634828 merged by jenkins-bot:
[mediawiki/core@master] Only preload logo if the optional logo feature is enabled.

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

Change 634833 merged by jenkins-bot:
[mediawiki/skins/WikimediaApiPortal@master] Don't preload logo.

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

Verified on beta that this image is no longer loaded. Thanks, Cindy!