mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1131626, fix autoscroll tests to work in e10s, r=felipe
This commit is contained in:
parent
bf2cc207f4
commit
06c3d03c43
@ -4,11 +4,9 @@ support-files =
|
||||
file_contentTitle.html
|
||||
audio.ogg
|
||||
[browser_autoscroll_disabled.js]
|
||||
skip-if = e10s # Bug ?????? - test touches content (getElementById on the content document)
|
||||
[browser_browserDrop.js]
|
||||
skip-if = buildapp == 'mulet' || e10s # Relies on drop to be handled in the parent process
|
||||
[browser_bug295977_autoscroll_overflow.js]
|
||||
skip-if = e10s # Bug 921935 - focusmanager issues with e10s
|
||||
[browser_bug594509.js]
|
||||
skip-if = e10s # Bug ?????? - intermittent crash of child process reported when run under e10s
|
||||
[browser_bug982298.js]
|
||||
@ -25,7 +23,6 @@ skip-if = e10s # Bug ?????? - test directly manipulates content (TypeError: doc.
|
||||
support-files =
|
||||
empty.png
|
||||
[browser_keyevents_during_autoscrolling.js]
|
||||
skip-if = e10s # Bug 921935 - focusmanager issues with e10s
|
||||
[browser_save_resend_postdata.js]
|
||||
support-files =
|
||||
common/mockTransfer.js
|
||||
|
@ -1,75 +1,67 @@
|
||||
function test()
|
||||
add_task(function* ()
|
||||
{
|
||||
const kPrefName_AutoScroll = "general.autoScroll";
|
||||
Services.prefs.setBoolPref(kPrefName_AutoScroll, false);
|
||||
|
||||
var doc;
|
||||
|
||||
function startLoad(dataUri) {
|
||||
gBrowser.selectedBrowser.addEventListener("pageshow", onLoad, false);
|
||||
gBrowser.loadURI(dataUri);
|
||||
}
|
||||
|
||||
function onLoad() {
|
||||
gBrowser.selectedBrowser.removeEventListener("pageshow", onLoad, false);
|
||||
waitForFocus(onFocus, content);
|
||||
}
|
||||
|
||||
function onFocus() {
|
||||
doc = gBrowser.contentDocument;
|
||||
runChecks();
|
||||
}
|
||||
|
||||
function endTest() {
|
||||
// restore the changed prefs
|
||||
if (Services.prefs.prefHasUserValue(kPrefName_AutoScroll))
|
||||
Services.prefs.clearUserPref(kPrefName_AutoScroll);
|
||||
|
||||
// waitForFocus() fixes a failure in the next test if the latter runs too soon.
|
||||
waitForFocus(finish);
|
||||
}
|
||||
|
||||
waitForExplicitFinish();
|
||||
|
||||
let dataUri = 'data:text/html,<html><body id="i" style="overflow-y: scroll"><div style="height: 2000px"></div>\
|
||||
<iframe id="iframe" style="display: none;"></iframe>\
|
||||
</body></html>';
|
||||
startLoad(dataUri);
|
||||
|
||||
function runChecks() {
|
||||
var elem = doc.getElementById('i');
|
||||
// Skip the first callback as it's the same callback that the browser
|
||||
// uses to kick off the scrolling.
|
||||
var skipFrames = 1;
|
||||
var checkScroll = function () {
|
||||
if (skipFrames--) {
|
||||
window.requestAnimationFrame(checkScroll);
|
||||
return;
|
||||
let loadedPromise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
|
||||
gBrowser.loadURI(dataUri);
|
||||
yield loadedPromise;
|
||||
|
||||
yield BrowserTestUtils.synthesizeMouse("#i", 50, 50, { button: 1 },
|
||||
gBrowser.selectedBrowser);
|
||||
|
||||
yield ContentTask.spawn(gBrowser.selectedBrowser, { }, function* () {
|
||||
var iframe = content.document.getElementById("iframe");
|
||||
|
||||
if (iframe) {
|
||||
var e = new iframe.contentWindow.PageTransitionEvent("pagehide",
|
||||
{ bubbles: true,
|
||||
cancelable: true,
|
||||
persisted: false });
|
||||
iframe.contentDocument.dispatchEvent(e);
|
||||
iframe.contentDocument.documentElement.dispatchEvent(e);
|
||||
}
|
||||
});
|
||||
|
||||
yield BrowserTestUtils.synthesizeMouse("#i", 100, 100,
|
||||
{ type: "mousemove", clickCount: "0" },
|
||||
gBrowser.selectedBrowser);
|
||||
|
||||
// If scrolling didn't work, we wouldn't do any redraws and thus time out, so
|
||||
// request and force redraws to get the chance to check for scrolling at all.
|
||||
yield new Promise(resolve => window.requestAnimationFrame(resolve));
|
||||
|
||||
let msg = yield ContentTask.spawn(gBrowser.selectedBrowser, { }, function* () {
|
||||
// Skip the first animation frame callback as it's the same callback that
|
||||
// the browser uses to kick off the scrolling.
|
||||
return new Promise(resolve => {
|
||||
function checkScroll() {
|
||||
let msg = "";
|
||||
let elem = content.document.getElementById('i');
|
||||
if (elem.scrollTop != 0) {
|
||||
msg += "element should not have scrolled vertically";
|
||||
}
|
||||
if (elem.scrollLeft != 0) {
|
||||
msg += "element should not have scrolled horizontally";
|
||||
}
|
||||
|
||||
resolve(msg);
|
||||
}
|
||||
ok(elem.scrollTop == 0, "element should not have scrolled vertically");
|
||||
ok(elem.scrollLeft == 0, "element should not have scrolled horizontally");
|
||||
|
||||
endTest();
|
||||
};
|
||||
EventUtils.synthesizeMouse(elem, 50, 50, { button: 1 },
|
||||
gBrowser.contentWindow);
|
||||
content.requestAnimationFrame(checkScroll);
|
||||
});
|
||||
});
|
||||
|
||||
var iframe = gBrowser.contentDocument.getElementById("iframe");
|
||||
var e = new iframe.contentWindow.PageTransitionEvent("pagehide",
|
||||
{ bubbles: true,
|
||||
cancelable: true,
|
||||
persisted: false });
|
||||
iframe.contentDocument.dispatchEvent(e);
|
||||
iframe.contentDocument.documentElement.dispatchEvent(e);
|
||||
ok(!msg, "element scroll " + msg);
|
||||
|
||||
EventUtils.synthesizeMouse(elem, 100, 100,
|
||||
{ type: "mousemove", clickCount: "0" },
|
||||
gBrowser.contentWindow);
|
||||
/*
|
||||
* if scrolling didn’t work, we wouldn’t do any redraws and thus time out.
|
||||
* so request and force redraws to get the chance to check for scrolling at
|
||||
* all.
|
||||
*/
|
||||
window.requestAnimationFrame(checkScroll);
|
||||
}
|
||||
}
|
||||
// restore the changed prefs
|
||||
if (Services.prefs.prefHasUserValue(kPrefName_AutoScroll))
|
||||
Services.prefs.clearUserPref(kPrefName_AutoScroll);
|
||||
|
||||
// wait for focus to fix a failure in the next test if the latter runs too soon.
|
||||
yield SimpleTest.promiseFocus();
|
||||
});
|
||||
|
@ -1,7 +1,10 @@
|
||||
function test()
|
||||
add_task(function* ()
|
||||
{
|
||||
const kPrefName_AutoScroll = "general.autoScroll";
|
||||
Services.prefs.setBoolPref(kPrefName_AutoScroll, true);
|
||||
function pushPref(name, value) {
|
||||
return new Promise(resolve => SpecialPowers.pushPrefEnv({"set": [[name, value]]}, resolve));
|
||||
}
|
||||
|
||||
yield pushPref("general.autoScroll", true);
|
||||
|
||||
const expectScrollNone = 0;
|
||||
const expectScrollVert = 1;
|
||||
@ -78,24 +81,52 @@ function test()
|
||||
{elem: 's', expected: expectScrollNone, testwindow: true, middlemousepastepref: true}
|
||||
];
|
||||
|
||||
var doc;
|
||||
|
||||
function nextTest() {
|
||||
var test = allTests.shift();
|
||||
if (!test) {
|
||||
endTest();
|
||||
return;
|
||||
}
|
||||
|
||||
for (let test of allTests) {
|
||||
if (test.dataUri) {
|
||||
startLoad(test.dataUri);
|
||||
return;
|
||||
let loadedPromise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
|
||||
gBrowser.loadURI(test.dataUri);
|
||||
yield loadedPromise;
|
||||
continue;
|
||||
}
|
||||
|
||||
let prefsChanged = (test.middlemousepastepref == false || test.middlemousepastepref == true);
|
||||
if (prefsChanged) {
|
||||
yield pushPref("middlemouse.paste", test.middlemousepastepref);
|
||||
}
|
||||
|
||||
var elem = doc.getElementById(test.elem);
|
||||
yield BrowserTestUtils.synthesizeMouse("#" + test.elem, 50, 80, { button: 1 },
|
||||
gBrowser.selectedBrowser);
|
||||
|
||||
// This ensures bug 605127 is fixed: pagehide in an unrelated document
|
||||
// should not cancel the autoscroll.
|
||||
yield ContentTask.spawn(gBrowser.selectedBrowser, { }, function* () {
|
||||
var iframe = content.document.getElementById("iframe");
|
||||
|
||||
if (iframe) {
|
||||
var e = new iframe.contentWindow.PageTransitionEvent("pagehide",
|
||||
{ bubbles: true,
|
||||
cancelable: true,
|
||||
persisted: false });
|
||||
iframe.contentDocument.dispatchEvent(e);
|
||||
iframe.contentDocument.documentElement.dispatchEvent(e);
|
||||
}
|
||||
});
|
||||
|
||||
is(document.activeElement, gBrowser.selectedBrowser, "Browser still focused after autoscroll started");
|
||||
|
||||
yield BrowserTestUtils.synthesizeMouse("#" + test.elem, 100, 100,
|
||||
{ type: "mousemove", clickCount: "0" },
|
||||
gBrowser.selectedBrowser);
|
||||
|
||||
if (prefsChanged) {
|
||||
yield new Promise(resolve => SpecialPowers.popPrefEnv(resolve));
|
||||
}
|
||||
|
||||
// Start checking for the scroll.
|
||||
let firstTimestamp = undefined;
|
||||
function checkScroll(timestamp) {
|
||||
let timeCompensation;
|
||||
do {
|
||||
let timestamp = yield new Promise(resolve => window.requestAnimationFrame(resolve));
|
||||
if (firstTimestamp === undefined) {
|
||||
firstTimestamp = timestamp;
|
||||
}
|
||||
@ -104,7 +135,7 @@ function test()
|
||||
// ClickEventHandler.autoscrollLoop, except here it's cumulative across
|
||||
// all frames after the first one instead of being based only on the
|
||||
// current frame.
|
||||
let timeCompensation = (timestamp - firstTimestamp) / 20;
|
||||
timeCompensation = (timestamp - firstTimestamp) / 20;
|
||||
info("timestamp=" + timestamp + " firstTimestamp=" + firstTimestamp +
|
||||
" timeCompensation=" + timeCompensation);
|
||||
|
||||
@ -116,101 +147,62 @@ function test()
|
||||
// more likely that the accumulated scroll in autoscrollLoop will be >= 1,
|
||||
// although it also depends on acceleration, which here in this test
|
||||
// should be > 1 due to how it synthesizes mouse events below.
|
||||
if (timeCompensation < 5) {
|
||||
window.requestAnimationFrame(checkScroll);
|
||||
return;
|
||||
}
|
||||
} while (timeCompensation < 5);
|
||||
|
||||
// Close the autoscroll popup by synthesizing Esc.
|
||||
EventUtils.synthesizeKey("VK_ESCAPE", {}, gBrowser.contentWindow);
|
||||
var scrollVert = test.expected & expectScrollVert;
|
||||
var scrollHori = test.expected & expectScrollHori;
|
||||
// Close the autoscroll popup by synthesizing Esc.
|
||||
EventUtils.synthesizeKey("VK_ESCAPE", {});
|
||||
let scrollVert = test.expected & expectScrollVert;
|
||||
let scrollHori = test.expected & expectScrollHori;
|
||||
|
||||
if (test.testwindow) {
|
||||
ok((scrollVert && gBrowser.contentWindow.scrollY > 0) ||
|
||||
(!scrollVert && gBrowser.contentWindow.scrollY == 0),
|
||||
'Window for '+test.elem+' should'+(scrollVert ? '' : ' not')+' have scrolled vertically');
|
||||
ok((scrollHori && gBrowser.contentWindow.scrollX > 0) ||
|
||||
(!scrollHori && gBrowser.contentWindow.scrollX == 0),
|
||||
'Window for '+test.elem+' should'+(scrollHori ? '' : ' not')+' have scrolled horizontally');
|
||||
} else {
|
||||
ok((scrollVert && elem.scrollTop > 0) ||
|
||||
(!scrollVert && elem.scrollTop == 0),
|
||||
test.elem+' should'+(scrollVert ? '' : ' not')+' have scrolled vertically');
|
||||
ok((scrollHori && elem.scrollLeft > 0) ||
|
||||
(!scrollHori && elem.scrollLeft == 0),
|
||||
test.elem+' should'+(scrollHori ? '' : ' not')+' have scrolled horizontally');
|
||||
}
|
||||
let checkScroll = yield ContentTask.spawn(gBrowser.selectedBrowser,
|
||||
{ scrollVert : scrollVert,
|
||||
scrollHori: scrollHori,
|
||||
elemid : test.elem,
|
||||
checkWindow: test.testwindow },
|
||||
function* (args) {
|
||||
let msg = "";
|
||||
if (args.checkWindow) {
|
||||
if (!((args.scrollVert && content.scrollY > 0) ||
|
||||
(!args.scrollVert && content.scrollY == 0))) {
|
||||
msg += "Failed: ";
|
||||
}
|
||||
msg += 'Window for ' + args.elemid + ' should' + (args.scrollVert ? '' : ' not') + ' have scrolled vertically\n';
|
||||
|
||||
if (!((args.scrollHori && content.scrollX > 0) ||
|
||||
(!args.scrollHori && content.scrollX == 0))) {
|
||||
msg += "Failed: ";
|
||||
}
|
||||
msg += ' Window for ' + args.elemid + ' should' + (args.scrollHori ? '' : ' not') + ' have scrolled horizontally\n';
|
||||
} else {
|
||||
let elem = content.document.getElementById(args.elemid);
|
||||
if (!((args.scrollVert && elem.scrollTop > 0) ||
|
||||
(!args.scrollVert && elem.scrollTop == 0))) {
|
||||
msg += "Failed: ";
|
||||
}
|
||||
msg += ' ' + args.elemid + ' should' + (args.scrollVert ? '' : ' not') + ' have scrolled vertically\n';
|
||||
if (!((args.scrollHori && elem.scrollLeft > 0) ||
|
||||
(!args.scrollHori && elem.scrollLeft == 0))) {
|
||||
msg += "Failed: ";
|
||||
}
|
||||
msg += args.elemid + ' should' + (args.scrollHori ? '' : ' not') + ' have scrolled horizontally';
|
||||
}
|
||||
|
||||
// Before continuing the test, we need to ensure that the IPC
|
||||
// message that stops autoscrolling has had time to arrive.
|
||||
executeSoon(nextTest);
|
||||
};
|
||||
return msg;
|
||||
}
|
||||
);
|
||||
|
||||
if (test.middlemousepastepref == false || test.middlemousepastepref == true)
|
||||
Services.prefs.setBoolPref("middlemouse.paste", test.middlemousepastepref);
|
||||
ok(checkScroll.indexOf("Failed") == -1, checkScroll)
|
||||
|
||||
EventUtils.synthesizeMouse(elem, 50, 50, { button: 1 },
|
||||
gBrowser.contentWindow);
|
||||
|
||||
// This ensures bug 605127 is fixed: pagehide in an unrelated document
|
||||
// should not cancel the autoscroll.
|
||||
var iframe = gBrowser.contentDocument.getElementById("iframe");
|
||||
|
||||
if (iframe) {
|
||||
var e = new iframe.contentWindow.PageTransitionEvent("pagehide",
|
||||
{ bubbles: true,
|
||||
cancelable: true,
|
||||
persisted: false });
|
||||
iframe.contentDocument.dispatchEvent(e);
|
||||
iframe.contentDocument.documentElement.dispatchEvent(e);
|
||||
}
|
||||
|
||||
EventUtils.synthesizeMouse(elem, 100, 100,
|
||||
{ type: "mousemove", clickCount: "0" },
|
||||
gBrowser.contentWindow);
|
||||
|
||||
if (Services.prefs.prefHasUserValue("middlemouse.paste"))
|
||||
Services.prefs.clearUserPref("middlemouse.paste");
|
||||
|
||||
// Start checking for the scroll.
|
||||
window.requestAnimationFrame(checkScroll);
|
||||
// Before continuing the test, we need to ensure that the IPC
|
||||
// message that stops autoscrolling has had time to arrive.
|
||||
yield new Promise(resolve => executeSoon(resolve));
|
||||
}
|
||||
|
||||
waitForExplicitFinish();
|
||||
|
||||
nextTest();
|
||||
|
||||
function startLoad(dataUri) {
|
||||
gBrowser.selectedBrowser.addEventListener("pageshow", onLoad, false);
|
||||
gBrowser.loadURI(dataUri);
|
||||
// remove 2 tabs that were opened by middle-click on links
|
||||
while (gBrowser.visibleTabs.length > 1) {
|
||||
gBrowser.removeTab(gBrowser.visibleTabs[gBrowser.visibleTabs.length - 1]);
|
||||
}
|
||||
|
||||
function onLoad() {
|
||||
gBrowser.selectedBrowser.removeEventListener("pageshow", onLoad, false);
|
||||
waitForFocus(onFocus, content);
|
||||
}
|
||||
|
||||
function onFocus() {
|
||||
doc = gBrowser.contentDocument;
|
||||
nextTest();
|
||||
}
|
||||
|
||||
function endTest() {
|
||||
registerCleanupFunction(function() {
|
||||
// restore the changed prefs
|
||||
if (Services.prefs.prefHasUserValue(kPrefName_AutoScroll))
|
||||
Services.prefs.clearUserPref(kPrefName_AutoScroll);
|
||||
if (Services.prefs.prefHasUserValue("middlemouse.paste"))
|
||||
Services.prefs.clearUserPref("middlemouse.paste");
|
||||
|
||||
// remove 2 tabs that were opened by middle-click on links
|
||||
while (gBrowser.visibleTabs.length > 1) {
|
||||
gBrowser.removeTab(gBrowser.visibleTabs[gBrowser.visibleTabs.length - 1]);
|
||||
}
|
||||
});
|
||||
|
||||
// waitForFocus() fixes a failure in the next test if the latter runs too soon.
|
||||
waitForFocus(finish);
|
||||
}
|
||||
}
|
||||
// wait for focus to fix a failure in the next test if the latter runs too soon.
|
||||
yield SimpleTest.promiseFocus();
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
function test()
|
||||
add_task(function * ()
|
||||
{
|
||||
const kPrefName_AutoScroll = "general.autoScroll";
|
||||
Services.prefs.setBoolPref(kPrefName_AutoScroll, true);
|
||||
@ -21,7 +21,7 @@ function test()
|
||||
{
|
||||
key = aChar;
|
||||
dispatchedKeyEvents = kNoKeyEvents;
|
||||
EventUtils.sendChar(key, gBrowser.contentWindow);
|
||||
EventUtils.sendChar(key);
|
||||
is(dispatchedKeyEvents, expectedKeyEvents,
|
||||
"unexpected key events were dispatched or not dispatched: " + key);
|
||||
}
|
||||
@ -33,17 +33,17 @@ function test()
|
||||
{
|
||||
key = aKey;
|
||||
dispatchedKeyEvents = kNoKeyEvents;
|
||||
EventUtils.sendKey(key, gBrowser.contentWindow);
|
||||
EventUtils.sendKey(key);
|
||||
is(dispatchedKeyEvents, expectedKeyEvents,
|
||||
"unexpected key events were dispatched or not dispatched: " + key);
|
||||
}
|
||||
|
||||
function onKey(aEvent)
|
||||
{
|
||||
if (aEvent.target != root && aEvent.target != root.ownerDocument.body) {
|
||||
ok(false, "unknown target: " + aEvent.target.tagName);
|
||||
return;
|
||||
}
|
||||
// if (aEvent.target != root && aEvent.target != root.ownerDocument.body) {
|
||||
// ok(false, "unknown target: " + aEvent.target.tagName);
|
||||
// return;
|
||||
// }
|
||||
|
||||
var keyFlag;
|
||||
switch (aEvent.type) {
|
||||
@ -64,67 +64,57 @@ function test()
|
||||
is(keyFlag, expectedKeyEvents & keyFlag, aEvent.type + " fired: " + key);
|
||||
}
|
||||
|
||||
waitForExplicitFinish();
|
||||
gBrowser.selectedBrowser.addEventListener("pageshow", onLoad, false);
|
||||
var dataUri = 'data:text/html,<body style="height:10000px;"></body>';
|
||||
|
||||
let loadedPromise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
|
||||
gBrowser.loadURI(dataUri);
|
||||
yield loadedPromise;
|
||||
|
||||
function onLoad() {
|
||||
gBrowser.selectedBrowser.removeEventListener("pageshow", onLoad, false);
|
||||
waitForFocus(onFocus, content);
|
||||
}
|
||||
yield SimpleTest.promiseFocus(gBrowser.selectedBrowser);
|
||||
|
||||
function onFocus() {
|
||||
var doc = gBrowser.contentDocument;
|
||||
window.addEventListener("keydown", onKey, false);
|
||||
window.addEventListener("keypress", onKey, false);
|
||||
window.addEventListener("keyup", onKey, false);
|
||||
|
||||
root = doc.documentElement;
|
||||
root.addEventListener("keydown", onKey, true);
|
||||
root.addEventListener("keypress", onKey, true);
|
||||
root.addEventListener("keyup", onKey, true);
|
||||
// Test whether the key events are handled correctly under normal condition
|
||||
expectedKeyEvents = kAllKeyEvents;
|
||||
sendChar("A");
|
||||
|
||||
// Test whether the key events are handled correctly under normal condition
|
||||
expectedKeyEvents = kAllKeyEvents;
|
||||
sendChar("A");
|
||||
// Start autoscrolling by middle button click on the page
|
||||
let shownPromise = BrowserTestUtils.waitForEvent(window, "popupshown", false,
|
||||
event => event.originalTarget.className == "autoscroller");
|
||||
yield BrowserTestUtils.synthesizeMouseAtPoint(10, 10, { button: 1 },
|
||||
gBrowser.selectedBrowser);
|
||||
yield shownPromise;
|
||||
|
||||
// Start autoscrolling by middle button lick on the page
|
||||
EventUtils.synthesizeMouse(root, 10, 10, { button: 1 },
|
||||
gBrowser.contentWindow);
|
||||
// Most key events should be eaten by the browser.
|
||||
expectedKeyEvents = kNoKeyEvents;
|
||||
sendChar("A");
|
||||
sendKey("DOWN");
|
||||
sendKey("RETURN");
|
||||
sendKey("RETURN");
|
||||
sendKey("HOME");
|
||||
sendKey("END");
|
||||
sendKey("TAB");
|
||||
sendKey("RETURN");
|
||||
|
||||
// Before continuing the test, we need to ensure that the IPC
|
||||
// message that starts autoscrolling has had time to arrive.
|
||||
executeSoon(continueTest);
|
||||
}
|
||||
// Finish autoscrolling by ESC key. Note that only keydown and keypress
|
||||
// events are eaten because keyup event is fired *after* the autoscrolling
|
||||
// is finished.
|
||||
expectedKeyEvents = kKeyUpEvent;
|
||||
sendKey("ESCAPE");
|
||||
|
||||
function continueTest() {
|
||||
// Most key events should be eaten by the browser.
|
||||
expectedKeyEvents = kNoKeyEvents;
|
||||
sendChar("A");
|
||||
sendKey("DOWN");
|
||||
sendKey("RETURN");
|
||||
sendKey("RETURN");
|
||||
sendKey("HOME");
|
||||
sendKey("END");
|
||||
sendKey("TAB");
|
||||
sendKey("RETURN");
|
||||
// Test whether the key events are handled correctly under normal condition
|
||||
expectedKeyEvents = kAllKeyEvents;
|
||||
sendChar("A");
|
||||
|
||||
// Finish autoscrolling by ESC key. Note that only keydown and keypress
|
||||
// events are eaten because keyup event is fired *after* the autoscrolling
|
||||
// is finished.
|
||||
expectedKeyEvents = kKeyUpEvent;
|
||||
sendKey("ESCAPE");
|
||||
window.removeEventListener("keydown", onKey, false);
|
||||
window.removeEventListener("keypress", onKey, false);
|
||||
window.removeEventListener("keyup", onKey, false);
|
||||
|
||||
// Test whether the key events are handled correctly under normal condition
|
||||
expectedKeyEvents = kAllKeyEvents;
|
||||
sendChar("A");
|
||||
// restore the changed prefs
|
||||
if (Services.prefs.prefHasUserValue(kPrefName_AutoScroll))
|
||||
Services.prefs.clearUserPref(kPrefName_AutoScroll);
|
||||
|
||||
root.removeEventListener("keydown", onKey, true);
|
||||
root.removeEventListener("keypress", onKey, true);
|
||||
root.removeEventListener("keyup", onKey, true);
|
||||
|
||||
// restore the changed prefs
|
||||
if (Services.prefs.prefHasUserValue(kPrefName_AutoScroll))
|
||||
Services.prefs.clearUserPref(kPrefName_AutoScroll);
|
||||
|
||||
finish();
|
||||
}
|
||||
}
|
||||
finish();
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user