mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-20 16:55:40 +00:00
Bug 1582833, update findbar state correctly when findbar is closed to allow keyboard to work properly, r=mikedeboer
Differential Revision: https://phabricator.services.mozilla.com/D46906 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
204f15a778
commit
4348582007
@ -37,11 +37,8 @@ class FindBarChild extends JSWindowActorChild {
|
||||
|
||||
receiveMessage(msg) {
|
||||
if (msg.name == "Findbar:UpdateState") {
|
||||
this.findMode = msg.data.findMode;
|
||||
this.inQuickFind = msg.data.hasQuickFindTimeout;
|
||||
if (msg.data.isOpenAndFocused) {
|
||||
this.inPassThrough = false;
|
||||
}
|
||||
let { FindBarContent } = this;
|
||||
FindBarContent.updateState(msg.data);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -254,6 +254,50 @@ add_task(async function e10sLostKeys() {
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
||||
/**
|
||||
* This test makes sure that keyboard operations still occur
|
||||
* after the findbar is opened and closed.
|
||||
*/
|
||||
add_task(async function test_open_and_close_keys() {
|
||||
let tab = await BrowserTestUtils.openNewForegroundTab(
|
||||
gBrowser,
|
||||
"data:text/html,<body style='height: 5000px;'>Hello There</body>"
|
||||
);
|
||||
|
||||
await gFindBarPromise;
|
||||
let findBar = gFindBar;
|
||||
|
||||
is(findBar.hidden, true, "Findbar is hidden now.");
|
||||
let openedPromise = BrowserTestUtils.waitForEvent(findBar, "findbaropen");
|
||||
await EventUtils.synthesizeKey("f", { accelKey: true });
|
||||
await openedPromise;
|
||||
|
||||
is(findBar.hidden, false, "Findbar should not be hidden.");
|
||||
|
||||
let closedPromise = BrowserTestUtils.waitForEvent(findBar, "findbarclose");
|
||||
await EventUtils.synthesizeKey("KEY_Escape");
|
||||
await closedPromise;
|
||||
|
||||
let scrollPromise = BrowserTestUtils.waitForContentEvent(
|
||||
tab.linkedBrowser,
|
||||
"scroll"
|
||||
);
|
||||
await EventUtils.synthesizeKey("KEY_ArrowDown");
|
||||
await scrollPromise;
|
||||
|
||||
let scrollPosition = await SpecialPowers.spawn(
|
||||
tab.linkedBrowser,
|
||||
[],
|
||||
async function() {
|
||||
return content.document.body.scrollTop;
|
||||
}
|
||||
);
|
||||
|
||||
ok(scrollPosition > 0, "Scrolled ok to " + scrollPosition);
|
||||
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
||||
async function promiseFindFinished(searchText, highlightOn) {
|
||||
let findbar = await gBrowser.getFindBar();
|
||||
findbar.startFind(findbar.FIND_NORMAL);
|
||||
|
@ -60,6 +60,14 @@ class FindBarContent {
|
||||
this.passKeyToParent(event);
|
||||
}
|
||||
|
||||
updateState(data) {
|
||||
this.findMode = data.findMode;
|
||||
this.inQuickFind = data.hasQuickFindTimeout;
|
||||
if (data.isOpenAndFocused) {
|
||||
this.inPassThrough = false;
|
||||
}
|
||||
}
|
||||
|
||||
handleEvent(event) {
|
||||
switch (event.type) {
|
||||
case "keypress":
|
||||
|
Loading…
Reference in New Issue
Block a user