resourceloader: Refactor CSP $nonce passing
authorTimo Tijhof <krinklemail@gmail.com>
Thu, 17 May 2018 18:25:49 +0000 (20:25 +0200)
committerKunal Mehta <legoktm@member.fsf.org>
Fri, 18 May 2018 05:28:23 +0000 (22:28 -0700)
commit0980f94e131f9ffad723d237876956e14a773e3d
tree8e1f3a6089e3c58f4f8b06c940f3f09a6e7e4b44
parentb45207e0da48b660232fe2e499b2b22fe4bd3f5b
resourceloader: Refactor CSP $nonce passing

Follows-up 70941efd35562dcb700 which broke various public
signatures of the ClientHtml class that I'd prefer to handle
differently.

This commit mainly restores support for all previously public
signatures, and either removes the need for a parameter, or moves
it to the end of the original signature (as optional param).

* ClientHtml::getHeadHtml: Remove the positional/required parameter
  that was added. Restoring the method to being a stateless computer
  that requires no parameters. Pass the option via construct instead.

* ClientHtml::makeLoad:
  - Make $nonce optional.
  - Restore $extraQuery as optional.

* ResourceLoader::makeInlineScript: Document $nonce as optional
  (matching the implementation).

Change-Id: Iaf33f2a060048e6606fba8d875b6d2953b21ef45
includes/OutputPage.php
includes/resourceloader/ResourceLoader.php
includes/resourceloader/ResourceLoaderClientHtml.php
tests/phpunit/includes/resourceloader/ResourceLoaderClientHtmlTest.php