mw.loader: Omit private modules from the request queue
The server will just deny these modules with an error. We can save that roundtrip by just assuming that state directly. A fair number of these requests hit the server logs primarily from two sources: * Third parties that cache screen-scraped pages from before 2013. The private module wouldn't have existed in the HTML yet. Some scripts aren't cached by them and as such they get a really stretched hybrid. These sometimes end up making requests for modules that no longer exist or indeed modules that have since become private. * Web browsers and proxies that add or modify code on the page which can cause some inline scripts to break. There is no recovery from that in the current system. But falling back to the server is no solution for private modules. (Per T36907; bug 34907) Bug: T101806 Change-Id: If8780db1410dd9ca31b3c1c19a6381a58663edab
This commit is contained in:
parent
4dfd54082f
commit
1dd7390372
1 changed files with 9 additions and 0 deletions
|
|
@ -1357,7 +1357,16 @@
|
|||
|
||||
$.each( dependencies, function ( idx, module ) {
|
||||
var state = mw.loader.getState( module );
|
||||
// Only queue modules that are still in the initial 'registered' state
|
||||
// (not ones already loading, ready or error).
|
||||
if ( state === 'registered' && $.inArray( module, queue ) === -1 ) {
|
||||
// Private modules must be embedded in the page. Don't bother queuing
|
||||
// these as the server will deny them anyway (T101806).
|
||||
if ( registry[module].group === 'private' ) {
|
||||
registry[module].state = 'error';
|
||||
handlePending( module );
|
||||
return;
|
||||
}
|
||||
queue.push( module );
|
||||
if ( async ) {
|
||||
registry[module].async = true;
|
||||
|
|
|
|||
Loading…
Reference in a new issue