Solve problems with state consistency

Earlier, we used to do an incremental refreshing before executing the sensitive
query methods. Lately, we have stopped doing that; now we sync first, and
then assume everything is OK, and don't do scanning before the queries themselves.

Unfortunately, this does not work, because even if we start out in a clean
state, we can very easily corrupt is by routine operations, so we need
to re-add the checks before the sensitive operations.

 * TextMapperCore:
   * Moved logging here (from DomTextMapper)
   * On the sync API, always call scan before returning corpus text or length,
     or before executing getContextForCharRange().
   * Fix the login in _scanFinished(): always remove the callback from the list
     before calling it, to avoid circular calls.

 * DomTextMapper:
   * Commented out some debug output
   * Removed redundant _scanFinished (handled in TextMapperCore)
   * Always execute a (probably incremental) scan before executiny any of the
     synchronous query methods:
     * getInfoForNode
     * getMappingsForCharRange
   * Added error detection to computeSourcePosition, to avoid infinite loops
     on invalid input.
   * Added some (commented out) debug output to _syncState()

 * PageTextMapperCore
   * Removed the redundant CONTEXT_LEN constant (handled in TextMapperCode)
   * Moved to common logging
   * Added a _testAllMappings() method, for compatibility with dom-text-mapper

Fixes #31.