HomePhabricator

resourceloader: Wrap only=script responses in "if(window.mw)"

Authored by Krinkle.

Description

resourceloader: Wrap only=script responses in "if(window.mw)"

We currently have a few legacy requests to the load.php end point
that bypass the ResourceLoader client by coding a request to
load.php via a "<script src>" directly. Most prominently the
request for the 'site' wiki module (aka MediaWiki:Common.js).

Remove the manual wrapping of embedded private modules as this
is now taken are of by ResourceLoader::makeModuleResponse itself.

Misc:

  • Mark "jquery" and "mediawiki" as Raw modules. While the startup module had this already, these didn't. Without this, they'd get the conditional wrap – which would be a problem since mediawiki.js can't be conditional on 'window.mw' for that file defines that namespace itself.
  • Strip the cache-key comment in the unit tests because the hash no longer matches and using the generic 'wiki' dbname was breaking DB queries.
  • Relates to bug 63587.
  • See also 05d0f6fefdcc959d which expands the reach of the non-JS environment to IE6 and helped expose this bug.

Change-Id: Icf6ede09b51ce212aa70ff6be4b341762ec75b4d