   xhr.onload = ->
     triggerEvent 'page:receive'
 
-    if doc = validateResponse()
+    if doc = processResponse()
+      reflectNewUrl url
       changePage extractTitleAndBody(doc)...
       reflectRedirectedUrl()
       if document.location.hash

    [a, b] = [b, a] if a.length > b.length
    value for value in a when value in b

  if clientOrServerError()
    # Workaround for WebKit bug (https://bugs.webkit.org/show_bug.cgi?id=93506)
    url = document.location.href
    window.history.replaceState null, '', '#'
    window.location.replace url
    false
  else if invalidContent() or assetsChanged (doc = createDocument xhr.responseText)
    window.location.reload()
    false
  else
    doc

extractTitleAndBody = (doc) ->
  title = doc.querySelector 'title'


rememberCurrentState = ->
  currentState = window.history.state

recallScrollPosition = (page) ->
  window.scrollTo page.positionX, page.positionY
