mediawiki.inspect: add method for grepping loaded modules
authorOri Livneh <ori@wikimedia.org>
Tue, 26 Nov 2013 22:30:28 +0000 (14:30 -0800)
committerTimo Tijhof <krinklemail@gmail.com>
Thu, 20 Mar 2014 03:21:06 +0000 (04:21 +0100)
commit5b9aa7cf4a06ab55f2eed1715fbdab834e2942a0
treeec3492b093592b6fbb21e395e7e89f165e4ef28c
parent47e233e8fae5458f6d59474c79942465282a99a0
mediawiki.inspect: add method for grepping loaded modules

Example usage:

>>> mw.inspect.grep(':hover .settings-text')
["ext.uls.init"]
>>> mw.inspect.grep('options.expire')
["jquery.cookie", "mediawiki.user"]

Use cases:
* You're debugging a layout bug and want to trace a CSS rule to the module
  which inserts it.
* A JavaScript error contains a distinct and plausibly unique substring (such
  as a variable name), and you want to identify the module that is causing the
  error.

You can re-load the page with debug=1, but you still need to decipher load.php
URLs for non-file modules, and you might not be able to reproduce the issue in
debug mode. Alternately, you can grep a full clone of the production branch
that the wiki is running (assuming you have one handy), but that won't help you
if the module is a gadget.

Change-Id: Ie5f0e7d1c7022f8d399e895f157db8acefc8abee
resources/mediawiki/mediawiki.inspect.js