From 60fbe2ed5b0a0cec8b9c18cf676e4aa0860a7b0e Mon Sep 17 00:00:00 2001 From: Mark Finkle Date: Wed, 30 Mar 2011 13:19:00 -0400 Subject: [PATCH] Bug 646270 - MozScrolledAreaChanged changed behavior and broke some browser-chrome tests [r=mbrubeck] --- mobile/chrome/tests/browser_scrollbar.js | 12 +++++++----- mobile/chrome/tests/browser_scrollbar.sjs | 11 ++++++----- mobile/chrome/tests/browser_viewport.js | 5 +---- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/mobile/chrome/tests/browser_scrollbar.js b/mobile/chrome/tests/browser_scrollbar.js index 4d45c82a7101..33f4de03bb32 100644 --- a/mobile/chrome/tests/browser_scrollbar.js +++ b/mobile/chrome/tests/browser_scrollbar.js @@ -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)); diff --git a/mobile/chrome/tests/browser_scrollbar.sjs b/mobile/chrome/tests/browser_scrollbar.sjs index c4b895b92231..afaad7b68510 100644 --- a/mobile/chrome/tests/browser_scrollbar.sjs +++ b/mobile/chrome/tests/browser_scrollbar.sjs @@ -41,26 +41,27 @@ function handleRequest(request, response) { let action = ""; let query = decodeURIComponent(request.queryString || ""); response.write(""); - response.write(""); + response.write(""); + let body = "" + query + ""; switch (query) { case "blank": response.write("This is a not a scrollable page"); break; case "horizontal": response.write("This is a horizontally scrollable page"); - response.write("
Browser scrollbar test
"); + body += "\n
Browser scrollbar test
"; break; case "vertical": response.write("This is a vertically scrollable page"); - response.write("
Browser scrollbar test
"); + body += "\n
Browser scrollbar test
"; break; case "both": response.write("This is a scrollable page in both directions"); - response.write("
Browser scrollbar test
"); + body += "\n
Browser scrollbar test
"; break; default: break; } - response.write("" + query + ""); + response.write("" + body + ""); } diff --git a/mobile/chrome/tests/browser_viewport.js b/mobile/chrome/tests/browser_viewport.js index d5d467928801..c0cebe1b1fc4 100644 --- a/mobile/chrome/tests/browser_viewport.js +++ b/mobile/chrome/tests/browser_viewport.js @@ -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; });