 
 # Show notification on upgrade.
 showUpgradeMessage = ->
-  if shouldShowUpgradeMessage()
+  # Avoid showing the upgrade notification when previousVersion is undefined, which is the case for new
+  # installs.
+  Settings.set "previousVersion", currentVersion  unless Settings.get "previousVersion"
+  if Utils.compareVersions(currentVersion, Settings.get "previousVersion" ) == 1
     notificationId = "VimiumUpgradeNotification"
     notification =
       type: "basic"

      title: "Vimium Upgrade"
      message: "Vimium has been upgraded to version #{currentVersion}. Click here for more information."
      isClickable: true
    chrome.notifications.create notificationId, notification, ->
      unless chrome.runtime.lastError
        Settings.set "previousVersion", currentVersion
        chrome.notifications.onClicked.addListener (id) ->
          if id == notificationId
            openUrlInNewTab url: "https://github.com/philc/vimium#release-notes"

# Ensure that tabInfoMap is populated when Vimium is installed.
chrome.windows.getAll { populate: true }, (windows) ->


  if (portHandlers[port.name])
    port.onMessage.addListener(portHandlers[port.name])

chrome.runtime.onMessage.addListener((request, sender, sendResponse) ->
  if (sendRequestHandlers[request.handler])
