Bug 646270 - MozScrolledAreaChanged changed behavior and broke some browser-chrome tests [r=mbrubeck]

This commit is contained in:
Mark Finkle 2011-03-30 13:19:00 -04:00
parent 461f48b2d6
commit 60fbe2ed5b
3 changed files with 14 additions and 14 deletions

View File

@ -25,10 +25,8 @@ function waitForPageShow(aPageURL, aCallback) {
messageManager.addMessageListener("pageshow", function(aMessage) {
if (aMessage.target.currentURI.spec == aPageURL) {
messageManager.removeMessageListener("pageshow", arguments.callee);
messageManager.addMessageListener("MozScrolledAreaChanged", function(aMessage) {
messageManager.removeMessageListener("MozScrolledAreaChanged", arguments.callee);
aCallback();
});
setTimeout(aCallback, 0);
}
});
};
@ -75,7 +73,11 @@ gTests.push({
},
checkHorizontalScrollable: function() {
checkScrollbars(true, false);
checkScrollbars(true, true);
// TODO: current code forces the height to grow so we always have visible document when
// zooming out to see the wide document
//checkScrollbars(true, false);
todo(false, "Don't cause the height to grow beyond the window height if it doesn't need to");
waitForPageShow(testURL_01 + "vertical", gCurrentTest.checkVerticalScrollable);
gOpenedTabs.push(Browser.addTab(testURL_01 + "vertical", true));

View File

@ -41,26 +41,27 @@ function handleRequest(request, response) {
let action = "";
let query = decodeURIComponent(request.queryString || "");
response.write("<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>");
response.write("<meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1'>");
response.write("<meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1'>");
let body = "<span>" + query + "</span>";
switch (query) {
case "blank":
response.write("<title>This is a not a scrollable page</title>");
break;
case "horizontal":
response.write("<title>This is a horizontally scrollable page</title>");
response.write("<div style='height: 200px; width: 2000px; border: 1px solid red; background-color: grey; color: black'>Browser scrollbar test</div>");
body += "\n<div style='height: 200px; width: 2000px; border: 1px solid red; background-color: grey; color: black'>Browser scrollbar test</div>";
break;
case "vertical":
response.write("<title>This is a vertically scrollable page</title>");
response.write("<div style='height: 2000px; width: 200px; border: 1px solid red; background-color: grey; color: black'>Browser scrollbar test</div>");
body += "\n<div style='height: 2000px; width: 200px; border: 1px solid red; background-color: grey; color: black'>Browser scrollbar test</div>";
break;
case "both":
response.write("<title>This is a scrollable page in both directions</title>");
response.write("<div style='height: 2000px; width: 2000px; border: 1px solid red; background-color: grey; color: black'>Browser scrollbar test</div>");
body += "\n<div style='height: 2000px; width: 2000px; border: 1px solid red; background-color: grey; color: black'>Browser scrollbar test</div>";
break;
default:
break;
}
response.write("</head><body>" + query + "</body></html>");
response.write("</head><body style='border:2px solid blue'>" + body + "</body></html>");
}

View File

@ -59,13 +59,10 @@ function scaleRatio(n) {
let currentTab;
let loadURL = function loadURL(aPageURL, aCallback, aScale) {
messageManager.addMessageListener("MozScrolledAreaChanged", function(aMessage) {
messageManager.addMessageListener("pageshow", function(aMessage) {
if (aMessage.target.currentURI.spec == aPageURL) {
messageManager.removeMessageListener(aMessage.name, arguments.callee);
// HACK: Sometimes there are two MozScrolledAreaChanged messages in a
// row, and this waitFor is the only way founded to make sure the
// browser responds to both of them before we do.
waitFor(aCallback, function() {
return !aScale || aScale == aMessage.target.scale;
});