Bug 1175702 - Fix browser_bug590206.js failures r=paolo

This commit is contained in:
Tim Taubert 2015-08-06 15:35:52 +02:00
parent 4c67ccd6cb
commit 31351177cb
2 changed files with 30 additions and 15 deletions

View File

@ -7180,14 +7180,6 @@ var gIdentityHandler = {
},
_isURILoadedFromFile(uri) {
try {
uri.host;
// No internal/file URI if we have a host.
return false;
} catch (e) {
// All good, let's continue.
}
// Create a channel for the sole purpose of getting the resolved URI
// of the request to determine if it's loaded from the file system.
let chanOptions = {uri, loadUsingSystemPrincipal: true};

View File

@ -2,6 +2,8 @@
* Test the identity mode UI for a variety of page types
*/
"use strict";
const DUMMY = "browser/browser/base/content/test/general/dummy_page.html";
function loadNewTab(url) {
@ -12,6 +14,11 @@ function getIdentityMode() {
return document.getElementById("identity-box").className;
}
function getConnectionState() {
gIdentityHandler.refreshIdentityPopup();
return document.getElementById("identity-popup").getAttribute("connection");
}
// This test is slow on Linux debug e10s
requestLongerTimeout(2);
@ -49,13 +56,13 @@ add_task(function* test_chrome() {
let oldTab = gBrowser.selectedTab;
let newTab = yield loadNewTab("chrome://mozapps/content/extensions/extensions.xul");
is(getIdentityMode(), "fileURI", "Identity should be file");
is(getConnectionState(), "file", "Connection should be file");
gBrowser.selectedTab = oldTab;
is(getIdentityMode(), "unknownIdentity", "Identity should be unknown");
gBrowser.selectedTab = newTab;
is(getIdentityMode(), "fileURI", "Identity should be file");
is(getConnectionState(), "file", "Connection should be file");
gBrowser.removeTab(newTab);
});
@ -95,30 +102,30 @@ add_task(function* test_file() {
let fileURI = getTestFilePath("");
let newTab = yield loadNewTab(fileURI);
is(getIdentityMode(), "fileURI", "Identity should be file");
is(getConnectionState(), "file", "Connection should be file");
gBrowser.selectedTab = oldTab;
is(getIdentityMode(), "unknownIdentity", "Identity should be unknown");
gBrowser.selectedTab = newTab;
is(getIdentityMode(), "fileURI", "Identity should be file");
is(getConnectionState(), "file", "Connection should be file");
gBrowser.removeTab(newTab);
});
add_task(function test_resource_uri() {
let oldTab = gBrowser.selectedTab;
let dataURI = "resource://gre/modules/Services.jsm"
let dataURI = "resource://gre/modules/Services.jsm";
let newTab = yield loadNewTab(dataURI);
is(getIdentityMode(), "fileURI", "Identity should be unknown");
is(getConnectionState(), "file", "Connection should be file");
gBrowser.selectedTab = oldTab;
is(getIdentityMode(), "unknownIdentity", "Identity should be unknown");
gBrowser.selectedTab = newTab;
is(getIdentityMode(), "fileURI", "Identity should be unknown");
is(getConnectionState(), "file", "Connection should be file");
gBrowser.removeTab(newTab);
});
@ -138,3 +145,19 @@ add_task(function test_data_uri() {
gBrowser.removeTab(newTab);
});
add_task(function test_about_uri() {
let oldTab = gBrowser.selectedTab;
let aboutURI = "about:robots"
let newTab = yield loadNewTab(aboutURI);
is(getConnectionState(), "file", "Connection should be file");
gBrowser.selectedTab = oldTab;
is(getIdentityMode(), "unknownIdentity", "Identity should be unknown");
gBrowser.selectedTab = newTab;
is(getConnectionState(), "file", "Connection should be file");
gBrowser.removeTab(newTab);
});