From 451cbfc0393ee0f3b8d18f856e6c8ad88d57b172 Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Sun, 15 Apr 2018 09:48:39 +0200 Subject: Bug 1100291 - Make getShortcutOrURIAndPostData() async by calling the passed callback off a zero timeout Issue #112 --- application/palemoon/base/content/browser.js | 6 ++++++ application/palemoon/base/content/urlbarBindings.xml | 12 ++---------- 2 files changed, 8 insertions(+), 10 deletions(-) (limited to 'application/palemoon/base') diff --git a/application/palemoon/base/content/browser.js b/application/palemoon/base/content/browser.js index 154badae5..be7993961 100644 --- a/application/palemoon/base/content/browser.js +++ b/application/palemoon/base/content/browser.js @@ -1906,6 +1906,12 @@ function getShortcutOrURIAndPostData(aURL, aCallback) { let keyword = aURL; let param = ""; + // XXX Bug 1100294 will remove this little hack by using an async version of + // PlacesUtils.getURLAndPostDataForKeyword(). For now we simulate an async + // execution with at least a setTimeout(fn, 0). + let originalCallback = aCallback; + aCallback = data => setTimeout(() => originalCallback(data)); + let offset = aURL.indexOf(" "); if (offset > 0) { keyword = aURL.substr(0, offset); diff --git a/application/palemoon/base/content/urlbarBindings.xml b/application/palemoon/base/content/urlbarBindings.xml index 44b398304..ec9feb22d 100644 --- a/application/palemoon/base/content/urlbarBindings.xml +++ b/application/palemoon/base/content/urlbarBindings.xml @@ -324,18 +324,10 @@ gBrowser.selectedBrowser.focus(); let isMouseEvent = aTriggeringEvent instanceof MouseEvent; - let altEnter = !isMouseEvent && aTriggeringEvent && aTriggeringEvent.altKey; - - if (altEnter) { - // XXX This was added a long time ago, and I'm not sure why it is - // necessary. Alt+Enter's default action might cause a system beep, - // or something like that? - aTriggeringEvent.preventDefault(); - aTriggeringEvent.stopPropagation(); - } // If the current tab is empty, ignore Alt+Enter (just reuse this tab) - altEnter = altEnter && !isTabEmpty(gBrowser.selectedTab); + let altEnter = !isMouseEvent && aTriggeringEvent && + aTriggeringEvent.altKey && !isTabEmpty(gBrowser.selectedTab); if (isMouseEvent || altEnter) { // Use the standard UI link behaviors for clicks or Alt+Enter -- cgit v1.2.3