Page MenuHomePhabricator

Kindle 3: JavaScript error message from mobile-frontend-last-modified-months
Closed, ResolvedPublic

Description

On a Kindle Keyboard (Kindle 3) running software version Kindle 3.4: use "Search Wikipedia" and enter "King James". The resulting article is en.m.wikipedia.org/wiki/King_James and displays fine, but at the bottom, just below the "Read in another language" link, the error message

mobile-frontend-last-modified-months: Result of expression 'rule.split('@')[0].trim' [undefined] is not a function

is displayed.


Version: unspecified
Severity: normal

Details

Reference
bz62072

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 3:05 AM
bzimport set Reference to bz62072.
brion added a comment.Feb 28 2014, 8:28 PM

Per https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim the String.trim method wasn't added until a relatively recent version of JavaScript, so it may not be available on the Kindle's older browser.

Unless there's a polyfill being used, avoid it in generic-ish code...

Looks like it's being used in core, in resources/mediawiki.libs/CLDRPluralRuleParser.js

Will fire up the test Kindle 3 once it's charged and see if it works with that replaced with a regex.

brion added a comment.Feb 28 2014, 9:00 PM

Created attachment 14723
screen photo of error

note JavaScript must be enabled for the error to occur

Attached:

There is $.trim which should be used instead.

brion added a comment.Feb 28 2014, 9:10 PM

(In reply to Bartosz Dziewoński from comment #3)

There is $.trim which should be used instead.

The upstream code in https://github.com/santhoshtr/CLDRPluralRuleParser doesn't seem to have any explicit jQuery dependency, so I'd rather not add that here.

Change 116159 had a related patch set uploaded by Brion VIBBER:
Fix for CLDR plural rule parser for old browsers without String.trim

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

Change 116159 merged by jenkins-bot:
Fix for CLDR plural rule parser for old browsers without String.trim

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

brion added a comment.Mar 1 2014, 5:31 PM

Ok fix is merged in MediaWiki core and in the lib upstream repo. It should wander into the live site within a couple weeks.