mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 21:01:08 +00:00
Bug 1792635 - Prevent DNS not found page from suggesting the same URI - r=mak
I modified the boolean associated with fixupCreateAlternateURI to only be true if the host which contains the prefix and suffix differs from the fixed up version. This will allow the boolean to be false in cases where the fixup doesn't change the host. Then for the DNS error page, there is a check as to whether the host or protocol was changed. Differential Revision: https://phabricator.services.mozilla.com/D159175
This commit is contained in:
parent
be7ce82637
commit
b1eefaa0d6
@ -1284,6 +1284,7 @@ function maybeAddPrefixAndSuffix(oldHost) {
|
||||
* @throws If a non-NS_ERROR_MALFORMED_URI error occurs.
|
||||
*/
|
||||
function updateHostAndScheme(info, newHost) {
|
||||
let oldHost = info.fixedURI.host;
|
||||
let oldScheme = info.fixedURI.scheme;
|
||||
try {
|
||||
info.fixedURI = info.fixedURI
|
||||
@ -1300,6 +1301,8 @@ function updateHostAndScheme(info, newHost) {
|
||||
if (oldScheme != info.fixedURI.scheme) {
|
||||
info.fixupChangedProtocol = true;
|
||||
}
|
||||
info.fixupCreatedAlternateURI = true;
|
||||
if (oldHost != info.fixedURI.host) {
|
||||
info.fixupCreatedAlternateURI = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -14,22 +14,26 @@ var data = [
|
||||
// upgrade protocol.
|
||||
wrong: "http://www.example.com/",
|
||||
fixed: "https://www.example.com/",
|
||||
noAlternateURI: true,
|
||||
},
|
||||
{
|
||||
// no difference.
|
||||
wrong: "https://www.example.com/",
|
||||
fixed: "https://www.example.com/",
|
||||
noProtocolFixup: true,
|
||||
noAlternateURI: true,
|
||||
},
|
||||
{
|
||||
// don't add prefix when there's more than one dot.
|
||||
wrong: "http://www.example.abc.def/",
|
||||
fixed: "https://www.example.abc.def/",
|
||||
noAlternateURI: true,
|
||||
},
|
||||
{
|
||||
// http -> https.
|
||||
wrong: "http://www.example/",
|
||||
fixed: "https://www.example/",
|
||||
noAlternateURI: true,
|
||||
},
|
||||
{
|
||||
// domain.com -> https://www.domain.com.
|
||||
|
@ -89,7 +89,7 @@ class NetErrorChild extends RemotePageChild {
|
||||
this.contentWindow.location.href
|
||||
);
|
||||
|
||||
if (!info.fixupCreatedAlternateURI) {
|
||||
if (!info.fixupCreatedAlternateURI && !info.fixupChangedProtocol) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user