Bug 1398730 - Add private browsing to mozscreenshots config, fixed lint issues, leaves windows open at end; r?mconley
MozReview-Commit-ID: CrCNEoxFT9K
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);
+ });
+ },
+ },
+ },
+};