Page MenuHomePhabricator

Bug: Use of Array.prototype.find in block drawer displays triggers ReferenceErrors in ES5 browsers (breaking editor workflow)
Closed, ResolvedPublic

Description

Array.prototype.find is an ES6 feature not supported by all our target browsers: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find.

This has probably not been a problem because MobileFrontend is only likely to run on a subset of those, but we should fix this anyway.

Developer Notes

The code lives here:
https://github.com/wikimedia/mediawiki-extensions-MobileFrontend/blob/master/resources/mobile.editor.api/EditorGateway.js#L39
Array.find usage was added in 094a26531a in October by @dbarratt and only impacts users triggering the block notice in mobile.

This is likely throwing errors contributing to https://grafana.wikimedia.org/d/000000566/reading-web-dashboard?orgId=1&panelId=15&fullscreen so we should expect to see a drop in errors when the fix lands.

Event Timeline

Esanders created this task.Dec 14 2018, 4:26 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptDec 14 2018, 4:26 PM
Jdlrobson renamed this task from Use of Array.prototype.find in EditorGateway.js / getBlockInfo to Bug: Use of Array.prototype.find in block drawer displays triggers ReferenceErrors in ES5 browsers (breaking editor workflow).Dec 17 2018, 10:38 PM
Jdlrobson triaged this task as High priority.
Jdlrobson added a project: Anti-Harassment.
Jdlrobson updated the task description. (Show Details)
Jdlrobson added a subscriber: dbarratt.
Restricted Application added a subscriber: MGChecker. · View Herald TranscriptDec 17 2018, 10:38 PM
Jdlrobson added a subscriber: Jdlrobson.

@dbarratt is this something your team could look into given it impacts block message displays? This is likely causing lots of client side errors for older browsers so high priority from my side!

This comment was removed by dbarratt.
TBolliger moved this task from Untriaged to Backlog on the Anti-Harassment board.Dec 17 2018, 11:31 PM

Change 480275 had a related patch set uploaded (by Esanders; owner: Esanders):
[mediawiki/extensions/MobileFrontend@master] EditorGateway: Avoid Array#find

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

Change 480275 merged by jenkins-bot:
[mediawiki/extensions/MobileFrontend@master] EditorGateway: Avoid Array#find

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

Change 481026 had a related patch set uploaded (by Jdlrobson; owner: Esanders):
[mediawiki/extensions/MobileFrontend@wmf/1.33.0-wmf.9] EditorGateway: Avoid Array#find

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

Change 481026 merged by jenkins-bot:
[mediawiki/extensions/MobileFrontend@wmf/1.33.0-wmf.9] EditorGateway: Avoid Array#find

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

I've SWATed this. Will take a look at https://grafana.wikimedia.org/d/000000566/reading-web-dashboard?orgId=1&panelId=15&fullscreen tomorrow to see how it impacts client side errors. Provided no new bugs were introduced in 1.33.0-wmf.9, I would expect it to decrease, but not sure by how much.

Jdlrobson closed this task as Resolved.Dec 21 2018, 11:10 PM

Fix has been swatted. Seeing what's possibly a small dent in the error logs but time will tell.


Documented here: https://www.mediawiki.org/wiki/Reading/Web/Notable_incidents