From c3a500933bc819705f362c56393de6a2bdb2f831 Mon Sep 17 00:00:00 2001 From: Simon Lydell Date: Thu, 2 Oct 2014 19:19:51 +0200 Subject: [PATCH] =?utf8?q?Fix=20#393,=20#380:=20Don=E2=80=99t=20suppress?= =?utf8?q?=20Esc=20in=20browser=20chrome?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- extension/packages/modes.coffee | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/extension/packages/modes.coffee b/extension/packages/modes.coffee index 036f9a3..f536467 100644 --- a/extension/packages/modes.coffee +++ b/extension/packages/modes.coffee @@ -6,6 +6,10 @@ utils = require 'utils' , isReturnCommandKey , findStorage } = require 'commands' +{ interfaces: Ci } = Components + +XULDocument = Ci.nsIDOMXULDocument + modes = {} modes['normal'] = @@ -44,7 +48,12 @@ modes['normal'] = # custom dialog of a website is open, we should be able to cancel hint # markers on it without closing it. Secondly, otherwise cancelling hint # markers on Google causes its search bar to be focused. - if keyStr == 'Esc' and not autoInsertMode + # - It may only be suppressed in web pages, not in browser chrome. That + # allows for reseting the location bar when blurring it, and closing + # dialogs such as the “bookmark this page” dialog (). + document = event.originalTarget.ownerDocument + inBrowserChrome = (document instanceof XULDocument) + if keyStr == 'Esc' and (not autoInsertMode or inBrowserChrome) return false return true -- 2.39.3