Bug 1244221 - about:home wrapping is broken. r=Enn a=sylvestre
☠☠ backed out by 9a75286c2b19 ☠ ☠
authorXidorn Quan <quanxunzhen@gmail.com>
Wed, 10 Feb 2016 19:02:23 -0200
changeset 303921 8eb0ec626383d0a7ab55a641bd0b8bfea91e2c81
parent 303920 a6f485514b7c3a5d4275430d822ab1fda8e6c1c6
child 303922 0b9459bf937b31fa6250f06cbd82c2fe343c96e0
push id9055
push userkwierso@gmail.com
push dateThu, 11 Feb 2016 17:57:11 +0000
treeherdermozilla-aurora@06d13ff7785d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersEnn, sylvestre
bugs1244221
milestone46.0a2
Bug 1244221 - about:home wrapping is broken. r=Enn a=sylvestre Test by Felipe
browser/base/content/abouthome/aboutHome.js
browser/base/content/test/general/browser.ini
browser/base/content/test/general/browser_aboutHome_wrapsCorrectly.js
--- a/browser/base/content/abouthome/aboutHome.js
+++ b/browser/base/content/abouthome/aboutHome.js
@@ -364,15 +364,15 @@ function showDefaultSnippets()
       links[0].href = DEFAULT_SNIPPETS_URLS[randIndex];
     }
   }
   // Move the default snippet to the snippets element.
   snippetsElt.appendChild(entry);
 }
 
 function fitToWidth() {
-  if (window.scrollMaxX != window.scrollMinX) {
+  if (document.documentElement.scrollWidth > window.innerWidth) {
     document.body.setAttribute("narrow", "true");
   } else if (document.body.hasAttribute("narrow")) {
     document.body.removeAttribute("narrow");
     fitToWidth();
   }
 }
--- a/browser/base/content/test/general/browser.ini
+++ b/browser/base/content/test/general/browser.ini
@@ -124,16 +124,17 @@ skip-if = os == "linux" # Bug 958026
 support-files =
   content_aboutAccounts.js
 [browser_aboutCertError.js]
 [browser_aboutSupport_newtab_security_state.js]
 [browser_aboutHealthReport.js]
 skip-if = os == "linux" # Bug 924307
 [browser_aboutHome.js]
 skip-if = e10s # Bug 1093153 - no about:home support yet
+[browser_aboutHome_wrapsCorrectly.js]
 [browser_action_keyword.js]
 [browser_action_keyword_override.js]
 [browser_action_searchengine.js]
 [browser_action_searchengine_alias.js]
 [browser_addKeywordSearch.js]
 [browser_search_favicon.js]
 skip-if = e10s # Bug 1212647
 [browser_alltabslistener.js]
new file mode 100644
--- /dev/null
+++ b/browser/base/content/test/general/browser_aboutHome_wrapsCorrectly.js
@@ -0,0 +1,28 @@
+add_task(function* () {
+  let newWindow = yield BrowserTestUtils.openNewBrowserWindow();
+
+  let resizedPromise = BrowserTestUtils.waitForEvent(newWindow, "resize");
+  newWindow.resizeTo(300, 300);
+  yield resizedPromise;
+
+  yield BrowserTestUtils.openNewForegroundTab(newWindow.gBrowser, "about:home");
+
+  yield ContentTask.spawn(newWindow.gBrowser.selectedBrowser, {}, function* () {
+    is(content.document.body.getAttribute("narrow"), "true", "narrow mode");
+  });
+
+  resizedPromise = BrowserTestUtils.waitForContentEvent(newWindow.gBrowser.selectedBrowser, "resize");
+
+
+  yield ContentTask.spawn(newWindow.gBrowser.selectedBrowser, {}, function* () {
+    content.window.resizeTo(800, 800);
+  });
+
+  yield resizedPromise;
+
+  yield ContentTask.spawn(newWindow.gBrowser.selectedBrowser, {}, function* () {
+    is(content.document.body.hasAttribute("narrow"), false, "non-narrow mode");
+  });
+
+  yield BrowserTestUtils.closeWindow(newWindow);
+});