Page MenuHomePhabricator

ResourceLoader: Redesign how debug mode operates
Open, NormalPublic


Right now debug mode defaults to serving recursive load.php requests for each component (style, scripts) of each module. With the exception of file modules which instead serve individual files from disk directly.

This has various issues (see blocked tasks) and shouldn't be be necessary when we use source maps (see blocking tasks).


Problems that should be solved as part of this redesign:

  • In debug mode, JavaScript files currently execute in global scope instead of in a closure. – T64605
  • In debug mode, we currently can only minify or RTL-flip, not both. Can we provide unminified content via source maps, and still do RTL flipping? – T29025
  • In debug mode, large web apps (e.g. VisualEditor) load very slowly due to (serially) downloading 1000s of files in the browser. – T130782


  • Remove logic that makes debug=true behave different from production mode, except for disabling minification. Still perform all the same bundling, wrapping, filtering, and concatenating.
  • Use Source Maps instead to provide the raw code alongside the production code. – T47514

This request support throughout the entire stack so that offsets are maintained and may require CSSJanus and CSSMin to become parsers instead of regexp hamburgers. (Ideally we'd use a single parser and allow Less, CSSJanus and CSSMin to hook in and iterate the same tree.)

Related Objects

Event Timeline

Krinkle created this task.Jan 5 2015, 3:44 PM
Krinkle raised the priority of this task from to Low.
Krinkle updated the task description. (Show Details)
Krinkle added a subscriber: Krinkle.
He7d3r added a subscriber: He7d3r.Jan 5 2015, 11:42 PM
Ltrlg added a subscriber: Ltrlg.Oct 2 2016, 2:50 PM
Seb35 added a subscriber: Seb35.Sep 16 2017, 5:01 PM
Restricted Application added a project: Performance-Team. · View Herald TranscriptMay 4 2018, 3:20 AM
Krinkle raised the priority of this task from Low to Normal.Aug 18 2018, 6:20 AM
Krinkle moved this task from Backlog to Accepted Enhancement on the MediaWiki-ResourceLoader board.
Krinkle updated the task description. (Show Details)Aug 18 2018, 6:36 AM

Inspect the code (that causes an error) in non-debug mode is already pretty easy given browser's pretty formatters. But then trying to figure out where it comes from, I usually enable debug mode to get the filename (and a line number). This is also required for meaningful stracktraces (required for bug reports) as the function names are ambiguous without them. Similarly when stepping through code, debug mode is required to better understand what I am looking at, and not having to pretty-format each file. Also file blacklisting doesn't work well in non-debug mode.