From 8e2b5b37cb025c66be96088bf6a668730cdc6677 Mon Sep 17 00:00:00 2001 From: Ori Livneh Date: Wed, 30 Oct 2013 15:23:48 -0700 Subject: [PATCH] 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 --- resources/mediawiki/mediawiki.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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; -- 2.20.1