resourceloader: Wrap only=script responses in "if(window.mw)"
authorTimo Tijhof <krinklemail@gmail.com>
Wed, 6 Aug 2014 15:54:22 +0000 (15:54 +0000)
committerKrinkle <krinklemail@gmail.com>
Tue, 12 Aug 2014 23:20:42 +0000 (23:20 +0000)
commit9272bc6c472122548199865c5175185bdaa469c3
treedd65c99ea1c6fa61922d6dbeccfef5277c06fab2
parent0bce7520c10f492d27b3c8600f65ecf0a0415b3f
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
includes/OutputPage.php
includes/resourceloader/ResourceLoader.php
includes/resourceloader/ResourceLoaderStartUpModule.php
resources/Resources.php
tests/phpunit/includes/OutputPageTest.php