forked from mirrors/gecko-dev
This removes the sync reflow from almost all cases. The only case where we keep it is when a keypress caught in content triggers a sync message to the parent process. We should clean this up in bug 1371523. I've tried to fix the tests, but a lot of them seem to be disabled anyway... MozReview-Commit-ID: 9k36p7q8MKy --HG-- extra : rebase_source : 311ee41ba9456a5c5d58b81a0cfa999bcef0027e
61 lines
2.3 KiB
JavaScript
61 lines
2.3 KiB
JavaScript
/* Any copyright is dedicated to the Public Domain.
|
|
* http://creativecommons.org/publicdomain/zero/1.0/
|
|
*/
|
|
|
|
add_task(async function findBarDisabledOnSomePages() {
|
|
ok(!gFindBar || gFindBar.hidden, "Find bar should not be visible by default");
|
|
|
|
let findbarOpenedPromise = BrowserTestUtils.waitForEvent(gBrowser.selectedTab, "TabFindInitialized");
|
|
document.documentElement.focus();
|
|
// Open the Find bar before we navigate to pages that shouldn't have it.
|
|
EventUtils.synthesizeKey("f", { accelKey: true });
|
|
await findbarOpenedPromise;
|
|
ok(!gFindBar.hidden, "Find bar should be visible");
|
|
|
|
let urls = [
|
|
"about:config",
|
|
"about:addons",
|
|
];
|
|
|
|
for (let url of urls) {
|
|
await testFindDisabled(url);
|
|
}
|
|
|
|
// Make sure the find bar is re-enabled after disabled page is closed.
|
|
await testFindEnabled("about:about");
|
|
gFindBar.close();
|
|
ok(gFindBar.hidden, "Find bar should now be hidden");
|
|
});
|
|
|
|
function testFindDisabled(url) {
|
|
return BrowserTestUtils.withNewTab(url, async function(browser) {
|
|
let waitForFindBar = async () => {
|
|
await new Promise(r => requestAnimationFrame(r));
|
|
await new Promise(r => Services.tm.dispatchToMainThread(r));
|
|
};
|
|
ok(!gFindBar || gFindBar.hidden, "Find bar should not be visible at the start");
|
|
await BrowserTestUtils.synthesizeKey("/", {}, browser);
|
|
await waitForFindBar();
|
|
ok(!gFindBar || gFindBar.hidden, "Find bar should not be visible after fast find");
|
|
EventUtils.synthesizeKey("f", {accelKey: true});
|
|
await waitForFindBar();
|
|
ok(!gFindBar || gFindBar.hidden, "Find bar should not be visible after find command");
|
|
ok(document.getElementById("cmd_find").getAttribute("disabled"),
|
|
"Find command should be disabled");
|
|
});
|
|
}
|
|
|
|
async function testFindEnabled(url) {
|
|
return BrowserTestUtils.withNewTab(url, async function(browser) {
|
|
ok(!document.getElementById("cmd_find").getAttribute("disabled"),
|
|
"Find command should not be disabled");
|
|
|
|
// Open Find bar and then close it.
|
|
let findbarOpenedPromise = BrowserTestUtils.waitForEvent(gBrowser.selectedTab, "TabFindInitialized");
|
|
EventUtils.synthesizeKey("f", { accelKey: true });
|
|
await findbarOpenedPromise;
|
|
ok(!gFindBar.hidden, "Find bar should be visible again");
|
|
EventUtils.synthesizeKey("KEY_Escape");
|
|
ok(gFindBar.hidden, "Find bar should now be hidden");
|
|
});
|
|
}
|