Fix RT-testing regressions caused by 2c30cbfa

* #REDIRECT [[Main_Page]] was being RT-ed back in canonical
  form #REDIRECT [[Main Page]]. This showed up in RT testing
  where enwiki:Elizabeth_Truman and a bunch of other pages
  showing dirty diffs.

* This patch fixes that breakage.

* Added new tests to capture additional redirect variants.

Change-Id: I5d0020e774d8a2a92be11f1fcf9a08895bce8d65
Minor: Added returns after all cb(..) calls in WTS linkHandler

Change-Id: I1f890bc3d38f31261c88c0b872cbfd6ca2272ee3
Merge "Fix RT-testing regressions caused by 2c30cbfa"
Merge "Minor: Added returns after all cb(..) calls in WTS linkHandler"
Bug fix in HTML-pre TSR computation.

* pos value in the tokenizer is an absolute value, not an offset
  so endpos attribute on a <html-pre> token is not an offset.

  However, it needs to be offset wrt. the starting offset of the
  chunk because the tokenizer processes the input in chunks.
  This bit has always been a bit problematic because anyone who
  adds a new pos-type attribute to a token has to remember to
  update the code for Util.shiftTokenTSR

* Simplest test case to reproduce the buggy DSR inconsistency
  warning.
------
<p>
<pre>
foo
</pre></p>
------

* 11 fewer DSR inconsistency warnings as a result of this fix.

* 4 "additional" selser failures, but they are really improvements
  since the new selser output is more accurate compared to the
  non-selser WTS output.

Change-Id: Ide8309f73bfc347d7fb2b4eea08c199b96c3435e
Remove token caching and cloning

Bug: 51203
Change-Id: Ia377d5878ac048bab15dbd42187330bee653c6eb
Bug 59671: Serialize new page properties on their own line

Change-Id: I50ed135b0562bb60c19913de768b890d4ca21c3c
Fix --normalize in parse.js

Change-Id: I244f62ed229d46a807ee40446009c69c4bfb6724
Interface to compare nonconsecutive commits in rt server

Change-Id: Iba246013e9e466cb6da54ab4ace395f16b319d78
Return after errCB

Not returning after calling errCB in DOMPostProcessor was proceeding
with the parse.

Fixes the recurring errors here:
https://gist.github.com/gwicke/8e60d325468c874390d7

Change-Id: I93ff64d963b1d5e7e53d225d3e20778bbd899069
(Bug 60753) Accept empty links in image caption.

Newly added "Allow empty links in image captions" test is failing wt2wt, 
html2wt and html2html modes because the serializer is adding nowikis in
the image caption around [[]].

Change-Id: I484b591fc0e2711d81f6f4a834889df1ca537991
Rename PARSOID_PORT to PORT and PARSOID_INTERFACE to INTERFACE

Makes porting the init scripts easier, and is used in other daemons like
varnish.

Change-Id: Ia698b6749abd34c902a4a0a098858b337c89ff1a
Merge "(Bug 60753) Accept empty links in image caption."
Refactored attribute expansion to DOM into a Util method

This could potentially be useful in the image handling code
to deal with templated attributes that are currently getting
past the AttributeExpander. Alternatively, we may redo how
attributes are handled a bit to trap all templated attributes
independent of whether they are real attributes or not.

But, in either case, this refactoring should not affect
functionality.

Also documented couple methods in Util.

Change-Id: Ided7ca3da9686b614bda439f3b8d752d0afde024
Merge "Rename PARSOID_PORT to PORT and PARSOID_INTERFACE to INTERFACE"
Merge "Return after errCB"
Merge "Refactored attribute expansion to DOM into a Util method"
Code cleanup: Pipeline utilities now take env and parent frame.

* Removed manager and passed in env and parent-frame to all
  utilities that process content in new pipelines.

* Added more documentation to mediawiki.Util.js.

* Renamed processAttributeToDOM to a more appropriate name.

* Added pipelineFactory property to env and used that to
  construct parsing pipelines everywhere.

Change-Id: Ic612e5630d19d4e3f5d6388bc5cd117d337fd799
Bug 61243: Catch errors sent by the Parsoid server in roundtrip-test.js

Change-Id: I4cefe00dbe082ad7fd281d547dd3cc995d0afcde
Don't recurse in error handling

94d3399c delayed exiting until after the request was fully handled to make
sure that clients see a proper error response. Combined with missing exception
handling this introduced the risk of recursive error handling if any aspect of
the HTTP handling threw an exception.

The tricky part is that we need to delay exiting so that an error response can
be sent asynchronously. At the same time we don't want pending event handlers
to fire any more, but currently don't have a clean way to tear them down.

This patch protects against recursion by wrapping the entire method in a
try/catch and unconditionally exits after the error is handled. It also works
around the document callback firing by wrapping sendRes in a try/catch block
to avoid triggering errorHandler via an uncaught exception.

We should find a generic solution to avoid recursive error handling, ideally
in the logger class. A possible solution is to refuse recursive calls in the
logger (return without output if attempted) and routing all error handling
through it.

Change-Id: I99ce55c09289fb070b872b21fd25239029cdc2f2