From 5f8de423f190bbb79a62f804151bc24824fa32d8 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Fri, 2 Feb 2018 04:16:08 -0500 Subject: Add m-esr52 at 52.6.0 --- .../preferences/in-content/tests/.eslintrc.js | 7 + .../preferences/in-content/tests/browser.ini | 43 +++ .../in-content/tests/browser_advanced_update.js | 158 ++++++++++ .../tests/browser_basic_rebuild_fonts_test.js | 76 +++++ .../browser_bug1018066_resetScrollPosition.js | 24 ++ ...er_bug1020245_openPreferences_to_paneContent.js | 43 +++ ...9_prevent_scrolling_when_preferences_flipped.js | 92 ++++++ ..._prevent_scrolling_when_preferences_flipped.xul | 33 ++ .../in-content/tests/browser_bug410900.js | 46 +++ .../in-content/tests/browser_bug705422.js | 144 +++++++++ .../in-content/tests/browser_bug731866.js | 52 +++ .../tests/browser_bug795764_cachedisabled.js | 52 +++ .../in-content/tests/browser_change_app_handler.js | 98 ++++++ .../in-content/tests/browser_connection.js | 99 ++++++ .../tests/browser_connection_bug388287.js | 125 ++++++++ .../in-content/tests/browser_cookies_exceptions.js | 348 +++++++++++++++++++++ .../tests/browser_defaultbrowser_alwayscheck.js | 103 ++++++ .../in-content/tests/browser_healthreport.js | 62 ++++ .../browser_homepages_filter_aboutpreferences.js | 20 ++ .../tests/browser_notifications_do_not_disturb.js | 44 +++ .../tests/browser_permissions_urlFieldHidden.js | 45 +++ .../in-content/tests/browser_privacypane_1.js | 18 ++ .../in-content/tests/browser_privacypane_3.js | 17 + .../in-content/tests/browser_privacypane_4.js | 25 ++ .../in-content/tests/browser_privacypane_5.js | 17 + .../in-content/tests/browser_privacypane_8.js | 26 ++ .../in-content/tests/browser_proxy_backup.js | 65 ++++ .../tests/browser_sanitizeOnShutdown_prefLocked.js | 37 +++ .../in-content/tests/browser_searchsuggestions.js | 43 +++ .../in-content/tests/browser_security.js | 130 ++++++++ .../in-content/tests/browser_subdialogs.js | 293 +++++++++++++++++ .../in-content/tests/browser_telemetry.js | 52 +++ .../preferences/in-content/tests/head.js | 165 ++++++++++ .../tests/privacypane_tests_perwindow.js | 330 +++++++++++++++++++ .../preferences/in-content/tests/subdialog.xul | 27 ++ .../preferences/in-content/tests/subdialog2.xul | 27 ++ 36 files changed, 2986 insertions(+) create mode 100644 browser/components/preferences/in-content/tests/.eslintrc.js create mode 100644 browser/components/preferences/in-content/tests/browser.ini create mode 100644 browser/components/preferences/in-content/tests/browser_advanced_update.js create mode 100644 browser/components/preferences/in-content/tests/browser_basic_rebuild_fonts_test.js create mode 100644 browser/components/preferences/in-content/tests/browser_bug1018066_resetScrollPosition.js create mode 100644 browser/components/preferences/in-content/tests/browser_bug1020245_openPreferences_to_paneContent.js create mode 100644 browser/components/preferences/in-content/tests/browser_bug1184989_prevent_scrolling_when_preferences_flipped.js create mode 100644 browser/components/preferences/in-content/tests/browser_bug1184989_prevent_scrolling_when_preferences_flipped.xul create mode 100644 browser/components/preferences/in-content/tests/browser_bug410900.js create mode 100644 browser/components/preferences/in-content/tests/browser_bug705422.js create mode 100644 browser/components/preferences/in-content/tests/browser_bug731866.js create mode 100644 browser/components/preferences/in-content/tests/browser_bug795764_cachedisabled.js create mode 100644 browser/components/preferences/in-content/tests/browser_change_app_handler.js create mode 100644 browser/components/preferences/in-content/tests/browser_connection.js create mode 100644 browser/components/preferences/in-content/tests/browser_connection_bug388287.js create mode 100644 browser/components/preferences/in-content/tests/browser_cookies_exceptions.js create mode 100644 browser/components/preferences/in-content/tests/browser_defaultbrowser_alwayscheck.js create mode 100644 browser/components/preferences/in-content/tests/browser_healthreport.js create mode 100644 browser/components/preferences/in-content/tests/browser_homepages_filter_aboutpreferences.js create mode 100644 browser/components/preferences/in-content/tests/browser_notifications_do_not_disturb.js create mode 100644 browser/components/preferences/in-content/tests/browser_permissions_urlFieldHidden.js create mode 100644 browser/components/preferences/in-content/tests/browser_privacypane_1.js create mode 100644 browser/components/preferences/in-content/tests/browser_privacypane_3.js create mode 100644 browser/components/preferences/in-content/tests/browser_privacypane_4.js create mode 100644 browser/components/preferences/in-content/tests/browser_privacypane_5.js create mode 100644 browser/components/preferences/in-content/tests/browser_privacypane_8.js create mode 100644 browser/components/preferences/in-content/tests/browser_proxy_backup.js create mode 100644 browser/components/preferences/in-content/tests/browser_sanitizeOnShutdown_prefLocked.js create mode 100644 browser/components/preferences/in-content/tests/browser_searchsuggestions.js create mode 100644 browser/components/preferences/in-content/tests/browser_security.js create mode 100644 browser/components/preferences/in-content/tests/browser_subdialogs.js create mode 100644 browser/components/preferences/in-content/tests/browser_telemetry.js create mode 100644 browser/components/preferences/in-content/tests/head.js create mode 100644 browser/components/preferences/in-content/tests/privacypane_tests_perwindow.js create mode 100644 browser/components/preferences/in-content/tests/subdialog.xul create mode 100644 browser/components/preferences/in-content/tests/subdialog2.xul (limited to 'browser/components/preferences/in-content/tests') diff --git a/browser/components/preferences/in-content/tests/.eslintrc.js b/browser/components/preferences/in-content/tests/.eslintrc.js new file mode 100644 index 000000000..7c8021192 --- /dev/null +++ b/browser/components/preferences/in-content/tests/.eslintrc.js @@ -0,0 +1,7 @@ +"use strict"; + +module.exports = { + "extends": [ + "../../../../../testing/mochitest/browser.eslintrc.js" + ] +}; diff --git a/browser/components/preferences/in-content/tests/browser.ini b/browser/components/preferences/in-content/tests/browser.ini new file mode 100644 index 000000000..6cba02599 --- /dev/null +++ b/browser/components/preferences/in-content/tests/browser.ini @@ -0,0 +1,43 @@ +[DEFAULT] +support-files = + head.js + privacypane_tests_perwindow.js + +[browser_advanced_update.js] +[browser_basic_rebuild_fonts_test.js] +[browser_bug410900.js] +[browser_bug705422.js] +[browser_bug731866.js] +[browser_bug795764_cachedisabled.js] +[browser_bug1018066_resetScrollPosition.js] +[browser_bug1020245_openPreferences_to_paneContent.js] +[browser_bug1184989_prevent_scrolling_when_preferences_flipped.js] +support-files = + browser_bug1184989_prevent_scrolling_when_preferences_flipped.xul +[browser_change_app_handler.js] +skip-if = os != "win" # This test tests the windows-specific app selection dialog, so can't run on non-Windows +[browser_connection.js] +[browser_connection_bug388287.js] +[browser_cookies_exceptions.js] +[browser_defaultbrowser_alwayscheck.js] +[browser_healthreport.js] +skip-if = true || !healthreport # Bug 1185403 for the "true" +[browser_homepages_filter_aboutpreferences.js] +[browser_notifications_do_not_disturb.js] +[browser_permissions_urlFieldHidden.js] +[browser_proxy_backup.js] +[browser_privacypane_1.js] +[browser_privacypane_3.js] +[browser_privacypane_4.js] +[browser_privacypane_5.js] +[browser_privacypane_8.js] +[browser_sanitizeOnShutdown_prefLocked.js] +[browser_searchsuggestions.js] +[browser_security.js] +[browser_subdialogs.js] +support-files = + subdialog.xul + subdialog2.xul +[browser_telemetry.js] +# Skip this test on Android as FHR and Telemetry are separate systems there. +skip-if = !healthreport || !telemetry || (os == 'linux' && debug) || (os == 'android') diff --git a/browser/components/preferences/in-content/tests/browser_advanced_update.js b/browser/components/preferences/in-content/tests/browser_advanced_update.js new file mode 100644 index 000000000..e9d0e8652 --- /dev/null +++ b/browser/components/preferences/in-content/tests/browser_advanced_update.js @@ -0,0 +1,158 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +const { classes: Cc, interfaces: Ci, manager: Cm, utils: Cu, results: Cr } = Components; + +Cu.import('resource://gre/modules/XPCOMUtils.jsm'); + +const uuidGenerator = Cc["@mozilla.org/uuid-generator;1"].getService(Ci.nsIUUIDGenerator); + +const mockUpdateManager = { + contractId: "@mozilla.org/updates/update-manager;1", + + _mockClassId: uuidGenerator.generateUUID(), + + _originalClassId: "", + + _originalFactory: null, + + QueryInterface: XPCOMUtils.generateQI([Ci.nsIUpdateManager]), + + createInstance: function(outer, iiD) { + if (outer) { + throw Cr.NS_ERROR_NO_AGGREGATION; + } + return this.QueryInterface(iiD); + }, + + register: function () { + let registrar = Cm.QueryInterface(Ci.nsIComponentRegistrar); + if (!registrar.isCIDRegistered(this._mockClassId)) { + this._originalClassId = registrar.contractIDToCID(this.contractId); + this._originalFactory = Cm.getClassObject(Cc[this.contractId], Ci.nsIFactory); + registrar.unregisterFactory(this._originalClassId, this._originalFactory); + registrar.registerFactory(this._mockClassId, "Unregister after testing", this.contractId, this); + } + }, + + unregister: function () { + let registrar = Cm.QueryInterface(Ci.nsIComponentRegistrar); + registrar.unregisterFactory(this._mockClassId, this); + registrar.registerFactory(this._originalClassId, "", this.contractId, this._originalFactory); + }, + + get updateCount() { + return this._updates.length; + }, + + getUpdateAt: function (index) { + return this._updates[index]; + }, + + _updates: [ + { + name: "Firefox Developer Edition 49.0a2", + statusText: "The Update was successfully installed", + buildID: "20160728004010", + type: "minor", + installDate: 1469763105156, + detailsURL: "https://www.mozilla.org/firefox/aurora/" + }, + { + name: "Firefox Developer Edition 43.0a2", + statusText: "The Update was successfully installed", + buildID: "20150929004011", + type: "minor", + installDate: 1443585886224, + detailsURL: "https://www.mozilla.org/firefox/aurora/" + }, + { + name: "Firefox Developer Edition 42.0a2", + statusText: "The Update was successfully installed", + buildID: "20150920004018", + type: "major", + installDate: 1442818147544, + detailsURL: "https://www.mozilla.org/firefox/aurora/" + } + ] +}; + +function resetPreferences() { + Services.prefs.clearUserPref("browser.search.update"); +} + +function formatInstallDate(sec) { + var date = new Date(sec); + const locale = Cc["@mozilla.org/chrome/chrome-registry;1"] + .getService(Ci.nsIXULChromeRegistry) + .getSelectedLocale("global", true); + const dtOptions = { year: 'numeric', month: 'long', day: 'numeric', + hour: 'numeric', minute: 'numeric', second: 'numeric' }; + return date.toLocaleString(locale, dtOptions); +} + +registerCleanupFunction(resetPreferences); + +add_task(function*() { + yield openPreferencesViaOpenPreferencesAPI("advanced", "updateTab", { leaveOpen: true }); + resetPreferences(); + Services.prefs.setBoolPref("browser.search.update", false); + + let doc = gBrowser.selectedBrowser.contentDocument; + let enableSearchUpdate = doc.getElementById("enableSearchUpdate"); + is_element_visible(enableSearchUpdate, "Check search update preference is visible"); + + // Ensure that the update pref dialog reflects the actual pref value. + ok(!enableSearchUpdate.checked, "Ensure search updates are disabled"); + Services.prefs.setBoolPref("browser.search.update", true); + ok(enableSearchUpdate.checked, "Ensure search updates are enabled"); + + gBrowser.removeCurrentTab(); +}); + +add_task(function*() { + mockUpdateManager.register(); + + yield openPreferencesViaOpenPreferencesAPI("advanced", "updateTab", { leaveOpen: true }); + let doc = gBrowser.selectedBrowser.contentDocument; + + let showBtn = doc.getElementById("showUpdateHistory"); + let dialogOverlay = doc.getElementById("dialogOverlay"); + + // Test the dialog window opens + is(dialogOverlay.style.visibility, "", "The dialog should be invisible"); + showBtn.doCommand(); + yield promiseLoadSubDialog("chrome://mozapps/content/update/history.xul"); + is(dialogOverlay.style.visibility, "visible", "The dialog should be visible"); + + let dialogFrame = doc.getElementById("dialogFrame"); + let frameDoc = dialogFrame.contentDocument; + let updates = frameDoc.querySelectorAll("update"); + + // Test the update history numbers are correct + is(updates.length, mockUpdateManager.updateCount, "The update count is incorrect."); + + // Test the updates are displayed correctly + let update = null; + let updateData = null; + for (let i = 0; i < updates.length; ++i) { + update = updates[i]; + updateData = mockUpdateManager.getUpdateAt(i); + + is(update.name, updateData.name + " (" + updateData.buildID + ")", "Wrong update name"); + is(update.type, updateData.type == "major" ? "New Version" : "Security Update", "Wrong update type"); + is(update.installDate, formatInstallDate(updateData.installDate), "Wrong update installDate"); + is(update.detailsURL, updateData.detailsURL, "Wrong update detailsURL"); + is(update.status, updateData.statusText, "Wrong update status"); + } + + // Test the dialog window closes + let closeBtn = doc.getElementById("dialogClose"); + closeBtn.doCommand(); + is(dialogOverlay.style.visibility, "", "The dialog should be invisible"); + + mockUpdateManager.unregister(); + gBrowser.removeCurrentTab(); +}); diff --git a/browser/components/preferences/in-content/tests/browser_basic_rebuild_fonts_test.js b/browser/components/preferences/in-content/tests/browser_basic_rebuild_fonts_test.js new file mode 100644 index 000000000..32c1bd726 --- /dev/null +++ b/browser/components/preferences/in-content/tests/browser_basic_rebuild_fonts_test.js @@ -0,0 +1,76 @@ +Services.prefs.setBoolPref("browser.preferences.instantApply", true); + +registerCleanupFunction(function() { + Services.prefs.clearUserPref("browser.preferences.instantApply"); +}); + +add_task(function*() { + yield openPreferencesViaOpenPreferencesAPI("paneContent", null, {leaveOpen: true}); + let doc = gBrowser.contentDocument; + var langGroup = Services.prefs.getComplexValue("font.language.group", Ci.nsIPrefLocalizedString).data + is(doc.getElementById("font.language.group").value, langGroup, + "Language group should be set correctly."); + + let defaultFontType = Services.prefs.getCharPref("font.default." + langGroup); + let fontFamily = Services.prefs.getCharPref("font.name." + defaultFontType + "." + langGroup); + let fontFamilyField = doc.getElementById("defaultFont"); + is(fontFamilyField.value, fontFamily, "Font family should be set correctly."); + + let defaultFontSize = Services.prefs.getIntPref("font.size.variable." + langGroup); + let fontSizeField = doc.getElementById("defaultFontSize"); + is(fontSizeField.value, defaultFontSize, "Font size should be set correctly."); + + doc.getElementById("advancedFonts").click(); + let win = yield promiseLoadSubDialog("chrome://browser/content/preferences/fonts.xul"); + doc = win.document; + + // Simulate a dumb font backend. + win.FontBuilder._enumerator = { + _list: ["MockedFont1", "MockedFont2", "MockedFont3"], + EnumerateFonts: function(lang, type, list) { + return this._list; + }, + EnumerateAllFonts: function() { + return this._list; + }, + getDefaultFont: function() { return null; }, + getStandardFamilyName: function(name) { return name; }, + }; + win.FontBuilder._allFonts = null; + win.FontBuilder._langGroupSupported = false; + + let langGroupElement = doc.getElementById("font.language.group"); + let selectLangsField = doc.getElementById("selectLangs"); + let serifField = doc.getElementById("serif"); + let armenian = "x-armn"; + let western = "x-western"; + + langGroupElement.value = armenian; + selectLangsField.value = armenian; + is(serifField.value, "", "Font family should not be set."); + + langGroupElement.value = western; + selectLangsField.value = western; + + // Simulate a font backend supporting language-specific enumeration. + // NB: FontBuilder has cached the return value from EnumerateAllFonts(), + // so _allFonts will always have 3 elements regardless of subsequent + // _list changes. + win.FontBuilder._enumerator._list = ["MockedFont2"]; + + langGroupElement.value = armenian; + selectLangsField.value = armenian; + is(serifField.value, "MockedFont2", "Font family should be set."); + + langGroupElement.value = western; + selectLangsField.value = western; + + // Simulate a system that has no fonts for the specified language. + win.FontBuilder._enumerator._list = []; + + langGroupElement.value = armenian; + selectLangsField.value = armenian; + is(serifField.value, "", "Font family should not be set."); + + gBrowser.removeCurrentTab(); +}); diff --git a/browser/components/preferences/in-content/tests/browser_bug1018066_resetScrollPosition.js b/browser/components/preferences/in-content/tests/browser_bug1018066_resetScrollPosition.js new file mode 100644 index 000000000..9d938fdd4 --- /dev/null +++ b/browser/components/preferences/in-content/tests/browser_bug1018066_resetScrollPosition.js @@ -0,0 +1,24 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +var originalWindowHeight; +registerCleanupFunction(function() { + window.resizeTo(window.outerWidth, originalWindowHeight); + while (gBrowser.tabs[1]) + gBrowser.removeTab(gBrowser.tabs[1]); +}); + +add_task(function*() { + originalWindowHeight = window.outerHeight; + window.resizeTo(window.outerWidth, 300); + let prefs = yield openPreferencesViaOpenPreferencesAPI("paneApplications", undefined, {leaveOpen: true}); + is(prefs.selectedPane, "paneApplications", "Applications pane was selected"); + let mainContent = gBrowser.contentDocument.querySelector(".main-content"); + mainContent.scrollTop = 50; + is(mainContent.scrollTop, 50, "main-content should be scrolled 50 pixels"); + + gBrowser.contentWindow.gotoPref("paneGeneral"); + is(mainContent.scrollTop, 0, + "Switching to a different category should reset the scroll position"); +}); + diff --git a/browser/components/preferences/in-content/tests/browser_bug1020245_openPreferences_to_paneContent.js b/browser/components/preferences/in-content/tests/browser_bug1020245_openPreferences_to_paneContent.js new file mode 100644 index 000000000..bc2c6d800 --- /dev/null +++ b/browser/components/preferences/in-content/tests/browser_bug1020245_openPreferences_to_paneContent.js @@ -0,0 +1,43 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +Services.prefs.setBoolPref("browser.preferences.instantApply", true); + +registerCleanupFunction(function() { + Services.prefs.clearUserPref("browser.preferences.instantApply"); +}); + +add_task(function*() { + let prefs = yield openPreferencesViaOpenPreferencesAPI("paneContent"); + is(prefs.selectedPane, "paneContent", "Content pane was selected"); + prefs = yield openPreferencesViaOpenPreferencesAPI("advanced", "updateTab"); + is(prefs.selectedPane, "paneAdvanced", "Advanced pane was selected"); + is(prefs.selectedAdvancedTab, "updateTab", "The update tab within the advanced prefs should be selected"); + prefs = yield openPreferencesViaHash("privacy"); + is(prefs.selectedPane, "panePrivacy", "Privacy pane is selected when hash is 'privacy'"); + prefs = yield openPreferencesViaOpenPreferencesAPI("nonexistant-category"); + is(prefs.selectedPane, "paneGeneral", "General pane is selected by default when a nonexistant-category is requested"); + prefs = yield openPreferencesViaHash("nonexistant-category"); + is(prefs.selectedPane, "paneGeneral", "General pane is selected when hash is a nonexistant-category"); + prefs = yield openPreferencesViaHash(); + is(prefs.selectedPane, "paneGeneral", "General pane is selected by default"); +}); + +function openPreferencesViaHash(aPane) { + let deferred = Promise.defer(); + gBrowser.selectedTab = gBrowser.addTab("about:preferences" + (aPane ? "#" + aPane : "")); + let newTabBrowser = gBrowser.selectedBrowser; + + newTabBrowser.addEventListener("Initialized", function PrefInit() { + newTabBrowser.removeEventListener("Initialized", PrefInit, true); + newTabBrowser.contentWindow.addEventListener("load", function prefLoad() { + newTabBrowser.contentWindow.removeEventListener("load", prefLoad); + let win = gBrowser.contentWindow; + let selectedPane = win.history.state; + gBrowser.removeCurrentTab(); + deferred.resolve({selectedPane: selectedPane}); + }); + }, true); + + return deferred.promise; +} diff --git a/browser/components/preferences/in-content/tests/browser_bug1184989_prevent_scrolling_when_preferences_flipped.js b/browser/components/preferences/in-content/tests/browser_bug1184989_prevent_scrolling_when_preferences_flipped.js new file mode 100644 index 000000000..0972b2de4 --- /dev/null +++ b/browser/components/preferences/in-content/tests/browser_bug1184989_prevent_scrolling_when_preferences_flipped.js @@ -0,0 +1,92 @@ +const ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore); + +add_task(function* () { + waitForExplicitFinish(); + + const tabURL = getRootDirectory(gTestPath) + "browser_bug1184989_prevent_scrolling_when_preferences_flipped.xul"; + + yield BrowserTestUtils.withNewTab({ gBrowser, url: tabURL }, function* (browser) { + let doc = browser.contentDocument; + let container = doc.getElementById("container"); + + // Test button + let button = doc.getElementById("button"); + button.focus(); + EventUtils.synthesizeKey(" ", {}); + yield checkPageScrolling(container, "button"); + + // Test checkbox + let checkbox = doc.getElementById("checkbox"); + checkbox.focus(); + EventUtils.synthesizeKey(" ", {}); + ok(checkbox.checked, "Checkbox is checked"); + yield checkPageScrolling(container, "checkbox"); + + // Test listbox + let listbox = doc.getElementById("listbox"); + let listitem = doc.getElementById("listitem"); + listbox.focus(); + EventUtils.synthesizeKey(" ", {}); + ok(listitem.selected, "Listitem is selected"); + yield checkPageScrolling(container, "listbox"); + + // Test radio + let radiogroup = doc.getElementById("radiogroup"); + radiogroup.focus(); + EventUtils.synthesizeKey(" ", {}); + yield checkPageScrolling(container, "radio"); + }); + + yield BrowserTestUtils.withNewTab({ gBrowser, url: "about:preferences#search" }, function* (browser) { + let doc = browser.contentDocument; + let container = doc.getElementsByClassName("main-content")[0]; + + // Test search + let engineList = doc.getElementById("engineList"); + engineList.focus(); + EventUtils.synthesizeKey(" ", {}); + is(engineList.view.selection.currentIndex, 0, "Search engineList is selected"); + EventUtils.synthesizeKey(" ", {}); + yield checkPageScrolling(container, "search engineList"); + }); + + // Test session restore + const CRASH_URL = "about:mozilla"; + const CRASH_FAVICON = "chrome://branding/content/icon32.png"; + const CRASH_SHENTRY = {url: CRASH_URL}; + const CRASH_TAB = {entries: [CRASH_SHENTRY], image: CRASH_FAVICON}; + const CRASH_STATE = {windows: [{tabs: [CRASH_TAB]}]}; + + const TAB_URL = "about:sessionrestore"; + const TAB_FORMDATA = {url: TAB_URL, id: {sessionData: CRASH_STATE}}; + const TAB_SHENTRY = {url: TAB_URL}; + const TAB_STATE = {entries: [TAB_SHENTRY], formdata: TAB_FORMDATA}; + + let tab = gBrowser.selectedTab = gBrowser.addTab("about:blank"); + + // Fake a post-crash tab + ss.setTabState(tab, JSON.stringify(TAB_STATE)); + + yield BrowserTestUtils.browserLoaded(tab.linkedBrowser); + let doc = tab.linkedBrowser.contentDocument; + + // Make body scrollable + doc.body.style.height = (doc.body.clientHeight + 100) + "px"; + + let tabList = doc.getElementById("tabList"); + tabList.focus(); + EventUtils.synthesizeKey(" ", {}); + yield checkPageScrolling(doc.documentElement, "session restore"); + + gBrowser.removeCurrentTab(); + finish(); +}); + +function checkPageScrolling(container, type) { + return new Promise(resolve => { + setTimeout(() => { + is(container.scrollTop, 0, "Page should not scroll when " + type + " flipped"); + resolve(); + }, 0); + }); +} diff --git a/browser/components/preferences/in-content/tests/browser_bug1184989_prevent_scrolling_when_preferences_flipped.xul b/browser/components/preferences/in-content/tests/browser_bug1184989_prevent_scrolling_when_preferences_flipped.xul new file mode 100644 index 000000000..59b644c8f --- /dev/null +++ b/browser/components/preferences/in-content/tests/browser_bug1184989_prevent_scrolling_when_preferences_flipped.xul @@ -0,0 +1,33 @@ + + + + + + + +