#633: M1666072 M1556259 M1558023 M1578633 bad ports update M1678413

This commit is contained in:
Cameron Kaiser 2021-01-21 11:42:12 -08:00
parent 7b437c98d9
commit 0bb76284cd
5 changed files with 104 additions and 65 deletions

View File

@ -396,7 +396,7 @@ nsCaret::GetFrameAndOffset(Selection* aSelection,
return nullptr; return nullptr;
} }
if (!focusNode || !focusNode->IsContent()) { if (!focusNode || !focusNode->IsContent() || !aSelection) {
return nullptr; return nullptr;
} }

View File

@ -95,66 +95,80 @@ static mozilla::LazyLogModule gIOServiceLog("nsIOService");
// TODO: I am sure that there are more ports to be added. // TODO: I am sure that there are more ports to be added.
// This cut is based on the classic mozilla codebase // This cut is based on the classic mozilla codebase
int16_t gBadPortList[] = { int16_t gBadPortList[] = {
1, // tcpmux 1, // tcpmux
7, // echo 7, // echo
9, // discard 9, // discard
11, // systat 11, // systat
13, // daytime 13, // daytime
15, // netstat 15, // netstat
17, // qotd 17, // qotd
19, // chargen 19, // chargen
20, // ftp-data 20, // ftp-data
21, // ftp-cntl 21, // ftp
22, // ssh 22, // ssh
23, // telnet 23, // telnet
25, // smtp 25, // smtp
37, // time 37, // time
42, // name 42, // name
43, // nicname 43, // nicname
53, // domain 53, // domain
77, // priv-rjs 77, // priv-rjs
79, // finger 79, // finger
87, // ttylink 87, // ttylink
95, // supdup 95, // supdup
101, // hostriame 101, // hostriame
102, // iso-tsap 102, // iso-tsap
103, // gppitnp 103, // gppitnp
104, // acr-nema 104, // acr-nema
109, // pop2 109, // pop2
110, // pop3 110, // pop3
111, // sunrpc 111, // sunrpc
113, // auth 113, // auth
115, // sftp 115, // sftp
117, // uucp-path 117, // uucp-path
119, // nntp 119, // nntp
123, // NTP 123, // ntp
135, // loc-srv / epmap 135, // loc-srv / epmap
139, // netbios 139, // netbios
143, // imap2 143, // imap2
179, // BGP 179, // bgp
389, // ldap 389, // ldap
465, // smtp+ssl 427, // afp (alternate)
512, // print / exec 465, // smtp (alternate)
513, // login 512, // print / exec
514, // shell 513, // login
515, // printer 514, // shell
526, // tempo 515, // printer
530, // courier 526, // tempo
531, // Chat 530, // courier
532, // netnews 531, // chat
540, // uucp 532, // netnews
556, // remotefs 540, // uucp
563, // nntp+ssl 548, // afp
587, // 554, // rtsp
601, // 556, // remotefs
636, // ldap+ssl 563, // nntp+ssl
993, // imap+ssl 587, // smtp (outgoing)
995, // pop3+ssl 601, // syslog-conn
2049, // nfs 636, // ldap+ssl
4045, // lockd 993, // imap+ssl
6000, // x11 995, // pop3+ssl
0, // This MUST be zero so that we can populating the array 1720, // h323hostcall
1723, // pptp
2049, // nfs
3659, // apple-sasl
4045, // lockd
5060, // sip
5061, // sips
6000, // x11
6665, // irc (alternate)
6666, // irc (alternate)
6667, // irc (default)
6668, // irc (alternate)
6669, // irc (alternate)
6697, // irc+tls
0, // Sentinel value: This MUST be zero
}; };
static const char kProfileChangeNetTeardownTopic[] = "profile-change-net-teardown"; static const char kProfileChangeNetTeardownTopic[] = "profile-change-net-teardown";

View File

@ -141,6 +141,10 @@ nsViewSourceChannel::InitSrcdoc(nsIURI* aURI,
return NS_OK; return NS_OK;
} }
void nsViewSourceChannel::ReleaseListeners() {
mListener = nullptr;
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// nsIRequest methods: // nsIRequest methods:
@ -331,8 +335,10 @@ nsViewSourceChannel::AsyncOpen(nsIStreamListener *aListener, nsISupports *ctxt)
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {
mOpened = true; mOpened = true;
} else {
ReleaseListeners();
} }
return rv; return rv;
} }
@ -695,9 +701,12 @@ nsViewSourceChannel::OnStopRequest(nsIRequest *aRequest, nsISupports* aContext,
nullptr, aStatus); nullptr, aStatus);
} }
} }
return mListener->OnStopRequest(static_cast<nsIViewSourceChannel*>
(this), nsresult rv;
aContext, aStatus); rv = mListener->OnStopRequest(static_cast<nsIViewSourceChannel*>(this),
aContext, aStatus);
ReleaseListeners();
return rv;
} }

View File

@ -60,6 +60,7 @@ public:
protected: protected:
~nsViewSourceChannel() {} ~nsViewSourceChannel() {}
void ReleaseListeners();
nsCOMPtr<nsIChannel> mChannel; nsCOMPtr<nsIChannel> mChannel;
nsCOMPtr<nsIHttpChannel> mHttpChannel; nsCOMPtr<nsIHttpChannel> mHttpChannel;

View File

@ -36,6 +36,15 @@ function URLFetcher(url, timeout) {
xhr.channel.loadFlags |= Ci.nsIRequest.INHIBIT_CACHING; xhr.channel.loadFlags |= Ci.nsIRequest.INHIBIT_CACHING;
// Prevent privacy leaks // Prevent privacy leaks
xhr.channel.loadFlags |= Ci.nsIRequest.LOAD_ANONYMOUS; xhr.channel.loadFlags |= Ci.nsIRequest.LOAD_ANONYMOUS;
// We don't want to follow _any_ redirects
xhr.channel.QueryInterface(Ci.nsIHttpChannel).redirectionLimit = 0;
// bug 1666072 - firefox.com returns a HSTS header triggering a https upgrade
// but the upgrade triggers an internal redirect causing an incorrect locked
// portal notification. We exclude CP detection from STS.
xhr.channel.QueryInterface(Ci.nsIHttpChannel).allowSTS = false;
// The Cache-Control header is only interpreted by proxies and the // The Cache-Control header is only interpreted by proxies and the
// final destination. It does not help if a resource is already // final destination. It does not help if a resource is already
// cached locally. // cached locally.
@ -56,6 +65,12 @@ function URLFetcher(url, timeout) {
self.onsuccess(xhr.responseText); self.onsuccess(xhr.responseText);
} else if (xhr.status) { } else if (xhr.status) {
self.onredirectorerror(xhr.status); self.onredirectorerror(xhr.status);
} else if (xhr.channel && xhr.channel.status == Cr.NS_ERROR_REDIRECT_LOOP) {
// For some redirects we don't get a status, so we need to check it
// this way. This only works because we set the redirectionLimit to 0.
self.onredirectorerror(300);
// No need to invoke the onerror callback, we handled it here.
xhr.onerror = null;
} }
} }
}; };