Backed out changeset 362425ee97ad (bug 1419007) for ESLint failure and for failing test_threathit_report.html. r=backout on a CLOSED TREE

This commit is contained in:
Csoregi Natalia 2017-12-03 21:41:07 +02:00
parent 3a307d4ebb
commit 009021edbb
4 changed files with 12 additions and 46 deletions

View File

@ -4,7 +4,7 @@
"use strict";
const DUMMY = "browser/browser/base/content/test/siteIdentity/dummy_page.html"
const DUMMY = "browser/browser/base/content/test/general/dummy_page.html";
const INSECURE_ICON_PREF = "security.insecure_connection_icon.enabled";
const INSECURE_PBMODE_ICON_PREF = "security.insecure_connection_icon.pbmode.enabled";
@ -233,35 +233,6 @@ add_task(async function test_about_net_error_uri() {
await noCertErrorTest(false);
});
async function noCertErrorFromNavigationTest(secureCheck) {
let oldTab = gBrowser.selectedTab;
await SpecialPowers.pushPrefEnv({set: [[INSECURE_ICON_PREF, secureCheck]]});
let newTab = await loadNewTab("http://example.com/" + DUMMY);
let promise = BrowserTestUtils.waitForErrorPage(gBrowser.selectedBrowser);
await ContentTask.spawn(gBrowser.selectedBrowser, {}, function() {
content.document.getElementById("no-cert").click();
});
await promise;
await ContentTask.spawn(gBrowser.selectedBrowser, {}, function() {
is(content.window.location.href, "https://nocert.example.com/", "Should be the cert error URL");
});
is(newTab.linkedBrowser.documentURI.spec.startsWith("about:certerror?"), true, "Should be an about:certerror");
is(getIdentityMode(), "unknownIdentity", "Identity should be unknown");
is(getConnectionState(), "not-secure", "Connection should be file");
gBrowser.removeTab(newTab);
await SpecialPowers.popPrefEnv();
}
add_task(async function test_about_net_error_uri_from_navigation_tab() {
await noCertErrorFromNavigationTest(true);
await noCertErrorFromNavigationTest(false);
});
async function aboutUriTest(secureCheck) {
let oldTab = gBrowser.selectedTab;
await SpecialPowers.pushPrefEnv({set: [[INSECURE_ICON_PREF, secureCheck]]});

View File

@ -4,7 +4,6 @@
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"></meta>
</head>
<body>
<a href="https://nocert.example.com" id="no-cert">No Cert page</a>
<p>Dummy test page</p>
</body>
</html>

View File

@ -9365,9 +9365,6 @@ nsDocShell::CreateContentViewer(const nsACString& aContentType,
// OnLoadingSite(), but don't fire OnLocationChange()
// notifications before we've called Embed(). See bug 284993.
mURIResultedInDocument = true;
bool errorOnLocationChangeNeeded = false;
nsCOMPtr<nsIChannel> failedChannel = mFailedChannel;
nsCOMPtr<nsIURI> failedURI;
if (mLoadType == LOAD_ERROR_PAGE) {
// We need to set the SH entry and our current URI here and not
@ -9378,15 +9375,17 @@ nsDocShell::CreateContentViewer(const nsACString& aContentType,
// following function calls need it.
mLoadType = mFailedLoadType;
nsCOMPtr<nsIChannel> failedChannel = mFailedChannel;
nsIDocument* doc = viewer->GetDocument();
if (doc) {
doc->SetFailedChannel(failedChannel);
}
// Make sure we have a URI to set currentURI.
nsCOMPtr<nsIURI> failedURI;
nsCOMPtr<nsIPrincipal> triggeringPrincipal;
if (failedChannel) {
// Make sure we have a URI to set currentURI.
NS_GetFinalChannelURI(failedChannel, getter_AddRefs(failedURI));
}
else {
@ -9412,9 +9411,14 @@ nsDocShell::CreateContentViewer(const nsACString& aContentType,
// Create an shistory entry for the old load.
if (failedURI) {
errorOnLocationChangeNeeded = OnNewURI(
bool errorOnLocationChangeNeeded = OnNewURI(
failedURI, failedChannel, triggeringPrincipal,
nullptr, mLoadType, false, false, false);
if (errorOnLocationChangeNeeded) {
FireOnLocationChange(this, failedChannel, failedURI,
LOCATION_CHANGE_ERROR_PAGE);
}
}
// Be sure to have a correct mLSHE, it may have been cleared by
@ -9505,10 +9509,7 @@ nsDocShell::CreateContentViewer(const nsACString& aContentType,
FavorPerformanceHint(true);
}
if (errorOnLocationChangeNeeded) {
FireOnLocationChange(this, failedChannel, failedURI,
LOCATION_CHANGE_ERROR_PAGE);
} else if (onLocationChangeNeeded) {
if (onLocationChangeNeeded) {
FireOnLocationChange(this, aRequest, mCurrentURI, 0);
}

View File

@ -16,12 +16,7 @@ add_task(async function() {
];
});
info("Page that loaded: " + contentURL);
const errorURI = "about:neterror?";
ok(contentURL.startsWith(errorURI), "Should be on an error page");
const contentPrincipal = tab.linkedBrowser.contentPrincipal;
ok(contentPrincipal.URI.spec.startsWith(errorURI), "Principal should be for the error page");
ok(contentURL.startsWith("about:neterror?"), "Should be on an error page");
originalURL = new URL(originalURL);
is(originalURL.host, "example", "Should be an error for http://example, not http://www.example.com/");