Page MenuHomePhabricator

ResourceLoader: remove fallback for missing `window.Set`
Closed, DeclinedPublic

Description

startup/mediawiki.loader.js currently checks if window.Set exists, and if not creates a partial fallback that has support for add() and has(). See code - this was added in T146432, previously we never used window.Set.

based on the browser support at https://www.mediawiki.org/wiki/Compatibility#Browser_support_matrix and caniuse for the Set builtin (https://caniuse.com/mdn-javascript_builtins_set) it appears that all supported browsers already provide the Set class. Can the fallback be removed?

Event Timeline

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

Happy to tackle this myself just wanted to make sure I wasn't missing anything with removing the fallback, if its okay with the performance team I'll send a patch.

Set is ES6 whereas we require ES5 at the low level of mw.loader. The feature test in startup has a list of browsers versions that pass the current feature test, many of which do not support ES6.

The compatibility page describes what we are willing to fund support for. This is different from what passes the feature test at a technical level. The cut off for caring about the outcome is Grade C not Grade A.

Set is ES6 whereas we require ES5 at the low level of mw.loader. The feature test in startup has a list of browsers versions that pass the current feature test, many of which do not support ES6.

The compatibility page describes what we are willing to fund support for. This is different from what passes the feature test at a technical level. The cut off for caring about the outcome is Grade C not Grade A.

Then what if we test for window.Set as part of the feature test - its not full ES6 but would not change the supported browsers and would simplify a lot of the startup code

Then what if we test for window.Set as part of the feature test - its not full ES6 but would not change the supported browsers […]

It would. The browser ranges are quite different. For example, the current feature test passes in Safari 5, whereas ES6 Set landed in Safari 8.

As part of T178356, we'll adopt a different feature test. The StringSet implementation is only a handful of bytes after compression and imho not worth changing browser support over.

DannyS712 removed a project: User-DannyS712.

Okay, thanks for explaining