Backed out changeset 39762ef5d56e (bug 1493427) for frequent talos chrome failures a=backout

--HG--
rename : browser/base/content/test/siteIdentity/browser_navigation_failures.js => browser/base/content/test/siteIdentity/browser_tls_handshake_failure.js
This commit is contained in:
Coroiu Cristina 2018-09-28 07:29:39 +03:00
Родитель 71988c7b7e
Коммит 62682de0ba
4 изменённых файлов: 34 добавлений и 58 удалений

Просмотреть файл

@ -108,4 +108,4 @@ support-files =
[browser_iframe_navigation.js]
support-files =
iframe_navigation.html
[browser_navigation_failures.js]
[browser_tls_handshake_failure.js]

Просмотреть файл

@ -1,41 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
// Tests that the site identity indicator is properly updated for navigations
// that fail for various reasons. In particular, we currently test TLS handshake
// failures and about: pages that don't actually exist.
// See bug 1492424 and bug 1493427.
const kSecureURI = getRootDirectory(gTestPath).replace("chrome://mochitests/content",
"https://example.com") + "dummy_page.html";
add_task(async function() {
await BrowserTestUtils.withNewTab(kSecureURI, async (browser) => {
let identityMode = window.document.getElementById("identity-box").className;
is(identityMode, "verifiedDomain", "identity should be secure before");
const TLS_HANDSHAKE_FAILURE_URI = "https://ssl3.example.com/";
// Try to connect to a server where the TLS handshake will fail.
BrowserTestUtils.loadURI(browser, TLS_HANDSHAKE_FAILURE_URI);
await BrowserTestUtils.browserLoaded(browser, false, TLS_HANDSHAKE_FAILURE_URI, true);
let newIdentityMode = window.document.getElementById("identity-box").className;
is(newIdentityMode, "unknownIdentity", "identity should be unknown (not secure) after");
});
});
add_task(async function() {
await BrowserTestUtils.withNewTab(kSecureURI, async (browser) => {
let identityMode = window.document.getElementById("identity-box").className;
is(identityMode, "verifiedDomain", "identity should be secure before");
const BAD_ABOUT_PAGE_URI = "about:somethingthatdoesnotexist";
// Try to load an about: page that doesn't exist
BrowserTestUtils.loadURI(browser, BAD_ABOUT_PAGE_URI);
await BrowserTestUtils.browserLoaded(browser, false, BAD_ABOUT_PAGE_URI, true);
let newIdentityMode = window.document.getElementById("identity-box").className;
is(newIdentityMode, "unknownIdentity", "identity should be unknown (not secure) after");
});
});

Просмотреть файл

@ -0,0 +1,25 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
// Tests that the site identity indicator is properly updated for connections
// where the TLS handshake fails.
// See bug 1492424.
add_task(async function() {
let rootURI = getRootDirectory(gTestPath).replace("chrome://mochitests/content",
"https://example.com");
await BrowserTestUtils.withNewTab(rootURI + "dummy_page.html", async (browser) => {
let identityMode = window.document.getElementById("identity-box").className;
is(identityMode, "verifiedDomain", "identity should be secure before");
const TLS_HANDSHAKE_FAILURE_URI = "https://ssl3.example.com/";
// Try to connect to a server where the TLS handshake will fail.
BrowserTestUtils.loadURI(browser, TLS_HANDSHAKE_FAILURE_URI);
await BrowserTestUtils.browserLoaded(browser, false, TLS_HANDSHAKE_FAILURE_URI, true);
let newIdentityMode = window.document.getElementById("identity-box").className;
is(newIdentityMode, "unknownIdentity", "identity should be unknown (not secure) after");
});
});

Просмотреть файл

@ -251,8 +251,7 @@ nsSecureBrowserUIImpl::UpdateStateAndSecurityInfo(nsIChannel* channel,
// CheckForBlockedContent).
// When we receive a notification from the top-level nsIWebProgress, we extract
// any relevant security information and set our state accordingly. We then call
// OnSecurityChange on the docShell corresponding to the nsIWebProgress we were
// initialized with to notify any downstream listeners of the security state.
// OnSecurityChange to notify any downstream listeners of the security state.
NS_IMETHODIMP
nsSecureBrowserUIImpl::OnLocationChange(nsIWebProgress* aWebProgress,
nsIRequest* aRequest,
@ -294,22 +293,15 @@ nsSecureBrowserUIImpl::OnLocationChange(nsIWebProgress* aWebProgress,
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
}
nsCOMPtr<nsIDocShell> docShell = do_QueryReferent(mDocShell);
if (docShell) {
nsCOMPtr<nsISecurityEventSink> eventSink = do_QueryInterface(docShell);
if (eventSink) {
MOZ_LOG(gSecureBrowserUILog, LogLevel::Debug,
(" calling OnSecurityChange %p %x\n", aRequest, mState));
Unused << eventSink->OnSecurityChange(aRequest, mState);
} else {
MOZ_LOG(gSecureBrowserUILog, LogLevel::Debug,
(" docShell doesn't implement nsISecurityEventSink? %p\n",
docShell.get()));
nsCOMPtr<nsISecurityEventSink> eventSink;
NS_QueryNotificationCallbacks(channel, eventSink);
if (NS_WARN_IF(!eventSink)) {
return NS_ERROR_INVALID_ARG;
}
} else {
MOZ_LOG(gSecureBrowserUILog, LogLevel::Debug, (" docShell went away?\n"));
MOZ_LOG(gSecureBrowserUILog, LogLevel::Debug,
(" calling OnSecurityChange %p %x\n", aRequest, mState));
Unused << eventSink->OnSecurityChange(aRequest, mState);
}
return NS_OK;