It was previously creating a fresh context object, and then
manually imported some query parameters, and then *also* created
a derivative context object (so that it can copy over the
"getContentOverrideCallback" value and to allow the consumer
to also use setVersion/setModules).
The reason for this indirection was that I wanted to re-use the
query string parsing logic of ResourceLoaderContext::__construct,
instead of interpreting it here. However that extra indirection
is rather fragile as it could easily forget some other things to
inherit manually.
And, per T249189, it means there is no process cache shared between
the two. This is exactly what DerivativeResourceLoaderContext
is for, and if there is a missing feature in it, we should add it,
instead of working around it (note to self...). For now, though,
it can actually be used as-is.
Changes:
* Use DerivativeResourceLoaderContext directly.
* Set the 'only' and 'user' values directly using the setter
methods after creating the derivative object.
* Also set 'raw' correctly. This was previously handled by
$extraQuery being passed to ResourceLoaderContext::__construct,
but now needs to be done manually.
Bug: T249189
Change-Id: I4173ec75bef4fe9fee39663b1348c077414d3627