forked from mirrors/gecko-dev
		
	 0640b9ab0f
			
		
	
	
		0640b9ab0f
		
	
	
	
	
		
			
			This uses the pref browser.preferences.useOldOrganization=true to use the old prefs. MozReview-Commit-ID: DQyHYSZJTKd --HG-- rename : browser/components/preferences/in-content/advanced.js => browser/components/preferences/in-content-old/advanced.js rename : browser/components/preferences/in-content/advanced.xul => browser/components/preferences/in-content-old/advanced.xul rename : browser/components/preferences/in-content/applications.js => browser/components/preferences/in-content-old/applications.js rename : browser/components/preferences/in-content/applications.xul => browser/components/preferences/in-content-old/applications.xul rename : browser/components/preferences/in-content/containers.js => browser/components/preferences/in-content-old/containers.js rename : browser/components/preferences/in-content/containers.xul => browser/components/preferences/in-content-old/containers.xul rename : browser/components/preferences/in-content/content.js => browser/components/preferences/in-content-old/content.js rename : browser/components/preferences/in-content/content.xul => browser/components/preferences/in-content-old/content.xul rename : browser/components/preferences/in-content/jar.mn => browser/components/preferences/in-content-old/jar.mn rename : browser/components/preferences/in-content/main.js => browser/components/preferences/in-content-old/main.js rename : browser/components/preferences/in-content/main.xul => browser/components/preferences/in-content-old/main.xul rename : browser/components/preferences/in-content/moz.build => browser/components/preferences/in-content-old/moz.build rename : browser/components/preferences/in-content/preferences.js => browser/components/preferences/in-content-old/preferences.js rename : browser/components/preferences/in-content/preferences.xul => browser/components/preferences/in-content-old/preferences.xul rename : browser/components/preferences/in-content/privacy.js => browser/components/preferences/in-content-old/privacy.js rename : browser/components/preferences/in-content/privacy.xul => browser/components/preferences/in-content-old/privacy.xul rename : browser/components/preferences/in-content/search.js => browser/components/preferences/in-content-old/search.js rename : browser/components/preferences/in-content/search.xul => browser/components/preferences/in-content-old/search.xul rename : browser/components/preferences/in-content/security.js => browser/components/preferences/in-content-old/security.js rename : browser/components/preferences/in-content/security.xul => browser/components/preferences/in-content-old/security.xul rename : browser/components/preferences/in-content/subdialogs.js => browser/components/preferences/in-content-old/subdialogs.js rename : browser/components/preferences/in-content/sync.js => browser/components/preferences/in-content-old/sync.js rename : browser/components/preferences/in-content/sync.xul => browser/components/preferences/in-content-old/sync.xul rename : browser/components/preferences/in-content/tests/.eslintrc.js => browser/components/preferences/in-content-old/tests/.eslintrc.js rename : browser/components/preferences/in-content/tests/browser.ini => browser/components/preferences/in-content-old/tests/browser.ini rename : browser/components/preferences/in-content/tests/browser_advanced_siteData.js => browser/components/preferences/in-content-old/tests/browser_advanced_siteData.js rename : browser/components/preferences/in-content/tests/browser_advanced_update.js => browser/components/preferences/in-content-old/tests/browser_advanced_update.js rename : browser/components/preferences/in-content/tests/browser_applications_selection.js => browser/components/preferences/in-content-old/tests/browser_applications_selection.js rename : browser/components/preferences/in-content/tests/browser_basic_rebuild_fonts_test.js => browser/components/preferences/in-content-old/tests/browser_basic_rebuild_fonts_test.js rename : browser/components/preferences/in-content/tests/browser_bug1018066_resetScrollPosition.js => browser/components/preferences/in-content-old/tests/browser_bug1018066_resetScrollPosition.js rename : browser/components/preferences/in-content/tests/browser_bug1020245_openPreferences_to_paneContent.js => browser/components/preferences/in-content-old/tests/browser_bug1020245_openPreferences_to_paneContent.js rename : browser/components/preferences/in-content/tests/browser_bug1184989_prevent_scrolling_when_preferences_flipped.js => browser/components/preferences/in-content-old/tests/browser_bug1184989_prevent_scrolling_when_preferences_flipped.js rename : browser/components/preferences/in-content/tests/browser_bug1184989_prevent_scrolling_when_preferences_flipped.xul => browser/components/preferences/in-content-old/tests/browser_bug1184989_prevent_scrolling_when_preferences_flipped.xul rename : browser/components/preferences/in-content/tests/browser_bug410900.js => browser/components/preferences/in-content-old/tests/browser_bug410900.js rename : browser/components/preferences/in-content/tests/browser_bug705422.js => browser/components/preferences/in-content-old/tests/browser_bug705422.js rename : browser/components/preferences/in-content/tests/browser_bug731866.js => browser/components/preferences/in-content-old/tests/browser_bug731866.js rename : browser/components/preferences/in-content/tests/browser_bug795764_cachedisabled.js => browser/components/preferences/in-content-old/tests/browser_bug795764_cachedisabled.js rename : browser/components/preferences/in-content/tests/browser_change_app_handler.js => browser/components/preferences/in-content-old/tests/browser_change_app_handler.js rename : browser/components/preferences/in-content/tests/browser_connection.js => browser/components/preferences/in-content-old/tests/browser_connection.js rename : browser/components/preferences/in-content/tests/browser_connection_bug388287.js => browser/components/preferences/in-content-old/tests/browser_connection_bug388287.js rename : browser/components/preferences/in-content/tests/browser_cookies_exceptions.js => browser/components/preferences/in-content-old/tests/browser_cookies_exceptions.js rename : browser/components/preferences/in-content/tests/browser_defaultbrowser_alwayscheck.js => browser/components/preferences/in-content-old/tests/browser_defaultbrowser_alwayscheck.js rename : browser/components/preferences/in-content/tests/browser_healthreport.js => browser/components/preferences/in-content-old/tests/browser_healthreport.js rename : browser/components/preferences/in-content/tests/browser_homepages_filter_aboutpreferences.js => browser/components/preferences/in-content-old/tests/browser_homepages_filter_aboutpreferences.js rename : browser/components/preferences/in-content/tests/browser_notifications_do_not_disturb.js => browser/components/preferences/in-content-old/tests/browser_notifications_do_not_disturb.js rename : browser/components/preferences/in-content/tests/browser_permissions_urlFieldHidden.js => browser/components/preferences/in-content-old/tests/browser_permissions_urlFieldHidden.js rename : browser/components/preferences/in-content/tests/browser_privacypane_1.js => browser/components/preferences/in-content-old/tests/browser_privacypane_1.js rename : browser/components/preferences/in-content/tests/browser_privacypane_3.js => browser/components/preferences/in-content-old/tests/browser_privacypane_3.js rename : browser/components/preferences/in-content/tests/browser_privacypane_4.js => browser/components/preferences/in-content-old/tests/browser_privacypane_4.js rename : browser/components/preferences/in-content/tests/browser_privacypane_5.js => browser/components/preferences/in-content-old/tests/browser_privacypane_5.js rename : browser/components/preferences/in-content/tests/browser_privacypane_8.js => browser/components/preferences/in-content-old/tests/browser_privacypane_8.js rename : browser/components/preferences/in-content/tests/browser_proxy_backup.js => browser/components/preferences/in-content-old/tests/browser_proxy_backup.js rename : browser/components/preferences/in-content/tests/browser_sanitizeOnShutdown_prefLocked.js => browser/components/preferences/in-content-old/tests/browser_sanitizeOnShutdown_prefLocked.js rename : browser/components/preferences/in-content/tests/browser_searchsuggestions.js => browser/components/preferences/in-content-old/tests/browser_searchsuggestions.js rename : browser/components/preferences/in-content/tests/browser_security.js => browser/components/preferences/in-content-old/tests/browser_security.js rename : browser/components/preferences/in-content/tests/browser_subdialogs.js => browser/components/preferences/in-content-old/tests/browser_subdialogs.js rename : browser/components/preferences/in-content/tests/browser_telemetry.js => browser/components/preferences/in-content-old/tests/browser_telemetry.js rename : browser/components/preferences/in-content/tests/head.js => browser/components/preferences/in-content-old/tests/head.js rename : browser/components/preferences/in-content/tests/privacypane_tests_perwindow.js => browser/components/preferences/in-content-old/tests/privacypane_tests_perwindow.js rename : browser/components/preferences/in-content/tests/site_data_test.html => browser/components/preferences/in-content-old/tests/site_data_test.html rename : browser/components/preferences/in-content/tests/subdialog.xul => browser/components/preferences/in-content-old/tests/subdialog.xul rename : browser/components/preferences/in-content/tests/subdialog2.xul => browser/components/preferences/in-content-old/tests/subdialog2.xul rename : browser/locales/en-US/chrome/browser/preferences/advanced.dtd => browser/locales/en-US/chrome/browser/preferences-old/advanced.dtd rename : browser/locales/en-US/chrome/browser/preferences/applications.dtd => browser/locales/en-US/chrome/browser/preferences-old/applications.dtd rename : browser/locales/en-US/chrome/browser/preferences/containers.dtd => browser/locales/en-US/chrome/browser/preferences-old/containers.dtd rename : browser/locales/en-US/chrome/browser/preferences/containers.properties => browser/locales/en-US/chrome/browser/preferences-old/containers.properties rename : browser/locales/en-US/chrome/browser/preferences/content.dtd => browser/locales/en-US/chrome/browser/preferences-old/content.dtd rename : browser/locales/en-US/chrome/browser/preferences/main.dtd => browser/locales/en-US/chrome/browser/preferences-old/main.dtd rename : browser/locales/en-US/chrome/browser/preferences/preferences.dtd => browser/locales/en-US/chrome/browser/preferences-old/preferences.dtd rename : browser/locales/en-US/chrome/browser/preferences/preferences.properties => browser/locales/en-US/chrome/browser/preferences-old/preferences.properties rename : browser/locales/en-US/chrome/browser/preferences/privacy.dtd => browser/locales/en-US/chrome/browser/preferences-old/privacy.dtd rename : browser/locales/en-US/chrome/browser/preferences/search.dtd => browser/locales/en-US/chrome/browser/preferences-old/search.dtd rename : browser/locales/en-US/chrome/browser/preferences/security.dtd => browser/locales/en-US/chrome/browser/preferences-old/security.dtd rename : browser/locales/en-US/chrome/browser/preferences/sync.dtd => browser/locales/en-US/chrome/browser/preferences-old/sync.dtd rename : browser/locales/en-US/chrome/browser/preferences/tabs.dtd => browser/locales/en-US/chrome/browser/preferences-old/tabs.dtd extra : rebase_source : a2e39a4526b4938d3275978ab54bd24ed8427d1a
		
			
				
	
	
		
			155 lines
		
	
	
	
		
			5.3 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			155 lines
		
	
	
	
		
			5.3 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| /* 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(outer, iiD) {
 | |
|     if (outer) {
 | |
|       throw Cr.NS_ERROR_NO_AGGREGATION;
 | |
|     }
 | |
|     return this.QueryInterface(iiD);
 | |
|   },
 | |
| 
 | |
|   register() {
 | |
|     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() {
 | |
|     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(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 dtOptions = { year: "numeric", month: "long", day: "numeric",
 | |
|                       hour: "numeric", minute: "numeric", second: "numeric" };
 | |
|   return date.toLocaleString(undefined, 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();
 | |
| });
 |