Page MenuHomePhabricator

Concatenated files in ResourceLoader "scripts" modules should not share a scope
Open, Needs TriagePublic

Description

In the past we encourgaed IIFE closures to avoid this causing problems. With the advent of packgeFiles and the removal of debug=1 (T367441), we are now in a situation where it would be nice to remove per-file closures (T50886), but the old style raw concatenation could cause problems, especially with ES6's const complaining about variables being redeclared.

Given that we have been linting these files as if they were in the global scope it is very unlikely that anyone is relying on this functionality, so we should probably just plug this leak with ES6 block scope wrappers { ... }.

Event Timeline

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

Change #1122667 had a related patch set uploaded (by Esanders; author: Krinkle):

[mediawiki/core@master] [WIP] ResourceLoader: Add block scope around concatenated 'scripts' files

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

Krinkle renamed this task from Concatenated files in ResourceLoader "scripts" modules share a scope to Concatenated files in ResourceLoader "scripts" modules should not share a scope.Feb 27 2025, 7:02 PM
Krinkle updated the task description. (Show Details)