Bug 1373563 - Mozscreenshots: disable intermittent controlCenter_localFile on Windows 10 and OSX. r=MattN draft
authorJohann Hofmann <jhofmann@mozilla.com>
Wed, 19 Jul 2017 11:12:54 +0200
changeset 611246 f3cdaae487a66f022a08b871afcc7721ae78e9a4
parent 610973 1b065ffd8a535a0ad4c39a912af18e948e6a42c1
child 638090 4a1430ee608a249f051a68b54402c5c2e90243aa
push id69144
push userbmo:jhofmann@mozilla.com
push dateWed, 19 Jul 2017 09:13:50 +0000
reviewersMattN
bugs1373563
milestone56.0a1
Bug 1373563 - Mozscreenshots: disable intermittent controlCenter_localFile on Windows 10 and OSX. r=MattN I'm not sure whether this problem will extend to Linux and Win < 10 any time soon, if that's the case we will need to disable the test entirely. MozReview-Commit-ID: 5vvBPP8OjTb
browser/tools/mozscreenshots/mozscreenshots/extension/configurations/ControlCenter.jsm
--- a/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/ControlCenter.jsm
+++ b/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/ControlCenter.jsm
@@ -8,16 +8,17 @@ this.EXPORTED_SYMBOLS = ["ControlCenter"
 
 const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
 
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/Timer.jsm");
 Cu.import("resource://testing-common/BrowserTestUtils.jsm");
 Cu.import("resource:///modules/SitePermissions.jsm");
 Cu.import("resource://gre/modules/NetUtil.jsm");
+Cu.import("resource://gre/modules/AppConstants.jsm");
 
 let {UrlClassifierTestUtils} = Cu.import("resource://testing-common/UrlClassifierTestUtils.jsm", {});
 
 const RESOURCE_PATH = "browser/browser/tools/mozscreenshots/mozscreenshots/extension/mozscreenshots/browser/chrome/mozscreenshots/lib/controlCenter";
 const HTTP_PAGE = "http://example.com/";
 const HTTPS_PAGE = "https://example.com/";
 const PERMISSIONS_PAGE = "https://test1.example.com/";
 const HTTP_PASSWORD_PAGE = `http://test2.example.org/${RESOURCE_PATH}/password.html`;
@@ -32,31 +33,16 @@ this.ControlCenter = {
   configurations: {
     about: {
       async applyConfig() {
         await loadPage("about:home");
         await openIdentityPopup();
       },
     },
 
-    localFile: {
-      async applyConfig() {
-        let channel = NetUtil.newChannel({
-            uri: "chrome://mozscreenshots/content/lib/mozscreenshots.html",
-            loadUsingSystemPrincipal: true
-        });
-        channel = channel.QueryInterface(Ci.nsIFileChannel);
-        let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
-        let gBrowser = browserWindow.gBrowser;
-        BrowserTestUtils.loadURI(gBrowser.selectedBrowser, channel.file.path);
-        await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
-        await openIdentityPopup();
-      },
-    },
-
     http: {
       async applyConfig() {
         await loadPage(HTTP_PAGE);
         await openIdentityPopup();
       },
     },
 
     httpSubView: {
@@ -217,16 +203,33 @@ this.ControlCenter = {
         gBrowser.ownerGlobal.document.querySelector("#tracking-action-unblock").click();
         await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser, false, TRACKING_PAGE);
         await openIdentityPopup();
       },
     },
   },
 };
 
+// Local file paths include temporary task identifiers on OSX and Win10.
+if (AppConstants.platform != "macosx" &&
+    !AppConstants.isPlatformAndVersionAtLeast("win", "10")) {
+  this.ControlCenter.localFile = async function applyConfig() {
+      let channel = NetUtil.newChannel({
+          uri: "chrome://mozscreenshots/content/lib/mozscreenshots.html",
+          loadUsingSystemPrincipal: true
+      });
+      channel = channel.QueryInterface(Ci.nsIFileChannel);
+      let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
+      let gBrowser = browserWindow.gBrowser;
+      BrowserTestUtils.loadURI(gBrowser.selectedBrowser, channel.file.path);
+      await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
+      await openIdentityPopup();
+  };
+}
+
 async function loadPage(url) {
   let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
   let gBrowser = browserWindow.gBrowser;
   BrowserTestUtils.loadURI(gBrowser.selectedBrowser, url);
   await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser, false, url);
 }
 
 async function openIdentityPopup(expand) {