Bug 1398730 - Add private browsing to mozscreenshots config, fixed lint issues, leaves windows open at end; r?mconley draft
authorMike Williams <will2616@msu.edu>
Mon, 25 Sep 2017 00:59:13 -0400
changeset 672902 6c4b3316b896c328e1fa4d1c4be603a2e6772d05
parent 669653 3f384ef139c4217981891b23cdcce8352cab0a0c
child 674017 5d2ad23d1adfaf7b3c3073baa2cb88c1cdb00af0
push id82419
push userbmo:will2616@msu.edu
push dateFri, 29 Sep 2017 22:24:40 +0000
reviewersmconley
bugs1398730
milestone58.0a1
Bug 1398730 - Add private browsing to mozscreenshots config, fixed lint issues, leaves windows open at end; r?mconley MozReview-Commit-ID: CrCNEoxFT9K
browser/tools/mozscreenshots/mozscreenshots/extension/configurations/PrivateBrowsing.jsm
new file mode 100644
--- /dev/null
+++ b/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/PrivateBrowsing.jsm
@@ -0,0 +1,53 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+"use strict";
+
+this.EXPORTED_SYMBOLS = [ "PrivateBrowsing" ];
+
+const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
+
+Cu.import("resource://gre/modules/Services.jsm");
+Cu.import("resource://gre/modules/Timer.jsm");
+
+this.PrivateBrowsing = {
+
+  init(libDir) {},
+
+  configurations: {
+    noPB: {
+      async applyConfig() {
+        let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
+        browserWindow.OpenBrowserWindow({private: false});
+
+
+        // This is the code I added
+        await new Promise((resolve, reject) => {
+          setTimeout( () => {
+            // If I uncomment this, the test stalls
+            // browserWindow.close();
+            resolve();
+          }, 500);
+        });
+      },
+    },
+
+    tempPB: {
+      async applyConfig() {
+        let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
+        browserWindow.document.getElementById("main-window").removeAttribute("remotecontrol");
+        browserWindow.OpenBrowserWindow({private: true});
+
+        // This is the code I added
+        await new Promise((resolve, reject) => {
+          setTimeout( () => {
+            // Same as above
+            // browserWindow.close();
+            resolve();
+          }, 500);
+        });
+      },
+    },
+  },
+};