Page MenuHomePhabricator

TypeError: (intermediate value).toLowerCase is not a function
Closed, ResolvedPublicPRODUCTION ERROR

Description

Stack Trace
jquery.webfonts.js?fb6f4:65 Uncaught TypeError: (language || this.language || "").toLowerCase is not a function
    at WebFonts.getFont (jquery.webfonts.js?fb6f4:65)
    at HTMLFormElement.<anonymous> (jquery.webfonts.js?fb6f4:217)
    at Function.each (jquery.js?11c05:367)
    at jQuery.fn.init.each (jquery.js?11c05:202)
    at WebFonts.parse (jquery.webfonts.js?fb6f4:201)
    at WebFonts.init (jquery.webfonts.js?fb6f4:82)
    at new WebFonts (jquery.webfonts.js?fb6f4:31)
    at HTMLBodyElement.<anonymous> (jquery.webfonts.js?fb6f4:478)
    at Function.each (jquery.js?11c05:367)
    at jQuery.fn.init.each (jquery.js?11c05:202)

ext.uls.displaysettings.js?a4cd3:433 Uncaught TypeError: Cannot read property 'list' of undefined
    at DisplaySettings.prepareFontSelector (ext.uls.displaysettings.js?a4cd3:433)
    at DisplaySettings.prepareContentFonts (ext.uls.displaysettings.js?a4cd3:522)
    at ext.uls.displaysettings.js?a4cd3:558
Impact

Webfonts are on one particular page.

Notes

This happens because we access the lang attribute as element.lang. Normally this returns the attribute value, but for form elements, it returns the element with name="lang" instead. This is an element object (so truthy) which does not have toLowerCase method.

<form id="mw-newentity-form1" action="/wiki/Special:NewItem" method="post" enctype="application/x-www-form-urlencoded" class="mw-htmlform mw-htmlform-ooui oo-ui-layout oo-ui-formLayout">
[...]
<input
	type="text"
	tabindex="0"
	aria-disabled="false"
	name="lang"
	value="fi"
	id="ooui-php-2"
	class="oo-ui-inputWidget-input webfonts-changed"
	autocomplete="off"
	aria-expanded="false"
	role="combobox"
	aria-owns="ooui-1"
	aria-autocomplete="list"
/>
[...]
</form>

Not that there was also an earlier fix rEULSb6fbb2cfc723: Fix undefined.toLowerCase is not a function in jquery.webfonts.js but it does not cover this case.

Details

Request ID
4a992302-7beb-40e9-8c08-46102155e95f
Request URL
https://www.wikidata.org/wiki/Special:NewItem

Event Timeline

Change 633717 had a related patch set uploaded (by Nikerabbit; owner: Nikerabbit):
[mediawiki/extensions/UniversalLanguageSelector@master] Update jquery.webfonts

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

Change 633717 merged by jenkins-bot:
[mediawiki/extensions/UniversalLanguageSelector@master] Update jquery.webfonts

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

Change 634903 had a related patch set uploaded (by Nikerabbit; owner: Nikerabbit):
[mediawiki/extensions/UniversalLanguageSelector@master] Update jquery.webfonts

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

Change 634903 merged by jenkins-bot:
[mediawiki/extensions/UniversalLanguageSelector@master] Update jquery.webfonts

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