mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1105967 - Typing fast in address bar and pressing enter leads to missing end characters. a=paolo
This commit is contained in:
parent
9929a86661
commit
bb00bec3d9
@ -124,6 +124,7 @@ skip-if = e10s # Bug 1093153 - no about:home support yet
|
||||
[browser_alltabslistener.js]
|
||||
[browser_autocomplete_a11y_label.js]
|
||||
skip-if = e10s # Bug 1101993 - times out for unknown reasons when run in the dir (works on its own)
|
||||
[browser_autocomplete_enter_race.js]
|
||||
[browser_autocomplete_no_title.js]
|
||||
[browser_autocomplete_autoselect.js]
|
||||
[browser_autocomplete_oldschool_wrap.js]
|
||||
|
@ -0,0 +1,28 @@
|
||||
add_task(function*() {
|
||||
// This test is only relevant if UnifiedComplete is enabled.
|
||||
Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", true);
|
||||
|
||||
registerCleanupFunction(() => {
|
||||
PlacesUtils.bookmarks.removeFolderChildren(PlacesUtils.unfiledBookmarksFolderId);
|
||||
Services.prefs.clearUserPref("browser.urlbar.unifiedcomplete");
|
||||
});
|
||||
|
||||
let itemId =
|
||||
PlacesUtils.bookmarks.insertBookmark(PlacesUtils.unfiledBookmarksFolderId,
|
||||
NetUtil.newURI("http://example.com/?q=%s"),
|
||||
PlacesUtils.bookmarks.DEFAULT_INDEX,
|
||||
"test");
|
||||
PlacesUtils.bookmarks.setKeywordForBookmark(itemId, "keyword");
|
||||
|
||||
yield new Promise(resolve => waitForFocus(resolve, window));
|
||||
|
||||
yield promiseAutocompleteResultPopup("keyword bear");
|
||||
gURLBar.focus();
|
||||
EventUtils.synthesizeKey("d", {});
|
||||
EventUtils.synthesizeKey("VK_RETURN", {});
|
||||
|
||||
yield promiseTabLoadEvent(gBrowser.selectedTab);
|
||||
is(gBrowser.selectedTab.linkedBrowser.currentURI.spec,
|
||||
"http://example.com/?q=beard",
|
||||
"Latest typed characters should have been used");
|
||||
});
|
@ -124,6 +124,8 @@
|
||||
]]></destructor>
|
||||
|
||||
<field name="_value">""</field>
|
||||
<field name="gotResultForCurrentQuery">false</field>
|
||||
<field name="handleEnterWhenGotResult">false</field>
|
||||
|
||||
<!--
|
||||
onBeforeValueGet is called by the base-binding's .value getter.
|
||||
@ -806,11 +808,48 @@
|
||||
this._value = this.inputField.value;
|
||||
gBrowser.userTypedValue = this.value;
|
||||
this.valueIsTyped = true;
|
||||
this.gotResultForCurrentQuery = false;
|
||||
this.mController.handleText();
|
||||
}
|
||||
this.resetActionType();
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="handleEnter">
|
||||
<body><![CDATA[
|
||||
// When UnifiedComplete is enabled, we need to ensure we're using
|
||||
// a selected autocomplete result. A result should automatically be
|
||||
// selected by default (UnifiedComplete guarantees at least one
|
||||
// result), however autocomplete is async and therefore we may not
|
||||
// have a result set relating to the current input yet. If that
|
||||
// happens, we need to mark that when the first result does get added,
|
||||
// it needs to be handled as if enter was pressed with that first
|
||||
// result selected.
|
||||
// With UnifiedComplete disabled we don't have this problem, as the
|
||||
// default is to use the value directly from the input field (without
|
||||
// relying on autocomplete).
|
||||
|
||||
if (!Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete")) {
|
||||
return this.mController.handleEnter(false);
|
||||
}
|
||||
|
||||
// If anything other than the default (first) result is selected, then
|
||||
// it must have been manually selected by the human. We let this
|
||||
// explicit choice be used, even if it may be related to a previous
|
||||
// input.
|
||||
// However, if the default result is automatically selected, we
|
||||
// ensure that it corresponds to the current input.
|
||||
|
||||
if (this.popup.selectedIndex != 0 || this.gotResultForCurrentQuery) {
|
||||
return this.mController.handleEnter(false);
|
||||
}
|
||||
|
||||
this.handleEnterWhenGotResult = true;
|
||||
|
||||
return true;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
@ -1481,6 +1520,12 @@
|
||||
|
||||
if (this._matchCount > 0 && this.selectedIndex == -1)
|
||||
this.selectedIndex = 0;
|
||||
|
||||
this.input.gotResultForCurrentQuery = true;
|
||||
if (this.input.handleEnterWhenGotResult) {
|
||||
this.input.handleEnterWhenGotResult = false;
|
||||
this.input.mController.handleEnter(false);
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
@ -478,7 +478,7 @@
|
||||
kind: "key"
|
||||
};
|
||||
}
|
||||
cancel = this.mController.handleEnter(false);
|
||||
cancel = this.handleEnter();
|
||||
break;
|
||||
case KeyEvent.DOM_VK_DELETE:
|
||||
#ifdef XP_MACOSX
|
||||
@ -508,6 +508,12 @@
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="handleEnter">
|
||||
<body><![CDATA[
|
||||
return this.mController.handleEnter(false);
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<!-- ::::::::::::: miscellaneous ::::::::::::: -->
|
||||
|
||||
<method name="initSearchNames">
|
||||
|
Loading…
Reference in New Issue
Block a user