diff --git a/browser/base/content/test/newtab/browser_newtab_bug991111.js b/browser/base/content/test/newtab/browser_newtab_bug991111.js index e9932094ca88..ce36ef2bc29a 100644 --- a/browser/base/content/test/newtab/browser_newtab_bug991111.js +++ b/browser/base/content/test/newtab/browser_newtab_bug991111.js @@ -1,9 +1,15 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +const PREF_NEWTAB_ROWS = "browser.newtabpage.rows"; + function runTests() { + // set max rows to 1, to avoid scroll events by clicking middle button + Services.prefs.setIntPref(PREF_NEWTAB_ROWS, 1); yield setLinks("-1"); yield addNewTabPageTab(); + // we need a second newtab to honor max rows + yield addNewTabPageTab(); // Remember if the click handler was triggered let cell = getCell(0); @@ -16,4 +22,5 @@ function runTests() { // Send a middle-click and make sure it happened yield EventUtils.synthesizeMouseAtCenter(cell.node, {button: 1}, getContentWindow()); ok(clicked, "middle click triggered click listener"); + Services.prefs.clearUserPref(PREF_NEWTAB_ROWS); } diff --git a/browser/base/content/test/newtab/browser_newtab_bug998387.js b/browser/base/content/test/newtab/browser_newtab_bug998387.js index d2e51e7d1bd5..04ff21294ab4 100644 --- a/browser/base/content/test/newtab/browser_newtab_bug998387.js +++ b/browser/base/content/test/newtab/browser_newtab_bug998387.js @@ -1,9 +1,15 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +const PREF_NEWTAB_ROWS = "browser.newtabpage.rows"; + function runTests() { + // set max rows to 1, to avoid scroll events by clicking middle button + Services.prefs.setIntPref(PREF_NEWTAB_ROWS, 1); yield setLinks("0"); yield addNewTabPageTab(); + // we need a second newtab to honor max rows + yield addNewTabPageTab(); // Remember if the click handler was triggered let {site} = getCell(0); @@ -22,4 +28,5 @@ function runTests() { // Make sure the cell didn't actually get blocked checkGrid("0"); + Services.prefs.clearUserPref(PREF_NEWTAB_ROWS); } diff --git a/browser/base/content/test/newtab/browser_newtab_focus.js b/browser/base/content/test/newtab/browser_newtab_focus.js index a423e3397801..82d9b4237bc8 100644 --- a/browser/base/content/test/newtab/browser_newtab_focus.js +++ b/browser/base/content/test/newtab/browser_newtab_focus.js @@ -10,7 +10,8 @@ function runTests() { // Focus count in new tab page. // 30 = 9 * 3 + 3 = 9 sites, each with link, pin and remove buttons; search - // bar; search button; and toggle button. + // bar; search button; and toggle button. Additionaly there may or may not be + // a scroll bar caused by fix to 1180387, which will eat an extra focus let FOCUS_COUNT = 30; // Create a new tab page. @@ -42,7 +43,9 @@ function countFocus(aExpectedCount) { let focusedElement = document.commandDispatcher.focusedElement; if (focusedElement && focusedElement.classList.contains("urlbar-input")) { window.removeEventListener("focus", onFocus, true); - is(focusCount, aExpectedCount, "Validate focus count in the new tab page."); + // account for a potential presence of a scroll bar + ok(focusCount == aExpectedCount || focusCount == (aExpectedCount + 1), + "Validate focus count in the new tab page."); executeSoon(TestRunner.next); } else { if (focusedElement && focusedElement.ownerDocument == contentDoc && diff --git a/browser/base/content/test/newtab/head.js b/browser/base/content/test/newtab/head.js index e936ad75b0dd..6eb54ebf03f9 100644 --- a/browser/base/content/test/newtab/head.js +++ b/browser/base/content/test/newtab/head.js @@ -587,7 +587,8 @@ function createExternalDropIframe() { iframe.style.position = "absolute"; iframe.style.zIndex = 50; - let margin = doc.getElementById("newtab-margin-top"); + // the frame has to be attached to a visible element + let margin = doc.getElementById("newtab-search-container"); margin.appendChild(iframe); iframe.addEventListener("load", function onLoad() {