resourceloader: Remove redundant filter() in mw.load.load()
This was added for T36853, but never worked and wasn't needed because other parts of the commit for that task did the work already (I guess I was trying both ways and ended up submitting both). * The inline comment claims to remove unknown modules, but doesn't actually. Unknown modules would yield state `null`, which is not filtered out. They are actually filtered out by resolveStubbornly() and sortDependencies(). * The inline comment claims to filter out modules we tried previously and were already known to fail. This would work, if there were modules in such state, but that never happens at this stage because load() is the first thing on the page requesting any modules. Nothing notable happened before that. If this were to change in the future, or in case of user scripts calling mw.loader.load() directly with invalid module names, we're still covered by enqueue() and again by mw.loader.work() - both of which make sure we don't re-request or retry modules, by filtering down to only modules in the 'registered' state. Change-Id: I3b9f1a13379ad41aeabad8111647c0f6eddccdfc
This commit is contained in:
parent
d793a2039e
commit
d059dffa28
1 changed files with 5 additions and 11 deletions
|
|
@ -2031,7 +2031,7 @@
|
|||
* "text/javascript"; if no type is provided, text/javascript is assumed.
|
||||
*/
|
||||
load: function ( modules, type ) {
|
||||
var filtered, l;
|
||||
var l;
|
||||
|
||||
// Allow calling with a url or single dependency as a string
|
||||
if ( typeof modules === 'string' ) {
|
||||
|
|
@ -2055,16 +2055,10 @@
|
|||
modules = [ modules ];
|
||||
}
|
||||
|
||||
// Filter out top-level modules that are unknown or failed to load before.
|
||||
filtered = modules.filter( function ( module ) {
|
||||
var state = mw.loader.getState( module );
|
||||
return state !== 'error' && state !== 'missing';
|
||||
} );
|
||||
// Resolve remaining list using the known dependency tree.
|
||||
// This also filters out modules with unknown dependencies. (T36853)
|
||||
filtered = resolveStubbornly( filtered );
|
||||
// Some modules are not yet ready, add to module load queue.
|
||||
enqueue( filtered, undefined, undefined );
|
||||
// Resolve modules into flat list for internal queuing.
|
||||
// This also filters out unknown modules and modules with
|
||||
// unknown dependencies, allowing the rest to continue. (T36853)
|
||||
enqueue( resolveStubbornly( modules ), undefined, undefined );
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue