Page MenuHomePhabricator

TypeError: item.classList is undefined
Closed, ResolvedPublicBUG REPORT

Description

Error limited to French Wikipedia
https://logstash.wikimedia.org/app/dashboards#/doc/logstash-*/logstash-2021.10.01?id=kWjCPXwBw6ZjC92mR8Xo

The code seems to get caught in an infinite loop for certain gadget additions.

at getVectorMenu URL1:1134:510
at getVectorMenu URL1:1134:611
at getVectorMenu URL1:1134:611
at getVectorMenu URL1:1134:611
at getVectorMenu URL1:1134:611
at getVectorMenu URL1:1134:611
at getVectorMenu URL1:1134:611
at getVectorMenu URL1:1134:611
at getVectorMenu URL1:1134:611
at getVectorMenu URL1:1134:611
at getVectorMenu URL1:1134:611
at getVectorMenu URL1:1134:611
at addPortletLinkHandler URL1:1134:737
at fire URL1:1006:657
at addPortletLink URL1:1061:296
at fillPortlet URL2:36:760
at URL2:36:867
at mightThrow URL1:235:833
at resolve/</process< URL1:236:498

URL1: https://fr.wikipedia.org/w/load.php?lang=fr&modules=ext.centralNotice.choiceData%2Cdisplay%2CgeoIP%2CkvStore%2CstartUp%7Cext.centralauth.ForeignApi%7Cext.centralauth.centralautologin.clearcookie%7Cext.cite.ux-enhancements%7Cext.cx.eventlogging.campaigns%7Cext.echo.api%2Cinit%7Cext.eventLogging%2Ckartographer%2CnavigationTiming%2CwikimediaEvents%7Cext.kartographer.box%2Cdata%2Csite%2Cstyle%2Cutil%7Cext.kartographer.lib.topojson%7Cext.uls.interface%2Cpreferences%2Cwebfonts%7Cjquery%2Cmapbox%2Coojs%2Coojs-router%2Coojs-ui%2Coojs-ui-core%2Coojs-ui-toolbars%2Coojs-ui-widgets%2Coojs-ui-windows%2Csite%7Cjquery.client%2Ccookie%2CtextSelection%7Cmediawiki.ForeignApi%2CString%2CTitle%2CUri%2Capi%2Cbase%2Ccldr%2Ccookie%2Cexperiments%2CjqueryMsg%2Clanguage%2Cstorage%2Ctoc%2Cuser%2Cutil%2CvisibleTimeout%7Cmediawiki.ForeignApi.core%7Cmediawiki.editfont.styles%7Cmediawiki.libs.pluralruleparser%7Cmediawiki.page.ready%7Cmediawiki.page.watch.ajax%7Cmmv.bootstrap%2Chead%7Cmmv.bootstrap.autostart%7Coojs-ui-core.icons%2Cstyles%7Coojs-ui-toolbars.icons%7Coojs-ui-widgets.icons%7Coojs-ui-windows.icons%7Coojs-ui.styles.icons-interactions%2Cicons-media%2Cindicators%7Cskins.vector.icons.js%7Cskins.vector.js%7Cuser.defaults&skin=vector&version=1qk0q
URL2: https://fr.wikipedia.org/w/load.php?lang=fr&modules=ext.gadget.ArchiveLinks%2CBlockMessage%2CCatRename%2CConfirmRollback%2CCustomSidebar%2CDeluxeHistory%2CExtendedCache%2CFusionContribs%2CLiveRC%2CMonobookToolbar%2CMonobookToolbarPatrouille%2CMonobookToolbarStandard%2CNavigAdmin%2COngletJournal%2CPublierBrouillonInit%2CResumeDeluxe%2CRevertDiff%2CSousPages%2CWatchlistNotice%2CWhereWikimediansLive%2Csearchbox%2CtooltipRef&skin=vector&version=5320k

Event Timeline

Jdlrobson triaged this task as Unbreak Now! priority.Oct 1 2021, 9:19 PM

Given the volume of errors here, this should be considered UBN.
Graph is getting close to alerting threshold: https://grafana.wikimedia.org/d/000000566/overview?viewPanel=16&orgId=1

I believe this error is because Gadget-CustomSidebar.js is creating a portlet without the 'vector-menu' class, which causes 'getVectorMenu' to get stuck in a recursive loop. We could update 'Gadget-CustomSidebar' to include the 'vector-menu' class, and replace 'getVectorMenu' with $().closest() to prevent the possibility of this type of recursive error in the future.

The specific problem it runs into is that parentNode will eventually eventually be document.body, and in two iterations after that parentNode will move to the Document object, which is not an Element and thus has no classList and fails at that point. I believe there was a type warning for this, but it was overridden. I agree the simplest solution is indeed to not re-create closest() but use it.

Change 726013 had a related patch set uploaded (by Bernard Wang; author: Bernard Wang):

[mediawiki/skins/Vector@master] Replace getVectorMenu function with jQuery equivalent

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

bwang removed bwang as the assignee of this task.Oct 4 2021, 5:59 PM
bwang moved this task from Doing to Code Review on the Web-Team-Backlog (Kanbanana-FY-2021-22) board.

Can skip QA. I'll sign this off when the error has disappeared in production.

Jdlrobson lowered the priority of this task from Unbreak Now! to Medium.Oct 4 2021, 6:53 PM

Change 726013 merged by jenkins-bot:

[mediawiki/skins/Vector@master] Replace getVectorMenu function with jQuery equivalent

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

No results in logstash any more.