First cut: DOM fragment handling in token stream and expansion reuse

This patch adds a general-purpose mechanism to inject DOM fragments into the
token stream in a way that interacts well with token stream transformations.
This mechanism is used to recycle cached template expansions extracted from
cached HTML. It can also be used for regular template and (cached and
uncached) extension expansions.

To test, add this in your localsettings.js:
parsoidConfig.parsoidCacheURI = 'http://localhost:8000/';

Detailed changes:

* Create a ParsoidCacheRequest class that performs requests for the previous
  revision's HTML to a Parsoid cache with 'Cache-control: only-if-cached'
  header. Added the capability to generally work on bodies of ApiRequests in
  subclasses instead of assuming JSON responses.
* Call this for regular page parses and use the result, if any
* Fix a JSHint warning in ParserService
* added DOMUtils.hasBlockElementDescendant method
* added DOMUtils.extractExpansions method that pulls out transclusion and
  extension expansions from a DOM
* load expansions into expansion caches
* encapsulate template / extension content (both from cache and a subpipeline)
  into 2-4 placeholder tokens
* set the right attributes on these tokens and use them in the template
  handler
* unpack HTML content from attributes in the DOM and transfer dsr to old content
* test with actual parsoid service requests (but not Varnish requests yet)

TODO:
* clean up a bit, remove debug prints
* use cached expansions also in the extension handler
* test with Varnish setup

Change-Id: Ibb4f63d30bf70eae300bb0e463a434c297144caf
Support extension expansion reuse

Use the DOM fragment encapsulation infrastructure developed in Ibb4f63d30 for
extensions as well, so now both transclusion and extension content can be
reused after edits.

Also avoid re-parsing expansion fragment HTML by returning both DOM nodes and
HTML from DU.extractExpansions.

Change-Id: Idfd648a8266d2067ff661369e8aa935e1a6f4811
Merge changes Idfd648a8,Ibb4f63d3

* changes:
  Support extension expansion reuse
  First cut: DOM fragment handling in token stream and expansion reuse