From 131195868b3a637911c373392466676dc35d3b66 Mon Sep 17 00:00:00 2001 From: girst Date: Wed, 31 Jul 2019 12:52:55 +0200 Subject: [PATCH] Fix TypeError when hitting ESC When hitting esc a TypeError was shown in the browser console (Ctrl-Shift-J), except when an element is fullscreened. The location of the error (i.e. commands-frame.js:621) is only shown on special pages (like about:* or chrome://), making the problem harder to locate. see also: functionality introduced in commit ab17744 > TypeError: The expression cannot be converted to return the specified type. commands-frame.js:621 --- extension/lib/commands-frame.coffee | 3 +++ extension/lib/commands.coffee | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/extension/lib/commands-frame.coffee b/extension/lib/commands-frame.coffee index ad88a22..5ee2fed 100644 --- a/extension/lib/commands-frame.coffee +++ b/extension/lib/commands-frame.coffee @@ -638,6 +638,9 @@ commands.esc = (args) -> utils.clearSelectionDeep(vim.content) {document} = vim.content + + return unless document.fullscreenElement + if document.exitFullscreen document.exitFullscreen() else diff --git a/extension/lib/commands.coffee b/extension/lib/commands.coffee index f71f33a..2e7092c 100644 --- a/extension/lib/commands.coffee +++ b/extension/lib/commands.coffee @@ -1028,7 +1028,7 @@ commands.help = ({vim}) -> help.toggleHelp(vim.window, vim._parent) commands.esc = ({vim}) -> - vim._run('esc') # NOTE: this causes a TypeError somewhere in the call stack. + vim._run('esc') vim.hideNotification() # Firefox does things differently when blurring the location bar, depending on -- 2.39.3