       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"
+    if chrome.notifications?.create?
+      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"
+    else
+      # We need to wait for the user to accept the "notifications" permission.
+      chrome.permissions.onAdded.addListener showUpgradeMessage
 
 # Ensure that tabInfoMap is populated when Vimium is installed.
 chrome.windows.getAll { populate: true }, (windows) ->


# Show notification on upgrade.
showUpgradeMessage = ->
  if shouldShowUpgradeMessage()
    notificationId = "VimiumUpgradeNotification"
    notification =
      type: "basic"

      for tab in window.tabs
        chrome.tabs.sendMessage(tab.id, args, null))

openOptionsPageInNewTab = ->
  chrome.tabs.getSelected(null, (tab) ->
    chrome.tabs.create({ url: chrome.runtime.getURL("pages/options.html"), index: tab.index + 1 }))
