Page MenuHomePhabricator

TypeError: $.collapsibleTabs.getSettings(...) is undefined from Vector skin
Closed, ResolvedPublic

Description

When I access
https://pt.wikipedia.org/w/index.php?title=Wikip%C3%A9dia:Esplanada/propostas&curid=61666&action=history&debug=1
using Firefox 57.0 (64-bit), while logged in or unregistered, I always get the error

TypeError: $.collapsibleTabs.getSettings(...) is undefined [Learn More] collapsibleTabs.js:114:29
handleResize/< https://pt.wikipedia.org/w/skins/Vector/collapsibleTabs.js:114:29
each https://pt.wikipedia.org/w/load.php:362:10
handleResize https://pt.wikipedia.org/w/skins/Vector/collapsibleTabs.js:98:4

Clicking on the first link, it shows the line
https://github.com/wikimedia/mediawiki-skins-Vector/blob/8842f744ee49a69fce24d0b4e1116068f97755d3/collapsibleTabs.js#L114

On Chrome 62, it looks like this:

collapsibleTabs.js?0c860:115 Uncaught TypeError: Cannot read property 'expandedWidth' of undefined

at jQuery.fn.init.<anonymous> (collapsibleTabs.js?0c860:115)
at Function.each (load.php?debug=true&lang=pt&modules=jquery%2Cmediawiki|mediawiki.legacy.wikibits&only=scripts&skin=vector&version=1b46sjy:362)
at handleResize (collapsibleTabs.js?0c860:98)

I believe there is some race condition and/or some missing dependency in the code (see e.g. rMW61d650befc58d4c5c9d82b3b0585e65c75766e9c).

See also

Event Timeline

Given the code in Vector/collapsibleTabs.js, I'm fairly certain that a race condition within the Vector skin code is not possible.

The only way getSettings can be missing, is if something else removes it after it was defined. I suspect that perhaps a gadget or user script might be modifying the jQuery object in ways that breaks it.

I am not able to reproduce it myself, but when I view https://pt.wikipedia.org/w/index.php?title=Wikip%C3%A9dia:Esplanada/propostas&curid=61666&action=history, I do get a different error:

(x) Uncaught TypeError: Cannot read property 'expandedWidth' of undefined
      at jQuery.fn.init.<anonymous>
      at Function.each
      at handleResize
(4) Uncaught TypeError: Cannot read property 'expandedWidth' of undefined

Hmm... I'm not sure why, but it has something to do with this code:
https://pt.wikipedia.org/wiki/MediaWiki:Common.js?diff=50508967
The problem disappears if I remove it.

Grr... It happened again, even after the code above was removed from local Common.js. Maybe it was due to a cached version of the script, because it didn't happen after reloading the page
https://pt.wikipedia.org/w/index.php?diff=50536783&oldid=50504506

{
	"errorMessage": "TypeError: $.collapsibleTabs.getSettings(...) is undefined",
	"url": "https://pt.wikipedia.org/w/load.php?debug=false&lang=pt&modules=ext.centralNotice.choiceData%2Cdisplay%2CgeoIP%2CimpressionDiet%2CkvStore%2CkvStoreMaintenance%2CstartUp%7Cext.centralauth.ForeignApi%7Cext.centralauth.centralautologin.clearcookie%7Cext.cite.a11y%7Cext.cx.campaigns.contributionsmenu%7Cext.cx.eventlogging%2Cmodel%7Cext.cx.widgets.callout%7Cext.echo.api%2Cinit%7Cext.eventLogging%2CnavigationTiming%2Cpopups%2Cthanks%2CwikimediaEvents%7Cext.eventLogging.subscriber%7Cext.popups.images%7Cext.thanks.revthank%7Cext.uls.common%2Ccompactlinks%2Ceventlogger%2Cinit%2Cinterface%2Cpreferences%2Cwebfonts%7Cext.visualEditor.desktopArticleTarget.init%7Cext.visualEditor.supportCheck%2CtargetLoader%2Ctrack%2Cve%7Cext.wikimediaEvents.loggedin%7Cjquery.accessKeyLabel%2CbyteLength%2CcheckboxShiftClick%2Cclient%2Cconfirmable%2Ccookie%2CgetAttrs%2Chidpi%2ChighlightText%2CmakeCollapsible%2Cmw-jump%2Csuggestions%2CtabIndex%2CtextSelection%2Cthrottle-debounce%7Cjquery.uls.data%7Cmediawiki.ForeignApi%2CRegExp%2CTitle%2CUri%2Capi%2Ccldr%2Ccookie%2Cexperiments%2CjqueryMsg%2Clanguage%2Cnotify%2CsearchSuggest%2Cstorage%2Ctemplate%2Ctoc%2Cuser%2Cutil%7Cmediawiki.ForeignApi.core%7Cmediawiki.api.options%2Cuser%2Cwatch%7Cmediawiki.language.data%2Cinit%7Cmediawiki.libs.pluralruleparser%7Cmediawiki.page.ready%2Cstartup%7Cmediawiki.page.watch.ajax%7Cmediawiki.template.mustache%2Cregexp%7Cmediawiki.ui.icon%7Cmmv.bootstrap%2Chead%7Cmmv.bootstrap.autostart%7Coojs%2Coojs-ui-core%2Coojs-ui-windows%2Csite%7Coojs-ui-core.styles%7Coojs-ui.styles.icons-alerts%2Cicons-content%2Cicons-interactions%2Cicons-movement%2Cindicators%2Ctextures%7Cschema.UniversalLanguageSelector%7Cskins.vector.js%7Cuser.defaults&skin=vector&version=0a9x3ml",
	"lineNumber": 615,
	"columnNumber": 963,
	"errorObject": {}
}

I am unable to reproduce such issue if anyone do so can you please specify the screenshot?

@Rammanojpotla: Talking about "screenshots" does not make sense here - we talk about text, not images.
See previous comments explaining potentially influential factors. Most people will not be able to reproduce.

Krinkle changed the task status from Open to Stalled.Sep 17 2018, 11:20 PM
Jdlrobson changed the task status from Stalled to Open.EditedJul 16 2020, 1:19 AM

Note this error still happens on mediawiki.org

The only way getSettings can be missing, is if something else removes it after it was defined.

I don't think the error is about getSettings being missing but rather it returning undefined?

I can replicate the error if I run $.collapsibleTabs.getSettings( $('div.foo') ).shifting which based on the stack trace I'm seeing in logstash matches with this line:

https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/skins/Vector/+/refs/heads/master/resources/skins.vector.legacy.js/collapsibleTabs.js#81

note getSettings can return undefined if $collapsible.data( 'collapsibleTabsSettings' ) returns undefined.

Change 613002 had a related patch set uploaded (by Jdlrobson; owner: Jdlrobson):
[mediawiki/skins/Vector@master] Make collapsible code more resilient

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

Change 613002 merged by jenkins-bot:
[mediawiki/skins/Vector@master] Make collapsible code more resilient

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

matmarex assigned this task to Jdlrobson.

Last error was at 2020-07-21T16:22:52 before 18:03 deploy so I think it's safe to say this was the source of the bug.
https://logstash.wikimedia.org/app/kibana#/doc/logstash-*/logstash-2020.07.21/clienterror?id=AXNyL15z3_NNwgAUAIay&_g=h@e3739c2