   psAddEventLogger 'did-fail-load'
 
 NavigationBar = React.createClass
+  canSetState: true
   getInitialState: ->
     navigateStatus: 'Loading'
   getIcon: ->

  onResize: (e) ->
    $('inner-page')?.style?.height = "#{window.innerHeight - 50}px"
    $('inner-page webview')?.style?.height = $('inner-page webview /deep/ object[is=browserplugin]')?.style?.height = "#{window.innerHeight - 50}px"
  onStartedLoading: (e) ->
    @setState
      navigateStatus: 'Loading'
  onStoppedLoading: ->
    @setState
      navigateStatus: 'OK'
  onFailedToLoad: ->
    @setState
      navigateStatus: 'Failed'
  componentDidMount: ->
    window.addEventListener 'resize', @onResize
    webview.addEventListener 'did-start-loading', @onStartedLoading

    webview.removeEventListener 'did-start-loading', @onStartedLoading
    webview.removeEventListener 'did-stop-loading', @onStoppedLoading
    webview.removeEventListener 'did-fail-load', @onFailedToLoad
  componentWillUpdate: ->
    @canSetState = false
  componentDidUpdate: ->
    @canSetState = true

  goBack: ->
    if webview.canGoBack()
