     if @currentIndex is -1
       ''
     else
-      @history[@currentIndex].url
+      @history[@currentIndex]
 
   stop: ->
     @pendingIndex = -1

    @history = []
    @currentIndex = -1
    @pendingIndex = -1

    @webContents.on 'navigation-entry-commited', (event, url, inPage, replaceEntry) =>
      console.log 'navigation-entry-commited', url, inPage, replaceEntry

      if @pendingIndex >= 0 # Go to index.
        @currentIndex = @pendingIndex
        @pendingIndex = -1
        @history[@currentIndex] = {url, inPage}
      else if replaceEntry # Non-user initialized navigation.
        @history[@currentIndex] = {url, inPage}
      else  # Normal navigation.
        @history = @history.slice 0, @currentIndex + 1  # Clear history.
        currentEntry = @history[@currentIndex]
        if currentEntry?.url isnt url or currentEntry?.inPage isnt inPage
          @currentIndex++
          @history.push {url, inPage}

  loadUrl: (url, options={}) ->
    @pendingIndex = -1

  goBack: ->
    return unless @canGoBack()
    @pendingIndex = @getActiveIndex() - 1
    if @inPageIndex > -1 and @pendingIndex >= @inPageIndex
      @webContents._goBack()
    else
      @webContents._loadUrl @history[@pendingIndex], {}

  goForward: ->
    return unless @canGoForward()
    @pendingIndex = @getActiveIndex() + 1
    if @inPageIndex > -1 and @pendingIndex >= @inPageIndex
      @webContents._goForward()
    else
      @webContents._loadUrl @history[@pendingIndex], {}

  goToIndex: (index) ->
    return unless @canGoToIndex index
