Bug 1274712 - Add a mozscreenshots configuration for the DNT dialog. r=MattN
authorJohann Hofmann <jhofmann@mozilla.com>
Thu, 26 May 2016 23:27:02 +0200
changeset 338648 b4a3f56b263f0c90b4841a1c6093142132a915c2
parent 338647 af81ae8922d6a90dc0413bb1c0f8fdf176a628fa
child 338649 fae4da38e0b407f53f19f77405ee3b3c4cc33361
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMattN
bugs1274712
milestone49.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1274712 - Add a mozscreenshots configuration for the DNT dialog. r=MattN MozReview-Commit-ID: AoGYvnwHm37
browser/tools/mozscreenshots/mozscreenshots/extension/configurations/Preferences.jsm
--- a/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/Preferences.jsm
+++ b/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/Preferences.jsm
@@ -7,16 +7,17 @@
 this.EXPORTED_SYMBOLS = ["Preferences"];
 
 const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
 
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/Task.jsm");
 Cu.import("resource://gre/modules/Timer.jsm");
 Cu.import("resource://testing-common/TestUtils.jsm");
+Cu.import("resource://testing-common/ContentTask.jsm");
 
 this.Preferences = {
 
   init(libDir) {
     Services.prefs.setBoolPref("browser.preferences.inContent", true);
 
     let panes = [
       ["paneGeneral", null],
@@ -34,17 +35,28 @@ this.Preferences = {
     ];
     for (let [primary, advanced] of panes) {
       let configName = primary.replace(/^pane/, "prefs") + (advanced ? "-" + advanced : "");
       this.configurations[configName] = {};
       this.configurations[configName].applyConfig = prefHelper.bind(null, primary, advanced);
     }
   },
 
-  configurations: {},
+  configurations: {
+    "panePrivacy-DNTDialog": {
+      applyConfig: Task.async(function*(){
+        let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
+        yield prefHelper("panePrivacy", null);
+
+        yield ContentTask.spawn(browserWindow.gBrowser.selectedBrowser, null, function* () {
+          content.document.getElementById("doNotTrackSettings").click();
+        });
+      }),
+    },
+  },
 };
 
 let prefHelper = Task.async(function*(primary, advanced) {
   let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
   let selectedBrowser = browserWindow.gBrowser;
   let readyPromise = null;
   if (selectedBrowser.currentURI.specIgnoringRef == "about:preferences") {
     readyPromise = new Promise((resolve) => {
@@ -60,9 +72,14 @@ let prefHelper = Task.async(function*(pr
 
   if (primary == "paneAdvanced") {
     browserWindow.openAdvancedPreferences(advanced);
   } else {
     browserWindow.openPreferences(primary);
   }
 
   yield readyPromise;
+
+  // close any dialog that might still be open
+  yield ContentTask.spawn(selectedBrowser.selectedBrowser, null, function*() {
+    content.window.gSubDialog.close();
+  });
 });