Bug 1175702 - Fix browser_bug590206.js failures r=paolo
☠☠ backed out by 4fc077aa4dc0 ☠ ☠
authorTim Taubert <ttaubert@mozilla.com>
Thu, 06 Aug 2015 15:35:52 +0200
changeset 288268 7216b345380e3acd451fc842bd2e2c49b4d4a144
parent 288267 dc33bb49347daad4d6332d26bedc3ad74bb0fc71
child 288269 b735f4eea9359c0d88373be4afda32618c7ce567
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspaolo
bugs1175702, 590206
milestone42.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1175702 - Fix browser_bug590206.js failures r=paolo
browser/base/content/browser.js
browser/base/content/test/general/browser_bug590206.js
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -7175,24 +7175,16 @@ var gIdentityHandler = {
     this._identityPopupContentSupp.textContent = supplemental;
     this._identityPopupContentVerif.textContent = verifier;
 
     // Update per-site permissions section.
     this.updateSitePermissions();
   },
 
   _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};
     let resolvedURI = NetUtil.newChannel(chanOptions).URI;
     if (resolvedURI.schemeIs("jar")) {
       // Given a URI "jar:<jar-file-uri>!/<jar-entry>"
       // create a new URI using <jar-file-uri>!/<jar-entry>
       resolvedURI = NetUtil.newURI(resolvedURI.path);
--- a/browser/base/content/test/general/browser_bug590206.js
+++ b/browser/base/content/test/general/browser_bug590206.js
@@ -1,22 +1,29 @@
 /*
  * 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) {
   return BrowserTestUtils.openNewForegroundTab(gBrowser, url);
 }
 
 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);
 
 add_task(function* test_webpage() {
   let oldTab = gBrowser.selectedTab;
 
   let newTab = yield loadNewTab("http://example.com/" + DUMMY);
   is(getIdentityMode(), "unknownIdentity", "Identity should be unknown");
@@ -44,23 +51,23 @@ add_task(function* test_blank() {
 
   gBrowser.removeTab(newTab);
 });
 
 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);
 });
 
 add_task(function* test_https() {
   let oldTab = gBrowser.selectedTab;
 
   let newTab = yield loadNewTab("https://example.com/" + DUMMY);
@@ -90,40 +97,40 @@ add_task(function* test_addons() {
   gBrowser.removeTab(newTab);
 });
 
 add_task(function* test_file() {
   let oldTab = gBrowser.selectedTab;
   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);
 });
 
 add_task(function test_data_uri() {
   let oldTab = gBrowser.selectedTab;
   let dataURI = "data:text/html,hi"
 
@@ -133,8 +140,24 @@ add_task(function test_data_uri() {
   gBrowser.selectedTab = oldTab;
   is(getIdentityMode(), "unknownIdentity", "Identity should be unknown");
 
   gBrowser.selectedTab = newTab;
   is(getIdentityMode(), "unknownIdentity", "Identity should be unknown");
 
   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);
+});