 
   # ### location.toString() => String
   toString: ->
-    return URL.format(@_url)
+    return URL.format(@_history.current)
 
   # ### location.href => String
   @prototype.__defineGetter__ "href", ->
-    return @_url?.href
+    return @_history.current?.href
 
   # ### location.href = url
   @prototype.__defineSetter__ "href", (new_url)->

  for prop in ["hash", "host", "hostname", "pathname", "port", "protocol", "search"]
    do (prop)=>
      @prototype.__defineGetter__ prop, ->
        @_url?[prop] || ""
      @prototype.__defineSetter__ prop, (value)->
        newUrl = URL.parse(@_url?.href)
        newUrl[prop] = value
        @_history._assign URL.format(newUrl)


    # History is a stack of Entry objects.
    @_stack = []
    @_index = 0
    @_location = new Location(this)

    Object.defineProperty @, "current",
        get: =>
          @_stack[@_index]?.url || ABOUT_BLANK

  # Apply to window.
  _use: (window)->
