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
* code for a full account of why we need a try / catch: <http://git.io/4NEwKg>.
*/
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;