зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 8b6868dfc7a7 (bug 1613264) for leaks at (AbstractThread, AbstractWatcher, AnimationTimeline, AsyncFreeSnowWhite). CLOSED TREE
This commit is contained in:
Родитель
d28d60e71f
Коммит
0a07db889e
|
@ -671,6 +671,7 @@ class TelemetryEvent {
|
|||
"mousedown",
|
||||
"TabSelect",
|
||||
"focus",
|
||||
"urlbar-reopen",
|
||||
];
|
||||
if (!validEvents.includes(event.type)) {
|
||||
Cu.reportError("Can't start recording from event type: " + event.type);
|
||||
|
|
|
@ -1023,18 +1023,16 @@ class UrlbarInput {
|
|||
|
||||
_afterTabSelectAndFocusChange() {
|
||||
// We must have seen both events to proceed safely.
|
||||
if (!this._gotFocusChange || !this._tabSelectEvent) {
|
||||
if (!this._gotFocusChange || !this._gotTabSelect) {
|
||||
return;
|
||||
}
|
||||
let event = this._tabSelectEvent;
|
||||
this._gotFocusChange = false;
|
||||
this._tabSelectEvent = null;
|
||||
this._gotFocusChange = this._gotTabSelect = false;
|
||||
|
||||
this._resetSearchState();
|
||||
|
||||
// Switching tabs doesn't always change urlbar focus, so we must try to
|
||||
// reopen here too, not just on focus.
|
||||
if (this.view.autoOpen({ event })) {
|
||||
if (this.view.autoOpen({ event: new CustomEvent("urlbar-reopen") })) {
|
||||
return;
|
||||
}
|
||||
// The input may retain focus when switching tabs in which case we
|
||||
|
@ -2057,7 +2055,7 @@ class UrlbarInput {
|
|||
}
|
||||
|
||||
_on_TabSelect(event) {
|
||||
this._tabSelectEvent = event;
|
||||
this._gotTabSelect = true;
|
||||
this._afterTabSelectAndFocusChange();
|
||||
}
|
||||
|
||||
|
|
|
@ -420,12 +420,6 @@ class UrlbarView {
|
|||
return false;
|
||||
}
|
||||
|
||||
// TabSwitch is the only case where we requery if the view is open, because
|
||||
// switching tabs doesn't necessarily close the view.
|
||||
if (this.isOpen && queryOptions.event.type != "TabSelect") {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (
|
||||
this._rows.firstElementChild &&
|
||||
this._queryContext.searchString == this.input.value
|
||||
|
|
|
@ -411,37 +411,3 @@ add_task(async function test_allowAutofill() {
|
|||
|
||||
await BrowserTestUtils.closeWindow(win);
|
||||
});
|
||||
|
||||
add_task(async function test_clicks_after_autofill() {
|
||||
info(
|
||||
"Check that clickin on an autofilled input field doesn't requery, causing loss of the caret position"
|
||||
);
|
||||
let win = await BrowserTestUtils.openNewBrowserWindow();
|
||||
info("autofill in tab2, switch to tab1, then back to tab2 with the mouse");
|
||||
await UrlbarTestUtils.promiseAutocompleteResultPopup({
|
||||
window: win,
|
||||
waitForFocus,
|
||||
value: "e",
|
||||
fireInputEvent: true,
|
||||
});
|
||||
Assert.equal(win.gURLBar.value, "example.com/", "Should have autofilled");
|
||||
|
||||
// Check single click.
|
||||
let input = win.gURLBar.inputField;
|
||||
EventUtils.synthesizeMouse(input, 30, 10, {}, win);
|
||||
// Wait a bit, in case of a mistake this would run a query, otherwise not.
|
||||
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
|
||||
await new Promise(resolve => setTimeout(resolve, 300));
|
||||
Assert.ok(win.gURLBar.selectionStart < win.gURLBar.value.length);
|
||||
Assert.equal(win.gURLBar.selectionStart, win.gURLBar.selectionEnd);
|
||||
|
||||
// Check double click.
|
||||
EventUtils.synthesizeMouse(input, 30, 10, { clickCount: 2 }, win);
|
||||
// Wait a bit, in case of a mistake this would run a query, otherwise not.
|
||||
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
|
||||
await new Promise(resolve => setTimeout(resolve, 300));
|
||||
Assert.ok(win.gURLBar.selectionStart < win.gURLBar.value.length);
|
||||
Assert.ok(win.gURLBar.selectionEnd > win.gURLBar.selectionStart);
|
||||
|
||||
await BrowserTestUtils.closeWindow(win);
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче