From: Ori Livneh Date: Wed, 30 Oct 2013 22:23:48 +0000 (-0700) Subject: mw.loader.store: temporarily allow users to opt-in via cookie X-Git-Tag: 1.31.0-rc.0~18338^2 X-Git-Url: http://git.cyclocoop.org//%27%40script%40/%27?a=commitdiff_plain;h=8e2b5b37cb025c66be96088bf6a668730cdc6677;p=lhc%2Fweb%2Fwiklou.git mw.loader.store: temporarily allow users to opt-in via cookie To facilitate mw.loader.store testing on production wikis, it would be good to allow developers and JavaScript-savvy users to opt-in for mw.loader.store testing by manually setting a cookie in their browser. With this patch in place, this would be possible to do by executing the following statement in a debug console: $.cookie( 'ResourceLoaderStorageEnabled', 1, { expires: 7, path: '/' } ); This will be removed from mediawiki.js (long) before the 1.23 release. Bug: 56397 Change-Id: I51cfd563734a3aeed3667fbb19bf3be40fabbb6b --- diff --git a/resources/mediawiki/mediawiki.js b/resources/mediawiki/mediawiki.js index f1b308295a..9267a49e7e 100644 --- a/resources/mediawiki/mediawiki.js +++ b/resources/mediawiki/mediawiki.js @@ -1799,14 +1799,18 @@ var mw = ( function ( $, undefined ) { * code for a full account of why we need a try / catch: . */ init: function () { - var raw, data; + var raw, data, optedIn; if ( mw.loader.store.enabled !== null ) { // #init already ran. return; } - if ( !mw.config.get( 'wgResourceLoaderStorageEnabled' ) || mw.config.get( 'debug' ) ) { + // Temporarily allow users to opt-in during mw.loader.store test phase by + // manually setting a cookie (bug 56397). + optedIn = /ResourceLoaderStorageEnabled=1/.test( document.cookie ); + + if ( !( mw.config.get( 'wgResourceLoaderStorageEnabled' ) || optedIn ) || mw.config.get( 'debug' ) ) { // Disabled by configuration, or because debug mode is set. mw.loader.store.enabled = false; return;