Page MenuHomePhabricator

Setting a cookie to go into a RL debug mode
Closed, ResolvedPublic

Description

The idea is to make this work:
javascript:alert(document.cookie="resource_loader_debug=1;path=/")

Meaning a developer could add this URI as a bookmark which would in effect turn on the debug mode.

I was going to attach a patch, but I see my original idea is not working and I have a question - can I replace all this getFuzzyBool thingies in OutputPage.php to a static method call of e.g. ResourceLoaderContext? Something like:
ResourceLoaderContext::isInDebugMode($wgRequest)


Version: 1.17.x
Severity: enhancement

Details

Reference
bz25610

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:12 PM
bzimport set Reference to bz25610.

If making a bookmarklet to turn the cookie on, be sure to have one to turn it off too! ;) Actually this'd be handy in a little 'developer goodies' gadget.

Implemented in r75825. Cookie name is resourceLoaderDebug. Setting it to "" or "0" disables debug mode, any other value enables debug mode.

Are you sure this is enough? The behaviour seems to differ a bit as you also read "debug" state on line 2410 and 2579 and you don't read from the cookie there. The cookie state is also disregarded in the __construct of ResourceLoaderContext. Maybe not a big difference now, but it seems to be a point where things can go bad in the future (where debug might mean something more). What I'm saying is debugging with a cookie and with a param is different even now and might be worse in future. This doesn't feel like an expected or intended behaviour.

(In reply to comment #3)

Are you sure this is enough? The behaviour seems to differ a bit as you also
read "debug" state on line 2410 and 2579 and you don't read from the cookie
there.

Good point, I missed those. Fixed in r76138.

The cookie state is also disregarded in the __construct of

ResourceLoaderContext. Maybe not a big difference now, but it seems to be a
point where things can go bad in the future (where debug might mean something
more). What I'm saying is debugging with a cookie and with a param is different
even now and might be worse in future. This doesn't feel like an expected or
intended behaviour.

This is actually not a problem. All the debug cookie and the debug param when applied to *index.php* do is make OutputPage.php generate links to load.php with debug=true instead of debug=false. load.php itself never needs to read the cookie for this reason (and if it did, that would violate cacheability).