Backed out 4 changesets (bug 1325876) for causing wd failures @ navigation.spec.js CLOSED TREE
Backed out changeset b29ef3f14bf7 (bug 1325876) Backed out changeset f8add6e2ef93 (bug 1325876) Backed out changeset 41cc884f84c1 (bug 1325876) Backed out changeset 014c9c77393a (bug 1325876)
This commit is contained in:
@@ -1,38 +0,0 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
function decode(str) {
|
||||
return decodeURIComponent(str.replace(/\+/g, encodeURIComponent(" ")));
|
||||
}
|
||||
|
||||
function handleRequest(request, response) {
|
||||
const queryString = request.queryString;
|
||||
let params = queryString.split("&").reduce((memo, pair) => {
|
||||
let [key, val] = pair.split("=");
|
||||
if (!val) {
|
||||
val = key;
|
||||
key = "query";
|
||||
}
|
||||
|
||||
try {
|
||||
memo[decode(key)] = decode(val);
|
||||
} catch (e) {
|
||||
memo[key] = val;
|
||||
}
|
||||
|
||||
return memo;
|
||||
}, {});
|
||||
|
||||
const status = parseInt(params.status);
|
||||
const message = params.message;
|
||||
|
||||
// Set default if missing parameters
|
||||
if (!status || !message) {
|
||||
response.setStatusLine(request.httpVersion, 400, "Bad Request");
|
||||
response.setHeader("Content-Length", "0", false);
|
||||
return;
|
||||
}
|
||||
|
||||
response.setStatusLine(request.httpVersion, status, message);
|
||||
response.setHeader("Content-Length", "0", false);
|
||||
}
|
||||
@@ -45,11 +45,6 @@ skip-if = [
|
||||
|
||||
["browser_aboutNetError.js"]
|
||||
|
||||
["browser_aboutNetError_blank_page.js"]
|
||||
support-files = [
|
||||
"blank_page.sjs",
|
||||
]
|
||||
|
||||
["browser_aboutNetError_csp_iframe.js"]
|
||||
https_first_disabled = true
|
||||
support-files = [
|
||||
|
||||
@@ -1,77 +0,0 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
const BLANK_PAGE =
|
||||
"https://example.com/browser/browser/base/content/test/about/blank_page.sjs";
|
||||
|
||||
async function test_blankPage(
|
||||
page,
|
||||
expectedL10nID,
|
||||
responseStatus,
|
||||
responseStatusText
|
||||
) {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["browser.http.blank_page_with_error_response.enabled", false]],
|
||||
});
|
||||
|
||||
let browser;
|
||||
let pageLoaded;
|
||||
const uri = `${page}?status=${encodeURIComponent(
|
||||
responseStatus
|
||||
)}&message=${encodeURIComponent(responseStatusText)}`;
|
||||
|
||||
// Simulating loading the page
|
||||
await BrowserTestUtils.openNewForegroundTab(
|
||||
gBrowser,
|
||||
() => {
|
||||
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, uri);
|
||||
browser = gBrowser.selectedBrowser;
|
||||
pageLoaded = BrowserTestUtils.waitForErrorPage(browser);
|
||||
},
|
||||
false
|
||||
);
|
||||
|
||||
info("Loading and waiting for the net error");
|
||||
await pageLoaded;
|
||||
|
||||
await SpecialPowers.spawn(
|
||||
browser,
|
||||
[expectedL10nID, responseStatus, responseStatusText],
|
||||
function (l10nID, expectedStatus, expectedText) {
|
||||
const doc = content.document;
|
||||
ok(
|
||||
doc.documentURI.startsWith("about:neterror"),
|
||||
"Should be showing error page"
|
||||
);
|
||||
|
||||
const titleEl = doc.querySelector(".title-text");
|
||||
const actualDataL10nID = titleEl.getAttribute("data-l10n-id");
|
||||
is(actualDataL10nID, l10nID, "Correct error page title is set");
|
||||
|
||||
const expectedLabel =
|
||||
"Error code: " + expectedStatus.toString() + " " + expectedText;
|
||||
const actualLabel = doc.getElementById(
|
||||
"response-status-label"
|
||||
).textContent;
|
||||
is(actualLabel, expectedLabel, "Correct response status message is set");
|
||||
}
|
||||
);
|
||||
|
||||
BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
await SpecialPowers.popPrefEnv();
|
||||
}
|
||||
|
||||
add_task(async function test_blankPage_4xx() {
|
||||
await test_blankPage(BLANK_PAGE, "httpErrorPage-title", 400, "Bad Request");
|
||||
});
|
||||
|
||||
add_task(async function test_blankPage_5xx() {
|
||||
await test_blankPage(
|
||||
BLANK_PAGE,
|
||||
"serverError-title",
|
||||
503,
|
||||
"Service Unavailable"
|
||||
);
|
||||
});
|
||||
@@ -39,15 +39,6 @@ add_task(async function test_serverError() {
|
||||
"serverError-title",
|
||||
"Correct error page title is set"
|
||||
);
|
||||
|
||||
const responseStatusLabel = doc.getElementById(
|
||||
"response-status-label"
|
||||
).textContent;
|
||||
is(
|
||||
responseStatusLabel,
|
||||
"Error code: 500 Internal Server Error",
|
||||
"Correct response status message is set"
|
||||
);
|
||||
});
|
||||
|
||||
BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
|
||||
@@ -15,12 +15,6 @@ Services.scriptloader.loadSubScript(
|
||||
this
|
||||
);
|
||||
|
||||
add_setup(async function () {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["browser.http.blank_page_with_error_response.enabled", true]],
|
||||
});
|
||||
});
|
||||
|
||||
add_task(async function normal_page__foreground__click() {
|
||||
await doTestInSameWindow({
|
||||
link: "wait-a-bit--blank-target",
|
||||
|
||||
@@ -14,12 +14,6 @@ const { UrlbarTestUtils } = ChromeUtils.importESModule(
|
||||
"resource://testing-common/UrlbarTestUtils.sys.mjs"
|
||||
);
|
||||
|
||||
add_setup(async function () {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["browser.http.blank_page_with_error_response.enabled", true]],
|
||||
});
|
||||
});
|
||||
|
||||
add_task(async function normal_page__by_script() {
|
||||
await doTestInSameWindow({
|
||||
link: "wait-a-bit--by-script",
|
||||
|
||||
@@ -15,12 +15,6 @@ const { UrlbarTestUtils } = ChromeUtils.importESModule(
|
||||
"resource://testing-common/UrlbarTestUtils.sys.mjs"
|
||||
);
|
||||
|
||||
add_setup(async function () {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["browser.http.blank_page_with_error_response.enabled", true]],
|
||||
});
|
||||
});
|
||||
|
||||
add_task(async function normal_page__no_target() {
|
||||
await doTestInSameWindow({
|
||||
link: "wait-a-bit--no-target",
|
||||
|
||||
@@ -15,12 +15,6 @@ Services.scriptloader.loadSubScript(
|
||||
this
|
||||
);
|
||||
|
||||
add_setup(async function () {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["browser.http.blank_page_with_error_response.enabled", true]],
|
||||
});
|
||||
});
|
||||
|
||||
add_task(async function normal_page__other_target__foreground() {
|
||||
await doTestInSameWindow({
|
||||
link: "wait-a-bit--other-target",
|
||||
|
||||
@@ -6,7 +6,6 @@ malformedURI2=Please check that the URL is correct and try again.
|
||||
fileNotFound=Firefox can’t find the file at %S.
|
||||
fileAccessDenied=The file at %S is not readable.
|
||||
# %S is replaced by the uri host
|
||||
httpErrorPage=%S sent back an error.
|
||||
serverError=%S might have a temporary problem or it could have moved.
|
||||
dnsNotFound2=We can’t connect to the server at %S.
|
||||
unknownProtocolFound=Firefox doesn’t know how to open this address, because one of the following protocols (%S) isn’t associated with any program or is not allowed in this context.
|
||||
|
||||
@@ -3353,9 +3353,6 @@ nsDocShell::DisplayLoadError(nsresult aError, nsIURI* aURI,
|
||||
nestedURI = do_QueryInterface(tempURI);
|
||||
}
|
||||
error = "unknownProtocolFound";
|
||||
} else if (NS_ERROR_NET_EMPTY_RESPONSE == aError) {
|
||||
NS_ENSURE_ARG_POINTER(aURI);
|
||||
error = "httpErrorPage";
|
||||
} else if (NS_ERROR_NET_ERROR_RESPONSE == aError) {
|
||||
NS_ENSURE_ARG_POINTER(aURI);
|
||||
error = "serverError";
|
||||
@@ -6105,7 +6102,6 @@ nsresult nsDocShell::FilterStatusForErrorPage(
|
||||
|
||||
if (aStatus == NS_ERROR_NET_TIMEOUT ||
|
||||
aStatus == NS_ERROR_NET_TIMEOUT_EXTERNAL ||
|
||||
aStatus == NS_ERROR_NET_EMPTY_RESPONSE ||
|
||||
aStatus == NS_ERROR_NET_ERROR_RESPONSE ||
|
||||
aStatus == NS_ERROR_PROXY_GATEWAY_TIMEOUT ||
|
||||
aStatus == NS_ERROR_REDIRECT_LOOP ||
|
||||
|
||||
@@ -1667,30 +1667,16 @@ void Document::GetNetErrorInfo(NetErrorInfo& aInfo, ErrorResult& aRv) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(mFailedChannel));
|
||||
|
||||
// We don't throw even if httpChannel is null, we just keep responseStatus and
|
||||
// responseStatusText empty
|
||||
if (httpChannel) {
|
||||
uint32_t responseStatus;
|
||||
nsAutoCString responseStatusText;
|
||||
rv = httpChannel->GetResponseStatus(&responseStatus);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
aInfo.mResponseStatus = responseStatus;
|
||||
}
|
||||
|
||||
rv = httpChannel->GetResponseStatusText(responseStatusText);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
aInfo.mResponseStatusText.AssignASCII(responseStatusText);
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsITransportSecurityInfo> tsi;
|
||||
rv = mFailedChannel->GetSecurityInfo(getter_AddRefs(tsi));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
aRv.Throw(rv);
|
||||
return;
|
||||
}
|
||||
if (NS_WARN_IF(!tsi)) {
|
||||
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
return;
|
||||
}
|
||||
|
||||
nsresult channelStatus;
|
||||
rv = mFailedChannel->GetStatus(&channelStatus);
|
||||
@@ -1700,12 +1686,6 @@ void Document::GetNetErrorInfo(NetErrorInfo& aInfo, ErrorResult& aRv) {
|
||||
}
|
||||
aInfo.mChannelStatus = static_cast<uint32_t>(channelStatus);
|
||||
|
||||
// If nsITransportSecurityInfo is not set, simply keep the remaining fields
|
||||
// empty (to make responseStatus and responseStatusText accessible).
|
||||
if (!tsi) {
|
||||
return;
|
||||
}
|
||||
|
||||
// TransportSecurityInfo::GetErrorCodeString always returns NS_OK
|
||||
(void)tsi->GetErrorCodeString(aInfo.mErrorCodeString);
|
||||
if (aInfo.mErrorCodeString.IsEmpty()) {
|
||||
|
||||
@@ -6,7 +6,6 @@ malformedURI2=Please check that the URL is correct and try again.
|
||||
fileNotFound=The file %S cannot be found. Please check the location and try again.
|
||||
fileAccessDenied=The file at %S is not readable.
|
||||
# %S is replaced by the uri host
|
||||
httpErrorPage=%S sent back an error.
|
||||
serverError=%S might have a temporary problem or it could have moved.
|
||||
dnsNotFound2=%S could not be found. Please check the name and try again.
|
||||
unknownProtocolFound=One of the following (%S) is not a registered protocol or is not allowed in this context.
|
||||
|
||||
@@ -15,8 +15,6 @@ add_task(async function test_subdocument_downgrade() {
|
||||
["dom.security.https_first", true],
|
||||
// Makes it easier to detect the error
|
||||
["security.mixed_content.block_active_content", false],
|
||||
// Avoid error page for empty file (blank page with 429)
|
||||
["browser.http.blank_page_with_error_response.enabled", true],
|
||||
],
|
||||
});
|
||||
|
||||
|
||||
@@ -12,6 +12,4 @@
|
||||
dictionary NetErrorInfo {
|
||||
DOMString errorCodeString = "";
|
||||
unsigned long channelStatus = 0;
|
||||
unsigned long responseStatus = 0;
|
||||
DOMString responseStatusText = "";
|
||||
};
|
||||
|
||||
@@ -157,7 +157,6 @@ XPC_MSG_DEF(NS_ERROR_NET_TIMEOUT_EXTERNAL , "The request has been canc
|
||||
XPC_MSG_DEF(NS_ERROR_OFFLINE , "The requested action could not be completed in the offline state")
|
||||
XPC_MSG_DEF(NS_ERROR_PORT_ACCESS_NOT_ALLOWED , "Establishing a connection to an unsafe or otherwise banned port was prohibited")
|
||||
XPC_MSG_DEF(NS_ERROR_NET_RESET , "The connection was established, but no data was ever received")
|
||||
XPC_MSG_DEF(NS_ERROR_NET_EMPTY_RESPONSE , "The connection was established, but the browser received an empty page with an error response")
|
||||
XPC_MSG_DEF(NS_ERROR_NET_ERROR_RESPONSE , "The connection was established, but the browser received an error response from the server")
|
||||
XPC_MSG_DEF(NS_ERROR_NET_INTERRUPT , "The connection was established, but the data transfer was interrupted")
|
||||
XPC_MSG_DEF(NS_ERROR_NET_PARTIAL_TRANSFER , "A transfer was only partially done when it completed")
|
||||
|
||||
@@ -1570,19 +1570,6 @@
|
||||
value: false
|
||||
mirror: always
|
||||
|
||||
# If false, show internal error page for HTTP responses with error
|
||||
# codes (4xx, 5xx) and "Content-Length": 0 instead of blank page
|
||||
# See https://bugzilla.mozilla.org/show_bug.cgi?id=1325876#c32 for why this
|
||||
# is disabled on Android.
|
||||
- name: browser.http.blank_page_with_error_response.enabled
|
||||
type: bool
|
||||
#if !defined(ANDROID)
|
||||
value: false
|
||||
#else
|
||||
value: true
|
||||
#endif
|
||||
mirror: always
|
||||
|
||||
# The minimum area for a rect to be included in a wireframe, in CSS pixels.
|
||||
#
|
||||
# The current value of 50 is pretty arbitrary, and will be tuned as we refine
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
prefs: [network.early-hints.enabled: true, browser.http.blank_page_with_error_response.enabled: true]
|
||||
prefs: [network.early-hints.enabled: true]
|
||||
leak-threshold: [tab:358400]
|
||||
lsan-allowed: [Alloc, AllocateProtoAndIfaceCache, createTable, mozilla::detail::HashTable]
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
if not debug and (os == "android") and sessionHistoryInParent: [OK, TIMEOUT]
|
||||
if not debug and (os == "android") and not sessionHistoryInParent: [OK, TIMEOUT]
|
||||
if debug: TIMEOUT
|
||||
prefs: [browser.http.blank_page_with_error_response.enabled:true]
|
||||
[This test validates the response status of resources.]
|
||||
expected:
|
||||
if (os == "android") and not debug: [PASS, FAIL]
|
||||
|
||||
@@ -46,7 +46,6 @@ const KNOWN_ERROR_TITLE_IDS = new Set([
|
||||
"unsafeContentType-title",
|
||||
"netReset-title",
|
||||
"netTimeout-title",
|
||||
"httpErrorPage-title",
|
||||
"serverError-title",
|
||||
"unknownProtocolFound-title",
|
||||
"proxyConnectFailure-title",
|
||||
@@ -266,32 +265,6 @@ function recordTRREventTelemetry(
|
||||
}
|
||||
}
|
||||
|
||||
function setResponseStatus(shortDesc) {
|
||||
let responseStatus;
|
||||
let responseStatusText;
|
||||
try {
|
||||
const netErrorInfo = document.getNetErrorInfo();
|
||||
responseStatus = netErrorInfo.responseStatus;
|
||||
responseStatusText = netErrorInfo.responseStatusText;
|
||||
} catch (ex) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (responseStatus >= 400) {
|
||||
let responseStatusLabel = document.createElement("p");
|
||||
responseStatusLabel.id = "response-status-label"; // id for testing
|
||||
document.l10n.setAttributes(
|
||||
responseStatusLabel,
|
||||
"neterror-response-status-code",
|
||||
{
|
||||
responsestatus: responseStatus,
|
||||
responsestatustext: responseStatusText ?? "",
|
||||
}
|
||||
);
|
||||
shortDesc.appendChild(responseStatusLabel);
|
||||
}
|
||||
}
|
||||
|
||||
function initPage() {
|
||||
// We show an offline support page in case of a system-wide error,
|
||||
// when a user cannot connect to the internet and access the SUMO website.
|
||||
@@ -622,7 +595,6 @@ function initPage() {
|
||||
setNetErrorMessageFromParts(longDesc, parts);
|
||||
}
|
||||
|
||||
setResponseStatus(shortDesc);
|
||||
setNetErrorMessageFromCode();
|
||||
}
|
||||
|
||||
@@ -745,7 +717,8 @@ function getNetErrorDescParts() {
|
||||
case "connectionFailure":
|
||||
case "netInterrupt":
|
||||
case "netReset":
|
||||
case "netTimeout": {
|
||||
case "netTimeout":
|
||||
case "serverError": {
|
||||
let errorTags = [
|
||||
["li", "neterror-load-error-try-again"],
|
||||
["li", "neterror-load-error-connection"],
|
||||
@@ -757,10 +730,6 @@ function getNetErrorDescParts() {
|
||||
return errorTags;
|
||||
}
|
||||
|
||||
case "httpErrorPage": // 4xx
|
||||
return [["li", "neterror-http-error-page"]];
|
||||
case "serverError": // 5xx
|
||||
return [["li", "neterror-load-error-try-again"]];
|
||||
case "blockedByPolicy":
|
||||
case "deniedPortAccess":
|
||||
case "malformedURI":
|
||||
@@ -855,10 +824,7 @@ function setNetErrorMessageFromCode() {
|
||||
try {
|
||||
errorCode = document.getNetErrorInfo().errorCodeString;
|
||||
} catch (ex) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!errorCode) {
|
||||
// We don't have a securityInfo when this is for example a DNS error.
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -129,7 +129,6 @@ contentEncodingError-title = Content Encoding Error
|
||||
unsafeContentType-title = Unsafe File Type
|
||||
netReset-title = The connection was reset
|
||||
netTimeout-title = The connection has timed out
|
||||
httpErrorPage-title = Looks like there’s a problem with this site
|
||||
serverError-title = Looks like there’s a problem with this site
|
||||
unknownProtocolFound-title = The address wasn’t understood
|
||||
proxyConnectFailure-title = The proxy server is refusing connections
|
||||
|
||||
@@ -44,8 +44,6 @@ neterror-load-error-firewall = If your computer or network is protected by a fir
|
||||
# This warning is only shown on macOS Sequoia and later (see bug 1929377)
|
||||
neterror-load-osx-permission = If you are trying to load a local network page, please check that { -brand-short-name } has been granted Local Network permissions in the macOS Privacy & Security settings.
|
||||
|
||||
neterror-http-error-page = Check to make sure you’ve typed the website address correctly.
|
||||
|
||||
neterror-captive-portal = You must log in to this network before you can access the internet.
|
||||
|
||||
# Variables:
|
||||
@@ -180,8 +178,3 @@ certerror-mitm-what-can-you-do-about-it-attack-sts = If you are not familiar wit
|
||||
certerror-what-should-i-do-bad-sts-cert-explanation = <b>{ $hostname }</b> has a security policy called HTTP Strict Transport Security (HSTS), which means that { -brand-short-name } can only connect to it securely. You can’t add an exception to visit this site.
|
||||
|
||||
cert-error-trust-certificate-transparency-what-can-you-do-about-it = Probably nothing, since it’s likely there’s a problem with the site itself.
|
||||
|
||||
# Variables:
|
||||
# $responsestatus (string) - HTTP response status code (e.g., 500).
|
||||
# $responsestatustext (string) - HTTP response status text (e.g., "Internal Server Error").
|
||||
neterror-response-status-code = Error code: { $responsestatus } { $responsestatustext }
|
||||
|
||||
@@ -63,7 +63,6 @@ ID01:
|
||||
- unsafeContentType-title
|
||||
- netReset-title
|
||||
- netTimeout-title
|
||||
- httpErrorPage-title
|
||||
- serverError-title
|
||||
- unknownProtocolFound-title
|
||||
- proxyConnectFailure-title
|
||||
|
||||
@@ -131,23 +131,6 @@ NS_IMETHODIMP nsDocumentOpenInfo::OnStartRequest(nsIRequest* request) {
|
||||
if (204 == responseCode || 205 == responseCode) {
|
||||
return NS_BINDING_ABORTED;
|
||||
}
|
||||
|
||||
if (!mozilla::StaticPrefs::
|
||||
browser_http_blank_page_with_error_response_enabled()) {
|
||||
// Bug 1325876: Show internal error page for HTTP responses with error
|
||||
// codes (4xx, 5xx) and "Content-Length": 0 instead of blank page
|
||||
int64_t contentLength = 0;
|
||||
rv = httpChannel->GetContentLength(&contentLength);
|
||||
|
||||
if (NS_FAILED(rv) || contentLength <= 0) {
|
||||
if (responseCode >= 500) {
|
||||
return NS_ERROR_NET_ERROR_RESPONSE;
|
||||
}
|
||||
if (responseCode >= 400) {
|
||||
return NS_ERROR_NET_EMPTY_RESPONSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -327,8 +327,6 @@ with modules["NETWORK"]:
|
||||
errors["NS_ERROR_NET_RESET"] = FAILURE(20)
|
||||
# The connection was established, but browser received an error response from the server
|
||||
errors["NS_ERROR_NET_ERROR_RESPONSE"] = FAILURE(35)
|
||||
# The connection was established, but browser received an empty page with 4xx, 5xx error response
|
||||
errors["NS_ERROR_NET_EMPTY_RESPONSE"] = FAILURE(36)
|
||||
# The connection was established, but the data transfer was interrupted.
|
||||
errors["NS_ERROR_NET_INTERRUPT"] = FAILURE(71)
|
||||
# The connection attempt to a proxy failed.
|
||||
|
||||
Reference in New Issue
Block a user