mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-09 01:08:39 +09:00
Bug 1100291 - Make getShortcutOrURIAndPostData() async by calling the passed callback off a zero timeout
Issue #112
This commit is contained in:
parent
6b4c0ab0f1
commit
f124289e28
2 changed files with 8 additions and 10 deletions
|
|
@ -1905,6 +1905,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);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue