Bug 1295488 - Don't use a directory for mozscreenshots localFile tests. r?MattN
MozReview-Commit-ID: 3QJZsB7BHqg
--- 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/Task.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");
let {UrlClassifierTestUtils} = Cu.import("resource://testing-common/UrlClassifierTestUtils.jsm", {});
const RESOURCE_PATH = "extensions/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`;
@@ -34,21 +35,25 @@ this.ControlCenter = {
applyConfig: Task.async(function* () {
yield loadPage("about:home");
yield openIdentityPopup();
}),
},
localFile: {
applyConfig: Task.async(function* () {
- let filePath = "file:///";
- if (Services.appinfo.OS === "WINNT") {
- filePath += "C:/";
- }
- yield loadPage(filePath);
+ 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);
+ yield BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
yield openIdentityPopup();
}),
},
http: {
applyConfig: Task.async(function* () {
yield loadPage(HTTP_PAGE);
yield openIdentityPopup();