diff --git a/layout/base/nsCaret.cpp b/layout/base/nsCaret.cpp index cc54c709c..3b702ff53 100644 --- a/layout/base/nsCaret.cpp +++ b/layout/base/nsCaret.cpp @@ -396,7 +396,7 @@ nsCaret::GetFrameAndOffset(Selection* aSelection, return nullptr; } - if (!focusNode || !focusNode->IsContent()) { + if (!focusNode || !focusNode->IsContent() || !aSelection) { return nullptr; } diff --git a/netwerk/base/nsIOService.cpp b/netwerk/base/nsIOService.cpp index 529365790..3b8de2b27 100644 --- a/netwerk/base/nsIOService.cpp +++ b/netwerk/base/nsIOService.cpp @@ -95,66 +95,80 @@ static mozilla::LazyLogModule gIOServiceLog("nsIOService"); // TODO: I am sure that there are more ports to be added. // This cut is based on the classic mozilla codebase -int16_t gBadPortList[] = { - 1, // tcpmux - 7, // echo - 9, // discard - 11, // systat - 13, // daytime - 15, // netstat - 17, // qotd - 19, // chargen - 20, // ftp-data - 21, // ftp-cntl - 22, // ssh - 23, // telnet - 25, // smtp - 37, // time - 42, // name - 43, // nicname - 53, // domain - 77, // priv-rjs - 79, // finger - 87, // ttylink - 95, // supdup - 101, // hostriame - 102, // iso-tsap - 103, // gppitnp - 104, // acr-nema - 109, // pop2 - 110, // pop3 - 111, // sunrpc - 113, // auth - 115, // sftp - 117, // uucp-path - 119, // nntp - 123, // NTP - 135, // loc-srv / epmap - 139, // netbios - 143, // imap2 - 179, // BGP - 389, // ldap - 465, // smtp+ssl - 512, // print / exec - 513, // login - 514, // shell - 515, // printer - 526, // tempo - 530, // courier - 531, // Chat - 532, // netnews - 540, // uucp - 556, // remotefs - 563, // nntp+ssl - 587, // - 601, // - 636, // ldap+ssl - 993, // imap+ssl - 995, // pop3+ssl - 2049, // nfs - 4045, // lockd - 6000, // x11 - 0, // This MUST be zero so that we can populating the array +int16_t gBadPortList[] = { + 1, // tcpmux + 7, // echo + 9, // discard + 11, // systat + 13, // daytime + 15, // netstat + 17, // qotd + 19, // chargen + 20, // ftp-data + 21, // ftp + 22, // ssh + 23, // telnet + 25, // smtp + 37, // time + 42, // name + 43, // nicname + 53, // domain + 77, // priv-rjs + 79, // finger + 87, // ttylink + 95, // supdup + 101, // hostriame + 102, // iso-tsap + 103, // gppitnp + 104, // acr-nema + 109, // pop2 + 110, // pop3 + 111, // sunrpc + 113, // auth + 115, // sftp + 117, // uucp-path + 119, // nntp + 123, // ntp + 135, // loc-srv / epmap + 139, // netbios + 143, // imap2 + 179, // bgp + 389, // ldap + 427, // afp (alternate) + 465, // smtp (alternate) + 512, // print / exec + 513, // login + 514, // shell + 515, // printer + 526, // tempo + 530, // courier + 531, // chat + 532, // netnews + 540, // uucp + 548, // afp + 554, // rtsp + 556, // remotefs + 563, // nntp+ssl + 587, // smtp (outgoing) + 601, // syslog-conn + 636, // ldap+ssl + 993, // imap+ssl + 995, // pop3+ssl + 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"; diff --git a/netwerk/protocol/viewsource/nsViewSourceChannel.cpp b/netwerk/protocol/viewsource/nsViewSourceChannel.cpp index 987acea6e..845d4e08c 100644 --- a/netwerk/protocol/viewsource/nsViewSourceChannel.cpp +++ b/netwerk/protocol/viewsource/nsViewSourceChannel.cpp @@ -141,6 +141,10 @@ nsViewSourceChannel::InitSrcdoc(nsIURI* aURI, return NS_OK; } +void nsViewSourceChannel::ReleaseListeners() { + mListener = nullptr; +} + //////////////////////////////////////////////////////////////////////////////// // nsIRequest methods: @@ -331,8 +335,10 @@ nsViewSourceChannel::AsyncOpen(nsIStreamListener *aListener, nsISupports *ctxt) if (NS_SUCCEEDED(rv)) { mOpened = true; + } else { + ReleaseListeners(); } - + return rv; } @@ -695,9 +701,12 @@ nsViewSourceChannel::OnStopRequest(nsIRequest *aRequest, nsISupports* aContext, nullptr, aStatus); } } - return mListener->OnStopRequest(static_cast - (this), - aContext, aStatus); + + nsresult rv; + rv = mListener->OnStopRequest(static_cast(this), + aContext, aStatus); + ReleaseListeners(); + return rv; } diff --git a/netwerk/protocol/viewsource/nsViewSourceChannel.h b/netwerk/protocol/viewsource/nsViewSourceChannel.h index d4c6a4b43..07a1c1f13 100644 --- a/netwerk/protocol/viewsource/nsViewSourceChannel.h +++ b/netwerk/protocol/viewsource/nsViewSourceChannel.h @@ -60,6 +60,7 @@ public: protected: ~nsViewSourceChannel() {} + void ReleaseListeners(); nsCOMPtr mChannel; nsCOMPtr mHttpChannel; diff --git a/toolkit/components/captivedetect/captivedetect.js b/toolkit/components/captivedetect/captivedetect.js index 74f237dde..9b1ecb908 100644 --- a/toolkit/components/captivedetect/captivedetect.js +++ b/toolkit/components/captivedetect/captivedetect.js @@ -36,6 +36,15 @@ function URLFetcher(url, timeout) { xhr.channel.loadFlags |= Ci.nsIRequest.INHIBIT_CACHING; // Prevent privacy leaks 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 // final destination. It does not help if a resource is already // cached locally. @@ -56,6 +65,12 @@ function URLFetcher(url, timeout) { self.onsuccess(xhr.responseText); } else if (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; } } };