         event.srcElement.blur()
       exitInsertMode()
       DomUtils.suppressEvent event
-      pushHandledKeydownEvent event
+      KeydownEvents.push event
 
   else if (findMode)
     if (KeyboardUtils.isEscape(event))
       handleEscapeForFindMode()
       DomUtils.suppressEvent event
-      pushHandledKeydownEvent event
+      KeydownEvents.push event
 
     else if (event.keyCode == keyCodes.backspace || event.keyCode == keyCodes.deleteKey)
       handleDeleteForFindMode()
       DomUtils.suppressEvent event
-      pushHandledKeydownEvent event
+      KeydownEvents.push event
 
     else if (event.keyCode == keyCodes.enter)
       handleEnterForFindMode()
       DomUtils.suppressEvent event
-      pushHandledKeydownEvent event
+      KeydownEvents.push event
 
     else if (!modifiers)
       DomUtils.suppressPropagation(event)
-      pushHandledKeydownEvent event
+      KeydownEvents.push event
 
   else if (isShowingHelpDialog && KeyboardUtils.isEscape(event))
     hideHelpDialog()
     DomUtils.suppressEvent event
-    pushHandledKeydownEvent event
+    KeydownEvents.push event
 
   else if (!isInsertMode() && !findMode)
     if (keyChar)
       if (currentCompletionKeys.indexOf(keyChar) != -1 or isValidFirstKey(keyChar))
         DomUtils.suppressEvent event
-        pushHandledKeydownEvent event
+        KeydownEvents.push event
 
       keyPort.postMessage({ keyChar:keyChar, frameId:frameId })
 

isPassKey = ( keyChar ) ->
  return !keyQueue and passKeys and 0 <= passKeys.indexOf(keyChar)

handledKeydownEvents = {}
eventDetailsString = (event) ->
  JSON.stringify
    metaKey: event.metaKey
    altKey: event.altKey
    ctrlKey: event.ctrlKey
    keyIdentifier: event.keyIdentifier
    keyCode: event.keyCode
pushHandledKeydownEvent = (event) -> handledKeydownEvents[eventDetailsString event] = true
hasHandledKeydownEvent = (event) ->
  detailString = eventDetailsString event
  value = handledKeydownEvents[detailString]
  delete handledKeydownEvents[detailString]
  value

#
# Sends everything except i & ESC to the handler in background_page. i & ESC are special because they control

     (currentCompletionKeys.indexOf(KeyboardUtils.getKeyChar(event)) != -1 ||
      isValidFirstKey(KeyboardUtils.getKeyChar(event))))
    DomUtils.suppressPropagation(event)
    KeydownEvents.push event

onKeyup = (event) ->
  return unless handlerStack.bubbleEvent("keyup", event)

  # Don't propagate the keyup to the underlying page if Vimium has handled it. See #733.
  DomUtils.suppressPropagation(event) if KeydownEvents.pop event

checkIfEnabledForUrl = ->
  url = window.location.toString()
