Page MenuHomePhabricator

Wikidata guided tour doesn't work on mobile, throws production error
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

What happens?:

Could not show step 'step0' because this.initialize() failed.  Underlying error: TourDefinitionError: description must be mw.guidedTour.WikitextDescription (wikitext), mw.Title (a page title), or a string (HTML)

What should have happened instead?:
No error.
Tour code is here: https://www.wikidata.org/wiki/MediaWiki:Guidedtour-tour-wbadminterritory.js

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):

Other information (browser name/version, screenshots, etc.):

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Pppery subscribed.

This seems to be caused by on-wiki code in https://www.wikidata.org/wiki/MediaWiki:Guidedtour-lib.js that is failing to properly split a page into sections when using mobile HTML:

var rawSections = data.parse.text['*'].split( /<h2[^>]*>((?!<\/h2>).)*<\/h2>/gi )

Removing MediaWiki-extensions-GuidedTour as this has nothing to do with GuidedTour itself.

The reason for that seems to be that mobile HTML puts the </h2> on a different line from the <h2>, which confuses the above script. Trivial fix would be to add the singleline flag to the aforementioned regex, there are various other deeper fixes possible.

(the regex is parsing mobile HTML because it calls the API action=parse on the local site, which ends up at https://m.wikidata.org/w/api.php?action=parse&page=Wikidata:Tours/Administrative_Territory if run from mobile)

FYI Bene* hasn't been active in years.