From abf66baef5026b1f6cc874978a49db1bfee92a9e Mon Sep 17 00:00:00 2001 From: Alex Monk Date: Sat, 23 Jan 2016 00:15:56 +0000 Subject: [PATCH] resourceloader: Introduce window.NORLQ Bug: T123457 Change-Id: Ice6ebb95bfcb2050f4813705467942f95f7e720c --- resources/src/startup.js | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/resources/src/startup.js b/resources/src/startup.js index 0c2d6d69ec..e53e5f3d29 100644 --- a/resources/src/startup.js +++ b/resources/src/startup.js @@ -4,7 +4,7 @@ * even the most ancient of browsers, so be very careful when editing. */ /*jshint unused: false, evil: true */ -/*globals mw, RLQ: true, $VARS, $CODE, performance */ +/*globals mw, RLQ: true, NORLQ: true, $VARS, $CODE, performance */ var mediaWikiLoadStart = ( new Date() ).getTime(), @@ -67,11 +67,29 @@ function isCompatible( ua ) { // Conditional script injection ( function () { + var NORLQ, script; if ( !isCompatible() ) { // Undo class swapping in case of an unsupported browser. // See OutputPage::getHeadScripts(). document.documentElement.className = document.documentElement.className .replace( /(^|\s)client-js(\s|$)/, '$1client-nojs$2' ); + + NORLQ = window.NORLQ || []; + while ( NORLQ.length ) { + NORLQ.shift()(); + } + window.NORLQ = { + push: function ( fn ) { + fn(); + } + }; + + // Clear and disable the other queue + window.RLQ = { + // No-op + push: function () {} + }; + return; } @@ -96,9 +114,15 @@ function isCompatible( ua ) { fn(); } }; + + // Clear and disable the other queue + window.NORLQ = { + // No-op + push: function () {} + }; } - var script = document.createElement( 'script' ); + script = document.createElement( 'script' ); script.src = $VARS.baseModulesUri; script.onload = script.onreadystatechange = function () { if ( !script.readyState || /loaded|complete/.test( script.readyState ) ) { -- 2.20.1