--- a/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/Preferences.jsm
+++ b/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/Preferences.jsm
@@ -12,51 +12,72 @@ Cu.import("resource://gre/modules/Servic
Cu.import("resource://gre/modules/Task.jsm");
Cu.import("resource://testing-common/TestUtils.jsm");
Cu.import("resource://testing-common/ContentTask.jsm");
this.Preferences = {
init(libDir) {
let panes = [
- ["paneGeneral", null],
- ["paneSearch", null],
- ["paneContent", null],
- ["paneApplications", null],
- ["panePrivacy", null],
- ["panePrivacy", null, DNTDialog],
- ["panePrivacy", null, clearRecentHistoryDialog],
- ["paneSecurity", null],
- ["paneSync", null],
- ["paneAdvanced", "generalTab"],
- ["paneAdvanced", "dataChoicesTab"],
- ["paneAdvanced", "networkTab"],
- ["paneAdvanced", "networkTab", connectionDialog],
- ["paneAdvanced", "updateTab"],
- ["paneAdvanced", "encryptionTab"],
- ["paneAdvanced", "encryptionTab", certManager],
- ["paneAdvanced", "encryptionTab", deviceManager],
+ /* The "new" organization */
+ ["paneGeneral"],
+ ["paneGeneral", scrollToBrowsingGroup],
+ ["paneApplications"],
+ ["paneSync"],
+ ["panePrivacy"],
+ ["panePrivacy", scrollToCacheGroup],
+ ["panePrivacy", DNTDialog],
+ ["panePrivacy", clearRecentHistoryDialog],
+ ["panePrivacy", connectionDialog],
+ ["panePrivacy", certManager],
+ ["panePrivacy", deviceManager],
+ ["paneAdvanced"],
+
+ /* The "old" organization. The third argument says to
+ set the pref to show the old organization when
+ opening the preferences. */
+ ["paneGeneral", null, true],
+ ["paneSearch", null, true],
+ ["paneContent", null, true],
+ ["paneApplications", null, true],
+ ["panePrivacy", null, true],
+ ["panePrivacy", DNTDialog, true],
+ ["panePrivacy", clearRecentHistoryDialog, true],
+ ["paneSecurity", null, true],
+ ["paneSync", null, true],
+ ["paneAdvanced", null, true, "generalTab"],
+ ["paneAdvanced", null, true, "dataChoicesTab"],
+ ["paneAdvanced", null, true, "networkTab"],
+ ["paneAdvanced", connectionDialog, true, "networkTab"],
+ ["paneAdvanced", null, true, "updateTab"],
+ ["paneAdvanced", null, true, "encryptionTab"],
+ ["paneAdvanced", certManager, true, "encryptionTab"],
+ ["paneAdvanced", deviceManager, true, "encryptionTab"],
];
- for (let [primary, advanced, customFn] of panes) {
+ for (let [primary, customFn, useOldOrg, advanced] of panes) {
let configName = primary.replace(/^pane/, "prefs") + (advanced ? "-" + advanced : "");
if (customFn) {
configName += "-" + customFn.name;
}
this.configurations[configName] = {};
- this.configurations[configName].applyConfig = prefHelper.bind(null, primary, advanced, customFn);
+ this.configurations[configName].applyConfig = prefHelper.bind(null, primary, customFn, useOldOrg, advanced);
}
},
configurations: {},
};
-let prefHelper = Task.async(function*(primary, advanced = null, customFn = null) {
+let prefHelper = Task.async(function*(primary, customFn = null, useOldOrg = false, advanced = null) {
let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
let selectedBrowser = browserWindow.gBrowser.selectedBrowser;
+ if (useOldOrg) {
+ Services.prefs.setBoolPref("browser.preferences.useOldOrganization", !!useOldOrg);
+ }
+
// close any dialog that might still be open
yield ContentTask.spawn(selectedBrowser, null, function*() {
if (!content.window.gSubDialog) {
return;
}
content.window.gSubDialog.close();
});
@@ -67,39 +88,53 @@ let prefHelper = Task.async(function*(pr
readyPromise = Promise.resolve();
} else {
readyPromise = paintPromise(browserWindow);
}
} else {
readyPromise = TestUtils.topicObserved("advanced-pane-loaded");
}
- if (primary == "paneAdvanced") {
+ if (useOldOrg && primary == "paneAdvanced") {
browserWindow.openAdvancedPreferences(advanced);
} else {
browserWindow.openPreferences(primary);
}
yield readyPromise;
if (customFn) {
let customPaintPromise = paintPromise(browserWindow);
yield* customFn(selectedBrowser);
yield customPaintPromise;
}
+
+ Services.prefs.clearUserPref("browser.preferences.useOldOrganization");
});
function paintPromise(browserWindow) {
return new Promise((resolve) => {
browserWindow.addEventListener("MozAfterPaint", function() {
resolve();
}, {once: true});
});
}
+function* scrollToBrowsingGroup(aBrowser) {
+ yield ContentTask.spawn(aBrowser, null, function* () {
+ content.document.getElementById("browsingGroup").scrollIntoView();
+ });
+}
+
+function* scrollToCacheGroup(aBrowser) {
+ yield ContentTask.spawn(aBrowser, null, function* () {
+ content.document.getElementById("cacheGroup").scrollIntoView();
+ });
+}
+
function* DNTDialog(aBrowser) {
yield ContentTask.spawn(aBrowser, null, function* () {
content.document.getElementById("doNotTrackSettings").click();
});
}
function* connectionDialog(aBrowser) {
yield ContentTask.spawn(aBrowser, null, function* () {